A polyfill to resurrect the blink tag.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.jwz.org/blog/2013/08/a-light-has-gone-out-on-the-web/ | |
/* full-source version */ | |
;(function(doc, cls) { | |
var TAG = 'blink'; // try changing this to 'a' or 'p' | |
var TIME = 2000; // total loop time (ms) | |
var s = doc.createElement('style'); | |
s.appendChild(doc.createTextNode('.' + cls + ' { visibility: hidden; }')); | |
doc.getElementsByTagName('head')[0].appendChild(s); | |
var elems = doc.getElementsByTagName(TAG); | |
setInterval(function() { | |
for (var i = 0, l = elems.length; i < l; i++) { | |
elems[i].classList.add(cls); | |
} | |
setTimeout(function() { | |
for (var i = 0, l = elems.length; i < l; i++) { | |
elems[i].classList.remove(cls); | |
} | |
}, TIME / 4); // three units on + one unit off (per jwz) | |
}, TIME); | |
}(document, 'blinking')); | |
/* minified bookmarklet */ | |
javascript:(function(a,d){var b=a.createElement("style");b.appendChild(a.createTextNode("."+d+" { visibility: hidden; }"));a.getElementsByTagName("head")[0].appendChild(b);var c=a.getElementsByTagName("blink");setInterval(function(){for(var a=0,b=c.length;a<b;a++)c[a].classList.add(d);setTimeout(function(){for(var a=0,b=c.length;a<b;a++)c[a].classList.remove(d)},500)},2E3)})(document,"blinking"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment