Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Bookmarklet 0.2

  1. #11
    Junior Member
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    First of all thank you for the great plugins. Me being a newbie to both PHP as well as Hotaru having little hard time[thanks to excellent doc]. I have not been successful in adding the bookmarklet. One thing which i am still unable to understand to how does the code add a bookmarklet to the browser? Where should i be adding the code: <a href="<?php echo $h->url(array('page'=>'bookmarklet')); ?>">Get our bookmarklet!</a>?

  2. #12
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Thanks
    18
    Thanked 8 Times in 8 Posts

    Default

    Quote Originally Posted by Nick View Post
    The bookmarklet plugin is very, very basic. All it does is display a link wherever you put the "hotaru_bookmarklet" plugin hook.

    With that in mind, I made a bookmarklet page which does not use the plugin.

    First, here's what it looks like on my site:

    Attachment 560

    Here's how to make it:

    1. Create a new .php file in your theme folder and name it bookmarklet.php
    2. Paste this into it:

    Code:
    <h2><?php echo SITE_NAME; ?> Bookmarklet</h2>
    
    Submit stories on the fly by adding the <?php echo SITE_NAME; ?> bookmarklet to your browser.<br /><br />
    Whenever you find an interesting article that you'd like to share, simply click the bookmarklet in your toolbar or Favorites menu and the <?php echo SITE_NAME; ?> submit form will open with the page's url and title already filled in.
    <br /><br />
    
    <p style="text-align: center;">
        <img src="<?php echo BASEURL; ?>content/themes/<?php echo THEME; ?>images/EXAMPLE_IMAGE.png" />
    </p>
    <br /><br />
    
    <?php if ($h->currentUser->loggedIn) { ?>
    
        <h2>Instructions</h2>
            <ul>
                <li><b>Internet Explorer:</b> Right click "Submit it!" and choose "Add to favorites"</li> 
                <li><b>Firefox:</b> Drag "Submit it!" to your Bookmarks Toolbar</li> 
                <li><b>Opera:</b> Right click "Submit it!" and choose "Bookmark Link"</li>
            </il>
        
        <p style="font-size: 20pt; font-weight: bold; text-align: center;">
            <a class="bookmarklet" href="javascript:q=(document.location.href);void(open('<?php echo BASEURL; ?>index.php?page=submit&url='+escape(q),'','resizable,location,scrollbars,menubar,toolbar,status'));">Submit it!</a>
        </p>
    
    <?php } else {?>
        You'll need to <a href="<?php echo $h->url(array('page'=>'login')); ?>">log in</a> to get the bookmarklet.
    <?php } ?>
    3. Link to that page in one of your other templates using this:

    Code:
    <a href="<?php echo $h->url(array('page'=>'bookmarklet')); ?>">Get our bookmarklet!</a>



    is there a way to hide the javascript code of the bookmarklet?

    i dont want my users see the script code when passing mouse over the "Submit it!" anchor.

  3. #13
    Junior Member
    Join Date
    Mar 2012
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How to include my icon?

    Is there a way to include my 16x16 share icon with the link dragged to the Firefox Bookmarks toolbar?

    I tried inserting the image tag with the absolute path like so but the image is left behind:

    Code:
    <a class="bookmarklet" href="javascript:q=(document.location.href);void(open('<?php echo BASEURL; ?>index.php?page=submit&url='+escape(q),'','resizable,location,scrollbars,menubar,toolbar,status'));"><img src="http://allthingsdemocrat.com/pages/images/ATD-button-16x16rounded.jpg" alt="Submit to ATD"><?php echo $h->lang['bookmarklet_submit']; ?></a>

  4. #14
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Thanks
    18
    Thanked 8 Times in 8 Posts

    Default

    atdoug, you can do it with some complex tricks.. using html img tags will not work at all..

    i was trying to figure out how to put an icon in bookmarklet some days ago and just gave up. Its too complex and not compatible with all browsers.

    If you wanna try, look http://stackoverflow.com/questions/5...ged-to-toolbar and http://wiki.whatwg.org/wiki/Link_Icons

  5. #15
    Junior Member
    Join Date
    Mar 2012
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default IE browser error with bookmarklet

    This may be old news but using the bookmarklet in IE 8, it treats the new window as a pop-up that I need to temporarily allow. Then it completes the script and the page works correctly, but generates this error:
    Code:
    Webpage error details
    
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; BRI/1; BRI/2)
    Timestamp: Tue, 20 Mar 2012 23:51:13 UTC
    
    
    Message: 'document.getElementById(...)' is null or not an object
    Line: 262
    Char: 2
    Code: 0
    URI: http://rsnews.allthingsdemocrat.com/cache/css_js_cache/hotaru_js_1332284408.js

  6. #16
    Junior Member
    Join Date
    Mar 2012
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    frytec,

    Thanks for the info.

    Funny - one respondent in that page link says it can't be done, but I have several bookmarklets in my bookmark toolbar that include an icon (Including Hotaru's firefly). So obviously there's a way to do it that we're not aware of at the moment. But if I find out I'll share ...

  7. #17
    Junior Member
    Join Date
    Mar 2012
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    fyi:

    I added these additional instructions for my users to bookmark in Chrome:

    Chrome: Drag the link to the Bookmarks Toolbar, which creates a globe icon. Right-click on the globe, select Edit from the menu, then change the Name to "Submit to YOUR HOTARU SITE"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •