Its a simple javascript bookmarklet which grabs title,url and selected text. To make sure it grabs the title perfectly(just the title) I had to make this bookmarklet long.It works just fine if i edit the bookamrklet manually.Its way too long to drag and drop just like usual bookmarklet. But i tried a lot through different way to make an external javascript way . I couldn't make it. I used google sites as the hosting site for JS file.
javascript:
q=(document.location.href);
t=(document.title);
tt=t.lastIndexOf('|');
if(tt>-1) title=t.substring(0,tt);
else
{
if(t.lastIndexOf('%E2%80%A2')>-1) title=t.substring(0,t.lastIndexOf('%E2%80%A2'));
else if(
t.lastIndexOf('%C2%AB')>-1) title=t.substring(0,t.lastIndexOf('%C2%AB'));
else { title=t; } }
if(q.search("inblog")!=-1)
{ x=title.lastIndexOf('-'); title=title.substring(0,x); }
else if(q.search("m-alo.com")!=-1)
{ x=title.lastIndexOf('-'); title=title.substring(x+2); }
else if(q.search("blog4")!=-1)
{ x=title.indexOf('|'); title=title.substring(x+2,title.length); }
else if(q.search("blogspot")!=-1)
{ x=title.indexOf(':'); title=title.substring(x+2,title.length); }
else if(q.search("blog")!=-1) title=document.getElementsByTagName('h2').item(0).innerHTML;
else if(q.search("arts")!=-1)
{ x=title.lastIndexOf('%C2%BB'); title=title.substring(x+2); }
else if(q.search("sports")!=-1||q.search("tech")!=-1) title=document.getElementsByTagName('h1').item(0).innerHTML;
else if(q.search("blog2")!=-1) { title=document.getElementsByTagName('h1').item(0).innerHTML; x=title.lastIndexOf('">'); title=title.substring(x+4,title.length-4); }
d=document,s='';
if(d.getSelection) s=d.getSelection(); if(d.selection) s=d.selection.createRange().text;
if(window.getSelection) s=window.getSelection();
void(open('http://domain.com/submit?url='+encodeURIComponent(q.replace(/[#].*/,''))+'&title='+encodeURIComponent(title)+'&body='+encodeURIComponent(s),'',
'resizable,location,menubar,toolbar,scrollbars,status'));
Can you help me? How can i put this script into an external js file and load it?