Created
October 8, 2008 23:21
-
-
Save satyr/15651 to your computer and use it in GitHub Desktop.
Bookmarklet for http://fulltextrssfeed.com and http://wedata.net/databases/
This file contains hidden or 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:FetchFullFeed:['http://gist.github.com/15651.txt',function(d,i,e){for(i=this.length;--i;d.body.appendChild(e))e=d.createElement('script'),e.src=this[i]].reverse()[0](document) | |
*/ | |
with(document)!function(){ | |
var list = body.insertBefore(createElement('ul'), body.firstChild); | |
list.style.cssText = | |
('position:fixed; top:5px; left:5px; z-index:999999;'+ | |
'text-align:left; background-color:menu; color:menutext;'+ | |
'width:auto; height:auto; max-height:none; max-width:none;'+ | |
'margin:0; padding:5px; font:normal 14px monospace;'+ | |
'border:2px outset menu; list-style:none; float:none'+ | |
'direction:ltr; text-decoration:none; text-transform:none'+ | |
'text-align:center; display:block; visibility:visible;'+ | |
'cursor:auto;').replace(/;/g, ' !important;'); | |
list.ondblclick = function(){ body.removeChild(list) }; | |
list.add = function(tag, txt, css){ | |
var e = createElement(tag); | |
e.innerText = e.textContent = e.href = txt; | |
e.style.cssText = (css || '') + '; background-color:menu; color:menutext'; | |
this.appendChild(createElement('li')).appendChild(e); | |
}; | |
var ftrf = 'http://fulltextrssfeed.com/' | |
, feed = /\b(?:rss|atom|xml)\b/ | |
, lnks = getElementsByTagName('link') | |
for(var link, i = -1; link = lnks[++i];) if(feed.test(link.type)) | |
list.add('a' | |
, ftrf + link.href.replace(/^\w+:\/+/, '') | |
, 'font-weight:bold') | |
!function wedata(db, qp){ | |
var cb, sc; | |
this[cb = db + +new Date] = function(arr){ | |
var href = location.href, found = 0, i = -1, d, m; | |
try { while(d = arr[++i]) if(m = href.match(d.data.url)) | |
found = true, qp(d, m) } catch(e){ if(e) throw e } | |
if(!found) list.add('div', 'Not in "'+ db +'"', 'font-style:italic'); | |
}; | |
(sc = createElement('script')).src = 'http://wedata.net/databases/'+ | |
db +'/items.json?callback='+ cb; | |
body.appendChild(sc); | |
return wedata; | |
}('fullfeeds', function(dt, mt){ | |
var f, i = -1, fs = dt.data.feeds.replace(/\{(\w+)\}/g, function(_, k){ | |
return mt[k] || dt.data[k] || dt[k] || _; | |
}).replace(/\[(\w+)\]/g, function(_, k){ | |
return encodeURIComponent(mt[k] || dt.data[k] || dt[k] || _); | |
}).match(/\S+/g); | |
while(f = fs[++i]) list.add('a', f); | |
}); | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment