mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-27 17:00:52 +01:00
Make no-animated-gif.js trigger on new_post
This commit is contained in:
parent
8412299fa5
commit
5f10badee9
@ -11,7 +11,6 @@
|
||||
* //$config['additional_javascript'][] = 'js/options/general.js';
|
||||
* $config['additional_javascript'][] = 'js/no-animated-gif.js';
|
||||
*/
|
||||
|
||||
function unanimate_gif(e) {
|
||||
if ($(e).closest('.thread').children('.thread-hidden').length > 0) return;
|
||||
|
||||
@ -36,13 +35,19 @@ function unanimate_gif(e) {
|
||||
$(e).addClass("unanimated").hide();
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
var gif_finder = 'img.post-image[src$=".gif"], img.thread-image[src$=".gif"]';
|
||||
|
||||
function no_animated_gif() {
|
||||
var anim_gifs = $('img.post-image[src$=".gif"], img.thread-image[src$=".gif"]');
|
||||
var anim_gifs = $(gif_finder);
|
||||
localStorage.no_animated_gif = true;
|
||||
$('#no-animated-gif>a').text(_('Animate GIFs'));
|
||||
$('#no-animated-gif>input').prop('checked', true);
|
||||
|
||||
$.each(anim_gifs, function(i, e) {unanimate_gif(e)} );
|
||||
|
||||
$(document).on('new_post', new_post_handler);
|
||||
}
|
||||
|
||||
function animated_gif() {
|
||||
@ -51,10 +56,17 @@ function animated_gif() {
|
||||
localStorage.no_animated_gif = false;
|
||||
$('#no-animated-gif>a').text(_('Unanimate GIFs'));
|
||||
$('#no-animated-gif>input').prop('checked', false);
|
||||
|
||||
$(document).off('new_post', new_post_handler);
|
||||
}
|
||||
|
||||
function new_post_handler(e, post) {
|
||||
$(post).find(gif_finder).each(function(k, v) {
|
||||
unanimate_gif(v);
|
||||
});
|
||||
}
|
||||
|
||||
if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko' || active_page == 'catalog') {
|
||||
$(function(){
|
||||
var selector, event;
|
||||
if (window.Options && Options.get_tab('general')) {
|
||||
selector = '#no-animated-gif>input';
|
||||
@ -77,5 +89,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko' |
|
||||
|
||||
if (localStorage.no_animated_gif === 'true')
|
||||
no_animated_gif();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user