/ Published in: JavaScript
URL: http://loucypher.tumblr.com/post/48491411/feeds-finder-bookmarklet-for-google-chrome
To be used as bookmarklet for Google Chrome. See the URL above.
Expand |
Embed | Plain Text
({ getFeedURL: function(e, doc){ var j = e; var c = doc.location; if (e.indexOf("/") !=0 ) { var d = c.pathname.split("/"); d[d.length-1] = e; j = d.join("/") } return c.protocol + "//" + c.hostname + j; }, isFeedBurner: function(u) { return u.indexOf("http://feeds.feedburner.com/") == 0; }, setFeedURL: function(u) { return this.isFeedBurner(u) ? u : "http://www.google.com/reader/view/feed/" + encodeURIComponent(u); }, checkForFeeds: function() { var f = false, s = "", n = 0; var m = document.getElementsByTagName("link"); for (var g = 0, a; a = m[g]; g++) { var h = a.getAttribute("type"); var i = a.getAttribute("rel"); if ((h && h.match(/[\+\/]xml$/)) && (i && (i == "alternate"))) { var b = a.getAttribute("href"); var t = a.getAttribute("title"); if (b.indexOf("http") != 0) { b = this.getFeedURL(b, document); } s += "<li><a href=" + this.setFeedURL(b) + ">" + (t ? t : b) + "</a></li>"; f = true; n = n + 1; } } if (!f) { alert("Can\"t find any feeds."); } else if (n == 1) { window.open(this.setFeedURL(b), "_blank"); } else { var w = window.open(); w.document.open(); w.document.write("<h1>" + "Found " + n + " feeds</h1><ol>"); w.document.write(s + "</ol>"); w.document.close(); } } }).checkForFeeds()
You need to login to post a comment.
