diff --git a/js/blur-images.js b/js/blur-images.js index 4e7aca1b..4a603d68 100644 --- a/js/blur-images.js +++ b/js/blur-images.js @@ -17,36 +17,36 @@ */ $(document).ready(function(){ - var hide_images = localStorage['hideimages'] ? true : false; + var blur_images = localStorage['blurimages'] ? true : false; - $('').appendTo($('head')); + $('').appendTo($('head')); - var hideImage = function() { + var blurImage = function() { if ($(this).parent().data('expanded') == 'true') { $(this).parent().click(); } - $(this).addClass('hidden'); + $(this).addClass('blur'); }; var restoreImage = function() { $(this) .attr('src', $(this).attr('data-orig')) - .removeClass('hidden'); + .removeClass('blur'); }; // Fix for hide-images.js - var show_hide_hide_images_buttons = function() { - if (hide_images) { - $('a.hide-image-link').each(function() { - if ($(this).next().hasClass('show-image-link')) { + var show_hide_blur_images_buttons = function() { + if (blur_images) { + $('a.blur-image-link').each(function() { + if ($(this).next().hasClass('unblur-image-link')) { $(this).next().hide(); } - $(this).hide().after(''+_('hidden')+''); + $(this).hide().after(''+_('hidden')+''); }); } else { - $('span.toggle-images-placeholder').remove(); - $('a.hide-image-link').each(function() { - if ($(this).next().hasClass('show-image-link')) { + $('span.blur-images-placeholder').remove(); + $('a.blur-image-link').each(function() { + if ($(this).next().hasClass('unblur-image-link')) { $(this).next().show(); } else { $(this).show(); @@ -55,48 +55,48 @@ $(document).ready(function(){ } }; - var selector, event; - if (window.Options && Options.get_tab('general')) { - selector = '#toggle-images>input'; - event = 'change'; - Options.extend_tab("general", ""); - } - else { - selector = '#toggle-images a'; - event = 'click'; - $('hr:first').before('
-
'); - $('div#toggle-images a') - .text(hide_images ? _('Show images') : _('Hide images')); - } + var selector, event; + if (window.Options && Options.get_tab('general')) { + selector = '#blur-images>input'; + event = 'change'; + Options.extend_tab("general", ""); + } + else { + selector = '#blur-images a'; + event = 'click'; + $('hr:first').before('
-
'); + $('div#blur-images a') + .text(blur_images ? _('Unblur images') : _('Blur images')); + } $(selector) .on(event, function() { - hide_images = !hide_images; - if (hide_images) { - $('img.post-image, .theme-catalog .thread>a>img').each(hideImage); - localStorage.hideimages = true; + blur_images = !blur_images; + if (blur_images) { + $('img.post-image, .theme-catalog .thread>a>img').each(blurImage); + localStorage.blurimages = true; } else { $('img.post-image, .theme-catalog .thread>a>img').each(restoreImage); - delete localStorage.hideimages; + delete localStorage.blurimages; } - show_hide_hide_images_buttons(); + show_hide_blur_images_buttons(); - $(this).text(hide_images ? _('Show images') : _('Hide images')) + $(this).text(blur_images ? _('Unblur images') : _('Blur images')) }); - if (hide_images) { - $('img.post-image, .theme-catalog .thread>a>img').each(hideImage); - show_hide_hide_images_buttons(); + if (blur_images) { + $('img.post-image, .theme-catalog .thread>a>img').each(blurImage); + show_hide_blur_images_buttons(); - if (window.Options && Options.get_tab('general')) { - $('#toggle-images>input').prop('checked', true); - } + if (window.Options && Options.get_tab('general')) { + $('#toggle-images>input').prop('checked', true); + } } $(document).on('new_post', function(e, post) { - if (hide_images) { - $(post).find('img.post-image').each(hideImage); + if (blur_images) { + $(post).find('img.post-image').each(blurImage); } }); });