אונטערשייד צווישן ווערסיעס פון "מעדיעוויקי:Common.js/externalsmaker.js"

קיין רעדאגירונג באמערקונג
אין תקציר עריכה
צייכן: צוריקגעשטעלט
אין תקציר עריכה
צייכן: צוריקגעשטעלט
שורה 40: שורה 40:


// הסרת ריפוד של אפס מתאריך
// הסרת ריפוד של אפס מתאריך
if (day.charAt(0) == '0')
if (day.charAt(0) == '0' && !forceEnglish)
day = day.substring(1, day.length);
day = day.substring(1, day.length);
שורה 629: שורה 629:
{ str: '' },
{ str: '' },
{ telem: "#fullRecordView th:contains(בתוך):first + td", match: /\((.*?)\)/, func: function (yh) { return yh.substring(0, yh.length - 1) + '"' + yh.substr(yh.length - 1); } },
{ telem: "#fullRecordView th:contains(בתוך):first + td", match: /\((.*?)\)/, func: function (yh) { return yh.substring(0, yh.length - 1) + '"' + yh.substr(yh.length - 1); } },
{ telem: "#fullRecordView th:contains(בתוך):first + td", match: /(\d+\-\d+)/ },
{ telem: "#fullRecordView th:contains(מס' מערכת):first + td", prefix: "רמבי=" }
{ telem: "#fullRecordView th:contains(מס' מערכת):first + td", prefix: "רמבי=" }
]
]
שורה 1,605: שורה 1,604:
var curParam = data[i].params[j][k],
var curParam = data[i].params[j][k],
removed = false; params[j] = '';
removed = false; params[j] = '';
// --- התחלה של הוספת הקוד המתוקן לבדיקת עברית לפני העיבוד ---
// בדיקה מקדימה אם יש עברית באחד מהפרמטרים הראשונים (שם האתר והמחבר)
let foundHebrewBefore = false;
if (j <= 1) { // בודק רק את 2 הפרמטרים הראשונים, שהם לרוב שם האתר ושם המחבר
if (typeof curParam.str != "undefined" && hasHebrew(curParam.str)) {
foundHebrewBefore = true;
} else if (typeof curParam.ldjson != "undefined" && curParam.ldjson.key === 'author') {
const author = $.map($(ldjson.author), function(a) { return a.name; }).join(VE);
if (hasHebrew(author)) {
foundHebrewBefore = true;
}
} else if (typeof curParam.telem != "undefined" && hasHebrew(jQuery('html').find(curParam.telem).first().text().trim())) {
foundHebrewBefore = true;
}
}
// --- סוף של הוספת הקוד המתוקן לבדיקת עברית לפני העיבוד ---


if (typeof curParam.str != "undefined") {
if (typeof curParam.str != "undefined") {
שורה 1,730: שורה 1,746:
}
}
}
}
// שינוי כאן: בדיקה אם forceEnglish צריכה להיות true
var shouldForceEnglish = !hasHebrew(params.join(' ')); // בודק האם יש עברית בכל הפרמטרים שנאספו עד כה
if (typeof curParam.date != "undefined") {
if (typeof curParam.date != "undefined") {
if (!(curParam.date instanceof Array))
if (!(curParam.date instanceof Array))
שורה 1,738: שורה 1,757:
params[j] = params[j].split(curParam.date[0]);
params[j] = params[j].split(curParam.date[0]);
params[j] = [params[j][curParam.date[1][0]], params[j][curParam.date[1][1]], params[j][curParam.date[1][2]]];
params[j] = [params[j][curParam.date[1][0]], params[j][curParam.date[1][1]], params[j][curParam.date[1][2]]];
params[j] = dateFormat(params[j], false);  
params[j] = dateFormat(params[j], shouldForceEnglish); // העברת הפרמטר החדש
}
}
}
}
שורה 1,747: שורה 1,766:
mm = (today.getMonth() + 1).toString(),
mm = (today.getMonth() + 1).toString(),
yy = today.getFullYear().toString().slice(-2);
yy = today.getFullYear().toString().slice(-2);
params[j] = dateFormat([dd, mm, yy], false);  
params[j] = dateFormat([dd, mm, yy], shouldForceEnglish); // העברת הפרמטר החדש
}
}
}
}
שורה 1,821: שורה 1,840:
while (params.indexOf('removeifempty') > -1)
while (params.indexOf('removeifempty') > -1)
params.splice(params.indexOf('removeifempty'), 1);
params.splice(params.indexOf('removeifempty'), 1);
// --- התחלה של הוספת הקוד המתוקן לבדיקת עברית ---
let foundHebrew = false;
let dateParamIndex = -1;
for (let h = 0; h < params.length; h++) {
if (hasHebrew(params[h])) {
foundHebrew = true;
}
// זיהוי הפרמטר של התאריך לפי זיהוי חודש עברי
const hebrewMonths = ["יאנואר", "פעברואר", "מערץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "סעפטעמבער", "אקטאבער", "נאוועמבער", "דעצעמבער"];
if (typeof params[h] === 'string' && hebrewMonths.some(month => params[h].includes(month))) {
dateParamIndex = h;
}
}
// אם לא נמצאה עברית בכל הפרמטרים, נשנה את פורמט התאריך לאנגלי
if (!foundHebrew && dateParamIndex !== -1) {
const hebrewDate = params[dateParamIndex];
try {
const hebrewMonthsMap = {
"יאנואר": 1, "פעברואר": 2, "מערץ": 3, "אפריל": 4, "מאי": 5, "יוני": 6, "יולי": 7, "אוגוסט": 8, "סעפטעמבער": 9, "אקטאבער": 10, "נאוועמבער": 11, "דעצעמבער": 12
};
// פירוק התאריך העברי
const parts = hebrewDate.split(' ');
const day = parts[1].replace(',', '');
const month = hebrewMonthsMap[parts[0]];
const year = parts[2];
if (day && month && year) {
params[dateParamIndex] = dateFormat([day, month, year], true); // המרה לאנגלית
}
} catch (e) {
console.error("Failed to convert Hebrew date to English:", e);
}
}
// --- סוף של הוספת הקוד המתוקן לבדיקת עברית ---


if (window.popup_template_canceled && !force_popup) {
if (window.popup_template_canceled && !force_popup) {