Nota: dopo aver salvato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.
- Firefox / Safari: tenere premuto il tasto delle maiuscole e fare clic su Ricarica, oppure premere Ctrl-F5 o Ctrl-R (⌘-R su Mac)
- Google Chrome: premere Ctrl-Shift-R (⌘-Shift-R su un Mac)
- Internet Explorer: tenere premuto il tasto Ctrl mentre si fa clic su Refresh, oppure premere Ctrl-F5
- Opera: svuotare completamente la cache dal menu Strumenti → Preferenze
CheckLink=function (title, site) { data= {format: 'json', action: 'query', titles: decodeURIComponent(title), prop: 'revisions', rvlimit: '1'}; $.ajax({ url: 'https:'+site+'/w/api.php', async:false, data:data, dataType: 'jsonp' }).done(function (data) { if (data.query!==undefined){ //Se la pagina non esiste va nascosto l'item if ((data.query.pages===undefined) || (data.query.pages[-1]!==undefined)) { //nascondo il link nel corpo dell'articolo $("a[href^='"+site+"/wiki/"+title+"']").parent("b").parents("li").hide(); //sposto e nascondo il link nella sidebar $("#p-wikibase-otherprojects ul li a[href^='"+site+"']").parent().appendTo('#p-wikibase-otherprojects ul').hide(); //Se la sezione Altri progetti è vuota la nascondo if( $('#Altri_progetti').parent().parent().children('ul').children('li:visible').length === 0 ){ $('#Altri_progetti').parent().hide(); //Se il menù Altri progetti della sidebar ha solo gli elementi dell'interprogetto (ed essendo qui non sono visibili) lo nascondo //Non lo nascondo direttamente perchè potrebbero essere presenti link di altri progetti come dmoz. if( $('#p-wikibase-otherprojects ul li').length == 1 ){ //1 è relativo al fatto che si controlla un solo sito: Wiktionary $('#p-wikibase-otherprojects').hide(); } } }else{ //Se il link esiste va aggiunto nella sidebar var witklink = $(".extiw[title^='wikt:']").last().attr("href") ; if(witklink !== null){ if($('#p-wikibase-otherprojects div ul').length === 0){ //Se il menù non esiste lo creo var PortalMenu = '<div class="portal" role="navigation" id="p-wikibase-otherprojects" aria-labelledby="p-wikibase-otherprojects-label">\n<h3 id="p-wikibase-otherprojects-label">Altri progetti</h3>\n<div class="body"><ul>\n</ul></div></div>\n'; $('#p-tb').before(PortalMenu); } //Da qui in poi ho la certezza che il menù esiste, quindi aggiungo il link $('#p-wikibase-otherprojects div ul').append('<li class="wb-otherproject-link wb-otherproject-wiktionary"><a href="'+witklink+'" hreflang="it">Wikizionario</a></li>'); } } } }); }; //Controllo l'esistenza del link a Wiktionary. L'esistenza degli altri è garantita da Wikidata var anchor = $(".extiw[title^='wikt:']").last(); if( anchor !== null & anchor.length > 0 ){ var parts=[]; parts = anchor.attr("href").split('/wiki/'); CheckLink(parts[1].split('?')[0], parts[0]); }