Created
October 12, 2012 17:26
-
-
Save tonioriol/3880371 to your computer and use it in GitHub Desktop.
Add New Source to Feedly bookmarklet
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
javascript: | |
var elements = document.getElementsByTagName('link'); | |
var feeds = []; | |
for (var i = 0; i < elements.length; ++i) { | |
if (elements[i].type == 'application/rss+xml' || elements[i].type == 'application/atom+xml') { | |
var aux = []; | |
aux['href'] = 'http://www.feedly.com/home#subscription/feed/' + elements[i].href; | |
aux['title'] = elements[i].title == '' ? 'Feed' : elements[i].title; | |
feeds.push(aux); | |
} | |
} | |
if(feeds.length > 0) { | |
var html = ''; | |
for (i in feeds) { | |
html += '<p style="margin: 10px; border-bottom: solid 3px grey;"><a target="_blank" onclick="document.getElementById(\'tron\').parentNode.removeChild(document.getElementById(\'tron\')); document.getElementById(\'wtron\').parentNode.removeChild(document.getElementById(\'wtron\'));" style="text-decoration: none; color: black;" href="' + feeds[i]['href'] + '">' + feeds[i]['title'] + '</a></p>'; | |
} | |
var wpopup = document.createElement('div'); | |
wpopup.setAttribute('id', 'wtron'); | |
wpopup.setAttribute('style', 'position: fixed; left: 0; top: 0px; height: 100000px; width: 1000000px; opacity: 0.8; z-index: 1000; background-color: #000'); | |
wpopup.setAttribute('onclick', 'document.getElementById("tron").parentNode.removeChild(document.getElementById("tron")); document.getElementById("wtron").parentNode.removeChild(document.getElementById("wtron"));'); | |
document.body.appendChild(wpopup); | |
var popup = document.createElement('div'); | |
popup.setAttribute('id', 'tron'); | |
popup.setAttribute('style', 'font: 16px Helvetica; color: black; position: fixed; left: 100px; top: 100px; border: solid 1px black; -webkit-border-radius: 3px; z-index: 1001; background-color: #fff'); | |
popup.innerHTML = html; | |
document.body.appendChild(popup); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment