This is an old revision of this page, as edited by Lenore(talk | contribs) at 18:03, 6 July 2009(For "Speciale:PaginePiùRecenti"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 18:03, 6 July 2009 by Lenore(talk | contribs)(For "Speciale:PaginePiùRecenti")
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.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Autolink [[wikilinks]], [external links] and {{templates}} (especially useful for monobook.js // and similar pages); adapted from [[Wikipedia:WikiProject User scripts/Scripts/Autolink]]/* ---------------------------------------------------------------------------------------------- */addOnloadHook(function(){if(___location.href.indexOf('&action=edit')!=-1||___location.href.indexOf('&action=submit')!=-1||___location.href.indexOf('Special%3A')!=-1||___location.href.indexOf('Speciale%3A')!=-1){return;// Disabled in edit, submit and some critic pages}if(typeof(autolinkParseLink)=='undefined'){autolinkParseLink=true;// Parse external links in all cases}/* ------------------------------------------ Skins --------------------------------------------- */if(document.getElementById('bodyContent'))autolinkBody=document.getElementById('bodyContent');// MonoBook-like skinselse{if(document.getElementById('mw_content'))autolinkBody=document.getElementById('mw_content');// Modern skinelseautolinkBody=document.getElementById('content');// Older skins}/* ---------------------------------------- Variables ------------------------------------------- */autolinkCrono=___location.href.indexOf('&action=history')!=-1||/* */___location.href.indexOf('Speciale:UltimeModifiche')!=-1||/* */___location.href.indexOf('Special:RecentChanges')!=-1||/* */___location.href.indexOf('Speciale:OsservatiSpeciali')!=-1||/* */___location.href.indexOf('Special:Watchlist')!=-1||/* */___location.href.indexOf('Speciale:ModificheCorrelate')!=-1||/* */___location.href.indexOf('Special:RecentChangesLinked')!=-1||/* */(___location.href.indexOf('Speciale:')!=-1&&document.title.indexOf('Pagine più recenti')!=-1)||/* */___location.href.indexOf('Special:NewPages')!=-1||/* */___location.href.indexOf('Speciale:Registri')!=-1||/* */___location.href.indexOf('Special:Log')!=-1||/* */___location.href.indexOf('Speciale:Contributi')!=-1||/* */___location.href.indexOf('Special:Contributions')!=-1;// It says if I'm in a history pageautolinkDiff=___location.href.indexOf('&diff=')!=-1;// It says if I'm in a diff pageautolinkTargetDiv=newArray();if(autolinkDiff){autolinkTargetDiv=autolinkBody.getElementsByClassName('diff');}else{if(!autolinkCrono)autolinkTargetDiv=autolinkBody.getElementsByTagName('pre','tt','code','source');elseautolinkTargetDiv[0]=autolinkBody;}/* ------------------------------------------ Regex --------------------------------------------- */if(autolinkCrono){varautolinkColor='';// Link color in history pagesautolinkRegexURLinWcodeWoLabel=/()\[{1}((?:https?|ftps?):\/\/[^\{\}\s]+?)\s*\]{1}()/g;// External links in history pages, wikicode without labelautolinkRegexURLinWcodeWithLabel=/()\[{1}((?:https?|ftps?):\/\/[^\{\}\s]+)()\s+([^\]\n]+)\]{1}()/g;// External links in history pages, wikicode with label (the URL will not be visible)}else{varautolinkColor='inherit';// Link color in other pagesautolinkRegexURLinWcodeWoLabel=/(\[{1})((?:https?|ftps?):\/\/[^\{\}\s]+?)(\s*\]{1})/g;// External links in other pages, wikicode without labelautolinkRegexURLinWcodeWithLabel=/(\[{1})(((?:https?|ftps?):\/\/[^\{\}\s]+))(\s+[^\]\n]+)(\]{1})/g;// External links in other pages, wikicode with label}autolinkRegexURL=/([^>"\[]|[^\=]")((?:https?|ftps?):\/\/[^\{\}]+?)([\s\]\)\|\}'"])/g;// External links (no wikicode)autolinkRegexWlink=/\[{2}([^\[\]<>\n]*?)(\<span class\="diffchange"\>|)([^\[\]<>\n]*?)(\<\/span\>|)([^\[\]<>\n]*?)(|\|[^\n]*?)\]{2}/g;// WikilinksautolinkRegexTemplate=/\{{2}([Ss][Uu][Bb][Ss][Tt]\:|[Mm][Ss][Gg]\:|[Mm][Ss][Gg][Nn][Ww]\:|)([^\{\}\:\&\|<>\n]*?)(\<span class\="diffchange"\>|)([^\{\}\:\&\|<>\n]*?)(\<\/span\>|)([^\{\}\:\&\|<>\n]*?)(\s*(?:(?:\:|\|)|\}{2}))/g;// TemplatesautolinkRegexInternalURL=/([^\=])('|"|\s)((?:\/?w\/index\.php\?|\/?wiki\/)[^\s\{\}\|]+?)\2/g;// External links (no wikicode, under wgServer)autolinkRegexImportScript=/([Ii]mport[Ss]cript(?:\<span class\="br0"\>)?\((?:\<\/span\>\<span class\="st0"\>)?)('|")([^\|\[\]<>\n]+?)(\2(?:\<\/span\>\<span class\="br0"\>)?\)(?:\<\/span\>)?)/g;// ImportScript/* ---------------------------------------------------------------------------------------------- */for(i=0;i<autolinkTargetDiv.length;i++){autolinkContent=autolinkTargetDiv[i].innerHTML;if(autolinkParseLink==true||!autolinkDiff){// Qui vanno tutte le sostituzioni fatte anche dal wikEd nelle diffautolinkContent=autolinkContent.replace(autolinkRegexURLinWcodeWoLabel,'$1<a class="autolink" style="color:'+autolinkColor+'" href="$2">$2</a>$3');// Make external links in wikicode without label into linksautolinkContent=autolinkContent.replace(autolinkRegexURLinWcodeWithLabel,'$1<a class="autolink" style="color:'+autolinkColor+'" href="$2">$3$4</a>$5');// Make external links in wikicode with label into linksautolinkContent=autolinkContent.replace(autolinkRegexURL,'$1<a class="autolink" style="color:'+autolinkColor+'" href="$2">$2</a>$3');// Parse inactive external links (no wikicode)autolinkContent=autolinkContent.replace(autolinkRegexWlink,'[[<a class="autolink" style="color:'+autolinkColor+'" href="/wiki/$1$3$5">$1$2$3$4$5</a>$6]]');// Make wikilink code into linksautolinkContent=autolinkContent.replace(autolinkRegexTemplate,'{{<a class="autolink" style="color:'+autolinkColor+'" href="/wiki/Help:$1">$1</a><a class="autolink" style="color:'+autolinkColor+'" href="/wiki/Template:$2$4$6">$2$3$4$5$6</a>$7');// Make template code into links}autolinkContent=autolinkContent.replace(autolinkRegexInternalURL,'$1$2<a class="autolink" style="color:'+autolinkColor+'" href="'+wgServer+'$3">$3</a>$2');// Parse inactive external links (no wikicode, under wgServer)autolinkContent=autolinkContent.replace(autolinkRegexImportScript,'$1$2<a class="autolink" style="color:'+autolinkColor+'" href="/wiki/$3">$3</a>$4');// Parse ImportScriptautolinkTargetDiv[i].innerHTML=autolinkContent;// Write it back}});// [[Category:Wikipedia scripts|Autolink]]