Disable-able animated GIFs in a non-shitty way (unlike wizardchan)

This commit is contained in:
8chan 2014-06-10 18:00:49 +00:00 committed by Fredrick Brennan
parent e27c923b79
commit dfe8ddc340
3 changed files with 65 additions and 8 deletions

View file

@ -27,9 +27,17 @@ onready(function(){
if (!this.dataset.src) {
this.parentNode.removeAttribute('style');
this.dataset.expanded = 'true';
if (this.childNodes[0].tagName === 'CANVAS') {
this.removeChild(this.childNodes[0]);
this.childNodes[0].style.display = 'block';
}
this.dataset.src= this.childNodes[0].src;
this.dataset.width = this.childNodes[0].style.width;
this.dataset.height = this.childNodes[0].style.height;
this.childNodes[0].src = this.href;
this.childNodes[0].style.width = 'auto';
this.childNodes[0].style.height = 'auto';
@ -48,6 +56,10 @@ onready(function(){
delete this.dataset.src;
delete this.childNodes[0].style.opacity;
delete this.childNodes[0].style.filter;
if (localStorage.no_animated_gif === 'true' && typeof unanimate_gif === 'function') {
unanimate_gif(this.childNodes[0]);
}
}
return false;
}