Created
February 24, 2010 07:01
-
-
Save tkosaka/313196 to your computer and use it in GitHub Desktop.
Get rss urls and do action(s)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================ // | |
// Inside of the PRESERVE Area | |
// ============================================================ // | |
function anythingRss () { | |
var document = window.content.document; | |
var document_baseurl = document.baseURI; | |
var links = document.getElementsByTagName("link"); | |
var rssList = []; | |
for (var i = 0; i < links.length; i++) { | |
var link = links[i]; | |
var type = link.getAttribute("type"); | |
if (type) { | |
if (type.match("application\/.+[+]xml$")) { | |
var url = window.makeURLAbsolute(document_baseurl, link.getAttribute("href")); | |
var title = link.getAttribute("title"); | |
rssList.push([title, url]); | |
} | |
} | |
} | |
if (rssList.length == 0) { | |
display.echoStatusBar("No RSS was found.", 2000); | |
} | |
else { | |
prompt.selector( | |
{ | |
message: "List of RSS, ATOM, etc.", | |
collection: rssList, | |
header: ["title", "url"], | |
width: [20, 80], | |
actions: [[function (aArg) { | |
var url = rssList[aArg][1]; | |
command.setClipboardText(url); | |
}, | |
"Copy RSS URL", | |
"copy-rss-url,c"], | |
] | |
} | |
); | |
} | |
} | |
ext.add("anything-rss", anythingRss, | |
"anything-rss"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment