User:PC-XT/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:PC-XT/common.css. |
popupFixDabs=true;
p=mw.config.get('wgPageName');
/*ns=mw.config.get('wgNamespaceNumber');
//for(t in wgNamespaceIds)if(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():"";*/
mw.util.addPortletLink('p-tb','/wiki/Special:PrefixIndex/'+p,'PrefixIndex','Special-PrefixIndex');
t=p.split('/');t.length--;
if(t.length)mw.util.addPortletLink('p-tb','/wiki/Special:PrefixIndex/'+t.join('/')+'/','PrefixIndex/../','Special-PrefixIndex2');
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://wikipedia.ramselehof.de/wikiblame.php?user_lang=en&lang=en&project=wikipedia&article='+p,'WikiBlame','WikiBlame');
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(wgAction=="edit"||wgAction=="submit"){
//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 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 matches=ct.getAllMatches(/([^\[])\[(\/\/[^ \]]*|[^\[\]][^ \]]*\/\/[^ \]]*) ([^\]]+)\]([^\]])( ([^ ]+)( \([-0-9]+\)|)\. Retrieved on ([-0-9]+)\..)?/g,s),suggestions=[],i,m,cite,t,url,title,archive,archivedate;
for(i=0;i<matches.length;i++){m=matches[i];archive='';
url=m[2].replace('"',"%22").replace("'","%27").replace('<',"%3c").replace('>',"%3e").replace('[',"%5b").replace('|',"%7c").replace('}',"%7d");//too late to escape ] and sp
title=m[3].replace(/\|/g,"|");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(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=1*t[3]+" "+wgMonthNames[1*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])+(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*accessdate\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[2]+" -->"+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[2]+" -->"+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<matches.length;k++){m=matches[k];
suggestions.push({start:m.start,end:m.end-1,
name:"deprecated parameter"
});}return suggestions;},
function(s){var matches=ct.getAllMatches(/\<(\/?)tt\>/g,s),suggestions=[],k;
for(k=0;k<matches.length;k++){m=matches[k];
suggestions.push({start:m.start,end:m.end,
name:"obsolete HTML tag",
replacement:"<"+m[1]+"code>",
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');
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
//forked from: importScript('User:Frietjes/findargdups.js'); // [[User:Frietjes/findargdups]]
var myContent = document.getElementsByName('wpTextbox1')[0];
if(wgNamespaceNumber != -1 && myContent)(function wpFindDuplicateArgs(debugflag)
{
// Flag used to determine if we have issued an alert popup
var alertissued=0;
// Internal for and while loop variables
var i=0; var j=0; var loopcount=0;
// Array used to hold the list of unnested templates
var tlist = [];
// Regular expression which matchs a template arg
var argexp = new RegExp("\\|[\\s]*([^\\s=\\|\\[\\]\\{\\}][^=\\|\\[\\]\\{\\}]*[^\\s=\\|\\[\\]\\{\\}]|[^\\s=\\|\\[\\]\\{\\}]|)[\\s]*=", "gm");
// Copy the contents of the text window so we can modify it without problems
var mytxt = myContent.value;
// Remove some includeonly, noinclude, and onlyinclude tags
mytxt = mytxt.replace(/<\/?[ ]*(?:includeonly|noinclude|onlyinclude)[ ]*>/gi, '');
// Remove PAGENAME, BASEPAGENAME, ... nested inside of triple braces
mytxt = mytxt.replace(/\{\{\{[^\{\}]*\|[ ]*\{\{[A-Z]+\}\}\}\}\}/g, '');
// Remove some triple braces
loopcount = 0;
while((mytxt.search(/\{\{\{[^\{\}]*\}\}\}/g) >= 0) && (loopcount < 5) ) {
mytxt = mytxt.replace(/\{\{\{[^\{\}]*\}\}\}/g, '');
loopcount++;
}
// Replace some bare braces with HTML equivalent
mytxt = mytxt.replace(/([^\{])\{([^\{])/g, '$1{$2');
mytxt = mytxt.replace(/([^\}])\}([^\}])/g, '$1}$2');
// Remove newlines and tabs which confuse the regexp search
mytxt = mytxt.replace(/[\s]/gm, ' ');
// Compress whitespace
mytxt = mytxt.replace(/[\s][\s]+/gm, ' ');
// Remove some HTML comments
mytxt = mytxt.replace(/<!--[^<>]*-->/gm, '');
// Modify some = inside of file/image/wikilinks which cause false positives
loopcount = 0;
while((mytxt.search(/\[\[[^\[\]\{\}]*=/gi) >= 0) && (loopcount < 5) ) {
mytxt = mytxt.replace(/(\[\[[^\[\]\{\}]*)=/gi, '$1=');
loopcount++;
}
// Split the text into chunks to reduce processing overhead
var strlist = mytxt.split(/(\{\{|\}\})/);
// Now start unnesting the templates
loopcount = 0;
while( (strlist.length > 0) && (loopcount < 10) ) {
for (i = strlist.length - 1; i >= 0; i--) {
if((i+2) < strlist.length && strlist[i] == '{{' && strlist[i+2] == '}}') {
tlist.push(strlist[i] + strlist[i+1] + strlist[i+2]);
strlist.splice(i,3);
} else if((i+3) < strlist.length && strlist[i] == '{{' && strlist[i+3] == '}}') {
if( strlist[i+1].search(/[\{\}]/g) < 0 && strlist[i+2].search(/[\{\}]/g) < 0 ) {
tlist.push(strlist[i] + strlist[i+1] + strlist[i+2] + strlist[i+3]);
strlist.splice(i,4);
}
} else if( strlist[i].search(/^[\s]*$/g) >= 0 ) {
strlist.splice(i,1);
} else if((i+1) < strlist.length && strlist[i].search(/[\{\}]/g) < 0 && strlist[i+1].search(/[\{\}]/g) < 0) {
strlist[i] = strlist[i] + strlist[i+1];
strlist.splice(i+1,1);
}
}
loopcount++;
}
// Now find duplicates in the list of unnested templates
for(i=0; i < tlist.length; ++i) {
// Add numbers for unnamed parameters
var unp=0;
while((tlist[i].search(/(\{\{(?:[^{}\[\]]|\[\[[^\[\]]*\]\])*?\|)((?:[^{}\[\]=\|]|\[\[[^\[\]]*\]\])*(?:\||\}\}))/) >= 0)
&& (unp < 25)) {
unp++;
tlist[i] = tlist[i].replace(/(\{\{(?:[^{}\[\]]|\[\[[^\[\]]*\]\])*?\|)((?:[^{}\[\]=\|]|\[\[[^\[\]]*\]\])*(?:\||\}\}))/, '$1' + unp + '=$2');
}
// Split the template into an array of | arg = ... strings
var p = tlist[i].match(argexp);
if( p ) {
for(j=0; j < p.length; ++j) {
p[j] = p[j].replace(argexp, '$1');
}
p = p.sort();
for(j=0; j < p.length - 1; ++j) {
if( p[j] == p[j+1]) {
alertissued = 1;
alert('\"' + p[j] + '\" in\n' + tlist[i]);
}
}
}
}
if (alertissued) {
var editsummary = document.getElementsByName('wpSummary')[0];
if(typeof editsummary == 'object') {
if(typeof findargdupseditsummary == 'string') {
editsummary.value = findargdupseditsummary;
} else {
editsummary.value +=(editsummary.value.length?'; ':'')+ 'Clean up [[:Category:Pages using duplicate arguments in template calls|duplicate template arguments]] using [[User:Frietjes/findargdups|findargdups]]';
}
}
}
})(0);
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]]
LinkClassifierOnDemand=true;
function PCxtLinkClassifierGo(){
LinkClassifier.onDemand();
var t=document.getElementById('linkclassifier'),d=document.createElement("div");
d.style.fontSize="9pt";
d.innerHTML='linkclassifier:<br><a href="/wiki/User:Anomie/linkclassifier">link</a><br><a href="/wiki/Special:NewPages" class="new">new</a><br><a href="/wiki/Special:Redirects" class="redirect">redirect</a><br><a href="/wiki/Special:RandomRedirect" class="self-redirect">self-redirect</a><br><a href="/wiki/Special:Disambiguations" class="disambiguation">disambiguation</a><br><a href="/wiki/Special:Disambiguations" class="intentional-disambiguation">intentional-disambiguation</a><br><a href="/wiki/Special:Categories" class="soft-redirect-cats">soft-redirect-cats</a><br><a href="/w/index.php?title=Special%3ALog&type=delete" class="deletion">deletion</a><br><a href="/wiki/Special:BrokenRedirects" class="broken-redirect">broken-redirect</a><br><a href="/wiki/CAT:NFM" class="image.nonfree-media"><img alt="nonfree-media" src="https://bits.wikimedia.org/favicon/wikipedia.ico" /></a><br><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('p-tb').appendChild(d);
}
addOnloadHook(function(){mw.util.addPortletLink('p-tb'/*'p-cactions'*/, 'javascript:PCxtLinkClassifierGo()', 'linkclassifier','linkclassifier');});
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]]
/**
* Anzahl der Beobachter für Artikel in einem Tab
* oben rechts anzeigen lassen mit Verweis auf
* Artikel-Informationsseite
*
* Nutzbar für den Vector- und Monobook-Skin
*
* Author: Benutzer:Nightfly85 [[User:Nightfly85/common.js]]
*/
(function($, mw) {
function placeTab(text, url, title, isSelected) {
var liClass = isSelected ? 'selected' : '',
$liElement = $('<li style="display:none" class="' + liClass +'" ><span><a title="' + title + '" href="' + url + '">' + text + '</a></span></li>');
$('#ca-history').after($liElement);
$liElement.slideDown();
}
var isInfoPage = (mw.config.get('wgAction') == 'info'),
articleName = mw.util.wikiUrlencode(mw.config.get('wgPageName')),
wikiBaseUrl = mw.config.get('wgServer') + mw.config.get('wgScriptPath'),
infoUrl = wikiBaseUrl + '/index.php?action=info&title=' + articleName,
apiUrl = wikiBaseUrl + '/api.php?action=query&prop=info&inprop=watchers&format=xml&titles=' + articleName;
if(isInfoPage) {
// The info tab is selected, so highlight the tab and forget the ajax stuff
placeTab('Info', infoUrl, 'Article information', true);
} else {
if(false === mw.config.get('wgIsArticle') ) {
return; // Generated page
}
$.ajax({ url: apiUrl }).done(function(xmlData) {
var numViewer = $(xmlData).find('page').attr('watchers'),
numViewerText = (numViewer > 0) ? '<strong>' + numViewer + '</strong>' : 'Marginal';
placeTab(numViewerText + ' watchers', infoUrl, 'Show Article info', false);
});
}
})(jQuery, mediaWiki);