Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @include *.m.wikipedia.org/*
- // ==/UserScript==
- (function(){
- window.opera.addEventListener("BeforeScript", patch_scripts);
- function patch_scripts(UserJSEvent){
- var script = UserJSEvent.element;
- // ,r.addEventListener("load",function(){r.classList.add("image-lazy-loaded"),e.parentNode&&e.parentNode.replaceChild(r,e),
- // ''.replace(/[.*+?^${}()|[\]\\\/]/g, '\\$&');
- var pattern = /,([\w$]+\.addEventListener\("load",function\(\)\{[\w$]+\.classList\.add\("image-lazy-loaded"\)),([\w$]+\.parentNode&&[\w$]+\.parentNode\.replaceChild\([\w$]+,[\w$]+\)),/;
- var fixed = ",$2,$1,";
- if (!script.src && pattern.test(script.text)){
- script.text = script.text.replace(pattern, fixed);
- console.log("lazy-load patched");
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement