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

מ לבקשת קיפוד
שורה 5: שורה 5:
var par = ["{{" + this.templateName];
var par = ["{{" + this.templateName];
for (var i in this.orderedFields)
for (var i in this.orderedFields)
par.push((this.problematic? (parseInt(i)+1) + "=":"") + this.orderedFields[i].value);
par.push((this.problematic? (parseInt(i)+1) + "=":"") + $.trim(this.orderedFields[i].value));
if (this.defParam)
for (var parnum in this.defParam)
if (par[parnum] == this.defParam[parnum])
par[parnum] = '';
while (par.length && !par[par.length - 1].length) // remove tailing empty ordered params.
par.pop();
var code = par.join("|");
var code = par.join("|");
if (this.namedFields) {
if (this.namedFields) {
שורה 175: שורה 181:
};
};
return allNamedParam[templateName] || [];
return allNamedParam[templateName] || [];
}
function ltw_defaultParameters(templateName) { // if parameter has the default value, we omit it
var defs = {
"דבר": {7: "Ar"},
"מעריב": {7: "Ar"},
"הצבי": {7: "Ar"},
"הצפירה": {7: "Ar"},
"המגיד": {7: "Ar"},
"המליץ": {7: "Ar"},
"חבצלת": {7: "Ar"},
"PalPost": {7: "Ar"},
"עיתונות יהודית היסטורית 2": {9: "Ar"},
"ynet": {7: 'articles'},
"פנאי פלוס": {7: 'articles'}
}
return defs[templateName] || {};
}
}


שורה 271: שורה 294:
var top = (screen.height - height) / 2, left = (screen.width - 550) / 2;
var top = (screen.height - height) / 2, left = (screen.width - 550) / 2;
var popup = window.open("", "", "resizable=1,height="+height+",width=550,left="+left+",top="+top);
var popup = window.open("", "", "resizable=1,height="+height+",width=550,left="+left+",top="+top);
var doc = popup.document;
var doc = ltw_copyAttributes(popup.document, {
doc.problematic = regexDict && regexDict.problematic;
title: " הוספת תבנית: " + templateName,  
ltw_copyAttributes(doc, {title: " הוספת תבנית: " + templateName, dir: "rtl", templateName: templateName, orderedFields:[], getTemplate:ltw_createTemplate, updatePreview:function(){this.previewNode.data = this.getTemplate();}});
dir: "rtl",  
templateName: templateName,  
orderedFields: [],  
getTemplate: ltw_createTemplate,  
updatePreview: function(){this.previewNode.data = this.getTemplate();},
problematic: regexDict && regexDict.problematic,
defParam: ltw_defaultParameters(templateName)
});
var body = doc.body;
var body = doc.body;
if (regexDict) {
if (regexDict) {