מדיה ויקי:Gadget-TemplateParamWizard.js: הבדלים בין גרסאות בדף

גזר
שורה 4: שורה 4:
mw.loader.using(['jquery.ui.widget','jquery.tipsy','jquery.textSelection', 'jquery.ui.dialog'], function() {
mw.loader.using(['jquery.ui.widget','jquery.tipsy','jquery.textSelection', 'jquery.ui.dialog'], function() {
$(function() {
$(function() {
    // template parameter is an object with the following fields:
// template parameter is an object with the following fields:
// desc: desciption string
// desc: desciption string
// defval: default value (optional)
// defval: default value (optional)
שורה 111: שורה 111:
function showPreview() {
function showPreview() {
var temp = createWikiCode();
var temp = createWikiCode();
$.post(mw.util.wikiScript('api'), {action: 'parse', title: mw.config.get('wgPageName'), prop: 'text', text: temp, format: 'json'}, function(data) {
$.post(mw.util.wikiScript('api'),  
if (data && data.parse && data.parse.text) {
{action: 'parse',  
var buttons = [{text: i18n('close'), click: function() {$(this).dialog('close');}}],
title: mw.config.get('wgPageName'),  
div = $('<div>').html(data.parse.text['*']);
prop: 'text',  
$('a', div).attr('target', '_blank'); // we don't want people to click on links in preview - they'll lose their work.
text: temp,  
$('<div>')
format: 'json'
.dialog(
},  
{title: i18n('preview'),
function(data) {
modal: true,
if (data && data.parse && data.parse.text) {
position: [60, 60],
var buttons = [{text: i18n('close'), click: function() {$(this).dialog('close');}}],
buttons: buttons})
div = $('<div>').html(data.parse.text['*']);
.append(div);
$('a', div).attr('target', '_blank'); // we don't want people to click on links in preview - they'll lose their work.
circumventRtlBug();
$('<div>')
}
.dialog(
});
{title: i18n('preview'),
modal: true,
position: [60, 60],
buttons: buttons})
.append(div);
circumventRtlBug();
}
});
}
}


שורה 153: שורה 160:
case 'able templates category name': return 'תבניות הנתמכות על ידי אשף התבניות';
case 'able templates category name': return 'תבניות הנתמכות על ידי אשף התבניות';
case 'template selector title': return 'אנא בחרו תבנית מהרשימה:';
case 'template selector title': return 'אנא בחרו תבנית מהרשימה:';
case 'notInParamPage': return 'השדה ' + param + ' לא מופיע ברשימת הפרמטרים של התבנית';
case 'notInParamPage': return 'השדה "' + param + '" לא מופיע ברשימת הפרמטרים של התבנית';
case 'editParamPage': return 'לעריכת דף הפרמטרים';


}
}
שורה 174: שורה 182:
case 'able templates category name': throw('Must define category name for wizard-capable templates');
case 'able templates category name': throw('Must define category name for wizard-capable templates');
case 'template selector title': return 'Please select a template from this list';
case 'template selector title': return 'Please select a template from this list';
case 'notInParamPage': return 'field ' + param + ' does not appear in the template\'s parameters list';
case 'notInParamPage': return 'field "' + param + '" does not appear in the template\'s parameters list';
case 'editParamPage': return 'Edit paramters page';


}
}
שורה 273: שורה 282:
return def.htmlDesc;
return def.htmlDesc;
if (def.options.notInParamPage)
if (def.options.notInParamPage)
return i18n('notInParamPage', paramName);
return $('<div>')
.append(i18n('notInParamPage', paramName) + '<br />')
.append($('<a>', {href: mw.util.wikiGetlink(paramPage()) + '?action=edit', target: '_blank', text: i18n('editParamPage')}))
.html();
if (/[\[\]\{\}\<\>]/.test(desc)) // does it need parsing?
if (/[\[\]\{\}\<\>]/.test(desc)) // does it need parsing?
$.ajax({
$.ajax({