Utente:Tino/TradottoDa.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 22:
var inputArea = $('#wpTextbox1');
var cursor;
// flag for default browser behaviour on the shortcut
Riga 68 ⟶ 67:
];
// text to be added afterfor the cursorcompiled positiontemplate
var text = '{{tradotto da|' + lang + '|';
var index;
Riga 90 ⟶ 89:
// insert template completion
inputArea.textSelection('setSelection', {
start: cursor - 2,
end: cursor
});
inputArea.textSelection('encapsulateSelection', {
peri: text,
Riga 121 ⟶ 116:
dataType: 'jsonp',
success: function(data) {
if (!data.success)
end: cursorreturn;
var wiki = lang + 'wiki';
Riga 143 ⟶ 141:
keystrokeDefault = false;
var prevText, cursor, beginning, langMatch;
// get cursor position and select "{{tradotto da|ll" on keypress
cursor = inputArea.textSelection('getCaretPosition');
prevText = inputArea.val().substring(0, cursor);
beginning = prevText.lastIndexOf('{{tradotto da');
prevText = prevText.substring(beginning);
prevText = inputArea.textSelection('setSelection', {
{start: cursorbeginning, -end: 2,cursor});
// get language from the input in the textarea (last 2 chars)
var langlangMatch = inputAreaprevText.valmatch().substring/^{{tradotto da\|(cursor [a- z]{2, cursor})$/);
if (!langMatch || !langMatch[1])
})return;
queryWikidata(langlangMatch[1]);
});