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

וגם אם סודר ריק לפני סודר לא ריק יש להוסיף 1=
מ 148 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-TemplateParamWizard.js יובאו
 
(15 גרסאות ביניים של 3 משתמשים אינן מוצגות)
שורה 109: שורה 109:
paramOrder = data.paramOrder;
paramOrder = data.paramOrder;


function optionsOfParam(param) {
var options = {};
if (param.required) options.required = true;
if (param.suggestedvalues && param.suggestedvalues.length) options.choices = param.suggestedvalues.join(',');
return options;
}


function onemore(name) {
function onemore(name) {
var param = params[name];
var param = params[name];
if (param.deprecated)
return; // ignore deprecated parameters - pretend they are not in TD.
templateParams[name] = {  
templateParams[name] = {  
desc: param.description || '',  
desc: param.description || '',  
options: { required: param.required },  
options: optionsOfParam(param),  
label: param.label || name,  
label: param.label || name,  
param: param  
param: param  
שורה 235: שורה 243:
/=/.test(val) // order-based value containing "="
/=/.test(val) // order-based value containing "="
|| valuedOrdered && !val; // empty ordered w lower index than a non-empty one.
|| valuedOrdered && !val; // empty ordered w lower index than a non-empty one.
valuedOrdered |= val;
if (val) valuedOrdered = true;
}
}
 
 
שורה 390: שורה 398:
}
}
break;
break;
case 'ru':
switch (key) {
case 'explain': return 'поля с красной рамкой обязательны, остальные - по желанию';
case 'wizard dialog title': return 'Настройте параметры для шаблона: ' + template;
case 'ok': return 'OK';
case 'cancel': return 'Отмена';
case 'params subpage': return 'Параметры';
case 'preview': return 'Просмотр';
case 'options select': return 'Выбрать:';
case 'multiline': return 'Многострочный вид';
case 'close': return 'Закрыть';
case 'required': return 'Необходимое';
case 'depends': return 'Зависит от';
case 'defval': return 'По умолчанию';
case 'choices': return 'Выбор';
case 'date': return 'Дата';
case 'extended': return 'Расширенный';
case 'button hint': return 'Мастер параметров шаблона';
case 'able templates category name': throw('Необходимо определить название категории для шаблонов с поддержкой мастера');
case 'template selector title': return 'Пожалуйста, введите имя шаблона';
case 'notInParamPage': return 'поле "' + param + '" не отображается в списке параметров шаблона';
case 'editParamPage': return 'Править страницу параметров';
case 'unknown error': return 'Произошла ошибка: \n' + param;
case 'please select template': return 'Пожалуйста, введите имя шаблона';
case 'oneliner': return 'Однострочный вид';
case 'dateFormat': return 'ММ дд, гг';
case 'extended labels': return 'Показать все параметры';
}
default:
default:
switch (key) {
switch (key) {
שורה 443: שורה 479:
}
}
function templatePage() {return mw.config.get('wgFormattedNamespaces')[10] + ':' + $.trim(template);}
function templatePage() {
var t = $.trim(template)
return t.match(':') ? t : mw.config.get('wgFormattedNamespaces')[10] + ':' + t;
}


function updateRawPreview(){
function updateRawPreview(){
שורה 480: שורה 519:
if (param.param.required && ! hasVal) return markError('pve-required-empty');
if (param.param.required && ! hasVal) return markError('pve-required-empty');
if (param.param.deprecated && hasVal) return markError('pve-deprecated');
if (param.param.deprecated && hasVal) return markError('pve-deprecated');
if (param.param.type === 'number' && isNaN( Number( input.val() ) ) ) return markError('pve-incompatible');
if (param.param.type === 'number' && isNaN( Number( input.val().replace(/,/g, '') ) ) ) return markError('pve-incompatible');
return true;
return true;
}
}
שורה 509: שורה 548:
var choices = options.choices.split(/\s*,\s*/);
var choices = options.choices.split(/\s*,\s*/);
if (choices.length > 1) {
if (choices.length > 1) {
f = $('<select>').append($('<option>', {text: i18n('options select'), value: ''}));
f = $('<select>').append($('<option>', {text: i18n('options select'), value: '' }));
for (var i in choices)
for (var i in choices) {
f.append($('<option>', {text: choices[i], value: choices[i]}));
var choice = choices[i].trim(); // first and last may carry spaces
var option = $('<option>', {text: choice, value: choice});
f.append(option);
}
}
}
else {
else {
checkbox = true;
checkbox = true;
f = $('<input>', {type: 'checkbox', value: choices[0], text: choices[0]})
var choice = choices[0].trim();
f = $('<input>', {type: 'checkbox', value: choices[0], text: choices[0].trim()})
.css({float: rtl ? 'right' : 'left'});
.css({float: rtl ? 'right' : 'left'});
f.prop('checked', options.defval && options.defval == choices[0]);
f.prop('checked', options.defval && options.defval.trim() == choices[0]);
}
}
}
}
שורה 536: שורה 579:
.on('paste cut drop input change', updateRawPreview);
.on('paste cut drop input change', updateRawPreview);


if (options.defval)
if (options.defval && ! checkbox)
f.val(options.defval);
f.val(options.defval.trim());


if (options.required)
if (options.required)
שורה 567: שורה 610:
function tipsyContent() {
function tipsyContent() {
var
var
paramName = $(this).text(),
paramName = $(this).data('paramname'),
def = templateParams[paramName],
def = templateParams[paramName],
desc = def && def.desc || '';
desc = def && def.desc || '';
שורה 605: שורה 648:
$('<td>', {width: 120})
$('<td>', {width: 120})
.css({fontWeight: 'bold', color: nameColor})
.css({fontWeight: 'bold', color: nameColor})
.data({ paramname: paramName })
.text(templateParams[paramName].label || paramName)
.text(templateParams[paramName].label || paramName)
.tipsy({html: true, trigger: 'manual', title: tipsyContent})
.tipsy({html: true, trigger: 'manual', title: tipsyContent})
שורה 640: שורה 684:


function buildDialog(data) {
function buildDialog(data) {
var title = $('<span>').html(i18n('wizard dialog title', template));
$('.tpw_disposable').remove();
$('.tpw_disposable').remove();
if (rawTemplate)
if (rawTemplate)
buildParamsRaw(data);
buildParamsRaw(data);
else if (tdTemplate)  
else if (tdTemplate) {
buildParamsTd(data);
buildParamsTd(data);
if (data.description) title.find('a').attr({ title: data.description });
}
paramsFromSelection();
paramsFromSelection();
שורה 650: שורה 698:
var dialog = $('<div>', {'class': 'tpw_disposable'})
var dialog = $('<div>', {'class': 'tpw_disposable'})
.dialog({height: 'auto',
.dialog({height: 'auto',
title: i18n('wizard dialog title', template),
title: title.html(),
width: 'auto',
width: 'auto',
overflow: 'auto',
overflow: 'auto',