Hi There -
It's probably not complicated for someone who knows javascript and I'm sure it's something glaringly simple that I just can't see anymore. I'd be extremely grateful if someone could help me out. I could be completely off the wall with this too. Escaping quotes has consistently been a downfall of mine.
Am trying to create a bookmarklet - a link that you drag to your bookmarks bar and it sticks there.
I'd really appreciate any help I can get.
Lee
The naked code I need to escape is the following:
<a href="javascript:
u=document.location.href;
t=document.title.replace(/\|/g,'::');
s='<blockquote>'+window.getSelection()+'</blockquote>';
pre='<em>From <a target="_blank" href="'+escape(u)+'">'+escape(t) + escape('</a>:</em><br /> ');
void(window.open('http://EXAMPLE.net/node/add/page?edit[title]='+escape('Link: '+t)+'&edit[body]='+pre+escape(s)+escape('<a href="'+u+'" target="_blank">Link</a>'),'_blank','width=710,height=500,status=yes,resizable=yes,scrollbars=yes'));">blog this</a>
My attempt to escape this netted a blank page:
<?php
$blogthis1 = '<a href=\"javascript:';
$blogthis1 .= 'u=document.location.href;';
$blogthis1 .= "t=document.title.replace(/\|/g,\'::\');";
$blogthis1 .= "s='<blockquote>'+window.getSelection()+'</blockquote>';";
$blogthis1 .= "pre='<em>From <a target=\"_blank\" href="'+escape(u)+'">'+escape(t) + escape('</a>:</em><br /> ');";
$blogthis1 .= "void(window.open('http://myWebsite.net/node/add/page?edit[title]='+escape('Link:";
$blogthis1 .= "'+t)+'&edit[body]='+pre+escape(s)+escape('<a href=\"'+u+'\"";
$blogthis1 .= "target=\"_blank\">Link</a>'),'_blank','width=710,height=500,status=yes,resizable=yes,scrollbars=yes'));\">blog this</a>";
echo $blogthis1;
?>