From afee3205dcd24638524b5bdd364c53fb7834fe0f Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 15 May 2016 16:31:04 +0300 Subject: [PATCH] Option "option_fancybox_smart_hints" removed. --- chrome_point_plus/_locales/en/messages.json | 3 - chrome_point_plus/_locales/ru/messages.json | 3 - chrome_point_plus/js/point-plus.js | 75 +-------------------- chrome_point_plus/options.html | 5 -- 4 files changed, 2 insertions(+), 84 deletions(-) diff --git a/chrome_point_plus/_locales/en/messages.json b/chrome_point_plus/_locales/en/messages.json index d8c7c5d..cb72050 100644 --- a/chrome_point_plus/_locales/en/messages.json +++ b/chrome_point_plus/_locales/en/messages.json @@ -50,9 +50,6 @@ "option_fancybox_bind_images_to_one_flow": { "message": "Bind all images to one Fancybox gallery" }, - "option_fancybox_smart_hints": { - "message": "Generate image caption from tags" - }, "option_images_load_original": { "message": "Load original images instead of thumbnails" }, diff --git a/chrome_point_plus/_locales/ru/messages.json b/chrome_point_plus/_locales/ru/messages.json index 3dc92f9..f033f41 100644 --- a/chrome_point_plus/_locales/ru/messages.json +++ b/chrome_point_plus/_locales/ru/messages.json @@ -50,9 +50,6 @@ "option_fancybox_bind_images_to_one_flow": { "message": "Связать все картинки в одну галерею Fancybox" }, - "option_fancybox_smart_hints": { - "message": "Генерировать подписи к картинкам из тегов" - }, "option_images_load_original": { "message": "Загружать оригиналы вместо миниатюр" }, diff --git a/chrome_point_plus/js/point-plus.js b/chrome_point_plus/js/point-plus.js index 46e3ccc..6585c12 100644 --- a/chrome_point_plus/js/point-plus.js +++ b/chrome_point_plus/js/point-plus.js @@ -226,13 +226,6 @@ function PointPlus(ppVersion) { }); } - // Правим хинты у фансибокса - if (options.is('option_fancybox_smart_hints')) { - fancybox_set_smart_hints(); - } else { - $('div.post .postimg').attr('data-fancybox-title', ' '); - } - // Videos if (options.is('option_fancybox_videos')) { $('.postimg.youtube').addClass('fancybox-media').fancybox({ @@ -1153,69 +1146,6 @@ function parse_coub_links(current_options) { }); } -// Правим хинт в FancyBox -function fancybox_set_smart_hints() { - $('div.post').each(function() { - var all_post_images = $(this).find('.postimg'); - if (all_post_images.length == 0) { - return; - } - - var tags = $(this).find('div.tags a.tag'); - var default_hint_text = '';// Дефолтный текст для хинта в FancyBox, если не нашлость другого - // Сначала теги - for (var i = 0; i < tags.length; i++) { - var tag_name = $(tags[i]).html().toLowerCase(); - default_hint_text += ' ' + tag_name; - } - - // Потом текст - var textcontent = $(this).find('.text-content'); - if (textcontent.length > 0) { - textcontent = textcontent[0]; - for (var i = 0; i < textcontent.childNodes.length; i++) { - var current_child_node = textcontent.childNodes[i]; - if ((current_child_node.nodeName !== 'P') && (current_child_node.nodeName !== '#text')) { - continue; - } - var a = $(current_child_node).find('a.postimg'); - if (a.length > 0) { - continue; - } - - var tmp_str = current_child_node.textContent.replace(/(\n(\r)?)/g, ' '); - tmp_str = tmp_str.replace("\t", " "); - default_hint_text += ' ' + tmp_str; - } - } - - // Режем текст - default_hint_text = default_hint_text.replace(new RegExp(' {2,}'), ' ').replace(new RegExp(' +$'), '').substr(1); - if (default_hint_text.length > 140) { - default_hint_text = default_hint_text.substr(0, 140 - 3) + '...'; - } - - // Выставляем дефолтный - all_post_images.attr('data-fancybox-title', default_hint_text); - - // А теперь перебираем по одному все картинки - var paragraphs = $(this).find('.post-content > .text > p, .post-content > .text, .text-content > p, .text-content'); - - paragraphs.each(function() { - var nodes = this.childNodes; - for (var i = 0; i < nodes.length - 2; i++) { - if ($(nodes[i]).hasClass('booru_pic')) { - if (nodes[i + 2].nodeName == '#text') { - $(nodes[i]).attr('data-fancybox-title', nodes[i + 2].textContent); - i += 2; - continue; - } - } - } - }); - }); -} - /** * Система заметок о пользователях * https://bitbucket.org/skobkin/chrome_point_plus/issue/50/--------------------------- @@ -1553,11 +1483,10 @@ function instagram_posts_embedding_init(options) { id: 'instagram-' + num, href: 'http://instagram.com/p/' + matches[2] + '/media/?size=l', title: response.title, - traget: '_blank', 'data-fancybox-group': (options.is('option_fancybox_bind_images_to_one_flow')) ? 'one_flow_gallery' : '', - 'data-fancybox-title': (options.is('option_fancybox_smart_hints')) ? response.title : '' }) - .append($img); + .append($img) + ; $link.before($imgLink); diff --git a/chrome_point_plus/options.html b/chrome_point_plus/options.html index 93fc4f7..a174e9c 100644 --- a/chrome_point_plus/options.html +++ b/chrome_point_plus/options.html @@ -40,11 +40,6 @@ - -