add reporter to bookmarklet

This commit is contained in:
quenousimporte 2024-08-28 14:57:38 +02:00
parent dce35af9c6
commit 488417582a
1 changed files with 8 additions and 2 deletions

View File

@ -3,7 +3,8 @@ javascript: (function()
var map = { var map = {
"www.mediapart.fr": "https://www.mediapart.fr/articles/feed", "www.mediapart.fr": "https://www.mediapart.fr/articles/feed",
"www.lemonde.fr": "https://www.lemonde.fr/rss/une.xml", "www.lemonde.fr": "https://www.lemonde.fr/rss/une.xml",
"www.nytimes.com": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" "www.nytimes.com": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
"reporterre.net": "https://reporterre.net/spip.php?page=backend-simple"
}; };
var host = window.location.host; var host = window.location.host;
@ -25,7 +26,12 @@ javascript: (function()
items = xmldoc.evaluate("/rss/channel/item", xmldoc); items = xmldoc.evaluate("/rss/channel/item", xmldoc);
while ((item = items.iterateNext())) while ((item = items.iterateNext()))
{ {
var itemdate = new Date(item.getElementsByTagName("pubDate")[0].textContent); var datenode = item.getElementsByTagName("pubDate");
if (!datenode || !datenode.length)
{
datenode = item.getElementsByTagName("dc:date");
}
var itemdate = new Date(datenode[0].textContent);
var itemlink = item.getElementsByTagName("link")[0].textContent; var itemlink = item.getElementsByTagName("link")[0].textContent;
if (itemdate.toDateString() == today.toDateString()) if (itemdate.toDateString() == today.toDateString())
{ {