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

אפדעיט
אין תקציר עריכה
(אפדעיט)
 
(18 צווישנדיגע ווערסיעס פונעם זעלבן באַניצער נישט געוויזן)
שורה 1: שורה 1:
/* This code doesn't run in wikipedia but in other sites as bookmarklet */
/* This code runs in different sites as bookmarklet */
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) {
if (dateArr instanceof Array) {
var m = ["יאנואר", "פעברואר", "מערץ", "אפריל", "מאי", "יוני", "יולי", "אויגוסט", "סעפטעמבער", "אקטאבער", "נאוועמבער", "דעצעמבער"];
if (dateArr.length != 3)
return '';


dateArr[1] = m[Number(dateArr[1]) - 1];
function dateFormat(dateArr, english = false) {
if (Number(dateArr[2]) <= 50)
const months = english
dateArr[2] = 20 + dateArr[2];
? ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
else if (Number(dateArr[2]) >= 50 && Number(dateArr[2]) < 100)
: ["יאנואר", "פעברואר", "מערץ", "אפריל", "מאי", "יוני", "יולי", "אויגוסט", "סעפטעמבער", "אקטאבער", "נאוועמבער", "דעצעמבער"];
dateArr[2] = 19 + dateArr[2];


if (dateArr[0].charAt(0) == '0')
if (!Array.isArray(dateArr) || dateArr.length !== 3 || !dateArr[0] || !dateArr[1] || !dateArr[2])
dateArr[0] = dateArr[0].substring(1, dateArr[0].length);
return '';


dateArr = dateArr[1] + " " + dateArr[0] + ", " + dateArr[2];
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 jQuery.trim(dateArr);
return `${month} ${day}, ${year}`;
}
}
    function dateFormatEng(dateArr) {
if (dateArr instanceof Array) {
var  m = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
if (dateArr.length != 3)
return '';
dateArr[1] = m[Number(dateArr[1]) - 1];
if (Number(dateArr[2]) <= 50)
dateArr[2] = 20 + dateArr[2];
else if (Number(dateArr[2]) >= 50 && Number(dateArr[2]) < 100)
dateArr[2] = 19 + dateArr[2];
if (dateArr[0].charAt(0) == '0')
dateArr[0] = dateArr[0].substring(1, dateArr[0].length);


dateArr = dateArr[1] + " " + dateArr[0] + ", " + dateArr[2];
function hasHebrew(str) { return /[\u0590-\u05FF]/.test(str); }
}
return jQuery.trim(dateArr);
}
function engDateParse(engDate) {
var m = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
engDate = engDate.match(/(\w+) (\d+), (\d+)/);
return [engDate[2], (m.indexOf(engDate[1]) + 1), engDate[3]];
}


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(/&nbsp;/g, ' ')
.replace(/&nbsp;/g, ' ')
.replace(/״/g, '"')
.replace(/״/g, '"')
.replace(/׳/g, "'")
.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(/[\u200B\u200E\u200F\u2028\u202A\u202B\u202C\u202D\u202E]/g, '') // remove invisible Unicode control characters
.replace(/ {2,}/g, ' ')
.replace(/ {2,}/g, ' ')
שורה 82: שורה 52:


function getWikiLink() {
function getWikiLink() {
var result = '',
  let result = "";
oldid = getParameterByName('oldid') || getParameterByName('diff');
  const oldid = getParameterByName("oldid") || getParameterByName("diff");
  const host = window.location.host;


if (window.location.host == 'yi.hamichlol.org.il' && oldid) {
  if (host.startsWith("yi.hamichlol.org.il") && oldid) {
var oldComment = '';
    const oldComment = window.prompt("קעפּל פאַר די לינק. קען בלייבן ליידיג.", "");
oldComment = window.prompt("קעפּל פאַר די לינק. קען בלייבן ליידיג.", oldComment);
    result = `{{אונטערשייד צווישן ווערסיעס|${getParameterByName("title")}|${oldid}||${oldComment || "אונטערשייד צווישן ווערסיעס"}}}`;
result = '{{אונטערשייד צווישן ווערסיעס|' + getParameterByName('title') + '|' + oldid + '||' + (oldComment ? oldComment : 'אונטערשייד צווישן ווערסיעס') + '}}';
  } else {
} else {
    const nms = {
var nms = {
      "yi.hamichlol.org.il": "",
'yi.hamichlol.org.il': '',
      "www.hamichlol.org.il": "ע:",
'www.hamichlol.org.il': 'ע:',
      "he.wikiquote.org": "q:",
'he.wikiquote.org': 'q:',
      "he.wikisource.org": "s:",
'he.wikisource.org': 's:',
      "en.wiktionary.org": "wikt:",
'en.wiktionary.org': 'wikt:'
    };
},
wikinamespace = document.querySelector('.mw-page-title-namespace'),
wikiname = document.querySelector('.mw-page-title-main'),
wikiarticle = wikiname ? wikinamespace ? wikinamespace.textContent + ':' + wikiname.textContent : wikiname.textContent : null,
wikitype = nms[window.location.host];


if (wikitype != undefined && wikiname) {
    const wikinamespace = document.querySelector(".mw-page-title-namespace");
result = '[[' + wikitype + wikiarticle + (wikitype ? '|' + wikiname.textContent : '') + ']]';
    const wikiname = document.querySelector(".mw-page-title-main");
}
    const wikiarticle = wikiname
}
      ? wikinamespace
        ? `${wikinamespace.textContent}:${wikiname.textContent}`
        : wikiname.textContent
      : null;
    const wikitype = nms[host];
 
    if (wikitype !== undefined && wikiname) {
      result = `[[${wikitype}${wikiarticle}${wikitype ? "|" + wikiname.textContent : ""}]]`;
    }
  }


if (result) {
  if (result) {
if (prompt("דרוקן OK וועט קאפּירן דעם מוסטער:", result) != null) {
    navigator.clipboard.writeText(result).then(() => {
$('<input>').val(result).appendTo('body').select();document.execCommand('copy');
      alert("✅ קאפירט: " + result);
}
    });
return true;
    return true;
}
  }
return false;
  return false;
}
}
 
if (window.location.host.indexOf('hamichlol') == 0) {
if (window.location.host.includes("hamichlol")) {
if (getWikiLink()) {
  if (getWikiLink()) {
return true;
    if (window.old$) { window.$ = window.old$; }
}
    return;
  }
}
}


שורה 127: שורה 103:


var data = [
var data = [
{
hostname: "www.kore.co.il",
params: [
{ str: 'כל רגע' },
{ telem: 'article p.extraInfo span:nth-child(1)' },
{ telem: 'article h1' },
{ url: 1, match: /viewArticle\/(\d+)/ },
{ telem: 'article p.extraInfo span.pull-left' , match:/(.*)\|/}
]
},
{
{
hostname: /yediot(h)?(.ynet)?\.co\.il/,
hostname: /yediot(h)?(.ynet)?\.co\.il/,
שורה 171: שורה 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\/(.*)/, remove: ['#autoplay'] }
{ url: 1, match: /co\.il\/(.*)/ }
],
],
[
[
שורה 225: שורה 191:
},
},
{
{
hostname: "www.haaretz\\.(co\\.il|com)",
hostname: "www.haaretz.co.il", condition: function () { return location.pathname.startsWith('/ty-WRITER/'); },
params: [
{ str: 'הארץ - עיתונאי' },
{ url: 1, match: /([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/ }
]
},
{
hostname: "www.haaretz.(co.il|com)",
params: [
params: [
{ str: 'הארץ' },
{ str: 'הארץ' },
שורה 256: שורה 229:
{ telem: '#article-container div.col-lg-12 h1' },
{ telem: '#article-container div.col-lg-12 h1' },
{ url: 1, match: /article\/(\d+)/ },
{ url: 1, match: /article\/(\d+)/ },
{ telem: '#article-container div.credit time span:first', date: '/' }
[
{ telem: '#article-container div.credit time span:first', date: '/' },
{ ldjson: { key: 'dateModified' } }
]
]
]
},
},
שורה 280: שורה 256:
{ telem: '.story_autor_date' },
{ telem: '.story_autor_date' },
{ telem: '.player_time', date: '.' },
{ telem: '.player_time', date: '.' },
{ attr: ["div[class='date date-local']", "data-date-utc"], date: '.' },
{ attr: ["div[class*='date date-local']", "data-date-utc"], date: '.' },
{ attr: ["*[class='date-local']", "data-date-utc"], date: '.' }
{ attr: ["*[class*='date-local']", "data-date-utc"], date: '.' }
],
],
{ url: 1, match: /org\.il\/(.+?)\// }
{ url: 1, match: /org\.il\/(.+?)\// }
]
],
},
removeparam: {
{
'1': ['מערכת כאן חדשות', 'כתבי כאן חדשות']
hostname: "archive.kan.org.il",
}
params: [
{ str: 'כאן ארכיון' },
{ attr: ["meta[property='og:title']", "content"], remove: ['כאן ארכיון |'] },
{ url: 1, match: /(\d+)/ },
{ telem: 'span.itemPageDate', remove: ['תאריך שידור:'], date: '.' }
]
},
},
{
{
שורה 380: שורה 350:
{ telem: 'h1.project_title' }
{ telem: 'h1.project_title' }
],
],
{ url: 1, match: /=(\d+)/ },
{ url: 1, match: /=(\d+)/, fullhref: true },
[
[
{ elem: '.articleInfo .timestamp, #coteret_Modified, #F_Modified_on, .g_Article_DateTime', date: '/' },
{ elem: '.articleInfo .timestamp, #coteret_Modified, #F_Modified_on, .g_Article_DateTime', date: '/' },
שורה 395: שורה 365:
{ telem: "article a[rel='tag'], article a[href*='/writer/']" },
{ telem: "article a[rel='tag'], article a[href*='/writer/']" },
{ telem: "h1.headline" },
{ telem: "h1.headline" },
{ url: 1, match: /\/www\.the7eye\.org\.il\/(\d+)/ },
{ url: 1, match: /www\.the7eye\.org\.il\/(\d+)/ },
{ telem: "article span.date", date: '.' }
{ telem: "article span.date", date: '.' }
]
]
שורה 407: שורה 377:
[
[
{ url: 1, match: /news\/(\d+)/ },
{ url: 1, match: /news\/(\d+)/ },
{ var: 'userid' }
],
{ ldjson: { key:'datePublished' } }
]
},
{
hostname: "www.kore.co.il",
params: [
{ str: 'כל רגע' },
{ ldjson: { key:'author' } },
{ attr: ["meta[property='og:title']", "content"], remove:[' - כל רגע'] },
[
{ url: 1, match: /viewArticle\/(\d+)/ },
{ var: 'userid' }
{ var: 'userid' }
],
],
שורה 446: שורה 429:
{ telem: '.curr_issue_title > ._date', date: '/' }
{ telem: '.curr_issue_title > ._date', date: '/' }
]
]
]
],
removeparam: {
'1': [ 'מערכת אתר חיל-האוויר' ]
}
},
},
{
{
שורה 486: שורה 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]] }
]
]
},
},
שורה 507: שורה 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: '/' },
שורה 524: שורה 512:
hostname: "www.mako.co.il",
hostname: "www.mako.co.il",
params: [
params: [
{ str: 'mako' },
{ str: 'מאקו' },
[
[
{ elements: ['.writerData *:visible:first a', VE], shouldnt: /\d+\/\d+\/\d+/ },
{ elements: ['.writerData *:visible:first a', VE], shouldnt: /\d+\/\d+\/\d+/ },
{ telem: 'span.katav', match: /^(.*?),?\s?$/ },
{ telem: 'span.katav', match: /^(.*?),?\s?$/ },
{ attr:['span[itemprop=author]', 'content'] }
{ attr:['span[itemprop=author]', 'content'] },
{ attr: ["meta[name='author']", "content"] }
],
],
[
[
שורה 535: שורה 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: '/' },
שורה 542: שורה 534:
{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] }
{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] }
]
]
]
],
removeparam: {
'1': [/(מערכת )?(mako|מאקו)[א-ת ]+/, 'כתבי N12']
}
},
},
{
{
שורה 553: שורה 548:
{ telem: "a.author-bar li:eq(2), .h3_author" },
{ telem: "a.author-bar li:eq(2), .h3_author" },
{ telem: "div.art__info address" },
{ telem: "div.art__info address" },
{ var: ["_sf_async_config","authors"] }
{ telements: [ "address > a", ' ' ] }
],
],
[ { var: ['articlePage', 'name'] },
[ { var: ['articlePage', 'name'] },
שורה 587: שורה 582:
{ attr: ['meta[property="og:title"]', 'content'], remove: [' | כלכליסט'] },
{ attr: ['meta[property="og:title"]', 'content'], remove: [' | כלכליסט'] },
[
[
{ url: 1, match: /L\-(\d+)/ }, { attr: ["link[rel='alternate']", "href"], match: /guid=(\d+)/},
{ url: 1, match: /L\-(\d+)/ },
{ attr: ["link[rel='alternate']", "href"], match: /guid=(\d+)/},
{ url: 1, match: /calcalist\.co\.il\/(.*)/ }
{ url: 1, match: /calcalist\.co\.il\/(.*)/ }
],
],
שורה 610: שורה 606:
},
},
{
{
hostname: "www.news1.co.il",
hostname: "news1.co.il",
params: [
params: [
{ str: 'NFC' },
{ str: 'NFC' },
שורה 649: שורה 645:
[
[
{ url: 1, match: /Article\.\d+\.(\d+)\.html/ },
{ url: 1, match: /Article\.\d+\.(\d+)\.html/ },
{ url: 1, match: /docID=(\d+)/i }
{ url: 1, match: /docID=(\d+)/i, fullhref: true }
],
],
[
[
{ url: 1, match: /Article\.(\d+)\.\d+\.html/ },
{ url: 1, match: /Article\.(\d+)\.\d+\.html/ },
{ url: 1, match: /FolderID=(\d+)/i }
{ url: 1, match: /FolderID=(\d+)/i, fullhref: true }
],
],
[
[
שורה 705: שורה 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*)/ },
שורה 739: שורה 738:
{ telem: "a[rel='author'], span.author, li[itemprop='author']", remove: ["מאת "] },
{ telem: "a[rel='author'], span.author, li[itemprop='author']", remove: ["מאת "] },
{ telem: "h1.entry-title, h1.single-title, div.title-primary, span.breadcrumb_last" },
{ telem: "h1.entry-title, h1.single-title, div.title-primary, span.breadcrumb_last" },
{ url: 1, match: /https?:\/\/www.hayadan\.org\.il\/(.*?)$/i },
{ url: 1, match: /www.hayadan\.org\.il\/(.*?)$/i },
[
[
{ telem: "span.meta-date, span.date" },
{ telem: "span.meta-date, span.date" },
שורה 840: שורה 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: 'במחנה' },
שורה 846: שורה 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+)/ }
]
]
שורה 876: שורה 885:
'bustenai': 'עיתונות|bustenai',
'bustenai': 'עיתונות|bustenai',
'dav': 'דבר',
'dav': 'דבר',
'dertog': 'דער טאג (ניו יורק)',
'dhy': 'דואר היום',
'dhy': 'דואר היום',
'diedeborah' :'עיתונות|diedeborah',
'diedeborah' :'עיתונות|diedeborah',
שורה 899: שורה 909:
'hayal': 'לחייל',
'hayal': 'לחייל',
'hayomisr': 'עיתונות|hayomisr',
'hayomisr': 'עיתונות|hayomisr',
'hayomw': 'היום וורשה',
'hayomw': 'היום (ורשה)',
'hazit': 'החזית',
'hazit': 'החזית',
'hbkr': 'הבקר',
'hbkr': 'הבקר',
שורה 946: שורה 956:
'omer': 'אמר',
'omer': 'אמר',
'pisgoh': 'הפסגה',
'pisgoh': 'הפסגה',
'plb' :'עיתונות|plb',
'plb' :'PalBull',
'pls': 'PalPost',
'pls': 'PalPost',
'shar': 'שערים',
'shar': 'שערים',
שורה 986: שורה 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,028: שורה 1,038:
params: [
params: [
{ str: 'מזהה חסיד אומות העולם' },
{ str: 'מזהה חסיד אומות העולם' },
{ url: 1, match: /&itemId\=(\d+)/ }
{ url: 1, match: /&itemId\=(\d+)/, fullhref: true }
]
]
},
},
שורה 1,043: שורה 1,053:
params: [
params: [
{ str: 'מוג\'ו' },
{ str: 'מוג\'ו' },
{ urlparam: 'id', match: /(.*?)\.htm/ }
{ url: 1, match: /mojo\.com\/.*?(rl\d+|tt\d+)\// }
]
]
},
},
שורה 1,081: שורה 1,091:
{ str: 'רשות העתיקות' },
{ str: 'רשות העתיקות' },
{ str: '{{ס:' + "שם הדף בלי הסוגריים}}" },
{ str: '{{ס:' + "שם הדף בלי הסוגריים}}" },
{ url: 1, match: /loc_id\=(\d+)/ },
{ url: 1, match: /loc_id\=(\d+)/, fullhref: true },
{ url: 1, match: /\?id\=(\d+)/ }
{ url: 1, match: /\?id\=(\d+)/, fullhref: true }
]
]
},
},
שורה 1,105: שורה 1,115:
{ telem: '.article-date-report-wrap', date: '/' },
{ telem: '.article-date-report-wrap', date: '/' },
{ telem: '.article-publish-date', date: '/' },
{ telem: '.article-publish-date', date: '/' },
{ ldjson: { key: 'datePublished' } },
{ telem: 'div.tmi-article-reporter-date', date: '/'}, // tmi articles
{ telem: 'div.tmi-article-reporter-date', date: '/'}, // tmi articles
{ telem: 'time.tmi-article-info-date-time', date: '/'}, // tmi articles
{ telem: 'time.tmi-article-info-date-time', date: '/'}, // tmi articles
{ telem: 'time.blog-publish-date', date: '/'} // blogs
{ telem: 'time.blog-publish-date', date: '/'} // blogs
]
]
]
],
removeparam: {
'1': ['מערכת TMI'],
'2': ['{{!}} TMI']
}
},
},
{
{
שורה 1,125: שורה 1,140:
params: [
params: [
{ str: 'דוידסון1' },
{ str: 'דוידסון1' },
{ attr: ['meta[name="twitter:data1"]', 'content'] },
[
{ attr: ['meta[name="twitter:data2"]', 'content'] },
{ attr: ['meta[name="twitter:data1"]', 'content'] }
],
{ attr: ['meta[property="og:title"]', 'content'], remove: [' | מגזין | מכון דוידסון'] },
{ attr: ['meta[property="og:title"]', 'content'], remove: [' | מגזין | מכון דוידסון'] },
{ url: 1, match: /org\.il\/read-experience\/(.*)$/ },
{ url: 1, match: /org\.il\/read-experience\/(.*)$/ },
שורה 1,156: שורה 1,174:
params: [
params: [
{ str: 'סרוגים' },
{ str: 'סרוגים' },
{ telem: '.post_author', match: /(.+?)\d/, remove: [', חדשות סרוגים', 'חדשות סרוגים'] },
[
{ ldjson: { key: 'author' } },
{ telem: '.post_author', match: /(.+?)\d/ },
{ attr: ["meta[name='author']", "content"] }
],
{ telem: 'h1' },
{ telem: 'h1' },
{ 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: '.' }
]
]
]
],
removeparam: {
'1': [', חדשות סרוגים', 'חדשות סרוגים']
}
},
},
{
{
שורה 1,204: שורה 1,230:
[
[
{ var: ['detail_data','bookid'] },
{ var: ['detail_data','bookid'] },
{ url: 1, match: /(?:book|b)\/(\d*)\// }
{ url: 1, match: /(?:book|b)\/(\d+)\//, fullhref: true }
],
],
[
[
שורה 1,337: שורה 1,363:
{ prefix:'קישור=', urlparam: 'fileName'}
{ prefix:'קישור=', urlparam: 'fileName'}
],
],
{ prefix:'קובץ=', url: 1, func: function(s) { return s.indexOf('NetVerdicts') > -1 ? getParameterByName('fileName') : ''; }, removeifempty: true },
[
{ prefix:'סוג=', var: 'all_text', match: /([^\s]+?)[\s]+\d+\/\d+/m},
{ prefix:'קובץ=', attr: ["link[rel='themeData']", "href"], match: /^([^.]+)\.files/ },
{ 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:['parsed_data', 'OTTER'] },
{ prefix:'עותר=', var:['parsed_data', 'OTTER'] },
שורה 1,421: שורה 1,450:
},
},
{
{
hostname: "yuvalerel.com",
hostname: "geektime.co.il",
params: [
params: [
{ str: 'יובל אראל'},
{ str: 'גיקטיים'},
{ telem: 'a.author-name' },
{ telem: 'h1.post-title ' },
{ url: 1, match: /com\/(.*)/ }
]
},
{
hostname: "geektime.co.il",
params: [
{ str: 'גיקטיים'},
[
[
{ telem: 'p.post-meta > a' },
{ telem: 'p.post-meta > a' },
שורה 1,450: שורה 1,470:
],
],
removeparam: {
removeparam: {
'1': [ 'כתב אורח', /מאת:? / ]
'1': [ 'כתב אורח', /מאת:? /, 'מערכת Geektime' ]
}
}
},
},
שורה 1,457: שורה 1,477:
params: [
params: [
{ str: 'אאוריקה'},
{ str: 'אאוריקה'},
{ telem: 'div.head-text > h2' },
[
{ url: 1, match: /il\/item\/(\d*)\// }
{ url: 1, match: /il\/(?!item)(.*)/, func: function(val) { return val.replace('_', ' '); } },
{ telem: 'div.head-text > h2' },
],
[
{ url: 1, match: /il\/item\/(\d*)\// },
{ url: 1, match: /il\/(?!item)(.*)/ }
]
]
]
},
},
שורה 1,566: שורה 1,592:
{ str: 'יומן חדשות'},
{ str: 'יומן חדשות'},
{ telem: 'h1.content_title' },
{ telem: 'h1.content_title' },
{ url: 1, match: /il\/news_journal\/([\d-]+\/[\d-]+)/ },
{ url: 1, match: /il\/news_journal\/([\d-]+\/?[\d-]+)/ },
{ telem: '.content_subtitle' }
{ telem: '.content_subtitle' }
]
]
שורה 1,596: שורה 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,604: שורה 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,628: שורה 1,654:
{ telem: ".common-information-wrapper > span > time ", func: function(val) { if (val) { var arr = val.split(' '); return [arr[0], arr[1], arr[2]].join(' '); } return ''; } }
{ telem: ".common-information-wrapper > span > time ", func: function(val) { if (val) { var arr = val.split(' '); return [arr[0], arr[1], arr[2]].join(' '); } return ''; } }
]
]
]
},
{
hostname: "vanleer.org.il",
params: [
{ str: 'תיאוריה וביקורת' },
{ telem: ".single-heading > .blacktext" },
{ telem: ".single-heading > .heading > h1" },
{ url: 1, match: /vanleer\.org\.il\/tac_posts\/(.*)\// },
{ telem: ".single-heading > .taxonomy", remove: [ 'גיליון' ], func: function(val) { return val.replace(' | ', ', '); } }
]
},
{
hostname: "psik.io",
params: [
{ str: 'צ-ספר' },
{ ldjson: { raw: 'author', n: 0 }, prefix: "מחבר=" },
{ ldjson: { raw: 'name', n: 0 }, prefix: "שם=" },
{ ldjson: { raw: 'publisher', n: 0 }, prefix: "מו\"ל=", suffix: '}}, {{פסיק' },
{ url: 1, match: /psik\.io\/.*?(?!\/book\/|\/pdfViewer\/|book_id\=)(\d+)/, fullhref: true }
]
},
{
hostname: "cityofdavid.org.il",
params: [
{ str: 'הר הזיתים' },
{ url: 1, match: /grave-card=(\d+)/, fullhref: true }
]
]
}
}
שורה 1,646: שורה 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,654: שורה 1,708:
var ldjsons = $('script[type="application/ld+json"]').map(function(i,e) { try { return JSON.parse($(e).text().replace(/[\t\n\r]/g, ' ')); } catch (e) { return false; } });
var ldjsons = $('script[type="application/ld+json"]').map(function(i,e) { try { return JSON.parse($(e).text().replace(/[\t\n\r]/g, ' ')); } catch (e) { return false; } });
if (typeof curParam.ldjson.n != "undefined") {
if (typeof curParam.ldjson.n != "undefined") {
ldjson = ldjsons[curParam.ldjson.n];
ldjson = ldjsons.length ? ldjsons[curParam.ldjson.n] : {};
} else {
} else {
var filteredLdjson = ldjsons.filter(function(i,e) { return (curParam.ldjson.type?[curParam.ldjson.type]:['NewsArticle','Article']).includes(e['@type']); });
var filteredLdjson = ldjsons.filter(function(i,e) { return (curParam.ldjson.type?[curParam.ldjson.type]:['NewsArticle','Article']).includes(e['@type']); });
שורה 1,660: שורה 1,714:
ldjson = filteredLdjson[0];
ldjson = filteredLdjson[0];
} else {
} else {
console.error("more/less than single ldjson", filteredLdjson);
console.error("more/less than single ldjson, trying first", filteredLdjson);
return;
ldjson = filteredLdjson[0];
}
}
}
}
שורה 1,683: שורה 1,737:
}
}
} else if (typeof curParam.url != "undefined") {
} else if (typeof curParam.url != "undefined") {
params[j] = location.href;
params[j] = curParam.fullhref ? location.href : location.hostname+location.pathname;
if (curParam.url == 'decodeURIComponent')
if (curParam.url == 'decodeURIComponent')
params[j] = decodeURIComponent(params[j]);
params[j] = decodeURIComponent(params[j]);
שורה 1,809: שורה 1,863:
if (params[j] && typeof curParam.prefix != "undefined")
if (params[j] && typeof curParam.prefix != "undefined")
params[j] = curParam.prefix + params[j];
params[j] = curParam.prefix + params[j];
if (params[j] && typeof curParam.suffix != "undefined")
params[j] = params[j] + curParam.suffix;


if (typeof curParam.defvalue != "undefined" && params[j] == curParam.defvalue)
if (typeof curParam.defvalue != "undefined" && params[j] == curParam.defvalue)
שורה 1,815: שורה 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,820: שורה 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,866: שורה 1,929:
console.log('popup_template_canceled');
console.log('popup_template_canceled');
} else {
} else {
var result = '{{' + params.join('|') + '}}';
var result = '{' + '{' + params.join('|') + '}}';
if (window.addWikiNote) result = '{{הערה|' + result + '}}';
if (window.addWikiNote) result = '{{הערה|' + result + '}}';


שורה 1,886: שורה 1,949:


try {
try {
var ldojson = $('script[type="application/ld+json"]').map(function(i,e) { return JSON.parse($(e).text()); }).filter(function(i,e) { return ['NewsArticle', 'Article', 'article'].includes(e['@type']); });
const getldjson = () => {
var ldojson_website = [ { } ];
const ARTICLE_RE = /article/i;
if (ldojson.length == 0) {
const parsed = Array.from(document.querySelectorAll('script[type="application/ld+json"]'))
ldojson = $('script[type="application/ld+json"]').map(function(i,e) { return JSON.parse($(e).text()); }).filter(function(i,e) { return e['@graph']; });
.map(s => { try { return JSON.parse(s.textContent); } catch { return null; } })
if (ldojson.length == 1) {
.filter(Boolean);
ldojson_website = ldojson[0]['@graph'].filter(function(i,e) { return ['WebSite'].includes(i['@type']); });
const hasArticle = o => o?.['@type'] && (Array.isArray(o['@type']) ? o['@type'].some(t => ARTICLE_RE.test(t)) : ARTICLE_RE.test(o['@type']));
ldojson = ldojson[0]['@graph'].filter(function(i,e) { return ['WebPage'].includes(i['@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);


console.log('ldojson:', ldojson);
var date = new Date(article.datePublished || article.mainEntityOfPage?.datePublished || article.publisher?.datePublished);
if (ldojson.length == 1) {
var ldDate = (date && !isNaN(date)) ? dateFormat([''+date.getDate(), ''+(date.getMonth()+1), ''+date.getFullYear()], isEnglish) : '';
ldojson = ldojson[0];
var date = new Date(ldojson.datePublished);
if (isNaN(date)) {
date = new Date(ldojson.publisher.datePublished);
}
var שרייבער = $.map($(ldojson.author), function(a) { return a.name; }).join(VE);
var קעפל = ldojson.name || ldojson.headline;
var זייטל = (ldojson.publisher||ldojson_website[0]).name;
var hebrewFound = hasHebrew(שרייבער) || hasHebrew(קעפל) || hasHebrew(זייטל);
var dateFormatter = hebrewFound ? dateFormat : dateFormatEng;
var authors = (Array.isArray(article.author) ? article.author : (article.author ? [article.author] : []))
var formattedDate = '';
.map(function(a){ return a?.name || (typeof a === 'string' ? a : null); }).filter(Boolean);
if (date != "Invalid Date") {
if (!authors.length && article.author)
    var dateParts = [''+date.getDate(), ''+(date.getMonth()+1), ''+date.getFullYear()];
authors.push(String(article.author).replace(new RegExp(ldSite + '$'), '').trim());
    formattedDate = dateFormatter(dateParts);  
var ldAuthor = authors.join(', ').trim();
}
 
var general = {
var general = {
    'שרייבער': שרייבער,
'קעפל': ldTitle,
    'קעפל': קעפל,
'אדרעס': location.href
    'אדרעס': location.href,
    'זייטל': זייטל,
    'דאטום': formattedDate,
};
};
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);


שורה 1,926: שורה 2,002:
return k + '=' + cleanText(jQuery.trim(decodeURIComponent($('<a />').html(v).text())));
return k + '=' + cleanText(jQuery.trim(decodeURIComponent($('<a />').html(v).text())));
}).join('|') + '}}';
}).join('|') + '}}';
if (window.addWikiNote) gresult = '{{הערה|' + gresult + '}}';
if (prompt("דרוקן OK וועט קאפּירן דעם מוסטער:", gresult) != null) {
if (prompt("דרוקן OK וועט קאפּירן דעם מוסטער:", gresult) != null) {
$('<input>').val(gresult).appendTo('body').select();document.execCommand('copy');
$('<input>').val(gresult).appendTo('body').select();document.execCommand('copy');