מדיה ויקי:Gadget-TemplateParamWizard.js: הבדלים בין גרסאות בדף
כמקובל |
←using [[mw:CodeEditor|CodeEditor]]: פרמטרים מספריים לא צריכים לעקוף את השאר. |
||
| שורה 12: | שורה 12: | ||
//// date: use JS date widget | //// date: use JS date widget | ||
//// choices: array of legal values for the field | //// choices: array of legal values for the field | ||
var | |||
// templateParams is keyed by paramName. | // templateParams is keyed by paramName. | ||
templateParams, | |||
paramsOrder, | |||
// which template are we working on | // which template are we working on | ||
template, | template, | ||
| שורה 52: | שורה 55: | ||
if (name && paramPair.length) { | if (name && paramPair.length) { | ||
templateParams[name] = templateParams[name] || {options: {notInParamPage: 1}}; | templateParams[name] = templateParams[name] || {options: {notInParamPage: 1}}; | ||
if ($.inArray(name, paramsOrder) == -1) | |||
paramsOrder.push(name); | |||
$.extend(templateParams[name].options, {'defval': paramPair.join('=')}); | $.extend(templateParams[name].options, {'defval': paramPair.join('=')}); | ||
} | } | ||
| שורה 61: | שורה 66: | ||
paramExtractor = /{{3,}(.*?)[\|}]/mg, | paramExtractor = /{{3,}(.*?)[\|}]/mg, | ||
m; | m; | ||
while (m = paramExtractor.exec(data)) | while (m = paramExtractor.exec(data)) { | ||
templateParams[m[1]] = {desc: '', options: {multiline: 5}}; | templateParams[m[1]] = {desc: '', options: {multiline: 5}}; | ||
paramsOrder.push(m[1]); | |||
} | |||
} | } | ||
| שורה 110: | שורה 117: | ||
templateParams[name] = pAttribs; | templateParams[name] = pAttribs; | ||
paramsOrder.push(name); | |||
} | } | ||
} | } | ||
| שורה 409: | שורה 418: | ||
.css({backgroundColor: "lightGreen", maxWidth: '40em', maxHeight: '8em', overflow: 'auto'})); | .css({backgroundColor: "lightGreen", maxWidth: '40em', maxHeight: '8em', overflow: 'auto'})); | ||
while (paramsOrder.length) | |||
addRow( | addRow(paramsOrder.shift(), table); | ||
var buttons = {}; // we need to do it this way, because with literal object, the keys must be literal. | var buttons = {}; // we need to do it this way, because with literal object, the keys must be literal. | ||
| שורה 427: | שורה 436: | ||
template = null; | template = null; | ||
templateParams = {}; | templateParams = {}; | ||
paramsOrder = []; | |||
dialogFields = []; | dialogFields = []; | ||
rowsBypName = {}; | rowsBypName = {}; | ||