מדיה ויקי:Gadget-TemplateParamWizard.js: הבדלים בין גרסאות בדף
←using [[mw:CodeEditor|CodeEditor]]: תבנית בשורה. |
תאריך |
||
| שורה 10: | שורה 10: | ||
//// depends: another field's name | //// depends: another field's name | ||
//// required: boolean | //// required: boolean | ||
//// date: use JS date widget | |||
//// choices: array of legal values for the field | //// choices: array of legal values for the field | ||
// templateParams is keyed by paramName. | // templateParams is keyed by paramName. | ||
| שורה 114: | שורה 115: | ||
function analyzeOptions(str) { | function analyzeOptions(str) { | ||
var res = {}, | var res = {}, | ||
avail = ['multiline', 'required', 'depends', 'defval', 'choices'], // maybe we'll have more in the future | avail = ['multiline', 'required', 'depends', 'defval', 'choices', 'date'], // maybe we'll have more in the future | ||
tavail = $.map(avail, i18n), | tavail = $.map(avail, i18n), | ||
options = str.split(/\s*;\s*/); | options = str.split(/\s*;\s*/); | ||
| שורה 194: | שורה 195: | ||
case 'defval': return 'ברירת מחדל'; | case 'defval': return 'ברירת מחדל'; | ||
case 'choices': return 'אפשרויות'; | case 'choices': return 'אפשרויות'; | ||
case 'date': return 'תאריך'; | |||
case 'button hint': return 'אשף מילוי תבניות'; | case 'button hint': return 'אשף מילוי תבניות'; | ||
case 'able templates category name': return 'תבניות הנתמכות על ידי אשף התבניות'; | case 'able templates category name': return 'תבניות הנתמכות על ידי אשף התבניות'; | ||
| שורה 218: | שורה 220: | ||
case 'defval': return 'Default'; | case 'defval': return 'Default'; | ||
case 'choices': return 'Choices'; | case 'choices': return 'Choices'; | ||
case 'date': return 'Date'; | |||
case 'button hint': return 'Template parameters wizard'; | case 'button hint': return 'Template parameters wizard'; | ||
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'); | ||
| שורה 296: | שורה 299: | ||
if (options.required) | if (options.required) | ||
f.addClass('tpw_required').css({border: '1px red solid'}); | f.addClass('tpw_required').css({border: '1px red solid'}); | ||
if (options.date) | |||
f.datepicker(); | |||
return f; | return f; | ||
} | } | ||
| שורה 471: | שורה 477: | ||
data: {title: paramPage(), action: 'raw', ctype: 'text/x-wiki'}, | data: {title: paramPage(), action: 'raw', ctype: 'text/x-wiki'}, | ||
success: buildDialog, | success: buildDialog, | ||
cache: false, | |||
error: function() { | error: function() { | ||
rawTemplate = true; | rawTemplate = true; | ||
| שורה 484: | שורה 491: | ||
function doIt() { | function doIt() { | ||
mw.loader.using(['jquery.ui.widget','jquery.tipsy','jquery.textSelection', 'jquery.ui.autocomplete', 'jquery.ui.dialog'], function() { | mw.loader.using(['jquery.ui.widget','jquery.tipsy','jquery.textSelection', 'jquery.ui.autocomplete', 'jquery.ui.dialog', 'jquery.ui.datepicker'], function() { | ||
init(); | init(); | ||
var match = $("#wpTextbox1").textSelection('getSelection').match(/^\{\{([^|}]*)/); | var match = $("#wpTextbox1").textSelection('getSelection').match(/^\{\{([^|}]*)/); | ||