משתמש:שמוליק/קישורים חיצוניים/ff.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
/*@author Shmulik-[[משתמש:שמוליק]]*/
var m = ["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"];
var title,date,url=location.href,template,author,misc="";
switch (location.hostname)
{
case "www.ynet.co.il":
var h1 = document.getElementsByTagName("h1")[0];
title = h1.innerHTML;
author = h1.parentNode.getElementsByTagName("p")[3].childNodes[0].childNodes[2].childNodes[1].childNodes[0].innerHTML;
date = h1.parentNode.getElementsByTagName("p")[3].childNodes[0].childNodes[2].childNodes[3].childNodes[0].childNodes[0].childNodes[1].innerHTML;
date = date.substr(0,date.indexOf(',')).split('.');
url = url.substr(url.indexOf('L-')+2);
url = url.substr(0,url.indexOf(','));
template = "ynet";
break;
case "www.nrg.co.il":/*case "hot.nrg.co.il":*/
if (document.getElementsByTagName("h1").length>0)
{
title = document.getElementsByTagName("h1")[0].innerHTML.replace(/\n/g,"");
var acb = document.getElementById("articleCBar").getElementsByTagName("span")[0].innerHTML;/*newsVitzCredit*/
author = acb.substr("<!-- ARTICLE_WRITER_START --> ".length);
author = author.substr(0,author.indexOf("<!-- ARTICLE_WRITER_END -->"));
date = acb.substr(acb.indexOf("<!-- ARTICLE_DATE_START -->")+"<!-- ARTICLE_DATE_START -->".length);
date = date.substr(0,date.indexOf("<!-- ARTICLE_DATE_END -->"));
date = date.substr(0,date.indexOf(' ')).split('/');
}
else
{
title = document.getElementById("titleS1").innerHTML;
var r = document.getElementsByTagName("TD");
var nvc;
for (var i=0;i<r.length;i++)
if (r[i].className=="newsVitzCredit")
{
nvc = r[i].innerHTML;
break;
}
author = nvc.substring(0,nvc.indexOf("<br>"));
date = nvc.substring(nvc.indexOf("<br>")+4);
date = date.substring(0, date.indexOf(" ")).split("/");
}
var serCode = url.substring(url.indexOf('online/')+7,url.indexOf('/ART'));
var artCode = url.substr(url.lastIndexOf('ART')+3,1);
url = url.substring(url.substr(0,url.lastIndexOf("/")).lastIndexOf("/")+1,url.lastIndexOf("."));
misc = "|"+serCode+"|"+artCode;
template = "nrg";
break;
case "news.walla.co.il":
var h1 = document.getElementsByTagName("h1")[0];
title = h1.innerHTML;
author = h1.parentNode.getElementsByTagName("span")[0].innerHTML;
if (author.lastIndexOf(",")!=-1)
author = author.substring("מאת: ".length,author.lastIndexOf(","));
else
author = author.substring("מאת: ".length);
date = h1.parentNode.getElementsByTagName("div")[1].innerHTML;
date = date.substring(date.indexOf(",")+1,date.lastIndexOf(","));
misc = url.substring(0,url.lastIndexOf("/"));
misc = "|"+misc.substring(misc.lastIndexOf("/")+1);
url = url.substring(url.lastIndexOf("/")+1);
template = "וואלה!";
break;
case "www.inn.co.il":
title = document.getElementsByTagName("h1")[0].innerHTML;
var r = document.evaluate(
"//div[@class='Author']", document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null).snapshotItem(0);
author = r.innerHTML;
author = author.substring(author.indexOf("</div>")+6);
date = r.firstChild.innerHTML;
if (url.indexOf("Besheva")>=0)
{
date = date.substring(0,date.indexOf(",")).split("/");
template = "בשבע";
}
else
{
date = date.substring(date.indexOf(":")+1,date.lastIndexOf(",")).split("/");
template = "ערוץ7";
}
url = url.substring(url.lastIndexOf("/")+1);
break;
case "www.nana10.co.il":case "bidur.nana10.co.il":case"net.nana10.co.il":case "mymoney.nana10.co.il":case "gamer.nana10.co.il":case "news.nana10.co.il":
title = document.getElementById("ArtTitle").innerHTML.replace(/ /g,"");
var r = document.evaluate(
"//div[@class='Author']|//div[@class='ArticleDate']", document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
author = r.snapshotItem(1).innerHTML;
date = r.snapshotItem(0).innerHTML;
date = date.substring(date.lastIndexOf(" ")).split("/");
template = "נענע10";
misc = "|"+url.substring(url.indexOf("//")+2,url.indexOf("."));
url = url.substring(url.lastIndexOf("=")+1);
break;
case "www.haaretz.co.il":
var r = document.evaluate(
"//span[@class='t18B']|//span[@class='t12']|//span[@class='t11']",document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
if(r.snapshotItem(1).className!="t11")
{
date=r.snapshotItem(0).innerHTML;
title=r.snapshotItem(1).innerHTML;
author=r.snapshotItem(2).innerHTML;
}
else
{
date=r.snapshotItem(0).innerHTML;
title=r.snapshotItem(2).innerHTML;
author=r.snapshotItem(3).innerHTML;
}
date = date.split(" ")[5].split("/");
author = author.substr(author.indexOf(" ")+1);
url = url.substr(url.lastIndexOf('/')+1);
url = url.substr(0,url.lastIndexOf('.'));
if (url=="ShArt")
url = location.href.substring(location.href.lastIndexOf("=")+1);
template = "הארץ";
break;
case "www.globes.co.il":
title = document.getElementById("F_Title").innerHTML;
date = document.getElementById("F_Modified_on").innerHTML;
date = date.substring(0,date.indexOf(",")).split("/");
author = document.getElementById("F_Author").innerHTML.replace(/<.*?>/gmi,"");
url = url.substr(url.lastIndexOf('=')+1);
template = "גלובס";
break;
case "www.mouse.co.il":
var r = document.evaluate(
"//h1[.!='' and not(contains(@class,'ttl'))]|//p[@class='katava-info']",document,/*[@class!='ttl-gallery']*/
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
title = r.snapshotItem(0).innerHTML;
var ki = r.snapshotItem(1).innerHTML;
date = ki.substring(0,ki.indexOf("מאת")).split(" ");
date = date[2]+" "+date[3]+" "+date[4];
author = ki.substring(ki.indexOf("מאת")+5);
while(author[author.length-1]==' ')author = author.substring(0,author.length-2);
url = url.substring(url.indexOf("item,")+5,url.lastIndexOf(",.aspx"));
template = "עכבר העיר";
break;
}
title = title.replace('|',' - ');
if (date instanceof Array)
{
date[1] = m[Number(date[1])-1];
if (Number(date[2])<=15) date[2]=20+date[2];
else if (Number(date[2])>=50&&Number(date[2])<100) date[2]=19+date[2];
date =date[0]+" ב"+date[1]+" "+date[2];
}
author = author.replace(/<a .*?>/g,'');
author = author.replace(/<\/a>/g,'');
alert("{{"+template+"|"+author+"|"+title+"|"+url+"|"+date+"|"+misc+"}}");