User:PC-XT/common.js

popupFixDabs=true;

p=mw.config.get('wgPageName'); /*ns=mw.config.get('wgNamespaceNumber'); //for(t in mw.config.get('wgNamespaceIds'))if(mw.config.get('wgNamespaceIds')[t]==ns){Ns=t;break;}//{media:-2, special:-1, '':0, talk:1, user:2, user_talk:3, wikipedia:4, wikipedia_talk:5, file:6, file_talk:7, mediawiki:8, mediawiki_talk:9, template:10, template_talk:11, help:12, help_talk:13, category:14, category_talk:15, portal:100, portal_talk:101, book:108, book_talk:109, draft:118, draft_talk:119, education_program:446, education_program_talk:447, timedtext:710, timedtext_talk:711, module:828, module_talk:829, topic:2600, wp:4, wt:5, image:6, image_talk:7, project:4, project_talk:5} p_ext=p.split("/");p_ext=p_ext[p_ext.length-1].split(".");p_ext=p_ext.length>1?p_ext[p_ext.length-1].toLowerCase:"";*/

if(p!="Special:NewPages"||location.href.indexOf("&namespace=10")<0)mw.util.addPortletLink('p-tb','/wiki/Special:NewPages?dir=prev&hidepatrolled=1&namespace=10','NewTemplatePatrol','newTemplatePatrol'); else{ newTemplatePatrolSorter=function{var a=$("li.not-patrolled"),e,E=$("#mw-content-text ul")[1],P=$(" ").insertBefore(E)[0],nol=function{return $(" ")[0];},l={},rC=/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *([^{|}]+)/,r=[ [/^Template:Did you know nominations\//,2], [/-stub$/,2], [/\/doc$/,2,0,"Documentation"], [/\/(sandbox|testcases)$/,2], [/^Template:(User |Userbox\/)/,2,e=nol,"Userboxen"], [/\{\{ *[Uu]serbox(-level)? *\|/,12,e], [/^Template:Infobox /,2,e=nol,"Infoboxen"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{(\|[^|]* class="infobox"|\{ *[Ii]nfobox[ |])/,12,e], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Nn]avbox[ |]/,12,e=nol,"Navboxes"], [/^Template:Lists of /,2,e], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Aa]sbox[ |]/,12,0,"Asboxes"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *(#invoke:)?[Ss]idebar[ |]/,12,0,"Sidebars"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Bb]S-map[ |]/,12,e=nol,"Maps"], [/^Template:S-line\//,2,e], [/^Template:Uw-\//,2], [/^Template:Taxonomy\//,2], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Dd]on't edit this line *\{\{\{machine code\|/,12], [/^Template:Latest (stable|preview) software release\//,2,e=nol,"Latest software release"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Ll]SR[ |]/,12,e], [/^Template:ISO 639 name /,2], [/^Template:Fb /,2,e=nol,"Fb team"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Ff]b team[ |]/,12,e], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Ff]ootball (squad|manager history) *\|/,12], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Nn]ational basketball squad( no numbers)? *\|/,12], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[Cc]FB +Standings Start *\|/,12], [/^Template:[0-9]+TeamBracket-/,2,e=nol,"TeamBrackets"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *[0-9+]TeamBracket-/,12,e], [/^Template:Country data /,2,e=nol,"Flags and country data"], [/^\(\u2190Created page with '(|.*<\/noinclude>|.* ) *\{\{ *([Cc]ountry data|[Ff]lag(icon)?)[ |]/,12,e], [/^Template:Form of government row\//,2], [/^Template:Cite (doi|isbn|pmid)\//,2], [/\/meta\/(color|shortname)$/,2], [/^Template:WikiProject /,2], [/^Template:Attached KML\//,2], [/^Template:Editnotices\/Page\//,2], [/^Template:POTD protected\//,2], [/^\(\u2190Redirected page to /,12] ];P.appendChild(document.createTextNode("Miscellaneous"));P.appendChild(E);for(i=0;i=0){r[i][2].appendChild(a[j]);i=0;break;}if(i&&(e=a[j].childNodes[12]&&a[j].childNodes[12].textContent.match(rC))){e=e[2];while(e.length&&e.charAt(e.length-1)==' ')e=e.substring(0,e.length-1);if(!l[e.toLowerCase]){l[e.toLowerCase]=nol;P.appendChild(document.createTextNode(" wrappers"));P.appendChild(l[e.toLowerCase]);}l[e.toLowerCase].appendChild(a[j]);}}}; mw.util.addPortletLink('p-tb','javascript:newTemplatePatrolSorter','Sort Unpatrolled','newTemplatePatrolSort'); }

mw.util.addPortletLink('p-tb','http://dispenser.homenet.org/~dispenser/cgi-bin/webchecklinks.py?page='+p,'CheckLinks','Checklinks'); mw.util.addPortletLink('p-tb','http://dispenser.homenet.org/~dispenser/cgi-bin/webreflinks.py?page='+p,'RefLinks','Reflinks'); mw.util.addPortletLink('p-tb','http://dispenser.homenet.org/~dispenser/cgi-bin/dabfix.py?page='+p,'Fix DAB page','FixDABpage'); //can use other DAB fixing tools, so just bookmark dispenser's other tools for powerfixing //can use Page info, instead... mw.util.addPortletLink('p-tb','http://stats.grok.se/en/latest/'+p,'Traffic','traffic');

if({edit:1,submit:1}[mw.config.get('wgAction')]){ //function rvs(r,v,s){if(document.editform.wpTextbox1.value.search(r)<0)return;document.editform.wpTextbox1.value=document.editform.wpTextbox1.value.replace(r,v);document.editform.wpSummary.value+=(document.editform.wpSummary.value&&document.editform.wpSummary.value.search(/\*\/ $/)<0?";":"")+s;} //mw.util.addPortletLink('p-tb','javascript:rvs(/([^\\[])\\[([^\\[\\]][^ \\]]*) ([^\\]]+)\\]([^\\]])/g,"$1\x7b{cite web|url=$2|title=$3}}$4","cite web")','Titled links → cite web','citeweballtitledlinks'); //function langiconcv{if(document.editform.wpTextbox1.value.search(/\{\{[Ee]n/)<0)return;document.editform.wpTextbox1.value=document.editform.wpTextbox1.value.replace(/\{\{([Ee]n)\|/g,"\x7b{lang-$1|").replace(/\{\{([Ee][ns]|[Cc]a|[Dd]e|[Ff][ri]|[Dd]a|[Nn]l|[Ss][rv]|[Jj]a|[Ii][dt]|[Kk]o)\}\}/g,"\x7b{$1 icon}}");document.editform.wpSummary.value+=(document.editform.wpSummary.value?";":"")+"lang icons";} //mw.util.addPortletLink('p-tb','javascript:langiconcv','\x7b{xx}} → \x7b{xx icon}}','langicons'); function dewhitesp{document.editform.wpTextbox1.value=document.editform.wpTextbox1.value.replace(/[ \t]+$/gm,"");ct.scan;} mw.util.addPortletLink('p-tb','javascript:dewhitesp','rm trailing whitespace','dewhitelink'); function authorfl(s,n){var a=s.replace(/(^\s+|\s+$)/g,"").replace(/\s*,?\s+(and|&)\s+/gi,";").split(/\s*;\s*/),r="",i,j;for(i=0;i<a.length;i++)if(a[i])r+=(j=a[i].split(",")).length==2?"|last"+(i+n)+"="+j[0]+"|first"+(i+n)+"="+j[1]:(j=a[i].split(" ")).length==2?"|first"+(i+n)+"="+j[0]+"|last"+(i+n)+"="+j[1]:"|author"+(i+n)+"="+a[i];return r+(i+n<10?"":"|displayauthors="+(i+n-1));} //mw.util.addPortletLink('p-tb','javascript:alert(authorfl(prompt("coauthors="),2))','cite|coauthor→suggestion','coauthsug'); mw.util.addPortletLink('p-tb','javascript:alert(authorfl(prompt("authors="),1))','cite|authors→suggestion','authsug'); function monthp(m){return mw.config.get('wgMonthNames')[(parseInt(m)||{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12}[m.toString.substring(0,3).toLowerCase])]||m;} //importScript("User:PC-XT/JSubst.js");/*linkback: User:PC-XT/JSubst*/ //mw.util.addPortletLink('p-tb','javascript:JSubst.subst(list:"",function(p){return p(0);})','Convert lang icons','langicons'); //if(/*ns!=828&&(p.substring(0,11)!="User:PC-XT/"||(p_ext!="js"&&p_ext!="css"))*/!mw.config.get('wgCodeEditorCurrentLanguage')){//others could have own suggestion set, if add option to not include default rules switch(mw.config.get('wgCodeEditorCurrentLanguage')){ case"javascript": break; ct={noscroll:true,noDefaultRules:1,rules:[ ]};importScript('User:PC-XT/Advisor.js'); break;//end javascript case"css": break; ct={noscroll:true,noDefaultRules:1,rules:[ ]};importScript('User:PC-XT/Advisor.js'); break;//end css case"lua": break; ct={noscroll:true,noDefaultRules:1,rules:[ ]};importScript('User:PC-XT/Advisor.js'); break;//end lua default://wikicode assumed ct={noscroll:true,rules:[ // A ``rule'' is a JavaScript function that accepts a string as a   // parameter (the wikitext of the page being edited) and returns an array // of ``suggestion'' objects.

// A ``suggestion'' object must have the following properties: //    * start---the 0-based inclusive index of the first character to be replaced //    * end---analogous to start, but exclusive //    * (optional) replacement---the proposed wikitext, if any //    * name---this is what appears at the top of the page //    * description---used as a tooltip for the name of the suggestion //    * (optional) help---an HTML fragment as a string, it will appear in a yellow //                        box when a suggestion is double-clicked /*function(s){var matches=ct.getAllMatches(/\.(google)\.([a-z]{2})([^m])/i,s),suggestions=[],i,m; for(i=0;i<matches.length;i++){m=matches[i];suggestions.push({ start:m.start+1,end:m.end, name:"Globalize "+m[1]+"."+m[2]+" → "+m[1]+".com", description:"You may want to check the link before and after to make sure it works globalized", replacement:m[1]+".com"+m[3] });}return suggestions;},*/ function(s){var c={"\0":"NUL","\x7f":"DEL","\xAD":"soft hyphen","\u200B":"zero width space","\uFFFD":"replacement character"},matches=ct.getAllMatches(/(.)([\0-\x08\x0b\x0c\x0f-\x1f\x7F-\x9F\u200B\uE000-\uF8FF\uFFF9-\uFFFF]+|\xAD)(.)/g,s),suggestions=[],i;for(i=0;i1?'s':''), description:"These characters are either invisible or unprintable, and can probably be removed.", replacement:m[1]+m[3]});}return suggestions;}, function(s){var matches=ct.getAllMatches(/([^\[])\[(\/\/[^ \]]*|[^\[\]][^ \]]*\/\/[^ \]]*) ([^\]]+)\]([^\]])( ([^ ]+)( \([-0-9]+\)|)\. Retrieved on ([-0-9]+)\..|\{\{[Ww]ayback\|url=([^|]+)\|date=([0-9]+) *\}\})?/g,s),suggestions=[],i,m,cite,t,url,title,archive,archivedate,monthName=mw.config.get('wgMonthNames'); for(i=0;i',"%3e").replace('[',"%5b").replace('|',"%7c").replace('}',"%7d");//too late to escape ] and sp title=m[3].replace(/\|/g,"&#124;");if('"'.indexOf(title.substring(0,1))>=0&&'"'.indexOf(title.substring(title.length-1))>=0)title=title.substring(1,title.length-1); cite=m[0].search(/press release/i)>=0?"press release":m[0].search(/news/i)>=0?"news":url.indexOf("books.google.co")>=0?"book":"web"; if(m[10]){archive="//web.archive.org/web/"+m[10]+"/"+m[9];archivedate=+m[10].substring(6,8)+" "+monthName[+m[10].substring(4,6)]+" "+m[10].substring(0,4);}else if(url.indexOf(".archive.org/")>=0&&(t=url.match(/\.archive\.org\/[a-z/]*([0-9]{4})([0-9][0-9])([0-9][0-9])[0-9]+\/(.+)$/i))){archive=url.indexOf("//");if(archive>12||archive<0)archive="//"+url;else archive=url.substring(archive);t=url.match(/[\/.]archive\.org\/[a-z/]*([0-9]{4})([0-9][0-9])([0-9][0-9])[0-9]+\/(.+)$/i);archivedate=+t[3]+" "+monthName[+t[2]]+" "+t[1];url=t[4];} suggestions.push({start:m.start+1,end:m.end-1, replacement:"\x7b{cite "+cite+"|url="+url+(archive?"|archiveurl="+archive+"|archivedate="+archivedate:"")+"|title="+title+"|work="+(m[6]||(url.match(/\/\/(www.|)([A-Za-z0-9\-\.]+)(\/|$)/)||[0,"",""])[2])+((t=url.match(/books\.google\.co.+[&?]pg=PA([0-9]+)(\s*$|&)/i))?'|page='+t[1]:"")+(url.search(/\.pdf\s*$/i)>=0?"|format=PDF":"")+(m[7]?"|date="+m[7].substring(2).split(")")[0]:"")+(m[8]?"|accessdate="+m[8]:"")+"}}", name:"link→cite "+cite+(archive?' (archive)':''), description:"If this is not in prose, but a reference or in a list of links, possibly use \x7b{cite "+cite+"}}"+m });}return suggestions;}, /*function(s){var matches=ct.getAllMatches(/\{\{([Ee]n)\|/g,s),suggestions=[],i,m; for(i=0;i<matches.length;i++){m=matches[i];suggestions.push({start:m.start,end:m.end, replacement:"\x7b{lang-"+m[1]+"|", name:"\x7b{"+m[1]+"}}→\x7b{lang-"+m[1]+"}}" });}return suggestions;},*/ function(s){var matches=ct.getAllMatches(/\{\{([Ee][ns]|[Cc]a|[Dd]e|[Ff][ri]|[Dd]a|[Nn]l|[Ss][rv]|[Jj]a|[Ii][dt]|[Kk]o)\}\}/g,s),suggestions=[],i,m; for(i=0;i<matches.length;i++){m=matches[i];suggestions.push({start:m.start,end:m.end, replacement:"\x7b{"+m[1]+" icon}}", name:"\x7b{"+m[1]+"}}→\x7b{"+m[1]+" icon}}" });}return suggestions;}, function(s){var matches=ct.getAllMatches(/\|\s*coauthors?\s*=\s*([^|}]*)[|}]/g,s),suggestions=[],k,m; for(k=0;k<matches.length;k++){m=matches[k]; suggestions.push({start:m.start,end:m.end-1, replacement:authorfl(m[1],2), name:"cite|coauthors=deprecated" });}return suggestions;}, function(s){var matches=ct.getAllMatches(/(\{\{cite[^}<]*)(\|\s*access-?date\s*=\s*[^|}]*)([^}]*\}\})/g,s),suggestions=[],k,m;//[^<] to avoid comments, as tags not often used in a cite for(k=0;k<matches.length;k++){m=matches[k];if((m[1]+m[3]).search(/\|\s*url\s*=\s*[^|]{6}/)<0){ suggestions.push({start:m.start,end:m.end, name:"cite|accessdate without url", replacement:m[1]+""+m[3], description:"accessdate is only needed for urls" });}}return suggestions;}, function(s){var matches=ct.getAllMatches(/(\{\{cite[^}<]*)(\|\s*format\s*=\s*[^|}]*)([^}]*\}\})/g,s),suggestions=[],k,m;//[^<] to avoid comments, as tags not often used in a cite for(k=0;k<matches.length;k++){m=matches[k];if((m[1]+m[3]).search(/\|\s*url\s*=\s*[^|]{6}/)<0){ suggestions.push({start:m.start,end:m.end, name:"cite|format without url", replacement:m[1]+""+m[3], description:"format only applies to urls" });}}return suggestions;}, function(s){var matches=ct.getAllMatches(/(\{\{cite[^}<]*)\|\s*month\s*=\s*([^|]*)\|\s*year\s*=\s*([^|}]*)[|}]/g,s),suggestions=[],k,m; for(k=0;k<matches.length;k++){m=matches[k]; suggestions.push({start:m.start,end:m.end-1, name:"cite|month=deprecated", replacement:m[1]+"|date="+(monthp(m[2])+" "+m[3]).replace(/ /g," ").replace(/  /g," "), description:"If this is in a cite, fix it and check for CS1 date error" });}return suggestions;}, function(s){var matches=ct.getAllMatches(/(\{\{cite[^}<]*)\|\s*year\s*=\s*([^|]*)\|\s*month\s*=\s*([^|}]*)[|}]/g,s),suggestions=[],k,m; for(k=0;k<matches.length;k++){m=matches[k]; suggestions.push({start:m.start,end:m.end-1, name:"cite|month=deprecated", replacement:m[1]+"|date="+(monthp(m[3])+" "+m[2]).replace(/ /g," ").replace(/  /g," "), description:"If this is in a cite, fix it and check for CS1 date error" });}return suggestions;}, function(s){var matches=ct.getAllMatches(/(\{\{cite[^}<]*)\|\s*(month|day)\s*=\s*([^|}]*)[|}]/g,s),suggestions=[],k,m; for(k=0;k/g,s),suggestions=[],k; for(k=0;k", description:"should be replaced by <"+m[1]+"kbd>, <"+m[1]+"code> (default), <"+m[1]+"var>, or <"+m[1]+"samp> for output" });}return suggestions;} //template rules should go in here, too, since they may be used in main space, as well ]};importScript('User:PC-XT/Advisor.js'); importScript('User:Frietjes/findargdups.js'); // User:Frietjes/findargdups if(p.search(/[^:]*[Tt]alk:/)>=0){//talk page importScript('User:Scottywong/diffconverter.js'); //User:Scottywong/diffconverter.js mw.util.addPortletLink('p-tb','javascript:keydetect({keyCode:68,altKey:1,ctrlKey:1})','selected link→\x7b{diff}} (Ctrl+Alt+D)','Ctrl+Alt+D'); }else{//non-talk page var wgNamespaceNumber=mw.config.get('wgNamespaceNumber'); if(wgNamespaceNumber!=-1 && wgNamespaceNumber!=10 && document.getElementsByName('wpTextbox1')[0])$(document).ready(t=function{if(typeof wpFindDuplicateArgs!="undefined")wpFindDuplicateArgs(0);else setTimeout(t,1000);}); //importScript('User:Ohconfucius/script/Sources.js'); // User:Ohconfucius/script/Sources.js //importScript('User:Ohconfucius/script/formatgeneral.js'); // User:Ohconfucius/script/formatgeneral.js //importScript('User:Ohconfucius/script/MOSNUM dates.js'); //User:Ohconfucius/script/MOSNUM dates.js //if(p.substring(0,21)=="Wikipedia:WikiProject")importScript('User:PC-XT/ParticipantSort.js'); }//end talk switch }//end wikicode editor //importScript('User:Anomie/ajaxpreview.js'); // Linkback: User:Anomie/ajaxpreview.js var ajaxPreviewPos = 'bottom'; //buttons on the bottom, replacing standard var ajaxPreviewFull = true; //always update interwikis, categories and templates as well // code to execute after each preview update window.ajaxPreviewExec = function(previewArea) { if (window.setupTooltips) { setupTooltips(previewArea); previewArea.ranSetupTooltipsAlready = false; } mw.loader.using( [    'jquery.tablesorter',    'jquery.makeCollapsible'  ], function{    $( 'table.sortable' ).tablesorter;    $( '#wikiPreview .collapsible' ).makeCollapsible;  } ); } importScript('User:Js/ajaxPreview.js'); // user:js/ajaxPreview }else{//end editor, start reading tools /* importScript('User:Anomie/linkclassifier.js'); // Linkback: User:Anomie/linkclassifier.js importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: User:Anomie/linkclassifier.css var d=document.createElement("div"); d.class="portal"; d.style.fontSize="9pt"; d.innerHTML='linkclassifier: link new redirect self-redirect disambiguation intentional-disambiguation</a> <a href="/wiki/Special:Categories" class="soft-redirect-cats">soft-redirect-cats</a> <a href="/w/index.php?title=Special%3ALog&type=delete" class="deletion">deletion</a> <a href="/wiki/Special:BrokenRedirects" class="broken-redirect">broken-redirect</a> <a href="/wiki/CAT:NFM" class="image.nonfree-media"><img alt="nonfree-media" src="https://bits.wikimedia.org/favicon/wikipedia.ico" /></a> <a href="/w/index.php?title=Special%3ALog&type=delete" class="image.deletion"><img alt="deletion" src="https://bits.wikimedia.org/static-1.22wmf8/skins/vector/images/search-ltr.png?303-4" /></a>'; t.parentNode.removeChild(t); document.getElementById('mw-panel').appendChild(d); //mw.util.addPortletLink('p-tb','/wiki/Special:DisambiguationPageLinks','Disambig list','Special-Disambiguations'); importScript('User:Splarka/dabfinder.js'); } //importScript('User:Jackmcbarn/editProtectedHelper.js'); // Linkback: User:Jackmcbarn/editProtectedHelper.js