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

קפיצה לניווט קפיצה לחיפוש
אפדעיט
(אפדעיט)
(אפדעיט)
 
(10 צווישנדיגע ווערסיעס פונעם זעלבן באַניצער נישט געוויזן)
שורה 2: שורה 2:
function wikiit(event, force_popup) {
function wikiit(event, force_popup) {
window.$ = window.jQuery;
window.$ = window.jQuery;
    function hasHebrew(text) {
 
    if (typeof text !== 'string') {
        return false;
    }
    return /[\u0590-\u05FF]/.test(text);
    }
function dateFormat(dateArr, english = false) {
function dateFormat(dateArr, english = false) {
const months = english
const months = english
שורה 24: שורה 19:
year = (Number(year) <= 50 ? '20' : '19') + year;
year = (Number(year) <= 50 ? '20' : '19') + year;
}
}
return english ? `${month} ${day}, ${year}` : `${day} ב${month} ${year}`;
return `${month} ${day}, ${year}`;
}
}


שורה 50: שורה 45:
.replace(/=/g, "{{=}}")
.replace(/=/g, "{{=}}")
.replace(/''/g, '"')
.replace(/''/g, '"')
.replace(/((?<!עיתונות)\|\|?)/gm, function (x) { return "{" + "{" + x.replace(/\|/g, "!") + "}}"; }) .replace(/[\u200B\u200E\u200F\u2028\u202A\u202B\u202C\u202D\u202E]/g, '') // remove invisible Unicode control characters
.replace(/((?<!עיתונות)\|\|?)/gm, function (x) { return "{" + "{" + x.replace(/\|/g, "!") + "}}"; })
.replace(/[\u200B\u200E\u200F\u2028\u202A\u202B\u202C\u202D\u202E]/g, '') // remove invisible Unicode control characters
.replace(/ {2,}/g, ' ')
.replace(/ {2,}/g, ' ')
.replace('#google_vignette', '');
.replace('#google_vignette', '');
שורה 141: שורה 137:
{ url: 1, match: /co\.il\/((?:ency|home|headlines)\/.*?html?)/ },
{ url: 1, match: /co\.il\/((?:ency|home|headlines)\/.*?html?)/ },
{ url: 1, match: /L-(.*?),/ },
{ url: 1, match: /L-(.*?),/ },
{ url: 1, match: /co\.il\/(.*)/ } ],
{ url: 1, match: /co\.il\/(.*)/ }
],
[
[
{ url: 1, match: /co\.il\/((?:ency)\/.*?html?)/, prefix: "תאריך=", func: function(s) { return s ? 'ללא' : ''; }},
{ url: 1, match: /co\.il\/((?:ency)\/.*?html?)/, prefix: "תאריך=", func: function(s) { return s ? 'ללא' : ''; }},
שורה 475: שורה 472:
{ telem: "h1:first" },
{ telem: "h1:first" },
{ url:1, match: /makorrishon\.co\.il\/(.*?)\/?$/ },
{ url:1, match: /makorrishon\.co\.il\/(.*?)\/?$/ },
{ ldjson: { key:'datePublished'}, date:['-',[2,1,0]] }
]
]
},
},
שורה 608: שורה 606:
},
},
{
{
hostname: "www.news1.co.il",
hostname: "news1.co.il",
params: [
params: [
{ str: 'NFC' },
{ str: 'NFC' },
שורה 841: שורה 839:
},
},
{
{
hostname: 'www.nli.org.il', hrefmatch: /newspapers\/bamahane/, // it's own thing and not part of the larger nli
hostname: 'www.nli.org.il', hrefmatch: /newspapers\/bamahane\//, // it's own thing and not part of the larger nli
params: [
params: [
{ str: 'במחנה' },
{ str: 'במחנה' },
שורה 847: שורה 845:
{ str: '', func: function (str) { return window.prompt("כותרת הדף", str); } }, // $('.pageblockselected').attr('title')
{ str: '', func: function (str) { return window.prompt("כותרת הדף", str); } }, // $('.pageblockselected').attr('title')
{ url: 1, match: /newspapers\/bamahane\/(\d{4}\/\d{2}\/\d{2})\// },
{ url: 1, match: /newspapers\/bamahane\/(\d{4}\/\d{2}\/\d{2})\// },
{ url: 1, match: /page\/(\d+)/ }
]
},
{
hostname: 'www.nli.org.il', hrefmatch: /newspapers\/bamahanenahal\//, // it's own thing and not part of the larger nli
params: [
{ str: 'במחנה נחל' },
{ str: '', func: function (str) { return window.prompt("שם מחבר", str!='N/A'?str:''); } },
{ str: '', func: function (str) { return window.prompt("כותרת הדף", str); } }, // $('.pageblockselected').attr('title')
{ url: 1, match: /newspapers\/bamahanenahal\/(\d{4}\/\d{2}\/\d{2})\// },
{ url: 1, match: /page\/(\d+)/ }
{ url: 1, match: /page\/(\d+)/ }
]
]
שורה 877: שורה 885:
'bustenai': 'עיתונות|bustenai',
'bustenai': 'עיתונות|bustenai',
'dav': 'דבר',
'dav': 'דבר',
'dertog': 'דער טאג (ניו יורק)',
'dhy': 'דואר היום',
'dhy': 'דואר היום',
'diedeborah' :'עיתונות|diedeborah',
'diedeborah' :'עיתונות|diedeborah',
שורה 900: שורה 909:
'hayal': 'לחייל',
'hayal': 'לחייל',
'hayomisr': 'עיתונות|hayomisr',
'hayomisr': 'עיתונות|hayomisr',
'hayomw': 'היום וורשה',
'hayomw': 'היום (ורשה)',
'hazit': 'החזית',
'hazit': 'החזית',
'hbkr': 'הבקר',
'hbkr': 'הבקר',
שורה 987: שורה 996:
{ url: 1, match: /\/(\d+)\/$/ }
{ url: 1, match: /\/(\d+)\/$/ }
],
],
{ telem: "span.date", match: /(\d+ ב[א-ת]+ \d+)/ }
{ attr: ['meta[property="article:published_time"]', 'content'], date: ['-', '210'] }
]
]
},
},
שורה 1,166: שורה 1,175:
{ str: 'סרוגים' },
{ str: 'סרוגים' },
[
[
{ ldjson: { key: 'author' } },
{ telem: '.post_author', match: /(.+?)\d/ },
{ telem: '.post_author', match: /(.+?)\d/ },
{ attr: ["meta[name='author']", "content"] }
{ attr: ["meta[name='author']", "content"] }
שורה 1,172: שורה 1,182:
{ url: 1, match: /\.srugim\.co\.il\/(.*)$/ },
{ url: 1, match: /\.srugim\.co\.il\/(.*)$/ },
[
[
{ ldjson: { key: 'datePublished' } },
{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] },
{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] },
{ telem: '.post_details', date: '.' }
{ telem: '.post_details', date: '.' }
שורה 1,353: שורה 1,364:
],
],
[
[
{ prefix:'קובץ=', attr: ["link[rel='themeData']", "href"], match: /(.*)\.files/ },
{ prefix:'קובץ=', attr: ["link[rel='themeData']", "href"], match: /^([^.]+)\.files/ },
{ prefix:'קובץ=', url: 1, func: function(s) { return s.indexOf('NetVerdicts') > -1 ? getParameterByName('fileName') : ''; }, removeifempty: true }
{ prefix:'קובץ=', url: 1, func: s => s.includes('NetVerdicts') && (f = getParameterByName('fileName')) && !f.includes('.') ? f : '', fullhref: true, removeifempty: true }
],
],
{ prefix:'סוג=', var: 'all_text', match: /\(?([^\s]+)[\s]+\d+\/\d+/m},
{ prefix:'סוג=', var: 'all_text', match: /\(?([^\s]+)[\s]+\d+\/\d+/m},
שורה 1,436: שורה 1,447:
{ url: 1, match: /il\/(.+?)\// },
{ url: 1, match: /il\/(.+?)\// },
{ telem: 'div.date > span' }
{ telem: 'div.date > span' }
]
},
{
hostname: "yuvalerel.com",
params: [
{ str: 'יובל אראל'},
{ telem: 'a.author-name' },
{ telem: 'h1.post-title ' },
{ url: 1, match: /com\/(.*)/ }
]
]
},
},
שורה 1,468: שורה 1,470:
],
],
removeparam: {
removeparam: {
'1': [ 'כתב אורח', /מאת:? / ]
'1': [ 'כתב אורח', /מאת:? /, 'מערכת Geektime' ]
}
}
},
},
שורה 1,620: שורה 1,622:
{ url: 1, match: /co\.il\/(\d+)/, dirty: true },
{ url: 1, match: /co\.il\/(\d+)/, dirty: true },
{ ldjson: { key: 'datePublished' } }
{ ldjson: { key: 'datePublished' } }
]
},
{
hostname: "academia.edu",
params: [
{ str: 'אקדמיה' },
{ ldjson: ["script[data-component-name='TopCard']", "work.authors.0.displayName"] },
{ attr: ["meta[property='og:title']", "content"] },
{ url: 1, match: /academia.edu\/(\d+)/ },
{ ldjson: ["script[data-component-name='TopCard']", "publicationName"] },
{ ldjson: ["script[data-component-name='TopCard']", "publicationYear"] }
]
]
},
},
שורה 1,628: שורה 1,641:
{ telem: "h1.firstHeading" },
{ telem: "h1.firstHeading" },
{ telem: "h1.firstHeading", func: function(data) { var match = data.match(/ - [A-Za-z].*/); return match ? data.replace(match[0], '') : false; } }
{ telem: "h1.firstHeading", func: function(data) { var match = data.match(/ - [A-Za-z].*/); return match ? data.replace(match[0], '') : false; } }
]
},
{
hostname: "academia.edu",
params: [
{ str: 'אקדמיה' },
{ attr: ["meta[name='citation_author']", "content"] },
{ attr: ["meta[property='og:title']", "content"] },
{ url: 1, match: /academia.edu\/(\d+)/ },
{ attr: ["meta[name='citation_journal_title']", "content"] },
{ attr: ["meta[name='citation_publication_date']", "content"] }
]
]
},
},
שורה 1,697: שורה 1,699:
try {
try {
var curParam = data[i].params[j][k],
var curParam = data[i].params[j][k],
removed = false; params[j] = '';
removed = false;
params[j] = '';


if (typeof curParam.str != "undefined") {
if (typeof curParam.str != "undefined") {
שורה 1,869: שורה 1,872:
if (typeof curParam.shouldnt != "undefined" && typeof params[j] == "string" && params[j].match(curParam.shouldnt))
if (typeof curParam.shouldnt != "undefined" && typeof params[j] == "string" && params[j].match(curParam.shouldnt))
params[j] = '';
params[j] = '';
if (typeof curParam.combine != "undefined" && params[j]) {
params[j-1] = params[j-1] + curParam.combine + params[j];
console.log('changed', j-1, params[j-1])
params[j] = 'removeifempty';
}


if (typeof curParam.removeifempty != "undefined" && !params[j])
if (typeof curParam.removeifempty != "undefined" && !params[j])
שורה 1,971: שורה 1,980:
var ldAuthor = authors.join(', ').trim();
var ldAuthor = authors.join(', ').trim();


var שרייבער = $.map($(ldojson.author), function(a) { return a.name; }).join(VE);
var general = {
var קעפל = ldojson.name || ldojson.headline;
'קעפל': ldTitle,
var זייטל = (ldojson.publisher||ldojson_website[0]).name;
'אדרעס': location.href
var hebrewFound = hasHebrew(שרייבער) || hasHebrew(קעפל) || hasHebrew(זייטל);
};
 
var dateFormatter = hebrewFound ? dateFormat : dateFormatEng;
if (ldSite) general['זייטל'] = ldSite;
var formattedDate = '';
if (ldAuthor) general['שרייבער'] = ldAuthor;
if (date != "Invalid Date") {
if (ldDate) general['דאטום'] = ldDate;
    var dateParts = [''+date.getDate(), ''+(date.getMonth()+1), ''+date.getFullYear()];
if (isEnglish) general['שפראך'] = 'ענגליש';
    formattedDate = dateFormatter(dateParts);  
 
}
return general;
}


    'שרייבער': שרייבער,
ldojson = getldjson();
    'קעפל': קעפל,
console.log('ldojson:', ldojson);
    'אדרעס': location.href,
if (ldojson.length >= 1) {
    'זייטל': זייטל,
var general = extractArticleInfo(ldojson);
    'דאטום': formattedDate,
};
console.log('data', general);
console.log('data', general);


נאוויגאציע מעניו