Utente:Samuele Papa/common.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m small typo |
updated TemplateScript usage |
||
Riga 15:
*/
//Glboalizing the object, in order to use it from the console
var pathoglobal;
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
//console.log(pathoschild);
pathoglobal=pathoschild;
/**
* Add a template to a button box fixed to the bottom of the page. This implementation ignores the 'category' field.
Line 45 ⟶ 46:
.appendTo(bar);
});
/**
*/
pathoschild.TemplateScript.add([
{ name: 'Benvenuto', template: '\{\{Benvenuto\}\} \~\~\~\~', position: 'after', editSummary: 'Benvenuto!', forNamespaces:
▲ { name: 'Benvenuto', template: '\{\{Benvenuto\}\} \~\~\~\~', position: 'after', editSummary: 'Benvenuto!', forNamespaces: 3, forActions: 'edit', renderer: 'buttonbox' },
]);
/**
*/
pathoschild.TemplateScript.add({
name:'Debugger',
script: function(
console.log(
}
});
/**
*
pathoschild.TemplateScript.add({
name:"spostamento note",
script: function(
▲ var val=editbox.val();
▲ if (val.indexOf("<sup>nota</sup>") == -1) { // note in posizione regolare
lista = produciLista(val, "<ref", "</ref>", 1);
lista = jQuery.grep(lista, function (n, i) {
Riga 79:
});
for (i = 0; i < lista.length; i += 1) {
editor
.append('\n' + lista[i]);
}
} else { //presenza di marcatori
marks = count(val, "<ref>") + count(val, "<ref name=") + count(val, "<ref group=");
refs = count(val, "<sup>nota</sup>");
if (marks != refs) { // verifica parità
alert("ATTENZIONE: discordanza fra numero dei <br />segnaposti (" + marks + ") e numero delle note (" + refs + "). Controllare!");
return;
Line 93 ⟶ 94:
return (n.indexOf('<ref follow=') == -1);
});
for (i = 0; i < lista.length; i += 1) {
}
}
Line 104 ⟶ 105:
forNamespaces: [108],
renderer: 'buttonbox',
script: function(
}
});
|