From d14e69c7b57305fccde44f964c3ca8fc3e90aa01 Mon Sep 17 00:00:00 2001 From: Nokita Kaze Date: Wed, 26 Nov 2014 23:48:08 +0300 Subject: [PATCH] =?UTF-8?q?*=20*=20=D0=92=D1=8B=D0=B1=D0=BE=D1=80=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D1=81=D0=B8=D0=BD=D0=B3=D0=B0=20=D1=81=D1=81=D1=8B?= =?UTF-8?q?=D0=BB=D0=BE=D0=BA=20=D0=BD=D0=B0=20=D0=B2=D0=B8=D0=B4=D0=B5?= =?UTF-8?q?=D0=BE=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20=D1=80=D0=B0=D0=B4?= =?UTF-8?q?=D0=B8=D0=BE-=D0=B1=D0=B0=D1=82=D0=BE=D0=BD=20-=20=D0=9E=D0=BF-?= =?UTF-8?q?=D0=BF=D0=B0,=20=D1=81=D0=B8=D1=88=D0=BA=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB.=20=D0=9C=D0=B5=D0=BD=D1=8F=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D0=B7=D0=B0=D0=B5=D0=B1=D0=B0=D0=BB=D0=BE,=20=D1=87?= =?UTF-8?q?=D1=82=D0=BE=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D0=B5=20chrome://extensions/=20=D0=BA=D0=B0=D0=BA?= =?UTF-8?q?=D0=BE=D0=B5-=D1=82=D0=BE=20=D0=B3=D0=BE=D0=B2=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=B2=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8F=D1=85=20+=20=D0=9F?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20curren?= =?UTF-8?q?t=5Foptions,=20=D0=B2=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=BE?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-Transfer-Encoding: 8bit --- chrome_point_plus/_locales/en/messages.json | 14 +++++-- chrome_point_plus/_locales/ru/messages.json | 14 +++++-- chrome_point_plus/js/point-plus.js | 45 ++++++++++++--------- chrome_point_plus/options.html | 14 +++---- 4 files changed, 52 insertions(+), 35 deletions(-) diff --git a/chrome_point_plus/_locales/en/messages.json b/chrome_point_plus/_locales/en/messages.json index c3ddffa..6c19b2c 100644 --- a/chrome_point_plus/_locales/en/messages.json +++ b/chrome_point_plus/_locales/en/messages.json @@ -56,11 +56,17 @@ "option_images_load_booru": { "message": "Load pictures from Booru, Tumblr and some other sites" }, - "option_videos_parse_webm": { - "message": "Parse webm-links and create video instead" + "option_videos_parse_links": { + "message": "Parse video links and create video instead" }, - "option_videos_parse_all_videos": { - "message": "Parse all links to videos and create video instead" + "option_videos_parse_webm": { + "message": "Only webm" + }, + "option_videos_parse_all_links": { + "message": "Parse all links" + }, + "option_videos_parse_leave_links": { + "message": "Don't delete link itself" }, "option_embedding_soundcloud": { "message": "Soundcloud ▼" diff --git a/chrome_point_plus/_locales/ru/messages.json b/chrome_point_plus/_locales/ru/messages.json index 117b315..18b16f8 100644 --- a/chrome_point_plus/_locales/ru/messages.json +++ b/chrome_point_plus/_locales/ru/messages.json @@ -56,11 +56,17 @@ "option_images_load_booru": { "message": "Загружать картинки с Booru, Tumblr и других сайтов" }, - "option_videos_parse_webm": { - "message": "Оборачивать ссылки на webm в тег <video>" + "option_videos_parse_links": { + "message": "Превращать ссылки на видео в видео" }, - "option_videos_parse_all_videos": { - "message": "Оборачивать ссылки на всё видео в тег <video>" + "option_videos_parse_webm": { + "message": "Только webm" + }, + "option_videos_parse_all_links": { + "message": "Все ссылки на видео" + }, + "option_videos_parse_leave_links": { + "message": "Оставлять ссылку на видео" }, "option_embedding_soundcloud": { "message": "Soundcloud ▼" diff --git a/chrome_point_plus/js/point-plus.js b/chrome_point_plus/js/point-plus.js index 6f20cde..40992bb 100644 --- a/chrome_point_plus/js/point-plus.js +++ b/chrome_point_plus/js/point-plus.js @@ -26,9 +26,9 @@ $(document).ready(function() { // Loading options chrome.storage.sync.get('options', function(sync_data) { var options = sync_data.options; - + // Options debug - console.debug('Options loaded: %O', options); + console.debug('Options loaded: '+options); create_tag_system(); @@ -39,8 +39,8 @@ $(document).ready(function() { load_all_booru_images(); } // Parse webm-links and create video instead - if (options.option_videos_parse_webm.value == true) { - if (options.option_videos_parse_all_videos.value == true) { + if (options.option_videos_parse_links.value == true) { + if (options.option_videos_parse_links_type.value == "all") { parse_all_videos(); } else { parse_webm(); @@ -81,7 +81,8 @@ $(document).ready(function() { }); } - // Parse webm-links and create video instead + + // Parse pleer.com links and create audio instead if (options.option_embedding_pleercom.value == true) { parse_pleercom_links(); } @@ -545,11 +546,13 @@ var months = [ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; +// Копия опций +var current_options; // Картинки с бурятников var booru_picture_count = 0; function load_all_booru_images() { - $('a').each(function(num, obj) { + $('.post-content a').each(function(num, obj) { if ($(obj).hasClass('booru_pic')) { return; } @@ -652,7 +655,7 @@ function mark_unread_post() { // Webm function parse_webm() { - $('a').each(function(num, obj) { + $('.post-content a').each(function(num, obj) { if ($(obj).hasClass('booru_pic')) { return; } @@ -669,12 +672,16 @@ function parse_webm() { }).addClass('parsed-webm-link'); obj.parentElement.insertBefore(player, obj); + + if (current_options.option_videos_parse_leave_links.value == false) { + $(obj).hide(); + } } }); } function parse_all_videos() { - $('a').each(function(num, obj) { + $('.post-content a').each(function(num, obj) { if ($(obj).hasClass('booru_pic')) { return; } @@ -691,6 +698,10 @@ function parse_all_videos() { }).addClass('parsed-webm-link'); obj.parentElement.insertBefore(player, obj); + + if (current_options.option_videos_parse_leave_links.value == false) { + $(obj).hide(); + } } }); } @@ -751,17 +762,15 @@ function set_posts_count_label() { } function parse_pleercom_links() { - chrome.storage.sync.get(ppOptions, function(options) { - if (options.option_embedding_pleercom_nokita_server) { - parse_pleercom_links_nokita(); - } else { - parse_pleercom_links_ajax(); - } - }); + if (current_options.option_embedding_pleercom_nokita_server.value) { + parse_pleercom_links_nokita(); + } else { + parse_pleercom_links_ajax(); + } } function parse_pleercom_links_nokita() { - $('a').each(function(num, obj) { + $('.post-content a').each(function(num, obj) { var href = obj.href; var n = null; @@ -783,7 +792,7 @@ function parse_pleercom_links_nokita() { } function parse_pleercom_links_ajax() { - $('a').each(function(num, obj) { + $('.post-content a').each(function(num, obj) { var href = obj.href; var n = null; @@ -816,7 +825,7 @@ function create_pleercom_ajax(id) { $('.embeded_audio_' + this.settings.pleer_id)[0].appendChild(player); }, 'error': function() { - console.log('Can not get url'); + console.log('Can not get pleer.com url'); setTimeout(new Function('create_pleercom_ajax("' + this.settings.pleer_id + '");'), 1000); } diff --git a/chrome_point_plus/options.html b/chrome_point_plus/options.html index 8ca7cf1..e21907d 100644 --- a/chrome_point_plus/options.html +++ b/chrome_point_plus/options.html @@ -50,20 +50,16 @@
-
- - + +
+
+ +