User:Monochromatic Bunny/global.js

/* credit to kockadmiralac for js */

var regularList = [ 'u:dev:QuickCreateUserPage/code.js', 'u:dev:AjaxRC/code.js', 'u:dev:PurgeButton/code.js', 'u:dev:Rollback/code.js', 'u:dev:FindAndReplace/code.js', 'u:dev:RedirectManagement/code.js', 'u:dev:ListFiles/code.js', 'u:dev:QQX/code.js', 'u:dev:QuickDiff/code.js', 'u:dev:AnchoredRollback/code.js', 'u:dev:AjaxUndo/code.js', 'u:dev:CacheCheck/code.js', ], adminList = [ 'u:dev:AjaxBatchDelete/code.2.js', 'u:kocka:AjaxCommentDelete/code.js', 'u:dev:Nuke/code.js', 'u:dev:WHAM/code.2.js', 'u:kocka:MediaWiki:AjaxThreadDelete/code.js', 'u:dev:AjaxBlock/code.js', 'u:dev:AjaxPatrol/code.js', ];

importArticles({ type: 'script', articles: (regularList.concat((wgUserGroups.includes("sysop") ? adminList : []))) });

$(".message-removed.hide").removeClass("hide");

/* hide logs from Recent Changes var tx1 = 'created a user account'; $('li:contains(' + tx1 + ')').hide;

var tx2 = 'User avatar added or updated'; $('li:contains(' + tx2 + ')').hide; */

var autoFormatWikimediaLinks = false; var autoFormatTemplates = [ { name:  'YouTuber', format: '| _ = _\n', parameters: { 'lcase': false, 'caption': false, 'subscribers': false, } },  { name:   'YouTuber1', format: '| _ = _\n' }, ]; mw.loader.load( '//de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript' );

!function(window){ var $q = function(q, res){ if (document.querySelectorAll) { res = document.querySelectorAll(q); } else { var d=document , a=d.styleSheets[0] || d.createStyleSheet; a.addRule(q,'f:b'); for(var l=d.all,b=0,c=[],f=l.length;b<f;b++) l[b].currentStyle.f && c.push(l[b]);

a.removeRule(0); res = c;       } return res; }  , addEventListener = function(evt, fn){ window.addEventListener ? this.addEventListener(evt, fn, false) : (window.attachEvent) ? this.attachEvent('on' + evt, fn) : this['on' + evt] = fn; }  , _has = function(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); }   ;

function loadImage (el, fn) { var img = new Image , src = el.getAttribute('data-src'); img.onload = function { if (!! el.parent) el.parent.replaceChild(img, el) else el.src = src;

fn? fn : null; }   img.src = src; }

function elementInViewport(el) { var rect = el.getBoundingClientRect

return (      rect.top    >= 0    && rect.left   >= 0    && rect.top <= (window.innerHeight || document.documentElement.clientHeight)    ) }

var images = new Array , query = $q('img.lazy') , processScroll = function{ for (var i = 0; i < images.length; i++) { if (elementInViewport(images[i])) { loadImage(images[i], function {                images.splice(i, i);              }); }         };        }      ;    // Array.prototype.slice.call is not callable under our lovely IE8 for (var i = 0; i < query.length; i++) { images.push(query[i]); };

processScroll; addEventListener('scroll',processScroll);

}(this);