User:Matt2905/common.js

function setSizeApng {

var apngs = document.getElementsByClassName('apng'); for (var i = 0, len1 = apngs.length; i < len1; ++i) { for (var j = 0, len2 = apngs[i].classList.length; j < len2; ++j) { if (/size.*px/.test(apngs[i].classList[j])) { var size = apngs[i].classList[j].match(/\d+/g); apngs[i].setAttribute('style', "width :"+ size + "px"); var imgs = apngs[i].getElementsByTagName("img"); for (var k = 0, len3 = imgs.length; k < len3; ++k) { imgs[k].setAttribute('style', "max-width :"+ size + "px"); }               break; }       }    } }

$(document).on('DOMAttrModified', function(e) {   if (e.target.classList.contains("tabBody")) {        setSizeApng;    } });

$(document).querySelectorAll(".tagBody", function {   console.log("test ?"); });

$(function{   console.log("start");    setSizeApng; });