User:Freaksock/image fun.js

practice_mode = false; rm_img_comment = "rm deleted image"; importScript("User:Lupin/popups.js"); function temp(n){ return "xxx" + n + "xxx"; } addOnloadHook(function {  if(mw.config.get('wgNamespaceNumber') != 6) return;   if (getParamValue("action")=="delete" && document.title.indexOf("Action complete") != -1)      location.href  = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace("$1", mw.config.get('wgPageName')) + "?notify=imgdel";   if(getParamValue("notify")=="imgdel") bannerMessage(mw.config.get('wgPageName') + " has been deleted, gratz.");   if(document.getElementsByTagName("h1")[0].innerHTML == "Confirm delete") return;   u = document.getElementById("bodyContent").getElementsByTagName("ul"); if(!u.length) return;   p = u[u.length-1].getElementsByTagName("li"); if(!p.length) return;   f = mw.config.get('wgTitle').replace(/ /g, "_");   f = f.replace(/\\/g, "\\\\" ).replace(/\%/g, temp(1)).replace(/\?/g, temp(2));   f = f.replace(/\:/g, temp(3)).replace(/\(/g, temp(4)).replace(/\)/g, temp(5));   f = f.replace(/\,/g, "(?:\\,|\\%2C)").replace(/\./g, "(?:\\.|\\%2E)"); f = f.replace(/\!/g, "(?:\\!|\\%21)").replace(/\$/g, "(?:\\$|\\%24)"); f = f.replace(/\^/g, "(?:\\^|\\%5E)").replace(/\+/g, "(?:\\+|\\%2B)"); f = f.replace(/\'/g, "(?:\\%27|\\%2827)").replace(/\"/g, "(?:\\%22|\\%2822)");  f = f.replace(/\*/g, "(?:\\*|\\%2A)").replace(/\_/g, "(?:[\\s_]|\\%20|\\%5F)+");   f = f.replace(new RegExp(temp(1), "g"), "(?:\\%|\\%25)")   f = f.replace(new RegExp(temp(2), "g"), "(?:\\?|\\%3F)").replace(new RegExp(temp(3), "g"), "(?:\\:|\\%3A)");   f = f.replace(new RegExp(temp(4), "g"), "(?:\\(|\\%28)").replace(new RegExp(temp(5), "g"), "(?:\\)|\\%29)");   r2 = "Image\\s*\\:\\s*" + f;   r = "s~\\<\\!\\-\\-[^\\n]*image[^\\n]+:?\\s*(?:\\[\\[(?:[^\\[\\]]*" +    "(?:\\[\\^\\[\\+\\]\\])*[^\\[\\]]*)*\\]\\])?\\s*\\-\\-\\>~" + temp(1) + "~gim;" +   "s~(\\<\\s*gallery[^\\>]*\\>(?:[^\\n]*\\n\\s*))" + r2 +    "\\s*(?:\\|[^\\n]*)?\\n((?:[^\\n]*\\n)*<\\s*\\/\\s*gallery\\s*\\>)" + "~$1" + temp(2) +    "$2~gim;s~[\\s\\n]*\\<\\s*gallery[^\\>]*\\>(?:\\s|\\n|" + temp(1) + "|" + temp(2) +    ")*\\<\\s*\\/\\s*gallery\\s*\\>[\\s\\n]*~\\n" + temp(1) + "\\n~gim;" + "s~\\[\\[\\s*(?:Image|Media)\\s*\\:\\s*" + f + "(?:[^\\[\\]]*(?:\\[\\^\\[\\+\\]\\])*[^\\[\\]]*)*\\]\\]~" + temp(1) + "~gi;" + "s~\\[\\[\\s*(?:Image|Media)\\s*\\:\\s*" + f + "\\s*\\]\\]~" + temp(1) + "~gi;" + "s~" + r2 + "~" + temp(1) + "~gi;s~" + f + "~" + temp(1) + "~gi;s~\\n[ ]*" + temp(1) + "\\s*(?:\\<\\s*br[^\\>]*\\>\\n?)*~\\n" + temp(1) + "\\n~gim;s~[ ]+" + temp(1) + "[ ]+~" + temp(1) + " ~gim;s~" + temp(1) + "\\s*\\|~" + temp(1) + "\n|~gim;s~\\\'+" + temp(1) + "\\\'+~" + temp(1) + "~gim;s~\\n*[ ]*" + temp(1) + "\\s*~\\n" + temp(1) + "~gim;s~\\n+" + temp(1) + "\\n+~\\n" + temp(1) + "\\n~gim;s~(?:" + temp(1) + "|" + temp(2) +   ")gim;s~^\\n\\n+~\\n\\n~gim;s~^\\n;"; for(var c = 0; c < p.length; c++){ t = p[c].getElementsByTagName("a")[0].innerHTML.replace(/\"/g, "%22");     if(t.toLowerCase.indexOf("talk:") != -1) x = "talk";      else x = "kill";     p[c].innerHTML = "(" + x + ") " + p[c].innerHTML;      }   });