Feeds Show authentication Swap menu

Le bookmarklet

Bookmarklet inline Feeds_Show

Bookmarklet hébergé sur ce site Feeds_Show!

Informations

Source: http://dekstop.de/weblog/2006/03/feed_links_bookmarklet/

Le script

function txt(str){
	return document.createTextNode(str)
}

function tag(n,c){
	var e=document.createElement(n);
	e.style.fontFamily='Arial,sans-serif';
	e.style.color='#000';
	if(c)
	e.appendChild(c);
	return e
}

function p(c){
	return tag('p',c)
}

function a(href,desc){
	e=tag('a',txt(desc));
	e.href=href;
	e.style.color='#00c';
	e.style.textDecoration='underline';
	return e
}
var el=tag('div');
el.style.zIndex=100000;
el.style.position='absolute';
el.style.padding='20px';
el.style.top='10px';
el.style.left='10px';
el.style.backgroundColor='#ffffcc';
el.style.border='1px solid #333333';
el.style.textAlign='left';
var ul=tag('ul');
var found=false;
var links=document.getElementsByTagName('link');
for(var i=0,link;link=links[i];i++){
	var type=link.getAttribute('type');
	var rel=link.getAttribute('rel');
	if(type&&(type=='application/rss+xml'||type=='application/atom+xml')&&rel&&rel=='alternate'){
		var href=link.getAttribute('href');
		if(!href.match(/^http/)){
			var path=(href.match(/^\//))? '/' : location.pathname;
			href='http://'+location.hostname+path+href;
		}
		var title=link.getAttribute('title');
		ul.appendChild(tag('li',a(href,((title) ? title+' - ' : '')+href)));
		found=true;
	}
}
if(found){
	el.appendChild(p(txt('The current page links to these feeds:')));
	el.appendChild(ul);
} else {
	el.appendChild(p(txt('The current page does not link to any feeds.')));
}
var close=a('#','Close');
close.onclick=function(){
	el.style.display='none';
	return false;
};
el.appendChild(p(close));
function addFeedBox(){
	document.body.appendChild(el);
	y=window.scroll(0,0);
}
void(z=addFeedBox());

Valid XHTML 1.0 Strict Valid CSS

AccueilPage précédenteHaut de pagePage suivante