By default, EE (version 1.6.8) Bookmarklets insert page’s URL and selected text in the same field.
Can I customize a Bookmarklet so it would insert URL and selected text in separate fields?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
November 15, 2010 7:36am
Subscribe [2]#1 / Nov 15, 2010 7:36am
By default, EE (version 1.6.8) Bookmarklets insert page’s URL and selected text in the same field.
Can I customize a Bookmarklet so it would insert URL and selected text in separate fields?
#2 / Nov 15, 2010 2:30pm
A hacker friend offered me this solution:
[removed]bm=document.selection?document.selection.createRange().text:document.getSelection();void(bmentry=window.open(‘http://www.eagora.org.br/system/index.php/?C=publish&Z=1&BK=1&weblog_id=2&title;=’+encodeURIComponent(document.title)+’&tb;_url=&field;_id_2=’+encodeURIComponent(bm)+’&field;_id_7=’+encodeURIComponent([removed].href),‘bmentry’,‘width=700,height=820,toolbar=0,status=1,location=0,scrollbars=1,menubar=1,resizable=1’))
It would insert page`s selected text in field 2 (Body) and URL in field 7 (custom).
Function “encodeURIComponent”, instead of “encodeURI”, allows the bookmarklet to handle text with “&”.
Don’t ask how it works, but it works.
#3 / Nov 15, 2010 5:29pm
Glad to see you found a solution. Post again as needed, please.