Created
October 17, 2014 20:00
-
-
Save palimadra/3655f484a1cf1f3c194f to your computer and use it in GitHub Desktop.
Bookmarklet to add rss feed of a website to feedly in any browser
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
(function() { | |
void(d = document); | |
void(el = d.getElementsByTagName('link')); | |
void(g = false); | |
void(count = 0); | |
for (i = 0; i < el.length; i++) { | |
if (el[i].getAttribute('rel').indexOf('alternate') != -1) { | |
if(count == 0) { | |
ty = el[i].getAttribute('type'); | |
if(ty.indexOf('application/rss+xml') != -1 || ty.indexOf('text/xml') != -1) { | |
h = el[i].getAttribute('href'); | |
if(h.indexOf('comments') == -1) { | |
g = true; | |
window.open('http://www.feedly.com/home#subscription/feed/' + h, '_blank'); | |
} | |
} | |
} | |
count++; | |
} | |
} | |
if (!g) { window.alert('Could not find the RSS Feed') } | |
void(0); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment