From dfe8ddc34000685f5deaf504ffe78e8dd685681c Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 10 Jun 2014 18:00:49 +0000 Subject: Disable-able animated GIFs in a non-shitty way (unlike wizardchan) --- js/inline-expanding.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'js/inline-expanding.js') diff --git a/js/inline-expanding.js b/js/inline-expanding.js index 04d9298f..5bbfa0a0 100644 --- a/js/inline-expanding.js +++ b/js/inline-expanding.js @@ -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; } -- cgit v1.3