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

גרסה מ־19:44, 11 בנובמבר 2018 מאת חיים 7 (שיחה | תרומות) (ככה? הגאדג'ט לא עובד לאחר תיקון מעריב אונליין)

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (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() {
 	function dateFormatE(dateArr)
	{
    return dateFormat([dateArr[2],dateArr[1],dateArr[0]]);
	}
 
	function dateFormat(dateArr)
	{
		var m = ["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"];
		if (dateArr instanceof Array)
		{
			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 dateFormatShortHeb(dateArr)
	{
		var m = ["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"];
		if (dateArr instanceof Array)
		{
			if (dateArr.length != 3)
				return '';
 
      if (dateArr[1][dateArr[1].length-1] == '\'')
      {
        for (var i in m)
          if (m[i].indexOf(dateArr[1].substr(0,dateArr[1].length-1)) == 0)
          {
            dateArr[1] = m[i];
            break;
          }
      }
			
			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] ];
	}
 
	var ATags = [/<a .*?>/gi, /<\/a>/gi];
 
	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, ' '));
  }
 
  var data = 
  [
    {
      hostname: "www.yediot.co.il",
      params:[
        {str: "ynet"},
        {telem: ".ya-author-additional"},
        {telem: ".ahya-title"},
        {str:'', func:function(x){return dcContentID;}},
        {telem: ".ahya-date", match:/(\d+\.\d+\.\d+)/, split:'.', func:dateFormat},
        {str: ''},
        {str: location.href, match: /yediot.co.il\/([^[\/]*)/, defvalue: 'articles'}
      ]
    },
    {
     hostname: /www\.m?ynet\.co\.il/, minimum:4,
     params:[
		{str : (location.hostname.indexOf('mynet')>=0)?'mynet':'ynet'},
		[
			{elements : ['.authorHtmlCss',' ו'] },
			{telem : 'td:has(h1:first) .text14:first', func: [function(str){return (str.length<100)?str:'';}]},
			{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"},
		],
		[
			{telem : 'h1'},
			{telem:'.art_header_title'},
			{str : $("meta[property='og:title']").attr("content")}, //seems wrong on http://www.ynet.co.il/articles/0,7340,L-3676702,00.html
			{elem : 'head>title', match:/(?:ynet\s*-?)?([^\-]*)/},
		],
		{str : location.href, match: /L-(.*?),/},
		[
			{elem : 'td:has(h1:first) .text12g:last', match: /(\d+\.\d+\.\d+)/, split:'.', func:dateFormat},
			{elem : ".text12g + .text12g", match: /(\d+\.\d+\.\d+)/, split:'.', func:dateFormat},
			{elem : ".art_header_footer_author:last", match: /(\d+\.\d+\.\d+)/, split:'.', func:dateFormat},
		],
		{str:  location.href, match: /ynet.co.il\/[^[\/]*\/(\d+)/, defvalue: '0'},
		{str : location.href, match: /ynet.co.il\/([^[\/]*)/, defvalue: 'articles'}
     ]
	},
	{
	hostname: /mynet(jerusalem|krayot|kibbutz|rishon|hadera|netania|netanya|herzliya|holon|petahtikva|batyam|roshhaayin|kfarsaba|hodhasharon|rehovot|raanana|afula|emek|haifa|beersheva)\.co\.il$/i,
	params:[
		{str : 'mynet2'},
		{telem: 'div.BreadCrumbs a:first',  remove: ['MYNET ', 'mynet ']},
		{telem: 'a.PostCreator'},		
		{telem: 'h1.PostH1'},
		{str : location.href, match: /article\/(\d+)/},
		{telem: 'div.PostInfo:last', match:/(\d+\.\d+\.\d+)/m, split:'.',  func:dateFormat},
     ]
	},
	{
	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
		{str : location.href, match: /L-(.*?),/},
		{telem: ".BlogInfo,.author.clearFix cite,.time" , match: /(\d+\.\d+\.\d+)/ ,func:dateFormat, split:'.'},
		{str :''},
		{str : location.href, match: /articles\/(\d+),/, defvalue: '0'}
     ]
	},
	{
	hostname: "pplus.ynet.co.il", minimum:5,
	params:[
		{str : 'פנאי פלוס'},
		[{telem:'.ahpp_author a:last'}],
		{telem: 'div.ahpp_title'}, 
		{str : location.href, match: /L-(.*?),/},
		{telem: ".ahpp_date" , match: /(\d+\.\d+\.\d+)/ ,func:dateFormat, split:'.' ,  remove: ['פורסם ']},
		{str :''},
		{str : location.href, 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 : 'h1'},
		[{str : location.href, match:/item\/(\d+)/},
		{str : location.href, match:/w=\/\d*\/(\d+)/}],
		[ {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: /^\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', match:/(\d+\/\d+\/\d+)/, split:'/', func:dateFormat},
      {str :''},
      {str : location.href, match:/(\w+)\.nana/i}
     ]
    },
    {
    hostname: "www.haaretz.co.il", 
     params:[
      {str : 'הארץ'},
      {telem: "header address"},
      {telem: 'header h1'},
      {str : location.href, match:/(\d\.\d+)$/},
      {telem: "header time", match:/(\d+\.\d+\.\d+)/, split:'.' , func:dateFormat}
	  ]
    },
    {
    hostname: "www.inn.co.il", hrefmatch:/www\.inn\.co\.il.*Besheva/i,
     params:[
      {str : 'בשבע'},
	  {elem:'.Author:first', match:/<\/div>(.*)$/},
      {telem:'h3:first'},
      {str : location.href, match: /^.*\/(.*)$/},
      {telem:'.Date:first', match:/^(.*),/, split:'/' ,func:dateFormat}, //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'},
		{str : location.href, match: /article\/(\d+)/},
		{telem:'#article-container div.credit time span:first', match:/(.+?) /, split:'/' ,func:dateFormat},
     ]
    },
    {
    hostname: "www.kan.org.il",
     params:[
      {str : 'כאן'},
	  {telem:'.story_autor_name'},
      {telem:'.story_title'},
      {str : location.href, match: /Id\=(\d+)/i},
      {telem:'.story_autor_date'},
      {str : location.href, match: /org\.il\/(.+?)\//},
     ]
    },
    {
    hostname: "www.10.tv",
     params:[
      {str : 'ערוץ עשר'},
	  {telem:'.reporter-name'},
      {telem:'.article-header'},
      {str : location.href, match: /\/(\d+)/},
      {telem:'.space-date', split: ".", func: dateFormat},
      {str : location.href, match: /tv\/(.+?)\//},
     ]
    },
    {
    hostname: "mida.org.il",
     params:[
      {str : 'מידה'},
	  {telem:'.author', prefix: "כותב="},
      {telem:'.entry-title', prefix:"כותרת="},
      {elem : 'body', prefix: "מספר כתבה=", match: /post-(\d+)/},
      {telem:'.published', prefix: "תאריך=", split:'/', func:dateFormat},
     ]
    },
    {
    hostname: "www.inn.co.il",
     params:[
      {str : 'ערוץ7'},
      [{telem:'.ArticleAuthor h5'}, //http://www.inn.co.il/Articles/Article.aspx/7513
	   {str:'', func:[function(str){return $(".Author").contents().filter(function(){return this.nodeType===3}).text().replace(/^\s+|[,\s]+$/g, ''); }]}, //normal pages
	   {telem: '.Author a'}
	  ],
      [{telem: (location.href.indexOf("News/Flash")<0)?'h2:first':'#divMC h3'},{telem:'h1'}],
      {str : location.href, match: /^.*\/(.*)$/},
      [{telem:'.Date:first, .Author', match:/(\d+\/\d+\/\d+)/, split:'/', func:dateFormat},
       {telem:'.NewsMain .Top .Right', match:/(\d+ (.*?) \d+)/, split:' ', func:dateFormatShortHeb},
       {telem:'.NewsMain .Top .Right', match:/(\d+\/\d+\/\d+)/, split:'/', func:dateFormat}], //flashnews
      {str : location.href, match: /www\.inn\.co\.il\/(\w+\/\w+)\.aspx/, defvalue:'News/News'},
     ]
    },
    {
    hostname: "www.globes.co.il",
     params:[
      {str : 'גלובס'},
      {telem:'div.articleInfo a:first'},
      {elem:'#F_Title, .mainArticletitle' },
      {str : location.href, match: /=(\d+)/},
      [{elem:'#coteret_Modified, #F_Modified_on, .g_Article_DateTime', match:/^(.*),/, split:'/', func:dateFormat},
       {str: $("meta[name='article_created']").attr("content"),  match:/(\d+\/\d+\/\d+)/, split:'/', func:dateFormat}]
     ]
    },
    {
    hostname: "www.the7eye.org.il",
     params:[
      {str : 'העין השביעית'},
      {telem:"article a[rel='tag'], article a[href*='/writer/']"},
      {telem: "h1.headline"},
      {str : location.href, match: /\/www\.the7eye\.org\.il\/(\d+)/},
      {telem: "article span.date", func:dateFormat, split:'.'},
      ]
    },
    {
    hostname: "www.bhol.co.il",
     params:[
      {str : 'בחדרי חרדים'},
      {telem:'div.meta-info.article-place .date:first', match:/^\n(.*)\n/m },
      {elem: '.article-heading h1:first'},
      [{str : location.href, match: /news\/(\d+)/},{str: window.userid}],
      {telem:'div.meta-info.article-place .date:first', match:/(\d+\/\d+\/\d+)/, split:'/', func:dateFormat}
     ]
    },
    {
    hostname: "www.20il.co.il",
     params:[
      {str : 'ערוץ 20'},
      {telem:'.post-meta-author'},
      {telem: '.post-title'},
      {str : location.href, match: /il\/(.+?)\//},
      {telem: '.tie-date', match:/(\d+\/\d+\/\d+)/, split:'/', func:dateFormat}
     ]
    },
    {
    hostname: "iaf.org.il",
     params:[
      {str : 'אתר חיל האוויר'},
      {telem:'#ctl00_ContentPlaceHolder1_ucEventLog_divOuther'},
      {telem: '#ctl00_ContentPlaceHolder1_ucEventLog_titleText'},
      {str : location.href, match: /(\d+-\d+)-/},
      {telem: '#ctl00_ContentPlaceHolder1_ucEventLog_publishDate', split:'.', func:dateFormat}
     ]
    },
    {
    hostname: "actv.haifa.ac.il",
     params:[
      {str : 'הערוץ האקדמי'},
      {elements: ["#ctl00_ContentPlaceHolder_Content_Repeater_Humans_ctl00_HyperLink_Human_Name", ' ו']},
      {elem: '#ctl00_ContentPlaceHolder_Content_Label_Title'},
      {urlparam: 'it'},
      {elem: "#ctl00_ContentPlaceHolder_Content_Label_DateBroadcast" , remove:["תאריך הקלטה:"] ,split:'/', func:dateFormat}
     ]
    },
    {
    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"},
      {str : location.href, 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 -->/ , /(.*?)&nbsp;\|/] , remove:ATags.concat(["<span>"])}],
      {telem: "h1:first"},
      [{str : location.href, match: /(\d+\/\d+)\.html/}, {str : location.href, match: /\/(\d+)\/$/}],
      [{elem: "#articleCBar span:first, .articleBar h4:first", match: /(\d+\/\d+\/\d+)/, split:'/',  func:dateFormat}, {telem: ".jeg_meta_date", match: /(\d+\-\d+\-\d+)/, split:'-',  func:dateFormat}],
      [{str : location.href, match: /online\/(.*?)\/ART/}, {str : location.href, match: /il\/(.*?)\/\d+\/$/}],
      {str : location.href, match: /ART(\d+)/}
     ]
    },
    {
        hostname: "www.makorrishon.co.il", condition: function(){return !location.pathname.startsWith('/nrg/')},  minimum:3,
         params:[
          {str : 'מקור ראשון'},
          [{elem: "#articleCBar span:first, .cdat.small.bold, .articleBar h4:first, .jeg_meta_author a", match: [/<!-- ARTICLE_WRITER_START --> (.*?)<!-- ARTICLE_WRITER_END -->/ , /(.*?)&nbsp;\|/] , remove:ATags.concat(["<span>"])}],
          {telem: "h1:first"},
          {str : location.pathname, match: /^\/(.*)\/$/},
          {telem: ".jeg_meta_date", match: /(\d+\-\d+\-\d+)/, split:'-',  func:dateFormat},
         ]
        },
    {
    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"},
      {str : location.href, match: /(\d+\/\d+)\.html/},
      [
		   {telem: "font.newsVitzCredit:last, .opinionMainVitzBody", match: /(\d+\/\d+\/\d+)/, split:'/',  func:dateFormat},
		   {telements: ["td.newsVitzCredit",""],  match: /(\d+\/\d+\/\d+)/, split:'/',  func:dateFormat}
	    ],
      {str : location.href, match: /online\/(.*?)\/ART/},
      {str : location.href, match: /ART(\d+)/}
     ]
    },
    {
    hostname: "www.one.co.il",
     params:[
      {str : 'one'},
      {elem: "#ArticleCredit", match:/^.*$/gm, remove:["מאת מערכת ONE","מאת "]},
      {telem: "h1, #_ctl0_Main_ucFullArticle_lblCaption, #_ctl0_Main_ucFullArticle_lbColCaption"},
      {str: location.href, match:[/Article\/\d\d\-\d\d\/\d,\d+,\d,\d\/(\d+)/ ,/Article\/(\d+)/,/id=(\d+)/]},
      {elem: "#ArticleCredit, .f10.left" ,match: /(\d+\/\d+\/\d+)/, split:'/',  func:dateFormat}
     ]
    },
    {
    hostname: "www.israelhayom.co.il",
     params:[
      {str : 'ישראל היום'},
      {telem: ".normal14 .normal, .content li.taxonomy-term-reference-0, .views-field-name .field-content"},
      [{telem: ".pane-title"}, {str: $('meta[property="og:title"]').attr('content')}],
      [{urlparam: 'id'}, {str: location.href, match:/article\/(\d+)/}, {str: location.href, match:/\w+\/(\d+)$/}],
      [{telem: ".newsletter_title_date, .time time:first" , split:'.',  func:dateFormat}, {telem:".pane-node-created", match:/,(.*?\d+\, \d+)/}],
      {str : location.href, func:function(x){return x.indexOf('opinion')>=0?"1":"";} , def:''}
     ]
    },
   {
    hostname: "www.mako.co.il",
     params:[
      {str : 'mako'},
      [{elements: ['.writerData *:visible:first a',' ו'], shouldnt:/\d+\/\d+\/\d+/},
       {telem: 'span.katav', match:/^(.*?),?\s?$/,}],
      [{telem: ".article.clearer h1"}, {telem: "h1"}],
      {str: location.href, match:/Article-(.*?).htm/},
      {str: location.href, match:/www\.mako\.co\.il\/(.*?)\/Article/},
      [{elem:".writerData *:last", match:/(\d+\/\d+\/\d+)/, split:'/',  func:dateFormat},
       {elem:"span.displayDate", match:/(\d+\/\d+\/\d+)/, split:'/',  func:dateFormat},
      ]
     ]
    },
   {
    hostname: /^\w+\.themarker\.com$/i,
     params:[
      {str : 'TheMarker'},
      [{telements: [".prsnlArticleEnvelope .autorBarAnchor, .prsnlArticleEnvelope .autorBarWriters", ", "],  remove:["מאת:"]},{telem: ".author-bar li:eq(2), .h3_author",  remove:["מאת:"]},{telem: "div.art__info address"}],
      [{telem: "h1.h-mb--xxtight, h1.mainTitle"},{telem: "h2"}],
      {str: location.href, match:/com\/(.*?)$/},
      {telem:".author-bar li:eq(1), .h3_date, div.art__info time", match:/(\d+\.\d+\.\d+)/, split:'.',  func:dateFormat},
      {str: location.href, match:/\/\/(.*?).themarker/i , defvalue:"www"}
     ]
    },
	{
    hostname: "www.calcalist.co.il", minimum:5,
     params:[
      {str : 'כלכליסט'},
      {telem: ".shahor.art-author"},
      {telem: "h1"},
      {str: location.href, match:/L\-(\d+)/},
      {telem:".art-publish-date.afor", match:/\d\d\:\d\d(\d+\.\d+\.\d+)/m, split:'.', func:dateFormat}
     ]
    },
	{
    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"},
      {str: location.href, match:/ve\/(.*?)\.html/},
      {telem:"#ctl00_ContentMain_UcArticle1_lblCreateDate", match:/(\d+\/\d+\/\d+)/m, split:'/',  func:dateFormat}
     ]
    },
    { //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"," - "]}],
      {str: location.href, 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.yeshiva.org.il",
     params:[
      {str : 'אתר ישיבה'},
      {telem: ".trav", remove:["הרב","שליט\"א"], prefix:"הרב="},
      {telem: "h1", prefix:"נושא="},
      {str: location.href, prefix:"קישור="}
     ]
    },
    {
	hostname: "www.sport5.co.il",
     params:[
      {str : 'ספורט 5'},
      {telem: "#ContentPlaceHolder1_ancWriter, span#lblWriter2, #tdAuthorDateTime font", remove:["מערכת אתר ערוץ הספורט"]},
      {telem: "h1.article-main, h1#divTopTitle"},
      [
		{str: location.href, match: /Article\.\d+\.(\d+)\.html/},
		{str: location.href, match: /docID=(\d+)/}
	  ],
      [
		{str: location.href, match: /Article\.(\d+)\.\d+\.html/},
		{str: location.href, match: /FolderID=(\d+)/}
	  ],
      [{telem: "#lblDate2", split:'/',  func:dateFormat},{telem: ".hint", split:'.',  func:dateFormat, match: /(\d+\.\d+\.\d+)/}]
     ]
    },
	{
		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)", split:'/', func:dateFormat}
		]
	},
		{
		hostname: "www.idf.il",
		params:[
			{str : 'אתר צה"ל'},
			{telem: ".article-primary p strong:eq(0)", match:/(.+)\|/},
			{telem: "h1"},
			{str: decodeURI(location.pathname.substr(1)) },
			{telem: ".article-primary p strong:eq(0)", match:/(\d+\.\d+\.\d+)/ ,split:'.', func:dateFormat}
		]
	},
		{
		hostname: "www.kikar.co.il",
		params:[
			{str : 'כיכר השבת'},
			{telem: ".article_buttons_field:first"},
			{telem: "h1.article-title"},
			{str:  decodeURIComponent(location.href), match: /kikar\.co\.il\/(.*?)\.html$/i},
			{telem: ".article_buttons_field:last", match:/(\d+\.\d+\.\d+)/ ,split:'.', func:dateFormat}
		]
	},
		{
		hostname: "www.kipa.co.il",
		params:[
			{str : 'כיפה'},
			{telem: "author", remove:["מערכת כיפה", ", כיפה"]},
			{telem: "h1"},
			{str:  location.href, match: /co\.il\/(.+)/},
			{telem: ".date"}
		]
	},
		{
		hostname: "www.hebpsy.net",
		params:[
			{str : 'פסיכולוגיה עברית'},
			{str: $("meta[name='auhtor']").attr("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", remove:["מאת "]},
			{telem: "h1.entry-title, h1.single-title"},
			{str:  location.href, match: /http:\/\/www.hayadan\.org\.il\/(.*?)$/i},
			{telem: "span.meta-date, span.date"}
		]
	},
	{
		hostname: "hebrewbooks.org", hrefmatch:/org\/\d/,
		params:[
			{str : 'HebrewBooks'},
			{telem: "span.authorname"},
			{telem: "span.sefername"},
			[{urlparam: 'req'},{str:location.href, match: /hebrewbooks\.org\/(\d+)$/i}],
			{str: "{{כ}}" + $("#cpMstr_lblHebPlace").first().text() + " " + $("#cpMstr_lblHebDate").first().text()},
			{urlparam: 'pgnum', prefix:'עמוד='}
		]
	},
	{
		hostname: "hebrewbooks.org", hrefmatch:/pgnum/,
		params:[
			{str : 'HebrewBooks'},
			{telem: "span.authorname"},
			{str: $("span.sefername").first().text().replace("-", "")},
			[{urlparam: 'req'},{str:location.href, match: /hebrewbooks\.org\/(\d+)$/i}],
			{str: $("#cpMstr_lblHebPlace").first().text() + " " + $("#cpMstr_lblHebDate").first().text()},
			{urlparam: 'pgnum', prefix:'עמוד='}
		]
	},
	{
		hostname: "www.izkor.gov.il", hrefmatch:/HalalKorot/i,
		params:[
			{str : 'נזכור את כולם'},
			{urlparam: "id"},
			{aelem: ['#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: /jpress(\.nli)?.org.il/,
		params:[
			{str : 'עיתונות יהודית היסטורית 2', func:function(str){
        var pub=$.parseJSON($("span[data-json]").first().attr("data-json")).pub;
        var codes ={
          "BUL":{"title":"Bulletin de l'Alliance Israélite Universelle", "hasTemplate":false},
          "DAV":{"title":"דבר", "hasTemplate":true},
          "HLB":{"title":"הלבנון", "hasTemplate":false},
          "HZV":{"title":"הצבי", "hasTemplate":true},
          "ISR":{"title":"Israël", "hasTemplate":false},
          "LLB":{"title":"לה ליברט (צרפתית)", "hasTemplate":false},
          "LLR":{"title":"La Libert - Judeo-Arabic", "hasTemplate":false},
          "LRI":{"title":"L'Avenir Illustré", "hasTemplate":false},
          "MGD":{"title":"המגיד", "hasTemplate":true},
          "PLS":{"title":"PalPost", "hasTemplate":true},
          "PED":{"title":"Paix et Droit", "hasTemplate":false},
          "VDC":{"title":"La Voix des Communaut?s", "hasTemplate":false},
          "EGY":{"title":"Egyenlöség", "hasTemplate":false},
          "HSK":{"title":"השקפה", "hasTemplate":true},
          "HMZ":{"title":"המליץ", "hasTemplate":true},
          "NOR":{"title":"נער", "hasTemplate":false},
          "HZT":{"title":"חבצלת", "hasTemplate":true},
          "HZN":{"title":"הזמן", "hasTemplate":true},
          "HZF":{"title":"הצפירה", "hasTemplate":true},
          "OCC":{"title":"The Occident", "hasTemplate":false},
          "MAR":{"title":"מעריב", "hasTemplate":true},
          "HED":{"title":"הד המזרח", "hasTemplate":true},
          "HHR":{"title":"הפועל הצעיר", "hasTemplate":true},
          "HYM":{"title":"היום", "hasTemplate":true},
          "IVA":{"title":"עברי אנכי", "hasTemplate":true},
          "KMD":{"title":"קול מחזיקי הדת", "hasTemplate":true},
          "MAD":{"title":"מחזיקי הדת", "hasTemplate":true},
          "DHY":{"title":"דואר היום", "hasTemplate":true},
          "AHR":{"title":"על המשמר", "hasTemplate":true},
          "HRT":{"title":"חרות", "hasTemplate":true},
          "HYT":{"title":"היינט", "hasTemplate":true},
          "HMD":{"title":"המודיע", "hasTemplate":true},
          "MRH":{"title":"מוריה", "hasTemplate":true},
          "TAS":{"title":"מגיד מישרים", "hasTemplate":true},
          "HMI":{"title":"המזרחי", "hasTemplate":true},
          "MZP":{"title":"המצפה", "hasTemplate":true},
          "HZH":{"title":"הצופה", "hasTemplate":true},
          "HAM":{"title":"העם", "hasTemplate":true},
          "DMT":{"title":"דער מאמענט", "hasTemplate":true},
          "PLB":{"title":"PalBull", "hasTemplate":true},
          "INF":{"title":"Information Juive", "hasTemplate":false},
          "HMF":{"title":"המשקיף", "hasTemplate":true},
          "UES":{"title":"אונזער אקספרעס", "hasTemplate":false},
          "CGS":{"title":"Chicago Sentinel", "hasTemplate":false},
          "HCL":{"title":"הכרמל", "hasTemplate":true},
          "HCR":{"title":"הכרמלֹ רוסית", "hasTemplate":false},
          "LTB":{"title":"ליטערארישע בלעטער", "hasTemplate":false},
         };
        if (pub in codes && codes[pub]["hasTemplate"])
          return codes[pub]["title"];
        else if (pub in codes)
          return [str, codes[pub]["title"], pub];
         else
          return [str, $.parseJSON($("span[data-json]").first().attr("data-json")).pubt, pub];
         }
      },
			{str:'', func: function(str){return window.prompt("שם מחבר","")} },
			{str:'', func: function(str){return window.prompt("כותרת הדף (מובא מגרסת הטקסט האוטומטי)",$.parseJSON($("span[data-json]").first().attr("data-json")).n)} },
			{str:'', func: function(str){return $.parseJSON($("span[data-json]").first().attr("data-json")).href.match(/(\d+\/\d+\/\d+)/)[1];} },
			{str:'', func: function(str){return $.parseJSON($("span[data-json]").first().attr("data-json")).cid.match(/(\d+)/)[1]} },
			{str : ''},
			{str : ''},
			{str:'', defvalue:"Ar", func: function(str){return $.parseJSON($("span[data-json]").first().attr("data-json")).cid.match(/^(\w+?)\d+/)[1]} },
		]
	},
	{
		hostname: "www.pc.co.il",
		params:[
			{str : 'אנשים ומחשבים'},
			{telem: "span.author a"},
			{telem:".post_header > h2:nth-child(2)"},
			[{urlparam: 'p'}, {str:location.href, 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: /archive/,
		params:[
			{str : 'סיינטיפיק אמריקן'},
			{telem: '#post-' + location.href.match(/(\d+)/)[1], match: / \/ (.+)/},
			{telem: '#post-' + location.href.match(/(\d+)/)[1], match: /(.+) \//},
			{str : location.href, match: /(\d+)/},
			{telem: '.postinfo', match:/בתאריך (.+) בשעה/},
		]
	},
	{
		hostname: 'www.sciam.co.il', hrefmatch: /%/,
		params:[
			{str : 'סיינטיפיק אמריקן'},
			{telem: '.author-name'},
			{telem: '.entry-title'},
			{str : location.href, match: /il\/(.+?)\//},
			{telem: '.entry-date', match:/(\d+\.\d+\.\d+)/, split:'.' , func:dateFormat},
		]
	},
		{
		hostname: "chess.org.il", 
		params:[
			{str : 'האיגוד הישראלי לשחמט'},
			{urlparam: 'Id', prefix:''},
		]
	},
		{
		hostname: "ratings.fide.com", 
		params:[
			{str : 'כרטיס פיד"ה'},
			{urlparam: 'event', prefix:''},
		]
	},
		{
		hostname: "www.db.yadvashem.org", 
		params:[
			{str : 'חסיד אומות העולם'},
			{str : location.href, match: /&itemId\=(\d+)/},
		]
	},
	{
		hostname: "www.yadvashem.org",
		params:[
			{str : 'חסיד אומות העולם'},
			{str : location.href, 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', split:'.', func:dateFormat}
		]
	},
	{
		hostname: "www.0404.co.il",
		params:[
			{str : '0404'},
			{telem: '.postAuthor ', remove: [", "]},
			{telem: '.postTitle '},
			{str : location.href, match: /post\/(.*)\./},
			{telem: 'span.ng-binding[ng-bind="postTimer(singlePost.datePublished)"]', split:'/', func:dateFormat},
		]
	},
	{
		hostname: "www.ch10.co.il",
		params:[
			{str : 'חרדים10'},
			{telem: '.author'},
			{telem: '.main-post h1 a'},
			{str : location.href, match: /news\/(\d+)/},
			{telem: '.date', match:/(\d+\.\d+\.\d+)/m, split:'.',  func:dateFormat},
		]
	},
		{
		hostname: 'www.iaa-archives.org.il',
		params:[
			{str : 'רשות העתיקות'},
			{str: '{{ס:' + "שם הדף בלי הסוגריים}}"},
			{str : location.href, match: /loc_id\=(\d+)/},
			{str : location.href, 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: '.article-title'},
			{str : location.href, match: /co\.il\/(.*)/},
			[
				{telem: '.article-date-time, .article-he-date', match:/(\d+\/\d+\/\d+)/m, split:'/',  func:dateFormat},
				{telem: '.article-date-report-wrap', match:/(\d+\/\d+\/\d+)/m, split:'/',  func:dateFormat},
				{telem: '.article-publish-date', match:/(\d+\/\d+\/\d+)/m, split:'/',  func:dateFormat},
			],
		]
	},
	{
		hostname: "www.onlife.co.il",
		params:[
			{str : 'onlife'},
			{telem: '.status a'},
			[{telem: '.cafe_title'}, {str: $("meta[name='dc.title']").attr("content")}],
			{str:location.href, match:/www\.onlife\.co\.il\/(.*)$/},
			{telem: '.status em', match:/(\d+\.\d+\.\d+)/m, split:'.',  func:dateFormat},
		]
	},
	{
		hostname: "davidson.weizmann.ac.il", hrefmatch:/online/,
		params:[
			{str : 'דוידסון'},
			{telem: 'span.name'},
			{str: $('meta[property="og:title"]').attr('content')},
			{str:location.href, match:/davidson\.weizmann\.ac\.il\/online\/(.*)$/},
			{str: $("meta[property='article:published_time']").attr("content"), match:/(\d+\-\d+\-\d+)/m, split:'-',  func:dateFormatE},
		]
	},
	{
		hostname: "alaxon.co.il",
		params:[
			{str : 'אלכסון'},
			{telem: '.author'},
			{telem: 'h1'},
			{str:location.href, match:/alaxon\.co\.il\/(.*)$/},
			{str: $("meta[property='article:published_time']").attr("content"), match:/(\d+\-\d+\-\d+)/m, split:'-', func:dateFormatE},
		]
	},
	{
	hostname: "www.gvura.org",
		params:[
			{str : 'אתר הגבורה'},
			{telem: 'h1'},
			{aelem: ['input[name=hdaid]','value']},
		]
	},
	{
	hostname: "www.srugim.co.il",
		params:[
			{str : 'סרוגים'},
			{telem: '.post_author', match: /(.+?)\d/, remove:[', חדשות סרוגים','חדשות סרוגים']},
			{telem: 'h1'},
			{str:location.href, match:/\.srugim\.co\.il\/(.*)$/},
			{telem: '.post_details', split:'.', func:dateFormat, match: /(\d+\.\d+\.\d+)/},
		]
	},
  {
  hostname:'otzar.org',
    params:[
      {str: 'אוצר החכמה'},
      {str:'', func:function(_){return bookname.split('/')[1]}},
      {str:'', func:function(_){return bookname.split('/')[0]}},
      {str:'', func:function(_){return bookid}},
      {str:'', func:function(_){s = bookname.split('/')[2]; return (s[s.length-2] == ' ')?s.substr(0,s.length-2)+'"'+s[s.length-1]:s}},
      {str: ''},
      {str: '', func:function(_){return document.getElementById("ab").value.split(' ')[0]}, prefix:'עמוד='},
    ]
  },
   {
    hostname: "www.davar1.co.il",
        params:[
            {str : 'דבר ראשון'},
            {str: $('section').attr('data-author_name')},
            {telem:'.headline'}, // it might be {str: $('section').attr('data-article_title')},
            {str: location.href, match: /www\.davar1\.co\.il\/(\d+)/},
            {str: $('meta[itemprop="dateCreated"]').attr('content'), match: /(\d+\.\d+\.\d+)/, split:'.', func:dateFormat},
        ]
    },
  ];
  var isFound = false;
  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 = [];
      var k = 0;
      for (var j = 0; j < data[i].params.length; j++)
		try {
			var curParam = (data[i].params[j] instanceof Array)?(data[i].params[j][k]):(data[i].params[j]);
			params[j] = '';
			if (typeof curParam.str != "undefined")
			  params[j] = curParam.str;
			else if (typeof curParam.urlparam!= "undefined")
                          params[j] = getParameterByName(curParam.urlparam)||"";
			else if (typeof curParam.elem != "undefined")
			{
			  if (curParam.elem instanceof Array)
			  {
				params[j] = $(curParam.elem[0]);
				for(var elemIdx = 1; elemIdx < curParam.elem.length; elemIdx++)
				{
				  var func = curParam.elem[elemIdx].split(',');
				  params[j] = params[j][func[0]](func.length>0?func[1]:null);
				}
				if (typeof(params[j]) != "string")
          params[j] = params[j].html();
			  }    
			  else
				params[j] = $(curParam.elem).html();
			}
			else if (typeof curParam.elements != "undefined")
			{
			  params[j] = $(curParam.elements[0]).map(function(el){return $(this).html();}).toArray().join(curParam.elements[1]);
			}
			else if (typeof curParam.telements != "undefined")
			{
			  params[j] = $(curParam.telements[0]).map(function(el){return $(this).text();}).toArray().join(curParam.telements[1]);
			}
			else if (typeof curParam.telem != "undefined")
			{
				params[j] = $(curParam.telem).first().text();
			}
    else if (typeof curParam.aelem != "undefined")
			{
				params[j] = $(curParam.aelem[0]).attr(curParam.aelem[1]);
			}
			
			if (typeof curParam.match != "undefined")
			{
			  if (!(curParam.match instanceof Array))
				params[j] = match(params[j], curParam.match);
			  else for (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 params[j] == "string")
			{
            params[j] = jQuery.trim(decodeURIComponent(params[j].replace(/&nbsp;|\u202B-\u202d/gm," ").replace(/\s+/gm, ' '))
                                                            .replace(/=/g,"{{=}}")
                                                            .replace(/(\|\|?)/gm,function(x){return "{{" + x.replace(/\|/g,"!") + "}}"}));
      }
      else if (jQuery.isArray(params[j]))
      {
        params[j] = jQuery.trim(params[j].join("|"));
      }
             
			if (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] == '') && (data[i].params[j] instanceof Array) && (k < data[i].params[j].length - 1))
			{
				k++;
				j--;
				continue;
			}
 
			k = 0;
 
		}
			catch(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();
 
		prompt("Your template:", '{{' + params.join('|') + '}}');
		isFound = true;
		break;
	}
  }
 
  if (!isFound)  alert("This site\\page isn't supported by the bookmarklet.");
}
(function ()
{
	if (typeof(jQuery)!="undefined")
		window.$ = jQuery;
	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);
})();