בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,708
רעדאגירונגען
(אפדעיט) |
(אפדעיט) |
||
| שורה 8: | שורה 8: | ||
return /[\u0590-\u05FF]/.test(text); | return /[\u0590-\u05FF]/.test(text); | ||
} | } | ||
function dateFormat(dateArr) { | 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 english ? `${month} ${day}, ${year}` : `${day} ב${month} ${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: | שורה 46: | ||
.replace(/ /g, ' ') | .replace(/ /g, ' ') | ||
.replace(/״/g, '"') | .replace(/״/g, '"') | ||
.replace(/ | .replace(/[׳‘’]/g, "'") | ||
.replace(/(\n|\r)/g, ' ') | .replace(/(\n|\r)/g, ' ') | ||
.replace(/=/g, "{{=}}") | .replace(/=/g, "{{=}}") | ||
| שורה 521: | שורה 496: | ||
], | ], | ||
[ | [ | ||
{ 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: | שורה 526: | ||
{ 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: | שורה 538: | ||
], | ], | ||
removeparam: { | removeparam: { | ||
'1': [/(מערכת )?mako[א-ת ]+/] | '1': [/(מערכת )?(mako|מאקו)[א-ת ]+/, 'כתבי N12'] | ||
} | } | ||
}, | }, | ||
| שורה 724: | שורה 703: | ||
{ 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*)/ }, | ||
| שורה 1,677: | שורה 1,659: | ||
{ 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,892: | שורה 1,874: | ||
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,940: | ||
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 (ldojson.length | .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 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 (!authors.length && article.author) | |||
authors.push(String(article.author).replace(new RegExp(ldSite + '$'), '').trim()); | |||
var ldAuthor = authors.join(', ').trim(); | |||
var שרייבער = $.map($(ldojson.author), function(a) { return a.name; }).join(VE); | var שרייבער = $.map($(ldojson.author), function(a) { return a.name; }).join(VE); | ||
var קעפל = ldojson.name || ldojson.headline; | var קעפל = ldojson.name || ldojson.headline; | ||
| שורה 1,986: | שורה 1,982: | ||
formattedDate = dateFormatter(dateParts); | formattedDate = dateFormatter(dateParts); | ||
} | } | ||
'שרייבער': שרייבער, | 'שרייבער': שרייבער, | ||
'קעפל': קעפל, | 'קעפל': קעפל, | ||
רעדאגירונגען