Skip to content

Instantly share code, notes, and snippets.

@peponi
peponi / GifAnimationHandler.js
Last active August 17, 2021 13:34
deactivate all animated GIFs on the page after 5 sec
// needs https://github.com/liddiard/preview-gif
const GifAnimationHandler = function({timeoutInSec = 5000} = {}) {
const self = this;
const allImgs = document.querySelectorAll("img");
self.deactivateAnimatedGifs = (gifNodeList) => {
gifNodeList.forEach(gif => {
PreviewGIF(gif.dataset.src, (err, imageData) => {
if (err) console.error(err);
@peponi
peponi / debug-focus-in-cms.js
Created August 19, 2021 07:56
Debug :focus in CMS
var css = document.createElement('style');
css.type = 'text/css';
var styles = 'a:focus {background: blue}';
if (css.styleSheet) css.styleSheet.cssText = styles;
else css.appendChild(document.createTextNode(styles));
document.getElementsByTagName("head")[0].appendChild(css);