מדיה ויקי:Common.js/externalsmaker.js

מתוך ויקיפדיה, האנציקלופדיה החופשית

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
/* 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, ' '));
	}

	function cleanText(text) {
		return text
			.replace(/&nbsp;|\u202B-\u202d/gm, " "
				.replace(/\s+/gm, ' '))
			.replace(/&[mn]dash;/g, '-')
			.replace('&quot;', '"')
			.replace('&nbsp;', ' ')
			.replace('״', '"')
			.replace('׳', "'")
			.replace(/(\n|\r)/g, ' ')
			.replace(/=/g, "{{=}}")
			.replace(/''/g, '"')
			.replace(/((?<!עיתונות)\|\|?)/gm, function (x) { return "{{" + x.replace(/\|/g, "!") + "}}"; })
			.replace(/[\u200B\u200E\u200F\u2028\u202A\u202B\u202C\u202D\u202E]/g, '') // remove invisible Unicode control characters
			.replace(/ {2,}/g, ' ');
	}

	function getWikiLink() {
		var nms = {
				'he.wikipedia.org': '',
				'he.wikibooks.org': 'b:',
				'he.wikinews.org': 'n:',
				'he.wikiquote.org': 'q:',
				'he.wikisource.org': 's:',
				'he.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) {
			var result = '[[' + wikitype + wikiarticle + (wikitype ? '|' + wikiname.textContent : '') + ']]';
			if (prompt("לחיצה על אישור תעתיק את התבנית:", result) != null) {
				$('<input>').val(result).appendTo('body').select();document.execCommand('copy');
			}
			return true;
		}
		return false;
	}

	if (window.location.host.indexOf('he.wik') == 0) {
		if (getWikiLink()) {
			return true;
		}
	}

	var VE = ', ',
		TODAY = 'היום',
		YESTERDAY = 'אתמול';

	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", remove: ['ynet'] },
					{ attr: ["meta[property='vr:author']", 'content'], remove: ['מערכת ONE'] }
				],
				[
					{ telem: '.art_header_title' },
					{ attr: ["meta[property='og:title']", "content"] },
					{ elem: 'head>title', match: /(?:ynet\s*-?)?([^\-]*)/ },
					{ telem: 'h1' }
				],
				[
					{ url: 1, match: /L-(.*?),/ },
					{ url: 1, match: /co\.il\/(.*)/ }
				],
				[
					{ elem: 'td:has(h1:first) .text12g:last', date: '.' },
					{ elem: ".text12g + .text12g", date: '.' },
					{ elem: ".art_header_footer_author:last", date: '.' },
					{ elem: ".ArticleHeaderComponent .date", date: '.'},
					{ elem: ".authoranddate .date", date: '.'},
					{ elem: ".authoranddate .date", stringDate: true, func: function(s) { return !s || s.indexOf('אתמול') > -1 ? YESTERDAY : TODAY; } }, // contains "אתמול" for yesterday, nothing for today
					{ elem: ".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' },
				{ attr: ["meta[property='channel-name']", "content"] , 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" },
				{ url: 1, match: /L-(.*?),/ },
				[
					{ telem: ".BlogInfo,.author.clearFix cite,.time", date: '.' },
					{ telem: ".launch_date_time", date: '.' }
				],
				{ str: '' },
				{ url: 1, match: /articles\/(\d+),/, defvalue: '0' }
			]
		},
		{
			hostname: "pplus.ynet.co.il",
			params: [
				{ str: 'פנאי פלוס' },
				{ telem: 'div.authors > span' },
				{ telem: 'h1.mainTitle' },
				{ url: 1, match: /article\/(.*)$/ },
				{ telem: 'span.DateDisplay', date: '.' }
			]
		},
		{
			hostname: /^\w+\.walla\.co\.il$/,
			params: [
				{ str: 'וואלה' },
				[
					{ telem: 'div.writers-names' },
					{ telem: 'div.author' },
					{ telem: '.info .author:first, .provider', match: /^([^\|]*)/ },
					{ telem: 'div.wp-0-b:first span:first', match: /מאת:(.*),/ },
					{ telem: '.author > div', match: /^([^\|]*)/, remove: ['מערכת וואלה! ספורט'] }
				],
				{ attr: ["meta[property='og:title']", "content"], remove: [ / - וואלה!.*/ ] },
				[
					{ url: 1, match: /item\/(\d+)/ },
					{ url: 1, match: /w=\/\d*\/(\d+)/ },
					{ url: 1, match: /break\/(\d+)/ }
				],
				[
					{ ldjson: { key: 'datePublished' } },
					{ telem: '.info .date:first', match: /, (\d+ ב.*? \d+),/ },
					{ elem: ["h1", "parent", "children", "eq,2"], match: /,(.*),/, shouldnt: "online_presence" },
					{ telem: ".w2.txt-w:last", match: /, (\d+ ב.*? \d+),/ }
				]
			]
		},
		{
			hostname: "www.haaretz.co.il",
			params: [
				{ str: 'הארץ' },
				[
					{ var: ['articlePage', 'dimension1'] },
					{ telements: ["header address", VE] },
					{ telem: 'address > a' },
					{ attr: ["meta[name='author']", "content"] },
					{ telem: 'address' }
				],
				[
					{ telem: 'header h1' },
					{ attr: ['meta[property="og:title"]', 'content'] }
				],
				{ url: 1, match: /([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/, addParam: 'gift' },
				[
					{ telem: "header time", date: '.' },
					{ telem: 'time', date: '.' },
					{ telem: 'time', remove: [ /\d\d\:\d\d\, / ], removeDatePadding: true }
				]
			]
		},
		{
			hostname: "www.ice.co.il",
			params: [
				{ str: 'אייס' },
				{ telem: '#article-container div.credit span:first a', remove: ['מערכת ice'] },
				{ 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: '.name'}
				],
				[
					{ telem: '.story_title' },
					{ telem: '#progName'},
					{ attr: ["meta[property='og:title']", "content"] }
				],
				{ url: 1, match: /(\d+)/ },
				[
					{ telem: '.story_autor_date' },
					{ telem: '.player_time', date: '.' },
					{ attr: ["div[class='date date-local']", "data-date-utc"], date: '.' },
					{ attr: ["*[class='date-local']", "data-date-utc"], date: '.' }
				],
				{ url: 1, match: /org\.il\/(.+?)\// }
			]
		},
		{
			hostname: "archive.kan.org.il",
			params: [
				{ str: 'כאן ארכיון' },
				{ attr: ["meta[property='og:title']", "content"], remove: ['כאן ארכיון |'] },
				{ url: 1, match: /(\d+)/ },
				{ telem: 'span.itemPageDate', remove: ['תאריך שידור:'], date: '.' }
			]
		},
		{
			hostname: "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: "13news.co.il", hrefmatch: /ntr\-/i,
			params: [
				{ str: 'נענע10' },
				{ telem: '#author-and-date > ul', remove: ['חדשות nana10']},
				{ telem: '#article-title' },
				{ url: 1, match: /il\/.*\/ntr-(\d+)/ },
				{ telem: '.time-updated', date: '.' }
			]
		},
		{
			hostname: "(13news.co.il|13tv.co.il)",
			params: [
				{ str: 'חדשות 13' },
				{ ldjson: { key: 'author' } },
				[
					{ telem: 'h1#article-title' },
					{ telem: 'h1' }
				],
				[
					{ url: 1, match: /il\/(.*?)\/$/ },
					{ attr:['meta[property="og:url"]', 'content'], match:/il\/(.*?)\/$/}
				],
				[
					{ 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: '.article-credit--author', remove: ['ערוץ 7'] },
					{ telem: '.article-info--author', remove: ['ערוץ 7'] }
				],
				{ telem: 'h1.article-title' },
				{ url: 1, match: /^.*\/(.*)$/ },
				[
					{ telem: '.article-date-gregorian', date: '.' },
					{ telem: '.article-date-gregorian-date', date: '.' }
				]
			]
		},
		{
			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: 'בחדרי חרדים' },
				{ ldjson: { key:'author' } },
				{ attr: ["meta[property='og:title']", "content"] },
				[
					{ url: 1, match: /news\/(\d+)/ },
					{ var: 'userid' }
				],
				{ ldjson: { key:'datePublished' } }
			]
		},
		{
			hostname: "www.now14.co.il",
			params: [
				{ str: 'עכשיו 14' },
				{ telem: '.author-zone', remove: ['חדשות 14'] },
				{ telem: '.post-title' },
				{ url: 1, match: /il\/(.+?)\// },
				{ telem: '.date-zone', date: '/' }
			]
		},
		{
			hostname: "iaf.org.il",
			params: [
				{ str: 'אתר חיל האוויר' },
				[
					{ telem: '#ctl00_headerCPH_uc_newStyleHeader_divOuther' },
					{ telem: '.credits_line > .line' }
				],
				[
					{ telem: '#ctl00_ContentPlaceHolder1_general_h2Title' },
					{ telem: '.inner_bit_page_text_holder > h2' },
					{ attr: ["meta[name='og:title']", "content"] }
				],
				{ url: 1, match: /(\d+-\d+)-/ },
				[
					{ telem: '#ctl00_headerCPH_uc_newStyleHeader_publishDate', date: '.' },
					{ telem: '.curr_issue_title > ._date', 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 > a", 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'] },
					{ elem: '.single-post-meta-dates > time', date: '/' },
					{ elem: '.time', date: '.' }
				]
			]
		},
		{
			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:'/'},
					{ telem: 'time', remove: [ /\d\d\:\d\d\, / ], removeDatePadding: true }
				],
				{ 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+)/},
					{ url: 1, match: /calcalist\.co\.il\/(.*?\/article\/.*)/i }
				],
				[
					{ telem: ".art-publish-date.afor > .l-date:last", date: '.' },
					{ telem: ".calcalistArticleHeader_footer .date", date: '.'}
				]
			]
		},
		{
			hostname: "newmedia.calcalist.co.il",
			params: [
				{ str: 'מוסף כלכליסט' },
				{ telem: ".credit" },
				[
					{ telem: "div.head-container > h1.head-2" },
					{ attr: ['meta[property="og:title"]', 'content'], remove: [' | מוסף כלכליסט'] }
				],
				{ url: 1, match: /\.il\/magazine-(.*?)\.html/ }
			]
		},
		{
			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: 'רולינג סטון' },
				{ ldjson: { key: 'author' } },
				{ ldjson: { raw: 'headline' } },
				{ url: 1, match: /rollingstone.com\/(.*)$/ },
				{ ldjson: { key: 'datePublished' } }
			]
		},
		{
			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' },
				{ ldjson: { key: 'author' }, 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" },
				[
					{ attr: ["body.minisite", "data-uid"] },
					{ 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})/ },
					{ telem: ".rating-article > .rating-item", date: '.' }
				]
			]
		},
		{
			hostname: "www.kikar.co.il",
			params: [
				{ str: 'כיכר השבת' },
				{ attr: ["meta[name='author']", "content"] },
				{ telem: 'h1.MuiTypography-h1' },
				[
					{ url: 1, match: /il\/.*?\/(\d*)/ },
					{ url: 1, match: /il\/(.*)/ }
				],
				{ attr: ["meta[name='article:published_time']", "content"], date:['-', '210'] },
			]
		},
		{
			hostname: "www.kipa.co.il",
			params: [
				{ str: 'כיפה' },
				{ telem: "author", remove: ["מערכת כיפה", ", כיפה"] },
				{ telem: "h1" },
				{ url: 1, match: /co\.il\/(.+)/ },
				{ telem: "p.scheme-author > span", 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) { var 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: 'היברובוקס' },
				{ 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: 'היברובוקס' },
				{ 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);
						}
					},
					{ var:'canonical_url', match:/newspapers\/(.*?)\//, func:function(s) { return {
						'ahj': 'החרות ירושלים',
						'ahr': 'על המשמר',
						'ajns': 'עיתונות|ajns',
						'ashnav': 'אשנב',
						'bamar': 'במערכה',
						'dav': 'דבר',
						'dhy': 'דואר היום',
						'dmt': 'מאמענט',
						'dnajlb': 'עיתונות|dnajlb',
						'emda': 'עמדה',
						'eretzh': 'עיתונות|eretzh',
						'frw': 'פארווערטס',
						'haa': 'המאסף',
						'haam': 'העם עיתון לאומי',
						'hadashot': 'חדשות',
						'hadorkrakow': 'עיתונות|hadorkrakow',
						'hadt': 'האחדות',
						'haibri': 'העברי',
						'ham': 'העם',
						'haolam': 'העולם',
						'haretz': 'הארץ1',
						'has': 'השומר הצעיר ורשה',
						'haschiloah': 'השילוח1',
						'hayal': 'לחייל',
						'hayomisr': 'עיתונות|hayomisr',
						'hayomw': 'היום (ורשה)',
						'hazit': 'החזית',
						'hbkr': 'הבקר',
						'hcl': 'הכרמל',
						'hebrew': 'שרהזאהן',
						'hed': 'הד המזרח',
						'hegeh': 'עיתונות|hegeh',
						'hhr': 'הפועל הצעיר',
						'hlb': 'הלבנון',
						'hma': 'קואינקה',
						'hmd': 'המודיע',
						'hmf': 'המשקיף',
						'hmi': 'המזרחי',
						'hmz': 'המליץ',
						'hrt': 'חרות',
						'hsk': 'השקפה',
						'hym': 'היום',
						'hyt': 'היינט',
						'hzan': 'חזית העם',
						'hzf': 'הצפירה',
						'hzfn': 'הצפון',
						'hzfwar': 'עיתונות|hzfwar',
						'hzh': 'הצופה',
						'hzn': 'הזמן',
						'hzt': 'חבצלת',
						'hzv': 'הצבי',
						'iva': 'עברי אנכי',
						'khm': 'קול העם',
						'kmd': 'קול מחזיקי הדת',
						'kmv': 'קול מבשר',
						'kolhair': 'כל העיר1',
						'kotert': 'כותרת ראשית',
						'ktuvim': 'כתובים',
						'lbf': 'לעבנס-פראגן',
						'lmrv': 'למרחב',
						'ltb': 'ליטערארישע בלעטער',
						'mad': 'מחזיקי הדת',
						'mar': 'מעריב',
						'mgd': 'המגיד',
						'mrh': 'מוריה',
						'mzp': 'המצפה',
						'omer': 'אמר',
						'pisgoh': 'הפסגה',
						'shar': 'שערים',
						'sulm': 'סלם',
						'yarden': 'הירדן',
						'yomyom': 'יוםיום',
						'ytlv': 'ידיעות תל אביב',
						'zmanim': 'זמנים'
					}[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+\.?\d*)(\/|$)/ }
			]
		},
		{
			hostname: "www.pc.co.il",
			params: [
				{ str: 'אנשים ומחשבים' },
				{ attr: ["meta[name='author']", "content"] },
				[
					{ telem: ".post_header > h2:nth-child(2)" },
					{ telem: "h1.title-post" }
				],
				[
					{ 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: 'שם=' }
			]
		},
		{
			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', remove: ['חדשות 0404'] },
				{ telem: '.stitle' },
				{ urlparam: 'p' },
				{ telem: '.post_date', date: '/' }
			]
		},
		{
			hostname: "ch10.co.il",
			params: [
				{ str: 'חרדים10' },
				{ telem: '.author', remove: ['חרדים 10'] },
				{ 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', remove: [ 'מעריב אונליין'] },
					{ telem: 'a[rel=Author]' },
					{ telem: '.article-date-report-wrap', match: /^.*\|(.*)$/m },
					{ telem: 'span.article-reporter', remove: [ 'מעריב אונליין'] },
					{ telem: 'span.tmi-article-reporter' } // tmi articles
				],
				[
					{ attr: ['meta[property="og:title"]', 'content'] },
					{ 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: /sport1\.maariv\.co\.il/,
			params: [
				{ str: 'ספורט1' },
				{ telem: '.authors:first-child', remove: ['מערכת ספורט 1'] },
				{ telem: 'h1.entry-title' },
				{ url: 1, match: /co\.il\/(.*)\// },
				{ telem: '.entry-date', date: '.' }
			]
		},
		{
			hostname: "www.onlife.co.il",
			params: [
				{ str: 'onlife' },
				[
					{ telem: 'span.pull-right', remove: ['מאת: '] },
					{ telem: '.status a' }
				],
				[
					{ telem: 'div.post-title > h1'},
					{ telem: '.cafe_title' },
					{ attr: ["meta[name='dc.title']", "content"] }
				],
				{ url: 1, match: /www\.onlife\.co\.il\/(.*)$/ },
				[
					{ telem: 'span.cj-post-author-h__date', date: '/' },
					{ 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]] },
					{ telem: '.date', date: '.' }
				]
			]
		},
		{
			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(e) {}
						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: window.authorS,
								FULLNAME: window.booknameS,
								bookid: bookid
							};
						} else {
							bookid = bookid || window.bookid;
							var parts = $('title').text().replace('  - אוצר החכמה','').split('/'); // new pages (april 2022)
							if (parts.length == 1) {
								parts = document.querySelector('div.item-tab-con.active .tab-title').textContent.split('/'); // old pages (april 2022)
							}
							window.detail_data = {
								AUTHOR: parts[1],
								FULLNAME: parts[0],
								YEAR: parts[2],
								PrintedP_AND_YEAR: parts[0].split('-')[1],
								bookid: bookid
							};
						}
					} },
					{ var: ['detail_data', 'AUTHOR'] }
				],
				{ var: ['detail_data','FULLNAME'] },
				[
					{ var: ['detail_data','bookid'] },
					{ url: 1, match: /(?:book|b)\/(\d*)\// }
				],
				[
					{ 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: 'עמוד דיגיטלי=' },
					{ attr: ['.nav-active', 'position'], prefix: 'עמוד דיגיטלי='}
				]
			]
		},
		{
			hostname: "www.davar1.co.il",
			params: [
				{ str: 'דבר העובדים' },
				[
					{ attr: ['section', 'data-author_name'], remove: [ 'דבר ראשון', 'דבר העובדים' ] },
					{ attr: ['article', 'data-author_name'], remove: [ 'דבר ראשון', 'דבר העובדים' ] }
				],
				[
					{ telem: '.headline' },
					{ telem: '.g-article-headline'}
				],
				{ url: 1, match: /www\.davar1\.co\.il\/(\d+)/ },
				[
					{ attr: ['meta[itemprop="dateCreated"]', 'content'], date: '.' },
					{ telem: '.g-article-date', date: '.' }
				]
			]
		},
		{
			hostname: "www.youtube.com", hrefmatch: /youtube\.com\/watch\?v=.*/i,
			params: [
				{ str: "יוטיוב" },
				{ urlparam: "v" },
				{ telem: "player-microformat-renderer", func: function (str) { return JSON.parse(str).name; }, prefix: "שם=" },
				{ telem: "player-microformat-renderer", func: function (str) { var dur = JSON.parse(str).duration.slice(2, -1), time = new Date(dur * 1000).toISOString(); return dur < 3600 ? time.substr(14, 5) : time.substr(11, 8); }, prefix: "אורך=" },
				{ telem: "player-microformat-renderer", func: function (str) { return JSON.parse(str).author; }, 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 text;
									if (new Uint8Array(this.response).indexOf(0) < 0) {
										text = new TextDecoder("windows-1255").decode(this.response);
									} else {
										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();
						}
					} },
					{ 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
				]
			]
		},
		{
			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: "span.elementor-post-info__item--type-author", remove: ['מערכת JDN'] },
				{ telem: "h1.elementor-heading-title" },
				{ url: 1, match: /\/(\d+)\// },
				{ telem:'span.elementor-post-info__item--type-date', date:'.' }
			]
		},
		{
			hostname: "google\.co.*", hrefmatch:/google.*?\/maps/,
			params: [
				{ str: "coord" },
				[ //order does matter
					{ 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\.]+),/ }
				]
			]
		},
		{
			hostname: "timeout.co.il",
			params: [
				{ str: 'Time Out ישראל'},
				{ telem: 'div.byline > a', remove: ['מערכת טיים אאוט'] },
				{ telem: 'h1.headline' },
				{ url: 1, match: /il\/(.+?)\// },
				{ telem: 'div.date > span' }
			]
		},
		{
			hostname: "yuvalerel.com",
			params: [
				{ str: 'יובל אראל'},
				{ telem: 'a.author-name', remove: ['יובל אראל'] },
				{ telem: 'h1.post-title ' },
				{ url: 1, match: /com\/(.*)/ }
			]
		},
		{
			hostname: "geektime.co.il",
			params: [
				{ str: 'גיקטיים'},
				[
					{ telem: 'p.post-meta > a', remove: ['מערכת גיקטיים', 'כתב אורח'] },
					{ telem: 'section.post-content > p > strong', remove: ['מאת ', 'מאת: '] },
					{ telem: '.author', remove: ['מאת ', 'מאת: '] }
					
				],
				[
					{ telem: 'article.post-entry > h1' },
					{ telem: '.head-title' }
				],
				{ url: 1, match: /il\/(.*)\// },
				[
					{ telem: 'p.post-meta', date: '.' },
					{ telem: '.date', date: '.' }
				],
			]
		},
		{
			hostname: "eureka.org.il",
			params: [
				{ str: 'אאוריקה'},
				{ telem: 'div.head-text > h2' },
				{ url: 1, match: /il\/item\/(\d*)\// }
			]
		},
		{
			hostname: "ha-makom.co.il",
			params: [
				{ str: 'המקום'},
				{ telem: 'div.jeg_meta_author > a' },
				{ telem: 'div.entry-header > h1' },
				{ url: 1, match: /il\/(.*)/ },
				{ telem: 'div.jeg_meta_date > a', date: '.' }
			]
		},
		{
			hostname: "benyehuda.org",
			params: [
				{ str: 'פרויקט בן-יהודה'},
				{ url: 1, match: /org\/\w+\/(\d+)/, prefix: "זיהוי=" },
				[
					{ telem: 'div.author-page-top-name', prefix: 'שם=' },
					{ telem: 'div.work-title > div.headline-2-v02', prefix: 'שם=' }
				],
				{ telem: 'div.work-title > div.headline-1-v02', prefix: 'שם היצירה=', remove: ['[', ']'] }
			]
		},
		{
			hostname: "archives.gov.il",
			params: [
				{ str: 'ארכיון המדינה'},
				[
					{ telem: 'h2#chapter-title > span:nth-child(2)' },
					{ telem: 'h2#chapter-title' },
					{ telem: 'div.inner > h2' },
					{ telem: 'div#item-data > h1' },
					{ telem: 'div#page-centered-header-title > h1 '}
				],
				{ url: 1, match: /il\/(.*)/ }
			]
		},
		{
			hostname: "mekomit.co.il",
			params: [
				{ str: 'שיחה מקומית'},
				{ telem: 'article#main > header > div.post_details > a' },
				{ telem: 'article#main > header > h1.post_title' },
				{ url: 1, match: /il\/(.*)\// },
				{ telem: 'article#main > header > div.post_details > time', date: '.' }
			]
		},
		{
			hostname: "onegshabbat.blogspot.com",
			params: [
				{ str: 'עונג שבת'},
				[
					{ telem: 'div.post-body > div > span', remove: ['מאת', 'כתב וצילם', 'כתב'] },
					{ telem: 'div.post-body > div > b', remove: ['מאת', 'כתב וצילם', 'כתב'] },
					{ telem: 'div.post-body > div > strong', remove: ['מאת', 'כתב וצילם', 'כתב'] }
				],
				{ telem: 'h3.post-title' },
				{ url: 1, match: /com\/(\d{4}\/\d{2})\// },
				{ url: 1, match: /blog-post_(\d+).html/ },
				{ telem: 'h2.date-header', remove: [ /.*, / ] }
			]
		},
		{
			hostname: "anumuseum.org.il",
			params: [
				{ str: 'אנו – מוזיאון העם היהודי'},
				{ url: 1, match: /il\/.*\/\w(\d+)\/.*/ },
				{ telem: 'title', remove: [' | מאגרי מידע - אנו מוזיאון העם היהודי' ] }
			]
		},
		{
			hostname: "kolzchut.org.il",
			params: [
				{ str: 'כל זכות'},
				{ attr: ["meta[property='og:title']", "content"] }
			]
		},
		{
			hostname: "guidestar.org.il", hrefmatch: /organization/,
			params: [
				{ str: 'גיידסטאר'},
				{ url: 1, match: /il\/organization\/(\d+)/ },
				{ attr: ["meta[property='og:title']", "content"], remove: [' | גיידסטאר - אתר התאגידים של ישראל | משרד המשפטים' ] }
			]
		},
		{
			hostname: "www.inss.org.il",
			params: [
				{ str: 'INSS'},
				{ telements: ['.authors_in_post_item .author span', VE] },
				[
					{ telem: '.banner_post_item_title, .banner_post_item h1' },
					{ telem: 'h2.title_46' }
				],
				{ url: 1, match: /www\.inss\.org\.il\/he\/publication\/([^\/]+)/ },
				{ telem: '.cataloging_references' }
			]
		},
		{
			hostname: "jfc.org.il", hrefmatch: /news_journal/,
			params: [
				{ str: 'יומן חדשות'},
				{ telem: 'h1.content_title' },
				{ url: 1, match: /il\/news_journal\/([\d-]+\/[\d-]+)/ },
				{ telem: '.content_subtitle' }
			]
		},
		{
			hostname: "cbr.com",
			params: [
				{ str: 'CBR'},
				{ attr: ["meta[property='article:author']", "content"] },
				{ attr: ["meta[property='og:title']", "content"] },
				{ url: 1, match: /com\/(.*)\// },
				{ telem: '.date > time', remove: ['Published ']}
			]
		},
		{
			hostname: "atmag.co.il",
			params: [
				{ str: 'את'},
				{ attr: ["article", "data-author_name"] },
				{ attr: ["article", "data-article_title"] },
				{ attr: ["article", "data-path"] },
				{ telem: 'div.under-byline-date div.date'}
			]
		},
		{
			hostname: "www.tidhar.tourolib.org",
			params: [
				{ str: 'תדהר'},
				{ url: 1, match: /tidhar\/view\/(\d+)\/.+/ },
				{ url: 1, match: /tidhar\/view\/\d+\/(\d+)/ }
			]
		},
		{
			hostname: "shakuf.co.il",
			params: [
				{ str: 'שקוף'},
				{ telem: '.elementor-post-info__item--type-author' },
				{ attr: ["meta[property='og:title']", "content"], remove: [' | שקוף'] },
				{ url: 1, match: /co\.il.*\/(\d*)/ },
				{ telem: '.elementor-post-info__item--type-date', remove: [','] }
			]
		},
		{
			hostname: "ruvik.co.il",
			params: [
				{ str: 'הזירה הלשונית'},
				{ telem: '.emptyclause' },
				{ telem: 'h1' },
				{ url: 1, match: /co\.il\/(.*)\.aspx/ },
				{ telem: '.date1', remove: [','] }
			]
		},
		{
			hostname: "hebrew-academy.org.il", hrefmatch: /keyword/,
			params: [
				{ str: 'מילון ההווה'},
				{ url: 1, match: /org\.il\/keyword\/(.*)/ }
			]
		},
		{
			hostname: "hebrew-academy.org.il",
			params: [
				{ str: 'האקדמיה ללשון העברית - רשומה'},
				{ telem: 'h1.entry-title' },
				{ url: 1, match: /org\.il\/(\d{4}\/\d{2}\/\d{2})/ }
			]
		},
		{
			hostname: "screenrant.com",
			params: [
				{ str: 'Screen Rant'},
				{ attr: ["meta[property='article:author']", "content"] },
				{ attr: ["meta[property='og:title']", "content"] },
				{ url: 1, match: /com\/(.*)\// },
				{ attr: ["meta[itemprop='datePublished']", "content"], remove: [ /\d\d\:\d\d/ ] }
			]
		},
		{
			hostname: "bizportal.co.il",
			params: [
				{ str: 'Bizportal' },
				{ telem: ".credit > span > address > a > span > strong" },
				{ telem: ".text > h1" },
				{ url: 1, match: /article\/(\d+)/ },
				{ telem: "span.date", date: '/' }
			]
		},
		{
			hostname: "idi.org.il",
			params: [
				{ str: 'המכון הישראלי לדמוקרטיה' },
				{ telem: ".meta > * > span[itemprop=author]" },
				{ attr: ["meta[property='og:title']", "content"] },
				[
					{ url: 1, match: /articles\/(\d+)/ },
					{ url: 1, match: /\.il\/(.*)/ }
				],
				{ telem: ".meta > * > time[itemprop=datePublished]" }
			]
		},
		{
			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"] }
			]
		},
		{
			hostname: "yekum.org",
			params: [
				{ str: 'יקום תרבות' },
				{ attr: ["meta[name='author']", 'content'] },
				{ attr: ["meta[property='og:title']", 'content'], remove: [' - יְקוּם תַּרְבּוּת'] },
				{ url: 1, match: /org\/(.*)\// },
				{ attr: ['meta[property="article:published_time"]', 'content'], date: ['-', '210'] }
			]
		},
		{
			hostname: "tiuli.com",
			params: [
				{ str: 'טיולי' },
				{ url: 1, match: /com\/.*\/([a-z\d]+)(?:\/.*)?/ },
				{ url: 1, match: /com\/(.*)\/[a-z\d]+(?:\/.*)?/, func: function(s) { return {
					'events': 'אירוע',
					'fauna': 'חיה',
					'flora': 'פרח',
					'points-of-interest': 'נקודת עניין',
					'posts': 'בלוג',
					'tracks': 'מסלול'
					}[s]; } },
				[
					{ telem: 'h1' },
					{ telem: 'title' }
				]
			]
		},
		{
			hostname: "hashiloach.org.il",
			params: [
				{ str: 'השילוח' },
				{ attr: ["meta[name='author']", "content"] },
				{ attr: ['meta[property="og:title"]', 'content'], remove:[' - השילוח'] },
				{ url: 1, match: /org\.il\/(.*)\// },
				{ attr: ['meta[property="article:published_time"]', 'content'], date: ['-', '210'] }
			]
		},
		{
			hostname: "israeldefense.co.il",
			params: [
				{ str: 'ישראל דיפנס' },
				{ attr: ["meta[property='article:author:username']", "content"] },
				{ attr: ['meta[property="og:title"]', 'content'] },
				{ url: 1, match: /co\.il\/.*?\/(.*)/ },
				{ telem: ".submitted > .created_date", date: '/' }
			]
		}
	];

	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]];

								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++) {
								var temp = match(params[j], curParam.match[patIdx]);
								if (temp != '') {
									params[j] = temp;
									break;
								}
							}
						}
						if (typeof curParam.addParam != "undefined") {
							addedParam = getParameterByName(curParam.addParam);
							if (addedParam) {
								params[j] +=  ('?' + curParam.addParam + '=' + addedParam);
							}
						}
						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.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 gep = curParam.date[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
							params[j] = match(params[j], RegExp(('(\\d+' + gep + '\\d+' + gep + '\\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 curParam.stringDate != "undefined") {
							if (params[j]) {
								var today = new Date(),
									dd = (today.getDate() - (params[j] == YESTERDAY ? 1 : 0)).toString(),
									mm = (today.getMonth() + 1).toString(),
									yy = today.getFullYear().toString().slice(-2);
								params[j] = dateFormat([dd, mm, yy]);
							}
						}
						if (typeof curParam.removeDatePadding != "undefined") {
							if (params[j]) {
								var day = params[j].split(' ')[0];
								if (day && day[0] === '0') params[j] = params[j].replace(day, day[1]);
							}
						}
						if (typeof params[j] == "string") {
							try {
								params[j] = jQuery.trim(decodeURIComponent(params[j]));
							} catch (e) {
								console.error(e);
							}
							params[j] = cleanText(params[j]);
						} 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 (window.addWikiNote) result = '{{הערה|' + result + '}}';

				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 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']); });
		var ldojson_website = [ { } ];
		if (ldojson.length == 0) {
			ldojson = $('script[type="application/ld+json"]').map(function(i,e) { return JSON.parse($(e).text()); }).filter(function(i,e) { return e['@graph']; });
			if (ldojson.length == 1) {
				ldojson_website = ldojson[0]['@graph'].filter(function(i,e) { return ['WebSite'].includes(i['@type']); });
				ldojson = ldojson[0]['@graph'].filter(function(i,e) { return ['WebPage'].includes(i['@type']); });
			}
		}

		console.log('ldojson:', ldojson);
		if (ldojson.length == 1) {
			ldojson = ldojson[0];
			var date = new Date(ldojson.datePublished);
			if (isNaN(date)) {
				date = new Date(ldojson.publisher.datePublished);
			}
			var general = {
				'הכותב': $.map($(ldojson.author), function(a) { return a.name; }).join(VE),
				'כותרת': ldojson.name || ldojson.headline,
				'אתר': (ldojson.publisher||ldojson_website[0]).name,
				'תאריך': date != "Invalid Date" ? dateFormat([''+date.getDate(), ''+(date.getMonth()+1), ''+date.getFullYear()]) : '',
				'כתובת': location.href
			};
			console.log('data', general);

			var gresult = '{{קישור כללי|'+$.map(general, function(v,k) {
				return k + '=' + cleanText(jQuery.trim(decodeURIComponent($('<a />').html(v).text())));
			}).join('|') + '}}';
			if (prompt("לחיצה על אישור תעתיק את התבנית:", gresult) != null) {
				$('<input>').val(gresult).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();
	}
})();