ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Bookmarklet

January 10, 2012 5:40pm

Subscribe [1]
  • #1 / Jan 10, 2012 5:40pm

    TJ Draper

    222 posts

    I am trying to create a Bookmarklet that auto populates the custom fields I have set up instead of plopping both the selected text and the URL in the same field. I have it working after a fashion, but it is inserting a line break above my link in the link field and the selected text that gets put in the body field.

    Here’s the javascript I have at the moment:

    [removed]bm=document.selection?document.selection.createRange().text:document.getSelection();void(bmentry=window.open('http://appleuserpro.com/admin.php?S=0&D=cp&C=content_publish&M=entry_form&Z=1&BK=1&channel_id=13&title;='+encodeURIComponent(document.title)+'&tb;_url=&field;_id_7='+encodeURIComponent(bm)+'&field;_id_11='+encodeURIComponent([removed].href),'bmentry',''))

    I’m not so great at Javascript (I’m horrible actually) but with a little bit of searching on this forum, that above is what I came up with to get the URL to go into my custom URL field, and the selected text to go in the body. But as I said, it’s adding space before the URL, which obviously won’t work since my template is pulling from the URL field like this:

    <a href="http://{link_url}"></a>

    So I have to manually delete the line break the javascript inserts. I’d like to fix the Javascript of possible. Anybody know how to fix that Javascript?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases