מדיה ויקי:Common.js/externalsmaker.js – הבדלי גרסאות

מתוך ויקיפדיה, האנציקלופדיה החופשית
תוכן שנמחק תוכן שנוסף
פארווערטס
הוספת אפשרות עורך בוואלה, שינויים ב-one בעקבות שינוי מבנה האתר
שורה 126: שורה 126:
{ str: 'וואלה!' },
{ str: 'וואלה!' },
[{ telem: '.info .author:first, .provider', match: /^([^\|]*)/ },
[{ telem: '.info .author:first, .provider', match: /^([^\|]*)/ },
{ telem: 'div.wp-0-b:first span:first', match: /מאת:(.*),/ }],
{ telem: 'div.wp-0-b:first span:first', match: /מאת:(.*),/ },
{ telem: '.author > div', match: /^([^\|]*)/ }],
{ telem: 'h1' },
{ telem: 'h1' },
[{ url: 1, match: /item\/(\d+)/ },
[{ url: 1, match: /item\/(\d+)/ },
שורה 396: שורה 397:
params: [
params: [
{ str: 'one' },
{ str: 'one' },
{ elem: "#ArticleCredit", match: /^.*$/gm, remove: ["מאת מערכת ONE", "מאת "] },
{ elem: ".article-credit", match: /^.*$/gm, remove: ["מאת מערכת ONE", "מאת ", "מערכת ONE", "</a>"] },
{ telem: "h1, #_ctl0_Main_ucFullArticle_lblCaption, #_ctl0_Main_ucFullArticle_lbColCaption" },
{ telem: "h1, #_ctl0_Main_ucFullArticle_lblCaption, #_ctl0_Main_ucFullArticle_lbColCaption" },
{ url: 1, match: [/Article\/\d\d\-\d\d\/\d,\d+,\d,\d\/(\d+)/, /Article\/(\d+)/, /id=(\d+)/] },
{ url: 1, match: [/Article\/\d\d\-\d\d\/\d,\d+,\d,\d\/(\d+)/i, /Article\/(\d+)/i, /id=(\d+)/] },
{ elem: "#ArticleCredit, .f10.left", date: '/' }
{ elem: ".article-credit > time", date: '/' }
]
]
},
},

גרסה מ־11:43, 20 בספטמבר 2021

/* This code doesn't run in wikipedia but in other sites as bookmarklet */

function wikiit(event, force_popup) {
	window.$ = window.jQuery;

	function dateFormat(dateArr) {
		if (dateArr instanceof Array) {
			var m = ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"];

			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[0] + " ב" + dateArr[1] + " " + dateArr[2];
		}
		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 getParameterByName(name) {
		/* http://james.padolsey.com/javascript/bujs-1-getparameterbyname/ */
		var match = RegExp('[?&]' + name + '=([^&]*)')
			.exec(window.location.search);
		return match && decodeURIComponent(match[1].replace(/\+/gi, ' '));
	}

	VE = ' ו';

	var data = [
		{
			hostname: /yediot(h)?(.ynet)?\.co\.il/,
			params: [
				{ str: "ידיעות אחרונות" },
				{ telem: ".ya-author-additional" },
				{ telem: ".ahya-title" },
				{ var: "dcContentID" },
				{ telem: ".ahya-date", date: '.' },
			]
		},
		{
			hostname: /www\.ynet\.co\.il/, minimum: 4,
			params: [
				{ str: 'ynet' },
				[
					{ elements: ['.authorHtmlCss', VE] },
					{ telem: 'td:has(h1:first) .text14:first', match: /^(.{0,100})$/ },
					{ elem: 'font.text14 span p:last', match: /^\((.*?)\)$/ },
					{ telem: "style+span a[href^='http://www.ynet.co.il/tags/']" }, // for ynet bug
					{ telem: ".text16w", match: /\/(.*?)$/ },
					{ telem: ".text16w" },
					{ telem: ".art_header_footer_author span" },
					{ attr: ["meta[property='vr:author']", 'content'] },
				],
				[
					{ telem: '.art_header_title' },
					{ attr: ["meta[property='og:title']", "content"] }, //seems wrong on http://www.ynet.co.il/articles/0,7340,L-3676702,00.html
					{ elem: 'head>title', match: /(?:ynet\s*-?)?([^\-]*)/ },
					{ telem: 'h1' },
				],
				[
					{ url: 1, match: /L-(.*?),/ },
					{ attr: ["link[rel='alternate']", "href"], match: /ynet.co.il\/[^[\/]*\/(\d+)/, defvalue: '0' },
                    { var: 'articleId' }
				],
				[
					{ elem: 'td:has(h1:first) .text12g:last', date: '.' },
					{ elem: ".text12g + .text12g", date: '.' },
					{ elem: ".art_header_footer_author:last", date: '.' },
					{ elem: ".ArticleHeaderComponent .date", date: '.'}
				]
			]
		},
		{
			hostname: /(www|jerusalem|krayot|kibbutz|rishon|hadera|netania|netanya|herzliya|holon|petahtikva|batyam|roshhaayin|kfarsaba|hodhasharon|rehovot|raanana|afula|emek|haifa|beersheva)\.mynet\.co\.il$/i,
			params: [
				{ str: 'mynet3' },
				{ telem: '.MynetBreadcrumbsComponenta a:first', remove: ['MYNET ', 'mynet ', 'מיינט '], func:function(s){return s=='עפולה ועמק'?'העמק':s}},
				{ telem: 'div.authors' },
				{ telem: 'h1.mainTitle' },
				{ url: 1, match: /article\/(.*)$/ },
				{ telem: 'div.date:last', date: '.' },
			]
		},
		{
			hostname: "xnet.ynet.co.il", minimum: 5,
			params: [
				{ str: 'xnet' },
				[{ telem: 'div.ahxnet_author, div.author div.cp-h2' }],
				{ telem: "h1" }, //can use ".colorTitle:first>.right" for descrition or join them to one long title
				{ url: 1, match: /L-(.*?),/ },
				{ telem: ".BlogInfo,.author.clearFix cite,.time", date: '.' },
				{ str: '' },
				{ url: 1, match: /articles\/(\d+),/, defvalue: '0' }
			]
		},
		{
			hostname: "pplus.ynet.co.il", minimum: 5,
			params: [
				{ str: 'פנאי פלוס' },
				[{ telem: '.ahpp_author a:last' }],
				{ telem: 'div.ahpp_title' },
				{ url: 1, match: /L-(.*?),/ },
				{ telem: ".ahpp_date", date: '.', remove: ['פורסם '] },
				{ str: '' },
				{ url: 1, match: /articles\/(\d+),/, defvalue: '0' }
			]
		},
		{
			hostname: /^\w+\.walla\.co\.il$/,
			params: [
				{ str: 'וואלה!' },
				[{ telem: '.info .author:first, .provider', match: /^([^\|]*)/ },
				{ telem: 'div.wp-0-b:first span:first', match: /מאת:(.*),/ },
				{ telem: '.author > div', match: /^([^\|]*)/ }],
				{ telem: 'h1' },
				[{ url: 1, match: /item\/(\d+)/ },
				{ url: 1, match: /w=\/\d*\/(\d+)/ }],
				[
					{ ldjson: {key:'datePublished'}},
					{ telem: '.info .date:first', match: /, (\d+ ב.*? \d+),/ },
					{ elem: ["h1", "parent", "children", "eq,2"], match: /,(.*),/, shouldnt: "online_presence" }, //TODO:
					{ telem: ".w2.txt-w:last", match: /, (\d+ ב.*? \d+),/ }
				]
			]
		},
		{
			hostname: /^\w+\.nana(10)?\.co\.il$/i, minimum: 6,
			params: [
				{ str: 'נענע10' },
				{ telem: '.Author:first', remove: ['תרבות ובידור נענע 10', 'נענע 10'] },
				[{ telem: '#ArtTitle' }, { telem: 'h1' },],
				{ urlparam: 'ArticleID' },
				{ elem: '.ArticleDate:first,.Date', date: '/' },
				{ str: '' },
				{ url: 1, match: /(\w+)\.nana/i }
			]
		},
		{
			hostname: "www.haaretz.co.il",
			params: [
				{ str: 'הארץ' },
				[{ var: ['articlePage', 'dimension1'] }, { telements: ["header address", VE] }],
				{ telem: 'header h1' },
				[
					{ var: ['articlePage', 'id'] },
					{ url: 1, match: /\.il\/(\d\.\d+)/ },
					{ url: 1, match: /(\d\.\d+)$/ }
				],
				{ telem: "header time", date: '.' }
			]
		},
		{
			hostname: "www.inn.co.il", hrefmatch: /www\.inn\.co\.il.*Besheva/i,
			params: [
				{ str: 'בשבע' },
				{ telem: '.Author:first', match: /<\/div>(.*)$/ },
				{ telem: 'h1:first' },
				{ url: 1, match: /^.*\/(.*)$/ },
				{ telem: '.Date:first', date: '/' }, //normal pages
			]
		},
		{
			hostname: "www.ice.co.il",
			params: [
				{ str: 'אייס' },
				{ telem: '#article-container div.credit span:first a' },
				{ telem: '#article-container div.col-lg-12 h1' },
				{ url: 1, match: /article\/(\d+)/ },
				{ telem: '#article-container div.credit time span:first', date: '/' },
			]
		},
		{
			hostname: "www.kan.org.il",
			params: [
				{ str: 'כאן' },
				[{ telem: '.story_autor_name' }, {telem: '#progBrodcaster'}],
				[{ telem: '.story_title' }, {telem: '#progName'}],
				{ url: 1, match: /Id\=(\d+)/i },
				{ telem: '.story_autor_date' },
				{ url: 1, match: /org\.il\/(.+?)\// },
			]
		},
		{
			hostname: "(10.tv|13news.co.il)", hrefmatch: /10news\//i,
			params: [
				{ str: 'ערוץ עשר' },
				{ telem: 'li:contains("כתבים: ") + li' },
				{ telem: 'h1' },
				{ url: 1, match: /\/(\d+)$/ },
				{ telem: 'li:contains("פורסם ב: ") + li', date: '/' },
				{ url: 1, match: /\/([^\/]*?)\/\d+$/, defvalue: 'news' },
			]
		},
		{
			hostname: "(10.tv|13news.co.il)",
			params: [
				{ str: 'החדשות 13' },
				[
					{ telem: 'li:contains("כתבים: ") + li' },
					{ telements: ['#author-and-date ul', VE] }
				],
				[
					{ telem: 'h1#article-title' },
					{ telem: 'h1' },
				],
				[
					{ url: 1, match: /\/(\d+)$/ },
					{ attr:['link[rel="canonical"]', 'href'], match:/.*\/(.*?)\/$/}
				],
				[
					{ ldjson:{key:'datePublished'}},
					{ telem: 'li:contains("פורסם ב: ") + li', date: '/' }
				],
				[
					{ url: 1, match: /\/([^\/]*?)\/\d+$/, defvalue: 'news' },
				],
			]
		},
		{
			hostname: "mida.org.il",
			params: [
				{ str: 'מידה' },
				{ telem: '.author', prefix: "כותב=" },
				{ telem: '.entry-title', prefix: "כותרת=" },
				{ elem: 'body', prefix: "מספר כתבה=", match: /post-(\d+)/ },
				{ telem: '.published', prefix: "תאריך=", date: '/' },
			]
		},
		{
			hostname: "www.inn.co.il",
			params: [
				{ str: 'ערוץ7' },
				[
					{ telem: '.ArticleAuthor h5' }, //http://www.inn.co.il/Articles/Article.aspx/7513
					{ first_text_node:".Author *:first", match:/^(.*),\s+$/}, // https://www.inn.co.il/News/News.aspx/403520
					{ telem: '.Author a' }
				],
				[
                    { attr: ['meta[property="og:title"]', 'content']},
					{ telem: (location.href.indexOf("News/Flash") < 0) ? 'h2:first' : '#divMC h3' }, //TODO:
					{ telem: 'h1' },
				],
				{ url: 1, match: /^.*\/(.*)$/ },
				[{ telem: '.Date:first, .Author', date: '/' },
				{ telem: '.NewsMain .Top .Right', match: /(\d+ (.*?) \d+)/, split: ' ', func: dateFormat },
				{ telem: '.NewsMain .Top .Right', date: '/' }], //flashnews
				{ url: 1, match: /www\.inn\.co\.il\/(\w+\/\w+)\.aspx/, defvalue: 'News/News' },
			]
		},
		{
			hostname: "www.globes.co.il",
			params: [
				{ str: 'גלובס' },
				[{ attr: ["meta[property='article:author']", "content"] }, {ldjson:{key:'author'}}],
				{ elem: '#F_Title, .mainArticletitle' },
				{ url: 1, match: /=(\d+)/ },
				[
					{ elem: '.articleInfo .timestamp, #coteret_Modified, #F_Modified_on, .g_Article_DateTime', date: '/' },
					{ attr: ["meta[name='article_created']", "content"], date: '/' },
					{ telem: '.articleInfo .timestamp', date: '.'},
				]
			]
		},
		{
			hostname: "www.the7eye.org.il",
			params: [
				{ str: 'העין השביעית' },
				{ telem: "article a[rel='tag'], article a[href*='/writer/']" },
				{ telem: "h1.headline" },
				{ url: 1, match: /\/www\.the7eye\.org\.il\/(\d+)/ },
				{ telem: "article span.date", date: '.' },
			]
		},
		{
			hostname: "www.bhol.co.il",
			params: [
				{ str: 'בחדרי חרדים' },
				{ telem: 'div.meta-info.article-place .date:first', match: /^\n(.*)\n/m },
				{ elem: '.article-heading h1:first' },
				[{ url: 1, match: /news\/(\d+)/ }, { var: 'userid' }],
				{ telem: 'div.meta-info.article-place .date:first', date: '/' }
			]
		},
		{
			hostname: "www.20il.co.il",
			params: [
				{ str: 'ערוץ 20' },
				{ telem: '.post-meta-author' },
				{ telem: '.post-title' },
				{ url: 1, match: /il\/(.+?)\// },
				{ telem: '.tie-date', date: '/' }
			]
		},
		{
			hostname: "iaf.org.il",
			params: [
				{ str: 'אתר חיל האוויר' },
				{ telem: '#ctl00_ContentPlaceHolder1_ucEventLog_divOuther' },
				{ telem: '#ctl00_ContentPlaceHolder1_ucEventLog_titleText' },
				{ url: 1, match: /(\d+-\d+)-/ },
				{ telem: '#ctl00_ContentPlaceHolder1_ucEventLog_publishDate', date: '.' }
			]
		},
		{
			hostname: "actv.haifa.ac.il",
			params: [
				{ str: 'הערוץ האקדמי' },
				{ elements: ["#ctl00_ContentPlaceHolder_Content_Repeater_Humans_ctl00_HyperLink_Human_Name", VE] },
				{ elem: '#ctl00_ContentPlaceHolder_Content_Label_Title' },
				{ urlparam: 'it' },
				{ elem: "#ctl00_ContentPlaceHolder_Content_Label_DateBroadcast", remove: ["תאריך הקלטה:"], date: '/' }
			]
		},
		{
			hostname: "www.mouse.co.il", //only "CM.articles" have a template!
			params: [
				{ str: 'עכבר העיר' },
				{ telem: "address.u-d--i > span:nth-child(1)", remove: [", עכבר העיר אונליין", ', עכבר העיר'] },
				{ telem: ".katava-box.box h1, h1" },
				{ url: 1, match: /(\d+\.\d+)$/ },
				[{ elem: "p.katava-info:first", match: /^\W+ (\d+ \W+ \d+)/ },
				{ elem: "p.katava-infoVer2:first", match: /^יום \W+ (\d+ \W+ \d+)/ }]
			]
		},
		{
			hostname: "www.makorrishon.co.il", condition: function () { return ($("h1:first").length > 0 && location.pathname.startsWith('/nrg/')) }, minimum: 7,
			params: [
				{ str: 'nrg' },
				[
					{ elem: "#articleCBar span:first, .cdat.small.bold, .articleBar h4:first, .jeg_meta_author a", match:/<!-- ARTICLE_WRITER_START -->(.*)<!-- ARTICLE_WRITER_END -->/ },
					{ telem: "#articleCBar span:first, .cdat.small.bold, .articleBar h4:first, .jeg_meta_author a" },
				],
				[
					{ var: 'titleName'},
					{ elem: 'h1', match: [/<!-- ARTICLE_TITLE_START --> (.*?)<!-- ARTICLE_TITLE_END -->/, /(.*?)&nbsp;\|/] }
				],
				[{ url: 1, match: /(\d+\/\d+)\.html/ }, { url: 1, match: /\/(\d+)\/$/ }],
				[
					{ elem: "#articleCBar span:first, .articleBar h4:first", date: '/' },
					{ telem: ".jeg_meta_date", date: '-' },
					{ elem: "#articleCBar span:first, .cdat.small.bold, .articleBar h4:first, .jeg_meta_author a", match:/<!-- ARTICLE_DATE_START -->(.*)<!-- ARTICLE_DATE_END -->/, date: '/'},
				],
				[{ url: 1, match: /online\/(.*?)\/ART/ }, { url: 1, match: /il\/(.*?)\/\d+\/$/ }],
				{ url: 1, match: /ART(\d+)/ }
			]
		},
		{
			hostname: "www.makorrishon.co.il", condition: function () { return !location.pathname.startsWith('/nrg/') }, minimum: 3,
			params: [
				{ str: 'מקור ראשון' },
				{ telem: "#articleCBar span:first, .cdat.small.bold, .articleBar h4:first, .jeg_meta_author a" },
				{ telem: "h1:first" },
				{ url:1, match: /makorrishon\.co\.il\/(.*?)\/$/ },
				[
					{ telem: ".jeg_meta_date", date: '-' },
					{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] },
					{ telem: ".jeg_meta_date", date:['/',[1,0,2]] }
				],
			]
		},
		{
			hostname: "www.nrg.co.il", condition: function () { return ($("h1:first").length == 0) }, minimum: 7,
			params: [
				{ str: 'nrg' },
				[
					{ telem: "font.newsVitzCredit", remove: ["NRG מעריב"] },
					{ elem: "td.newsVitzCredit", match: /^(.*?)<br>/, remove: ["NRG מעריב"] },
					{ telem: "font.newsVitzBody:first", match: /^(.*)/, remove: ["NRG מעריב"] }
				],
				{ telem: "#titleS1" },
				{ url: 1, match: /(\d+\/\d+)\.html/ },
				[
					{ telem: "font.newsVitzCredit:last, .opinionMainVitzBody", date: '/' },
					{ telements: ["td.newsVitzCredit", ""], date: '/' }
				],
				{ url: 1, match: /online\/(.*?)\/ART/ },
				{ url: 1, match: /ART(\d+)/ }
			]
		},
		{
			hostname: "www.one.co.il",
			params: [
				{ str: 'one' },
				{ elem: ".article-credit", match: /^.*$/gm, remove: ["מאת מערכת ONE", "מאת ", "מערכת ONE", "</a>"] },
				{ telem: "h1, #_ctl0_Main_ucFullArticle_lblCaption, #_ctl0_Main_ucFullArticle_lbColCaption" },
				{ url: 1, match: [/Article\/\d\d\-\d\d\/\d,\d+,\d,\d\/(\d+)/i, /Article\/(\d+)/i, /id=(\d+)/] },
				{ elem: ".article-credit > time", date: '/' }
			]
		},
		{
			hostname: "www.israelhayom.co.il",
			params: [
				{ str: 'ישראל היום' },
				[{ telem: ".normal14 .normal, .content li.taxonomy-term-reference-0, .views-field-name .field-content" }, {ldjson: {key:'author'}}],
				[{ attr: ['meta[property="og:title"]', 'content'], remove:[' | ישראל היום'] }, { telem: ".pane-title" }],
				{ url: 1, match: /israelhayom.co.il\/(.*)$/},
				[{ldjson: {raw:['publisher', 'datePublished']}, date:['-', '210']}],
			]
		},
		{
			hostname: "www.mako.co.il",
			params: [
				{ str: 'mako' },
				[
					{ elements: ['.writerData *:visible:first a', VE], shouldnt: /\d+\/\d+\/\d+/ },
					{ telem: 'span.katav', match: /^(.*?),?\s?$/, },
					{ attr:['span[itemprop=author]', 'content']},
				],
				[{telem: '.panel-pane.pane-node-content .pane-title'}, { telem: ".article.clearer h1" }, { telem: "h1" }],
				{ url: 1, match: /Article-(.*?).htm/ },
				{ url: 1, match: /www\.mako\.co\.il\/(.*?)\/Article/ },
				[
					{ elem: ".writerData *:last", date: '/' },
					{ elem: "span.displayDate", date: '/' },
					{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] },
				]
			]
		},
		{
			hostname: /^\w+\.themarker\.com$/i,
			params: [
				{ str: 'TheMarker' },
				[
					{ telements: [".prsnlArticleEnvelope .autorBarAnchor, .prsnlArticleEnvelope .autorBarWriters", VE], remove: ["מאת:"] },
					{ attr: ['meta[name="author"]', "content"] },
					{ telem: "a.author-bar li:eq(2), .h3_author", remove: ["מאת:"] },
					{ telem: "div.art__info address" },
					{ var: ["_sf_async_config","authors"]}
				],
				[	{ var: ['articlePage', 'name']},
					{attr:['meta[property="og:title"]', 'content']},
					{ telem: "h1.h-mb--xxtight, h1.mainTitle" },
					{ telem: "h2" },
				],
				{ url: 1, match: /^.*\/(.+?)\/?$/ },
				[
					{ attr: ["meta[property='article:published']", "content"], date:['-',[2,1,0]] },
					{ telem: ".author-bar li:eq(1), .h3_date, div.art__info time", date: '.' },
					{ telem: ".inner_bar", date:'/'}
				],
				{ url: 1, match: /\/\/(.*?).themarker/i, defvalue: "www" }
			]
		},
		{
			hostname: "www.calcalist.co.il", minimum: 5,
			params: [
				{ str: 'כלכליסט' },
				[{ telem: ".shahor.art-author" }, {telem: ".calcalistArticleHeader_footer .authors"}],
				{ telem: "h1" },
				[{ url: 1, match: /L\-(\d+)/ }, { attr: ["link[rel='alternate']", "href"], match: /guid=(\d+)/}],
				[{ telem: ".art-publish-date.afor > .l-date:last", date: '.' }, {telem: ".calcalistArticleHeader_footer .date", date: '.'}]
			]
		},
		{
			hostname: "www.news1.co.il",
			params: [
				{ str: 'NFC' },
				{ telem: "#ctl00_ContentMain_UcArticle1_lnkWriterName, #ctl00_ContentMain_UcArticle1_lblTopWriterName", remove: ["מחלקה ראשונה"] },
				{ telem: "#ctl00_ContentMain_UcArticle1_lblHead1, #ctl00_ContentMain_UcArticle1_lblSpecialTitle" },
				{ url: 1, match: /ve\/(.*?)\.html/ },
				{ telem: "#ctl00_ContentMain_UcArticle1_lblCreateDate", date: '/' }
			]
		},
		{ //even this is not exactly "External Link Template"
			hostname: "aleph.nli.org.il",
			params: [
				{ str: 'צ-מאמר' },
				{ telem: "#fullRecordView th:contains(מחבר):first + td", func: function (str) { var strs = str.match(/^(.*?), (.*?)$/); return (strs.length == 3) ? (strs[2] + " " + strs[1]) : str; } },
				{ telem: "#fullRecordView th:contains(כותר):first + td", match: /^(.*?)\.?[\s\u202c]*$/ },
				{ telem: "#fullRecordView th:contains(בתוך):first + td", match: /^(.*?) \(/ },
				{ 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: /(\d+\-\d+)/ },
				{ telem: "#fullRecordView th:contains(מס' מערכת):first + td", prefix: "רמבי=" }
			]
		},
		{
			hostname: "www.rollingstone.com",
			params: [
				{ str: 'רולינג סטון' },
				{ telem: ".author", remove: ["By"] },
				[{ telem: "h1" }, { telements: ["h3:first, h4", " - "] }],
				{ url: 1, match: /rollingstone.com\/(.*)$/ },
				{ telem: ".date", match: /(\w+ \d+, \d+)/m, func: [engDateParse, dateFormat] }
			]
		},
		{
			hostname: "www.yeshiva.org.il", hrefmatch: /\/midrash\/shiur\.asp\?id=\d+/i,
			params: [
				{ str: 'אתר ישיבה1' },
				{ telem: ".trav", remove: ["הרב"] },
				{ telem: "h1" },
				{ urlparam: "id" }
			]
	},
		{
			hostname: "www.sport5.co.il",
			params: [
				{ str: 'ספורט 5' },
				{ telem: "#ContentPlaceHolder1_ancWriter, span#lblWriter2, #tdAuthorDateTime font", remove: ["מערכת אתר ערוץ הספורט"] },
				{ telem: "h1.article-main, h1#divTopTitle" },
				[
					{ url: 1, match: /Article\.\d+\.(\d+)\.html/ },
					{ url: 1, match: /docID=(\d+)/i }
				],
				[
					{ url: 1, match: /Article\.(\d+)\.\d+\.html/ },
					{ url: 1, match: /FolderID=(\d+)/i }
				],
				[{ telem: "#lblDate2", date: '/' }, { telem: ".hint", date: '.' }]
			]
		},
		{
			hostname: "britishpathe.com",
			hrefmatch: /britishpathe\.com/i,
			params: [
				{ str: 'British Pathe' },
				{ telem: "#record-container>h1", remove: ["video newsreel film"] },
				{ urlparam: 'id' },
				{ telem: "#researcher-stats td:eq(0)", date: '/' }
			]
		},
		{
			hostname: "www.idf.il",
			params: [
				{ str: 'אתר צה"ל' },
				{ telem: ".article-primary p strong:eq(0)", match: /(.+)\|/ },
				{ telem: "h1" },
				{ url: 'decodeURI', match: /idf\.il\/(.*)$/ },
				[
					{ telem: ".article-primary p strong:eq(0)", date: '.' },
					{ attr: ['meta[property="article:published_time"]', 'content'], match: /(\d+\s+.*?\s+\d{4})/ }
				]
			]
		},
		{
			hostname: "www.kikar.co.il",
			params: [
				{ str: 'כיכר השבת' },
				{ telem: ".article_buttons_field:first" },
				{ telem: "h1.article-title" },
				{ url: 'decodeURIComponent', match: /kikar\.co\.il\/(.*?)\.html$/i },
				{ telem: ".article_buttons_field:last", date: '.' }
			]
		},
		{
			hostname: "www.kipa.co.il",
			params: [
				{ str: 'כיפה' },
				{ telem: "author", remove: ["מערכת כיפה", ", כיפה"] },
				{ telem: "h1" },
				{ url: 1, match: /co\.il\/(.+)/ },
				{ telem: "#main_content > div > div.row.clearfix > div.col-lg-9.col-md-12.col-xs-12.pull-right > div.row > div.col-md-8.col-xs-12.pull-right.articleBody > div.fetured-img > div.row > div.col-sm-7.col-xs-12.pull-right > div > date > div > div.date"}
			]
		},
		{
			hostname: "www.hebpsy.net",
			params: [
				{ str: 'פסיכולוגיה עברית' },
				{ attr: ["meta[name='auhtor']", "content"] },
				{ telem: "h2.head" },
				{ urlparam: 'id' },
				{ telem: ".body_textarea:first > div:last", func: function (str) { arr = str.match(/(\d+)..([א-ת]+)..(\d+)/); return arr[1].replace(/^0+/, '') + " ב" + arr[2] + " " + arr[3]; } } //it's not space but other character
			]
		},
		{
			hostname: "www.hayadan.org.il",
			params: [
				{ str: 'הידען' },
				{ telem: "a[rel='author'], span.author, li[itemprop='author']", remove: ["מאת "] },
				{ telem: "h1.entry-title, h1.single-title, div.title-primary, span.breadcrumb_last" },
				{ url: 1, match: /https?:\/\/www.hayadan\.org\.il\/(.*?)$/i },
				[
					{ telem: "span.meta-date, span.date" },
					{ telem: ".entry-header .published" },
					{
						attr: ['meta[property="article:published_time"]', 'content'],
						func: function(s){return dateFormat(new Date(s).toLocaleDateString('he').split('.'))}, // just for after 22:00 articles as https://www.hayadan.org.il/colluns-astronauts-are-not-celebs-2307093
					}
				]
			]
		},
		{
			hostname: "hebrewbooks.org", hrefmatch: /org\/\d/,
			params: [
				{ str: 'HebrewBooks' },
				{ telem: "span.authorname" },
				{ telem: "span.sefername" },
				[{ urlparam: 'req' }, { url: 1, match: /hebrewbooks\.org\/(\d+)$/i }],
				{ prefix: "{{כ}}", telements: ["#cpMstr_lblHebPlace:first, #cpMstr_lblHebDate:first", " "] },
				{ urlparam: 'pgnum', prefix: 'עמוד=' }
			]
		},
		{
			hostname: "hebrewbooks.org", hrefmatch: /pgnum/,
			params: [
				{ str: 'HebrewBooks' },
				{ telem: "span.authorname" },
				{ telem: "span.sefername", remove: "-----" },
				[{ urlparam: 'req' }, { url: 1, match: /hebrewbooks\.org\/(\d+)$/i }],
				{ telements: ["#cpMstr_lblHebPlace:first, #cpMstr_lblHebDate:first", " "] },
				{ urlparam: 'pgnum', prefix: 'עמוד=' }
			]
		},
		{
			hostname: "www.izkor.gov.il", hrefmatch: /HalalKorot/i,
			params: [
				{ str: 'נזכור את כולם' },
				{ urlparam: "id" },
				{ attr: ['#ctl00_ctl00_MainContent_MainContent_HiddenFieldFullName', 'value'] },
				{ prefix: 'מלא=', str: 'כן' }
			]
		},
		{
			hostname: "tchelet.org.il",
			params: [
				{ str: 'תכלת' },
				{ telem: "h2 + a.author" },
				{ telem: "h2" },
				{ urlparam: "id" },
				{ telem: "#themag" }
			]
		},
		
		{
			hostname: 'www.nli.org.il',
			params: [
				[   {
						//just to reload ld+json
						func:function(){
							$('script[type="application/ld+json"]').remove()
							if (location.pathname == "/he/newspapers/") {
								window.canonical_url = $('link[rel="canonical"]').attr('href')
							} else {
								window.canonical_url = location.pathname;
							}
							var new_ldjson = $($.ajax({url:window.canonical_url, async:false}).responseText).filter('script[type="application/ld+json"]');
							console.log(new_ldjson)
							$('head').prepend(new_ldjson)	
						}
					},
					// { telem:'#breadcrumbscell li:nth-child(2)', match:/[\u2000-\u206F]*([^\u2000-\u206F]*)[\u2000-\u206F]*$/, } // name of the paper
					{ var:'canonical_url', match:/newspapers\/(.*?)\//, func:function(s){
						return {
						'omer': 'אמר',
						'ashnav': 'אשנב',
						'bamar': 'במערכה',
						'dav': 'דבר',
						'dhy': 'דואר היום',
						'hadt': 'האחדות',
						'haretz': 'הארץ1',
						'hbkr': 'הבקר',
						'hed': 'הד המזרח',
						'hzn': 'הזמן',
						'hazit': 'החזית',
						'hym': 'היום',
						'hayomw': 'היום וורשה',
						'hyt': 'היינט',
						'yarden': 'הירדן',
						'hcl': 'הכרמל',
						'hlb': 'הלבנון',
						'haa': 'המאסף',
						'hma': 'קואינקה',
						'mgd': 'המגיד',
						'hmd': 'המודיע',
						'hmi': 'המזרחי',
						'hmz': 'המליץ',
						'mzp': 'המצפה',
						'hmf': 'המשקיף',
						'haibri': 'העברי',
						'hebrew': 'שרהזאהן',
						'haolam': 'העולם',
						'ham': 'העם',
						'haam': 'העם עיתון לאומי',
						'hhr': 'הפועל הצעיר',
						'pisgoh': 'הפסגה',
						'ahj': 'החרות ירושלים',
						'hzv': 'הצבי',
						'hzh': 'הצופה',
						'hzfn': 'הצפון',
						'hzf': 'הצפירה',
						'has': 'השומר הצעיר ורשה',
						'hsk': 'השקפה',
						'zmanim': 'זמנים',
						'hzt': 'חבצלת',
						'hzan': 'חזית העם',
						'hrt': 'חרות',
						'ytlv': 'ידיעות תל אביב',
						'hayal': 'לחייל',
						'ltb': 'ליטערארישע בלעטער',
						'lmrv': 'למרחב',
						'lbf': 'לעבנס-פראגן',
						'dmt': 'מאמענט',
						'mrh': 'מוריה',
						'mad': 'מחזיקי הדת',
						'mar': 'מעריב',
						'sulm': 'סלם',
						'iva': 'עברי אנכי',
						'ahr': 'על המשמר',
						'emda': 'עמדה',
						'frw': 'פארווערטס',
						'khm': 'קול העם',
						'kmv': 'קול מבשר',
						'kmd': 'קול מחזיקי הדת',
						'shar': 'שערים',
					}[s.toLowerCase()]}},
				],
				{ ldjson:{raw:'author'}, func: function (str) { return window.prompt("שם מחבר", str!='N/A'?str:'') } },
				{ ldjson:{raw:'name'}, func: function (str) { return window.prompt("כותרת הדף", str) } }, // $('.pageblockselected').attr('title')
				{ var:'canonical_url', match:/newspapers\/\w+\/(\d+\/\d+\/\d+)\//, remove:'///'},
				{ var:'canonical_url', match:/article\/(\d+)(\/|$)/ },
			]
		},
		/*
		{
			hostname: 'www.nli.org.il',
			params: [
				{str: 'קישור כללי'},
				{ prefix:'אתר=', telem:'#breadcrumbscell li:nth-child(2)' },
				{ prefix:'כתובת=', url:1 },
				{ prefix:'הכותב=', telem:'script[type="application/ld+json"]', func: function (str) { var j=JSON.parse(str); return window.prompt("שם מחבר", j.author!='N/A'?j.author:'') }, },
				{ prefix:'כותרת=', telem:'script[type="application/ld+json"]', func: function (str) { var j=JSON.parse(str); return window.prompt("כותרת הדף", j.name) } },
				{ prefix:'תאריך=', telem:'script[type="application/ld+json"]', func: function (str) { var j=JSON.parse(str); return j.datePublished }, date:['-',[2,1,0]] },
				{ prefix:'עמודים=',  var: ['initialDisplayPageArea', 'pageID'], match:/^\d+\.(\d+)$/},
			]
		},
		*/
		{
			hostname: "www.pc.co.il",
			params: [
				{ str: 'אנשים ומחשבים' },
				{ telem: "span.author a" },
				{ telem: ".post_header > h2:nth-child(2)" },
				[{ urlparam: 'p' }, { url: 1, match: /\/(\d+)\/$/ }],
				{ telem: "span.date", match: /(\d+ ב[א-ת]+ \d+)/ }
			]
		},
		{
			hostname: "shironet.mako.co.il", hrefmatch: /type=lyrics/,
			params: [
				{ str: 'שירונט שיר' },
				{ urlparam: 'wrkid' },
				{ urlparam: 'prfid' },
				{ telem: '.artist_song_name_txt' },
				{ urlparam: 'lang', defvalue: '1' },
			]
		},
		{
			hostname: "shironet.mako.co.il", hrefmatch: /type=works/,
			params: [
				{ str: 'שירונט' },
				{ urlparam: 'prfid', prefix: 'מספר=' },
				{ telem: 'h1', prefix: 'שם=' }
			]
		},
		/* currently no page available in this format
		{
	
			hostname: 'www.sciam.co.il', hrefmatch: /archive/,
			params:[
				{str : 'סיינטיפיק אמריקן'},
				{telem: '#post-' + location.href.match(/(\d+)/)[1], match: / \/ (.+)/},
				{telem: '#post-' + location.href.match(/(\d+)/)[1], match: /(.+) \//},
				{url:1, match: /(\d+)/},
				{telem: '.postinfo', match:/בתאריך (.+) בשעה/},
			]
		},
		*/
		{
			hostname: 'www.sciam.co.il', hrefmatch: /%/,
			params: [
				{ str: 'סיינטיפיק אמריקן' },
				{ telem: '.author-name' },
				{ telem: '.entry-title' },
				{ url: 1, match: /il\/(.+?)\// },
				{ telem: '.entry-date', date: '.' },
			]
		},
		{
			hostname: "ratings.fide.com",
			params: [
				{ str: 'כרטיס פיד"ה' },
				{ urlparam: 'event', prefix: '' },
			]
		},
		{
			hostname: "www.db.yadvashem.org",
			params: [
				{ str: 'חסיד אומות העולם' },
				{ url: 1, match: /&itemId\=(\d+)/ },
			]
		},
		{
			hostname: "www.yadvashem.org",
			params: [
				{ str: 'חסיד אומות העולם' },
				{ url: 1, match: /stories\/([a-z]+)/ },
				{ prefix: 'עברית=', str: 'כן' },
			]
		},
		{
			hostname: "www.boxofficemojo.com",
			params: [
				{ str: 'מוג\'ו' },
				{ urlparam: 'id', match: /(.*?)\.htm/ },
			]
		},
		{
			hostname: /article.yedioth?.co.il/,
			params: [
				{ str: 'ידיעות אחרונות' },
				{ telem: '#lblAuthor' },
				{ telem: '#lblTitle' },
				{ urlparam: 'articleid' },
				{ telem: '#lblDatePublished', date: '.' }
			]
		},
		{
			hostname: "www.0404.co.il",
			params: [
				{ str: '0404א' },
				{ telem: '.post_admin' },
				{ telem: '.stitle' },
				{ urlparam: 'p' },
				{ telem: '.post_date', date: '/' },
			]
		},
		{
			hostname: "www.ch10.co.il",
			params: [
				{ str: 'חרדים10' },
				{ telem: '.author' },
				{ telem: '.main-post h1 a' },
				{ url: 1, match: /news\/(\d+)/ },
				{ telem: '.date', date: '.' },
			]
		},
		{
			hostname: 'www.iaa-archives.org.il',
			params: [
				{ str: 'רשות העתיקות' },
				{ str: '{{ס:' + "שם הדף בלי הסוגריים}}" },
				{ url: 1, match: /loc_id\=(\d+)/ },
				{ url: 1, match: /\?id\=(\d+)/ },
			]
		},
		{
			hostname: /(tmi|www)\.maariv\.co\.il/,
			params: [
				{ str: 'מעריב אונליין' },
				[
					{ telem: 'span.article-reporter a' },
					{ telem: 'a[rel=Author]' },
					{ telem: '.article-date-report-wrap', match: /^.*\|(.*)$/m },
					{ telem: 'span.article-reporter' },
					{ telem: 'span.tmi-article-reporter' } // tmi articles
				],
				[
					{ telem: '.article-title' },
					{ telem: 'h1.tmi-article-title' }, // tmi articles
				],
				{ url: 1, match: /co\.il\/(.*)/ },
				[
					{ telem: '.article-date-time, .article-he-date', date: '/' },
					{ telem: '.article-date-report-wrap', date: '/' },
					{ telem: '.article-publish-date', date: '/' },
					{ telem: 'div.tmi-article-reporter-date', date: '/'}, // tmi articles
				],
			]
		},
		{
			hostname: "www.onlife.co.il",
			params: [
				{ str: 'onlife' },
				{ telem: '.status a' },
				[{ telem: '.cafe_title' }, { attr: ["meta[name='dc.title']", "content"] }],
				{ url: 1, match: /www\.onlife\.co\.il\/(.*)$/ },
				{ telem: '.status em', date: '.' },
			]
		},
		{
			hostname: "davidson.weizmann.ac.il", hrefmatch: /online/,
			params: [
				{ str: 'דוידסון' },
				{ telem: 'span.name' },
				{ attr: ['meta[property="og:title"]', 'content'] },
				{ url: 1, match: /davidson\.weizmann\.ac\.il\/online\/(.*)$/ },
				{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] },
			]
		},
		{
			hostname: "alaxon.co.il",
			params: [
				{ str: 'אלכסון' },
				{ telem: '.author' },
				{ telem: 'h1' },
				{ url: 1, match: /alaxon\.co\.il\/(.*)$/ },
				{ attr: ["meta[property='article:published_time']", "content"], date:['-',[2,1,0]] },
			]
		},
		{
			hostname: "www.gvura.org",
			params: [
				{ str: 'אתר הגבורה' },
				{ telem: 'h1' },
				{ attr: ['input[name=hdaid]', 'value'] },
			]
		},
		{
			hostname: "www.srugim.co.il",
			params: [
				{ str: 'סרוגים' },
				{ telem: '.post_author', match: /(.+?)\d/, remove: [', חדשות סרוגים', 'חדשות סרוגים'] },
				{ telem: 'h1' },
				{ url: 1, match: /\.srugim\.co\.il\/(.*)$/ },
				{ telem: '.post_details', date: '.' },
			]
		},
		{
			hostname: 'otzar.org',
			params: [
				{ str: 'אוצר החכמה' },
				[
					{ urlparam: 'book', func: function(bookid){
						if (!bookid) try{bookid = $('#book-iframe').attr('src').match(/book=(\d+)/)[1]}catch{}
						if (bookid && location.hostname == 'tablet.otzar.org' ) {
							window.detail_data = 
								JSON.parse($.post({url:'//tablet.otzar.org/he/php/detailBook.php', async: false,
									data:'{"ParamQuery":"{\\"NUMBOOK\\":\\"'+bookid+'\\",\\"USERDATAID\\":0}","sqlFile":"selectSubOfBook"}'}
								).responseText).arr[0];
						} else if (window.booknameS && window.authorS){
							bookid = bookid || window.bookid;
							window.detail_data = {
								AUTHOR: authorS,
								FULLNAME: booknameS,
								bookid: bookid,
							}
						} else {
							bookid = bookid || window.bookid;
							var parts = $('title').text().replace('  - אוצר החכמה','').split('/');
							window.detail_data = {
								AUTHOR: parts[1],
								FULLNAME: parts[0],
								YEAR: parts[2],
								PrintedP_AND_YEAR: parts[0].split('-')[1],
								bookid: bookid,
							}
						}
					}}, // TODO: hack to have all the info ready in tablet page
					{ var: ['detail_data', 'AUTHOR']},
				],
				{ var: ['detail_data','FULLNAME']},
				{ var: ['detail_data','bookid']},
				[
					{ var: ['detail_data', 'PrintedP_AND_YEAR']},
					{ func: function () {
						return [
							window.detail_data['PrintedP'].match(/[\u0590-\u05FF ]+/)[0],
							window.detail_data['YEAR'],
						].join(' ')
					}},
					{ var: ['detail_data', 'YEAR']},
				],
				{ str: '' },
				[
					{ attr: ["ab", "value"], match: /^([^ ]*) /, prefix: 'עמוד=' },
					{ elem: ["#ab", "val"], prefix: 'עמוד=', match: /^(\d+) / },
					{ urlparam: 'pagenum', prefix: 'עמוד=' }
				],
			]
		},
		{
			hostname: "www.davar1.co.il",
			params: [
				{ str: 'דבר ראשון' },
				{ attr: ['section', 'data-author_name'] },
				{ telem: '.headline' }, // it might be {attr:['section', 'data-article_title']},
				{ url: 1, match: /www\.davar1\.co\.il\/(\d+)/ },
				{ attr: ['meta[itemprop="dateCreated"]', 'content'], date: '.' },
			]
		},
		{
			hostname: "www.youtube.com", hrefmatch: /youtube\.com\/watch\?v=.*/i,
			params: [
				{ str: "יוטיוב" },
				{ urlparam: "v" },
				{ telem: "h1", prefix: "שם=" },
				{ telem: ".ytp-time-duration", prefix: "אורך=" },
			]
		},
		{
			hostname: "www.forbes.co.il",
			params: [
				{ str: "פורבס" },
				{ telem: "#divforprint td.date", match:/.*\|(.*)$/ },
				{ telem: "h1.newsTitle"},
				{ url:1, match:/\?(.*)$/, prefix:'3=' },
				{ telem: "#divforprint td.date", date:'/' , prefix:'4='},
			]
		},
		{
			hostname: "supremedecisions.court.gov.il",
			params: [
				[	
					{func:function(){
						var f = function(body_j, head_j){
							window.body_j = body_j; // just for debug
							window.head_j = head_j; // just for debug
							window.all_text = body_j.text();
							if (!window.all_text)
								return
							window.parsed_data = {
								OTTER:
									body_j.find('td:contains("העותר:"):first + td:first').first().text() ||
									body_j.find('td:contains("העותרת:"):first + td:first').first().text() ||
									body_j.find('td:contains("המערער:"):first + td:first').first().text() ||
									body_j.find('td:contains("המערערת:"):first + td:first').first().text() ||
									body_j.find('td:contains("המבקש:"):first + td:first').first().text()||
									body_j.find('td:contains("המבקשת:"):first + td:first').first().text(),
								MESHIV:
									body_j.find('td:contains("המשיב:"):first + td:first').first().text() ||
									body_j.find('td:contains("המשיבה:"):first + td:first').first().text(),
								OTTERS:
									head_j.find('meta[name="side_nm"]').map(function(m){
										return head_j.find('meta[name="side_ty"]:eq('+m+')').attr('content') == "תביעה" ? [
												$(this).attr('content')
										] : []
									}).toArray(),
							}
							if (window.parsed_data.OTTERS && !window.parsed_data.OTTER){
								window.parsed_data.OTTER = (window.parsed_data.OTTERS.length > 1) ?
								(window.parsed_data.OTTERS[0].trim() + ' ואחרים') :
								(window.parsed_data.OTTERS[0])
							}
						}
						if (!window.all_text){
							f($('body'), $('head'));
						}
						if (!window.all_text){
							var xhr = new XMLHttpRequest();
							xhr.open('GET', location.href.replace('type=4','type=2'), true);
							xhr.responseType = 'arraybuffer';
							xhr.onload = function(e) {
								if (this.status == 200) {
									console.log('this.response', this.response, this)
									var jo;
									if (new Uint8Array(this.response).indexOf(0) < 0){
										var text = new TextDecoder("windows-1255").decode(this.response)
									} else {
										var text = new TextDecoder("UTF-16LE").decode(this.response)
									}
									var head_as_div = '<div id="head>'+text.replace(/^[\s\S]*<head.*?>|<\/head>[\s\S]*$/ig, '')+'</div>';
									var body_as_div = '<div id="body>'+text.replace(/^[\s\S]*<body.*?>|<\/body>[\s\S]*$/ig, '')+'</div>';
									f($(body_as_div), $(head_as_div))
									if (window.all_text)
										wikiit(undefined, 1);
								} else {
									window.all_text = 'Error! ' + this.status
								}
							};
							window.popup_template_canceled = true;
							xhr.send();
						}
					}}, //TODO: trick to have all the text
					{ str: "פס\"ד עליון" },
				],
				{ prefix:'קישור=', urlparam: 'fileName'},
				{ prefix:'סוג=', var: 'all_text', match: /([^\s]+?)[\s]+\d+\/\d+/m},
				[
					{ prefix:'עותר=', var:['parsed_data', 'OTTER']},
					{ prefix:'עותר=', var: 'all_text', match: /המבקש(?:ים|ות)\:\s*1\.([\s\S]]+?)2\./m, func:function(s){return s && (s.trim()+' ואחרים')}},
					{ prefix:'עותר=', var: 'all_text', match: /העותר(?:ים|ות)\:\s*1\.([\s\S]+?)2\./m, func:function(s){return s && (s.trim()+' ואחרים')}},
					{ prefix:'עותר=', var: 'all_text', match: /המערער(?:ים|ות)\:\s*1\.([\s\S]+?)2\./m, func:function(s){return s && (s.trim()+' ואחרים')}},
				],
				[
					{ prefix:'משיב=', var:['parsed_data', 'MESHIV']},
					{ prefix:'משיב=', var: 'all_text', match: /המשיב(?:ים|ות)[\s\S]*?1\.([\s\S]+?)2\./m, func:function(s){return s && (s.trim()+' ואחרים')}},
				],
				[
					{ prefix:'ניתן ב=', var: 'all_text', match: /ניתן\s+היום,.*?\((.*?)\)/m, date:'.'}, // https://supremedecisions.court.gov.il/Home/Download?path=HebrewVerdicts\11/850/019/o24&fileName=11019850.o24&type=4
					{ prefix:'ניתן ב=', var: 'all_text', match: /ניתנה\s+היום,.*?\((.*?)\)/m, date:'.'}, // https://supremedecisions.court.gov.il/Home/Download?path=HebrewVerdicts\16/240/062/02c&fileName=16062240.02c&type=4
					/*{ prefix:'ניתן ב=', var: 'all_text', match: /תאריך הישיבה:.*?(\d+\.\d+\.\d+)/ms, date:'.'},*/
				]
			]
		},
		{
			hostname: "www.colbonews.co.il",
			params: [
				{str:'כלבו'},
				{telem:'#post_author', remove:['מאת:']},
				{url:1, match:/www\.colbonews\.co\.il\/(.*)\/$/},
				{telem:'#post_h1'},
				{telem:'#post_time', date:'.'},
			]
		},
		{
			hostname: "space.gov.il",
			params :[
				{str: "סלה"},
				{telem: "hrf"}, 
				{telem: "h1"},
				{url:1, match:/(\d+)$/},
				{telem: "span.date-display-single", date:'.'},
			]
		},
		{

			hostname: "lib.cet.ac.il",
			params:[
				{str: "מטח"},
				{telem: ".TitleText", match: /מחבר.*?\:([\S\s]*)$/}, 
				{telem: "title"}, 
				{urlparam: "item"},
			]
			},
			{
				hostname: "jdn.co.il",
				params:[
				{str: "JDN"},
				{telem: "#cb-featured-image  span.cb-author"},
				{telem: ".entry-title"},
				{url:1, match:/\/(\d+)\//},
				{telem:'#cb-featured-image time.updated', date:'.'}
				]
			},
			{
			hostname: "google\.co.*", hrefmatch:/google.*?\/maps/,
			params:[
				{str: "coord"},
				[{telem: ".widget-reveal-card-open .link-like.widget-reveal-card-lat-lng", match:/(-?[\d\.]+), /}, {url:1, match:/([\d\.]+)!..[\d\.]+$/}, {url:1, match:/@(-?[\d\.]+),/}], //order does matter
				[{telem: ".widget-reveal-card-open .link-like.widget-reveal-card-lat-lng", match:/-?[\d\.]+, (-?[\d\.]+)/}, {url:1, match:/[\d\.]+!..([\d\.]+)$/}, {url:1, match:/@-?[\d\.]+,(-?[\d\.]+),/}] //order does matter
			]
		},
	];
	for (var i = 0; i < data.length; i++) {
		if (
			location.hostname.match(data[i].hostname)
			&& (!data[i].hrefmatch || location.href.match(data[i].hrefmatch))
			&& (!data[i].condition || data[i].condition())
		) {
			var params = [];
			for (var j = 0; j < data[i].params.length; j++) {
				if (!(data[i].params[j] instanceof Array)) {
					data[i].params[j] = [data[i].params[j]];
				}
				for (var k=0; k < data[i].params[j].length; k++) {
					try {
						var curParam = data[i].params[j][k];
						params[j] = '';
						if (typeof curParam.str != "undefined") {
							params[j] = curParam.str;
						} else if (typeof curParam.ldjson != "undefined") {
							var ldjson = null
							var ldjsons = $('script[type="application/ld+json"]').map(function(i,e){return JSON.parse($(e).text())})
							if (typeof curParam.ldjson.n != "undefined"){
								ldjson = ldjsons[curParam.ldjson.n]
							} else {
								var filteredLdjson = ldjsons.filter(function(i,e){return (curParam.ldjson.type?[curParam.ldjson.type]:['NewsArticle','Article']).includes(e['@type'])})
								if (filteredLdjson.length == 1){
									ldjson = filteredLdjson[0]
								} else {
									console.error("more/less than single ldjson", filteredLdjson)
									return
								}
							}
							if (curParam.ldjson.key == "datePublished"){
								params[j] = ldjson.datePublished;
								if (!curParam.date){
									curParam.date = ['-', '210']
								}
							} else if (curParam.ldjson.key == "author"){
								params[j] =
									$.map($(ldjson.author), function(a){return a.name})
									.join(VE)
							} else if (typeof curParam.ldjson.raw != "undefined"){
								if (!(curParam.ldjson.raw instanceof Array)) {
									curParam.ldjson.raw = [curParam.ldjson.raw]
								}
								params[j] = ldjson
								for (var t=0; t < curParam.ldjson.raw.length; t++){
									console.log('curParam.ldjson.raw[t]', curParam.ldjson.raw[t])
									params[j] = params[j][curParam.ldjson.raw[t]];
								}
							}
							
						} else if (typeof curParam.url != "undefined") {
							params[j] = location.href;
							if (curParam.url == 'decodeURIComponent')
								params[j] = decodeURIComponent(params[j])
							else if (curParam.url == 'decodeURI')
								params[j] = decodeURI(params[j])
						} else if (typeof curParam.attr != "undefined"){
							params[j] = jQuery('html').find(curParam.attr[0]).attr(curParam.attr[1]);
						} else if (typeof curParam.var != "undefined") {
							if (!(curParam.var instanceof Array))
								curParam.var = [curParam.var]
							params[j] = window;
							for (var vi=0; vi < curParam.var.length; vi++) {
								params[j] = params[j][curParam.var[vi]]
								// console.log(vi, params[j], curParam.var[vi])
								if (!params[j])
									break
							}
							if (params[j] == window)
								params[j] = undefined
						}
						else if (typeof curParam.urlparam != "undefined") {
							params[j] = getParameterByName(curParam.urlparam) || "";
						} else if (typeof curParam.elem != "undefined") {
							if (curParam.elem instanceof Array) {
								params[j] = jQuery('html').find(curParam.elem[0]);
								for (var elemIdx = 1; elemIdx < curParam.elem.length; elemIdx++) {
									var func = curParam.elem[elemIdx].split(',');
									params[j] = (func.length > 1) ? params[j][func[0]](func[1]) : params[j] = params[j][func[0]]();
								}
								if (typeof (params[j]) != "string")
									params[j] = params[j].html();
							}
							else
								params[j] = jQuery('html').find(curParam.elem).html();
						}
						else if (typeof curParam.first_text_node != "undefined"){
							params[j] = jQuery('html').find(curParam.first_text_node).contents().filter(function () { return this.nodeType === 3 }).text()
						} else if (typeof curParam.elements != "undefined" || (typeof curParam.telements != "undefined")) {
							var sep;
							if (typeof curParam.elements != "undefined"){
								params[j] = jQuery('html').find(curParam.elements[0]).map(function (el) { return $(this).html(); }).toArray()
								sep = curParam.elements[1];
							}
							if (typeof curParam.telements != "undefined"){
								params[j] = jQuery('html').find(curParam.telements[0]).map(function (el) { return $(this).text(); }).toArray();
								sep = curParam.telements[1];
							}
							if (sep != VE){ // hack for VE
								params[j] = params[j].join(sep);
							} else {
								if (params[j].length > 2){
									params[j] = [params[j].slice(0,-1).join(', '), params[j].slice(-1)].join(sep);
								} else {
									params[j] = params[j].join(sep);
								}
							}
						}
						else if (typeof curParam.telem != "undefined") {
							params[j] = jQuery('html').find(curParam.telem).first().text().trim();
						}

						if (typeof curParam.match != "undefined") {
							if (!(curParam.match instanceof Array))
								params[j] = match(params[j], curParam.match);
							else for (var patIdx = 0; patIdx < curParam.match.length; patIdx++) {
								temp = match(params[j], curParam.match[patIdx]);
								if (temp != '') {
									params[j] = temp;
									break;
								}
							}
						}


						if (typeof curParam.remove != "undefined")
							for (var removeIdx = 0; removeIdx < curParam.remove.length; removeIdx++)
								params[j] = params[j].replace(curParam.remove[removeIdx], "");

						if (typeof curParam.split != "undefined")
							params[j] = params[j].split(curParam.split);


						if (typeof curParam.func != "undefined") {
							if (!(curParam.func instanceof Array))
								curParam.func = [curParam.func];
							for (var funcIdx = 0; funcIdx < curParam.func.length; funcIdx++) {
								params[j] = curParam.func[funcIdx](params[j]);
							}
						}
						if (typeof curParam.date != "undefined") {
							if (!(curParam.date instanceof Array))
								curParam.date = [curParam.date, [0,1,2]];
							var sep = curParam.date[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
							params[j] = match(params[j], RegExp(('(\\d+' + sep + '\\d+' + sep + '\\d+)')))
							if (params[j]){
								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] = dateFormat(params[j]);
							}
						}
						if (typeof params[j] == "string") {
							try {
								params[j] = jQuery.trim(decodeURIComponent(params[j])) //TODO:
							} catch(e) {
								console.error(e)
							}
							params[j] = params[j]
							.replace(/&nbsp;|\u202B-\u202d/gm, " "
							.replace(/\s+/gm, ' '))
							.replace(/=/g, "{{=}}")
							.replace(/(\|\|?)/gm, function (x) { return "{{" + x.replace(/\|/g, "!") + "}}" })
							.replace(/(\|\|?)/gm, function (x) { return "{{" + x.replace(/\|/g, "!") + "}}" });
						}
						else if (jQuery.isArray(params[j])) {
							params[j] = jQuery.trim(params[j].join("|"));
						}

						if (params[j] && typeof curParam.prefix != "undefined")
							params[j] = curParam.prefix + params[j];

						if (typeof curParam.defvalue != "undefined" && params[j] == curParam.defvalue)
							params[j] = '';

						if (typeof curParam.shouldnt != "undefined" && typeof params[j] == "string" && params[j].match(curParam.shouldnt))
							params[j] = '';


						if ((params[j] != '') && (params[j] != undefined)) {
							console.log('found', j, params[j])
							break;
						}
						console.log('not found', j, curParam)
					}
					catch (e) {
						console.error(e)
					}
				}
			}


			var minimum = (typeof data[i].minimum != "undefined") ? (data[i].minimum) : (0);

			while (params[params.length - 1] == "" && params.length > minimum) //remove all last empty params
				params.pop();


			if (window.popup_template_canceled && !force_popup){
				console.log('popup_template_canceled');
			} else {
				var result = '{{' + params.join('|') + '}}'
				if (prompt("לחיצה על אישור תעתיק את התבנית:", result) != null){
					$('<input>').val(result).appendTo('body').select();document.execCommand('copy');
				}
				window.popup_template_canceled = false;
				if (window.old$) {window.$ = window.old$;}
			}
			return
		}
	}
	
	try {
		var ldjson = $('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'])})
		var ldjson_website = [{}]
		//saw on 0404 and hwzone
		if (ldjson.length == 0){
            ldjson = $('script[type="application/ld+json"]').map(function(i,e){return JSON.parse($(e).text())}).filter(function(i,e){return e['@graph']})
            if (ldjson.length == 1){
                ldjson_website = ldjson[0]['@graph'].filter(function(i,e){return ['WebSite'].includes(i['@type'])})
                ldjson = ldjson[0]['@graph'].filter(function(i,e){return ['WebPage'].includes(i['@type'])})
            }
		}

		console.log('ldjson:', ldjson)
		if (ldjson.length == 1){
			ldjson = ldjson[0]
			var date = new Date(ldjson.datePublished)
			if (isNaN(date)){
				// for example in Israel Hayom
				date = new Date(ldjson.publisher.datePublished)
			}
			console.log('date', date)
			var general = {
				'הכותב': $.map($(ldjson.author), function(a){return a.name}).join(VE),
				'כותרת': ldjson.name || ldjson.headline,
				'אתר': (ldjson.publisher||ldjson_website[0]).name,
				'תאריך': dateFormat([''+date.getDay(), ''+date.getMonth(), ''+date.getFullYear()]),
				'כתובת': location.href
			}
			var result = '{{קישור כללי|'+$.map(general, function(v,k){
				return k + '=' +  jQuery.trim(decodeURIComponent($('<a />').html(v).text())).replace(/&nbsp;|\u202B-\u202d/gm, " "
					.replace(/\s+/gm, ' '))
					.replace(/=/g, "{{=}}")
					.replace(/''/g, '"')
					.replace(/(\|\|?)/gm, function (x) { return "{{" + x.replace(/\|/g, "!") + "}}" })
					.replace(/(\|\|?)/gm, function (x) { return "{{" + x.replace(/\|/g, "!") + "}}" })
			}).join('|') + '}}'
			if (prompt("לחיצה על אישור תעתיק את התבנית:", result) != null){
				$('<input>').val(result).appendTo('body').select();document.execCommand('copy');
			}
			if (window.old$) {window.$ = window.old$;}
			return
		}
	} catch (e){
		console.error('failed to create general link', e)
	}

	alert("אתר או עמוד זה אינו נתמך על ידי הבוקמרקלט.");
	if (window.old$) {window.$ = window.old$;}
}
(function () {
	if (typeof (jQuery) == "undefined"){
		if (typeof ($) != "undefined"){
			window.old$ = window.$;
			console.log('store old dollar')
		}
		var s = document.createElement('script');
		s.setAttribute('src', "https://he.wikipedia.org/w/load.php?modules=jquery&only=scripts");
		s.onload = wikiit;
		document.getElementsByTagName('body')[0].appendChild(s);
	} else {
		wikiit()
	}
})();