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');
// flag for default browser behaviour on the shortcut
Riga 68 ⟶ 67:
];
// text
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)
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);
// get language from the input in the textarea (last 2 chars)
if (!langMatch || !langMatch[1])
queryWikidata(
});
|