בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,726
רעדאגירונגען
(אפדעיט) |
(אפדעיט) |
||
| (11 צווישנדיגע ווערסיעס פונעם זעלבן באַניצער נישט געוויזן) | |||
| שורה 2: | שורה 2: | ||
function wikiit(event, force_popup) { | function wikiit(event, force_popup) { | ||
window.$ = window.jQuery; | window.$ = window.jQuery; | ||
function dateFormat(dateArr, english = false) { | |||
const months = english | |||
? ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] | |||
: ["יאנואר", "פעברואר", "מערץ", "אפריל", "מאי", "יוני", "יולי", "אויגוסט", "סעפטעמבער", "אקטאבער", "נאוועמבער", "דעצעמבער"]; | |||
if (!Array.isArray(dateArr) || dateArr.length !== 3 || !dateArr[0] || !dateArr[1] || !dateArr[2]) | |||
return ''; | |||
let day = String(Number(dateArr[0])); | |||
let mIndex = Number(dateArr[1]) - 1; | |||
if (mIndex < 0 || mIndex > 11) return ''; | |||
let month = months[mIndex]; | |||
let year = dateArr[2]; | |||
if (year.length === 2) { | |||
year = (Number(year) <= 50 ? '20' : '19') + year; | |||
} | } | ||
return | return `${month} ${day}, ${year}`; | ||
} | } | ||
function hasHebrew(str) { return /[\u0590-\u05FF]/.test(str); } | |||
function | |||
function match(str, expr) { str = str ? str.match(expr) : str; return (str && str.length > 1) ? str[1] : ''; } | function match(str, expr) { str = str ? str.match(expr) : str; return (str && str.length > 1) ? str[1] : ''; } | ||
| שורה 71: | שורה 41: | ||
.replace(/ /g, ' ') | .replace(/ /g, ' ') | ||
.replace(/״/g, '"') | .replace(/״/g, '"') | ||
.replace(/ | .replace(/[׳‘’]/g, "'") | ||
.replace(/(\n|\r)/g, ' ') | .replace(/(\n|\r)/g, ' ') | ||
.replace(/=/g, "{{=}}") | .replace(/=/g, "{{=}}") | ||
.replace(/''/g, '"') | .replace(/''/g, '"') | ||
.replace(/((?<!עיתונות)\|\|?)/gm, function (x) { return "{" + "{" + x.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(/ {2,}/g, ' ') | .replace(/ {2,}/g, ' ') | ||
.replace('#google_vignette', ''); | .replace('#google_vignette', ''); | ||
| שורה 166: | שורה 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 ? 'ללא' : ''; }}, | ||
| שורה 500: | שורה 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]] } | |||
] | ] | ||
}, | }, | ||
| שורה 521: | שורה 494: | ||
], | ], | ||
[ | [ | ||
{ attr: ['meta[property="og:title"]', 'content'], remove:[' | ישראל היום'] }, | { attr: ['meta[property="og:title"]', 'content'], remove:[' | ישראל היום', ' | היום'] }, | ||
{ telem: ".pane-title" } | { telem: ".pane-title" } | ||
], | ], | ||
{ url: 1, match: /israelhayom.co.il\/(.*)$/ }, | { url: 1, match: /israelhayom.co.il\/(.*)$/ }, | ||
[ | [ | ||
{ ldjson: { key:'datePublished'}, date:['-',[2,1,0]] }, | |||
{ ldjson: { raw: ['publisher', 'datePublished'] }, date:['-', '210'] }, | { ldjson: { raw: ['publisher', 'datePublished'] }, date:['-', '210'] }, | ||
{ elem: '.single-post-meta-dates > time', date: '/' }, | { elem: '.single-post-meta-dates > time', date: '/' }, | ||
| שורה 550: | שורה 524: | ||
{ telem: "h1" } | { telem: "h1" } | ||
], | ], | ||
{ url: 1, match: /Article-(.*?).htm/ }, | [ | ||
{ url: 1, match: /www\.mako\.co\.il\/(.*?)\/Article/ }, | { url: 1, match: /Article-(.*?).htm/ }, | ||
{ url: 1, match: /(liveblog-.*?).htm/ } | |||
], | |||
{ url: 1, match: /www\.mako\.co\.il\/(.*?)\/(Article|liveblog)/ }, | |||
[ | [ | ||
{ elem: ".writerData *:last", date: '/' }, | { elem: ".writerData *:last", date: '/' }, | ||
| שורה 559: | שורה 536: | ||
], | ], | ||
removeparam: { | removeparam: { | ||
'1': [/(מערכת )?mako[א-ת ]+/] | '1': [/(מערכת )?(mako|מאקו)[א-ת ]+/, 'כתבי N12'] | ||
} | } | ||
}, | }, | ||
| שורה 629: | שורה 606: | ||
}, | }, | ||
{ | { | ||
hostname: " | hostname: "news1.co.il", | ||
params: [ | params: [ | ||
{ str: 'NFC' }, | { str: 'NFC' }, | ||
| שורה 724: | שורה 701: | ||
{ str: 'כיכר השבת' }, | { str: 'כיכר השבת' }, | ||
{ attr: ["meta[name='author']", "content"] }, | { attr: ["meta[name='author']", "content"] }, | ||
{ attr: ["meta[property='og:title']", "content"] }, | [ | ||
{ telem: "h1" }, | |||
{ attr: ["meta[property='og:title']", "content"] } | |||
], | |||
[ | [ | ||
{ url: 1, match: /il\/.*?\/(\d*)/ }, | { url: 1, match: /il\/.*?\/(\d*)/ }, | ||
| שורה 859: | שורה 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: 'במחנה' }, | ||
| שורה 865: | שורה 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+)/ } | ||
] | ] | ||
| שורה 895: | שורה 885: | ||
'bustenai': 'עיתונות|bustenai', | 'bustenai': 'עיתונות|bustenai', | ||
'dav': 'דבר', | 'dav': 'דבר', | ||
'dertog': 'דער טאג (ניו יורק)', | |||
'dhy': 'דואר היום', | 'dhy': 'דואר היום', | ||
'diedeborah' :'עיתונות|diedeborah', | 'diedeborah' :'עיתונות|diedeborah', | ||
| שורה 918: | שורה 909: | ||
'hayal': 'לחייל', | 'hayal': 'לחייל', | ||
'hayomisr': 'עיתונות|hayomisr', | 'hayomisr': 'עיתונות|hayomisr', | ||
'hayomw': 'היום | 'hayomw': 'היום (ורשה)', | ||
'hazit': 'החזית', | 'hazit': 'החזית', | ||
'hbkr': 'הבקר', | 'hbkr': 'הבקר', | ||
| שורה 1,005: | שורה 996: | ||
{ url: 1, match: /\/(\d+)\/$/ } | { url: 1, match: /\/(\d+)\/$/ } | ||
], | ], | ||
{ | { attr: ['meta[property="article:published_time"]', 'content'], date: ['-', '210'] } | ||
] | ] | ||
}, | }, | ||
| שורה 1,184: | שורה 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,190: | שורה 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,371: | שורה 1,364: | ||
], | ], | ||
[ | [ | ||
{ prefix:'קובץ=', attr: ["link[rel='themeData']", "href"], match: /(. | { prefix:'קובץ=', attr: ["link[rel='themeData']", "href"], match: /^([^.]+)\.files/ }, | ||
{ prefix:'קובץ=', url: 1, func: | { 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,454: | שורה 1,447: | ||
{ url: 1, match: /il\/(.+?)\// }, | { url: 1, match: /il\/(.+?)\// }, | ||
{ telem: 'div.date > span' } | { telem: 'div.date > span' } | ||
] | ] | ||
}, | }, | ||
| שורה 1,486: | שורה 1,470: | ||
], | ], | ||
removeparam: { | removeparam: { | ||
'1': [ 'כתב אורח', /מאת:? / ] | '1': [ 'כתב אורח', /מאת:? /, 'מערכת Geektime' ] | ||
} | } | ||
}, | }, | ||
| שורה 1,638: | שורה 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,646: | שורה 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; } } | ||
] | ] | ||
}, | }, | ||
| שורה 1,677: | שורה 1,661: | ||
{ str: 'תיאוריה וביקורת' }, | { str: 'תיאוריה וביקורת' }, | ||
{ telem: ".single-heading > .blacktext" }, | { telem: ".single-heading > .blacktext" }, | ||
{ telem: ".single-heading > .heading > h1" | { telem: ".single-heading > .heading > h1" }, | ||
{ url: 1, match: /vanleer\.org\.il\/tac_posts\/(.*)\// }, | { url: 1, match: /vanleer\.org\.il\/tac_posts\/(.*)\// }, | ||
{ telem: ".single-heading > .taxonomy", remove: [ 'גיליון' ], func: function(val) { return val.replace(' | ', ', '); } } | { telem: ".single-heading > .taxonomy", remove: [ 'גיליון' ], func: function(val) { return val.replace(' | ', ', '); } } | ||
| שורה 1,715: | שורה 1,699: | ||
try { | try { | ||
var curParam = data[i].params[j][k], | var curParam = data[i].params[j][k], | ||
removed = false; | removed = false; | ||
params[j] = ''; | |||
if (typeof curParam.str != "undefined") { | if (typeof curParam.str != "undefined") { | ||
| שורה 1,887: | שורה 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,892: | שורה 1,883: | ||
if (data[i].removeparam) { | if (data[i].removeparam) { | ||
if (data[i].removeparam[j]) { | if (data[i].removeparam[j] && params[j]) { | ||
for (var r = 0; r < data[i].removeparam[j].length; ++r) { | for (var r = 0; r < data[i].removeparam[j].length; ++r) { | ||
var currName = params[j]; | var currName = params[j]; | ||
| שורה 1,958: | שורה 1,949: | ||
try { | try { | ||
const getldjson = () => { | |||
const ARTICLE_RE = /article/i; | |||
const parsed = Array.from(document.querySelectorAll('script[type="application/ld+json"]')) | |||
.map(s => { try { return JSON.parse(s.textContent); } catch { return null; } }) | |||
if ( | .filter(Boolean); | ||
const hasArticle = o => o?.['@type'] && (Array.isArray(o['@type']) ? o['@type'].some(t => ARTICLE_RE.test(t)) : ARTICLE_RE.test(o['@type'])); | |||
const direct = parsed.filter(o => !Array.isArray(o) && !o['@graph'] && hasArticle(o)); | |||
if (direct.length) return direct; | |||
const arrayArticles = parsed.flatMap(o => Array.isArray(o) ? o : [o]).filter(o => !o['@graph'] && hasArticle(o)); | |||
if (arrayArticles.length) return arrayArticles; | |||
return parsed.filter(o => o['@graph']).flatMap(o => o['@graph']).filter(hasArticle); | |||
}; | |||
function extractArticleInfo(ldojson) { | |||
if (!ldojson || !ldojson.length) return null; | |||
var article = ldojson[0]; | |||
var ldSite = (article.publisher && article.publisher.name) || ''; | |||
var ldTitle = (article.headline || article.name || article.alternativeHeadline || '').replace(new RegExp('\\s*\\S\\s*' + ldSite + '\\s*$'), ''); | |||
if (!ldTitle) return null; | |||
var isEnglish = !hasHebrew(ldTitle); | |||
var date = new Date(article.datePublished || article.mainEntityOfPage?.datePublished || article.publisher?.datePublished); | |||
var ldDate = (date && !isNaN(date)) ? dateFormat([''+date.getDate(), ''+(date.getMonth()+1), ''+date.getFullYear()], isEnglish) : ''; | |||
var date = new Date( | |||
var | var authors = (Array.isArray(article.author) ? article.author : (article.author ? [article.author] : [])) | ||
.map(function(a){ return a?.name || (typeof a === 'string' ? a : null); }).filter(Boolean); | |||
if ( | if (!authors.length && article.author) | ||
authors.push(String(article.author).replace(new RegExp(ldSite + '$'), '').trim()); | |||
var ldAuthor = authors.join(', ').trim(); | |||
var general = { | var general = { | ||
'קעפל': ldTitle, | |||
'אדרעס': location.href | |||
}; | }; | ||
if (ldSite) general['זייטל'] = ldSite; | |||
if (ldAuthor) general['שרייבער'] = ldAuthor; | |||
if (ldDate) general['דאטום'] = ldDate; | |||
if (isEnglish) general['שפראך'] = 'ענגליש'; | |||
return general; | |||
} | |||
ldojson = getldjson(); | |||
console.log('ldojson:', ldojson); | |||
if (ldojson.length >= 1) { | |||
var general = extractArticleInfo(ldojson); | |||
console.log('data', general); | console.log('data', general); | ||
רעדאגירונגען