Discussioni MediaWiki:Gadget-LiveRC 1x.js/InserisciTemplate.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
Bug to be fixed
Riga 78:
::::::::Edit (2) : The actual code seems to be OK (I added a function to compare old templates and new templates, and prevent non-customized templates to be saved).
::::::::[[Utente:Dr Brains|Dr Brains]] ([[Discussioni utente:Dr Brains|msg]]) 18:39, 13 lug 2014 (CEST)
:{{ping|Jalo}}
:Hello,
:I noticed a problem in the functions <code>lrcRunInsertTemplate</code> and <code>getLiveTagFunctions["InserisciTemplateExtension"]</code>
:The actual code doesn't check if there is customized templates when it creates and checks the "tag" tool options.
:The changes to do are (lines <small>5-6-7</small> and <small>28-29-30</small>) :
{{cassetto
|titolo=Before
|testo=
<source lang=javascript line>
// Add options in the "Tag" form
function lrcRunInsertTemplate(data){
var TagSelect = document.getElementById('LiveTagReason');
 
 
jQuery.each(lstMyTemplate, function(i, val) {
var optTag = document.createElement('option');
optTag.value = i;
optTag.className = "InserisciTemplateExtension";
optTag.innerHTML = val.string;
TagSelect.appendChild(optTag);
});
// setup dialog
mw.loader.using(['jquery.ui.dialog'], function () {
$('<div>')
.attr('id', 'gtb-dialog')
.appendTo('body');
});
}
LiveRC_AddHook("AfterPreviewArticle", lrcRunInsertTemplate);
// Function launched when choosing one of this extension options
getLiveTagFunctions["InserisciTemplateExtension"] = function(page, option){
lrcDisableLink("LiveTagReason");
lrcDisableLink("LiveTagLink");
 
 
var message = lstMyTemplate[option.value];
wpajax.http({ url: wgServer + wgScriptPath + '/api.php?format=xml'
+ '&action=query&prop=info&intoken=edit'
+ '&inprop=protection'
+ '&titles=' + encodeURIComponent(page),
onSuccess: InserisciTemplate_PostTagPage,
page: page,
message: message});
return false;
}
</source>
}}
{{cassetto
|titolo=After
|testo=
<source lang=javascript line>
// Add options in the "Tag" form
function lrcRunInsertTemplate(data){
var TagSelect = document.getElementById('LiveTagReason');
var TemplateList = Custom_lstMyTemplate;
if(!lrcGetObjectLength(TemplateList)) TemplateList = lstMyTemplate;
jQuery.each(TemplateList, function(i, val) {
var optTag = document.createElement('option');
optTag.value = i;
optTag.className = "InserisciTemplateExtension";
optTag.innerHTML = val.string;
TagSelect.appendChild(optTag);
});
// setup dialog
mw.loader.using(['jquery.ui.dialog'], function () {
$('<div>')
.attr('id', 'gtb-dialog')
.appendTo('body');
});
}
LiveRC_AddHook("AfterPreviewArticle", lrcRunInsertTemplate);
// Function launched when choosing one of this extension options
getLiveTagFunctions["InserisciTemplateExtension"] = function(page, option){
lrcDisableLink("LiveTagReason");
lrcDisableLink("LiveTagLink");
var TemplateList = Custom_lstMyTemplate;
if(!lrcGetObjectLength(TemplateList)) TemplateList = lstMyTemplate;
var message = TemplateList[option.value];
wpajax.http({ url: wgServer + wgScriptPath + '/api.php?format=xml'
+ '&action=query&prop=info&intoken=edit'
+ '&inprop=protection'
+ '&titles=' + encodeURIComponent(page),
onSuccess: InserisciTemplate_PostTagPage,
page: page,
message: message});
return false;
}
</source>
}}
:[[Utente:Dr Brains|Dr Brains]] ([[Discussioni utente:Dr Brains|msg]]) 01:41, 10 ago 2014 (CEST)
:PS: Note that there are new italian translations needed [[:fr:Discussion_MediaWiki:Gadget-LiveRC.js/i18n/it.js|here]].
Ritorna alla pagina "Gadget-LiveRC 1x.js/InserisciTemplate.js".