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 @@
-
- - + +
+
+ +