מדיה ויקי:Gadget-TemplateParamWizard.js: הבדלים בין גרסאות בדף
updated based on translate from brother Zachariah |
מ label support, language support |
||
| שורה 96: | שורה 96: | ||
while (m = paramExtractor.exec(data)) { | while (m = paramExtractor.exec(data)) { | ||
var paramName = $.trim(m[1]); | var paramName = $.trim(m[1]); | ||
templateParams[paramName] = {desc: '', options: {multiline: 5}}; | templateParams[paramName] = {desc: '', options: {multiline: 5}, label: paramName}; | ||
addParam(paramName); | addParam(paramName); | ||
} | } | ||
| שורה 107: | שורה 107: | ||
function onemore(name) { | function onemore(name) { | ||
var param = params[name]; | var param = params[name]; | ||
templateParams[name] = { desc: param.description | templateParams[name] = { desc: param.description || '', options: { required: param.required }, label: param.label || name }; | ||
addParam(name); | addParam(name); | ||
} | } | ||
| שורה 452: | שורה 452: | ||
def = templateParams[paramName], | def = templateParams[paramName], | ||
desc = def.desc || ''; | desc = def.desc || ''; | ||
if (!def) return ''; // early terminate if param name is not valid | |||
if (def.htmlDesc) | if (def.htmlDesc) | ||
return def.htmlDesc; | return def.htmlDesc; | ||
| שורה 485: | שורה 486: | ||
$('<td>', {width: 120}) | $('<td>', {width: 120}) | ||
.css({fontWeight: 'bold', color: nameColor}) | .css({fontWeight: 'bold', color: nameColor}) | ||
.text(paramName) | .text(templateParams[paramName].label) | ||
.tipsy({html: true, trigger: 'manual', title: tipsyContent}) | .tipsy({html: true, trigger: 'manual', title: tipsyContent}) | ||
.mouseenter(function() { | .mouseenter(function() { | ||
| שורה 643: | שורה 644: | ||
$.ajax({ | $.ajax({ | ||
url: mw.util.wikiScript('api'), | url: mw.util.wikiScript('api'), | ||
data: {action: 'templatedata', titles: templatePage(), redirects: true, format: 'json'}, | data: {action: 'templatedata', titles: templatePage(), redirects: true, format: 'json', lang: mw.config.get('wgUserLanguage') }, | ||
dataType: 'json', | dataType: 'json', | ||
success: function(data) { | success: function(data) { | ||