Twitter fix.

This commit is contained in:
Alexey Skobkin 2015-01-27 03:59:05 +03:00
parent 684f6c15fe
commit aa7b9649d1

View file

@ -1592,25 +1592,21 @@ function twitter_tweet_embedding_wait_for_ready_injected() {
function twitter_tweet_embedding_parse_links() { function twitter_tweet_embedding_parse_links() {
// Обрабатываем все твиты // Обрабатываем все твиты
var twitter_tweet_count = 0; var twitter_tweet_count = 0;
$('.post-content a').each(function(num, obj) { $('.post-content a').not('.booru_pic').each(function(num, obj) {
if ($(obj).hasClass('booru_pic')) {
return;
}
var href = obj.href; var href = obj.href;
var n; var n;
if (n = href.match(new RegExp('^https?://(www\\.)?twitter\\.com/[^/]+/status/([0-9]+)', 'i'))) { if (n = href.match(new RegExp('^https?://(www\\.)?twitter\\.com/[^/]+/status/([0-9]+)', 'i'))) {
var image = document.createElement('div'); var tweet = document.createElement('div');
$(image).attr({ $(tweet).attr({
'id': 'tweet-' + twitter_tweet_count, 'id': 'tweet-' + twitter_tweet_count,
'data-tweet-id': n[2] 'data-tweet-id': n[2]
}).addClass('twitter-tweet-embedded'); }).addClass('twitter-tweet-embedded');
obj.parentElement.insertBefore(image, obj); obj.parentElement.insertBefore(tweet, obj);
window.twttr.widgets.createTweet( window.twttr.widgets.createTweet(
n[2], n[2],
image, tweet,
{ {
'lang': 'ru' 'lang': 'ru'
} }