Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
3 total  XML / RSS feed 

Javascript Bookmarklets

// various bookmarklets for cloning

javascript:var d=document,f='http://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1190041327&u='+e(l.href)+'&t='+e(d.title);1;try{if(!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z){a=function(){if(!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=0,width=626,height=436'))l.href=f+p};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)


javascript:location.href='http://rickrolldb.com/entries/new?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);

technorati multi-word tagging bookmarklet : my custom modification

// Replace BLOGNAME with your own blog name. If input is "javascript, text snippets, code" without quotes, output is "Tags: t javascript, t text snippets, t code, t BLOGNAME" with appropriate technorati tag links. span class is tectag. To find posts tagged javascript and code in your Blogger blog, search for ("t javascript" AND "t code") without paranthesis from the Blogger search box at the top, or search for (tag:javascript tag:code) from Technorati.
// This is a compressed and modified version of the bookmarklet code at http://consumingexperience.blogspot.com/2005/07/technorati-tag-creator-for-multiple.html

javascript:(
function(){
var a=' Tags: ';
var t=prompt('enter:','')+', BLOGNAME';
var tr=t.split(',');
for(var i=0;i<tr.length;i++){
        if(i>0){a+=', ';}
        tr[i]=tr[i].replace(/^\s*|\s*$/g,'');
        a+='t '+tr[i].replace(/\s/g,'+')+'\" rel=\"tag\">'+tr[i]+'';
}
prompt('copy:',a+'');
}
)()

JS translation bookmarklet

I got this mostly working - the only thing that sucks is encoding of non-ascii characters like �, �, etc... I've tried escape(), but it's just stripped the offending character. Anyone know js and feel like fixing this?

javascript:langpair="fr|en";
  text=""+(window.getSelection?window.getSelection()
           :document.getselection?document.getSelection()
           :document.selection.createRange().text);
  if(!text)text=prompt("enter%20text%20to%20translate","");
  if(text!=null)void(window.open(
      "http://google.com/translate_t?langpair="+langpair+"&text="+text,
     "translate","scrollbars=1,resizablel=1,width=500,height=500"))
« Newer Snippets
Older Snippets »
3 total  XML / RSS feed