jetzt icon indicating copy to clipboard operation
jetzt copied to clipboard

Make it easier to add bookmarklet

Open peteruithoven opened this issue 11 years ago • 13 comments
trafficstars

Currently it's a lot of manual work to add the bookmarklet. Ideally I would like to present a button that people can just drag to their bookmark bar, and have it dynamically filed with the code from bookmarklet.js. Could I for example add a page to gh-pages with some javascript or something that does this?

peteruithoven avatar Mar 13 '14 22:03 peteruithoven

Please feel free :)

ds300 avatar Mar 13 '14 22:03 ds300

Great! I'll try to find some time this week ;)

peteruithoven avatar Mar 13 '14 23:03 peteruithoven

I'd really like to see a page that lets you select your custom default-WPM and such prior to installation if that's where you're headed with this!

j6k4m8 avatar Mar 14 '14 21:03 j6k4m8

Interesting idea. Having a separate page for adding a bookmarklet would allow such customizations.

peteruithoven avatar Mar 14 '14 22:03 peteruithoven

well, these settings are read from localstorage, aren't they? so you could store them from one page and the boomarklet would use them, right? Or is localstorage per-domain? then you could add some json into the bookmarklet...

h0ru5 avatar Mar 14 '14 22:03 h0ru5

Yeah localStorage is per domain. I think there was a hack with an iframe, but I didn't want to get into that. So that why I thought it was a valid idea.

peteruithoven avatar Mar 14 '14 22:03 peteruithoven

Yes, then its really the best option to have a page generating a bookmarklet. In fact, with the very same backend you could also generate an embeddable snippet, some page owners could provide jetzt to their visitors.

h0ru5 avatar Mar 14 '14 22:03 h0ru5

Finally, after having my harddisk fail, I have time to look into this. I'm wondering, do we want to add all the css and js into the bookmarklet itself or should it load it from somewhere, like it currently does? Having it load files from http://ds300.github.io/jetzt/ has the benefit that it auto updates, but it also disables offline usage. Maybe make it a checkboxed option?

Separate question, I'm I correct in understanding that Jetzt currently defaults to localStorage for it's configBackend?

peteruithoven avatar Mar 17 '14 23:03 peteruithoven

A quick first step could be to load the latest bookmarklet.js into the href of a link, using something like:

    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $.get( "bookmarklet.js", function( data ) {
                $("#bookmarklet").attr("href",data);
            },"text");
        });
    </script>

@nslater, could you incorporate this into the first version of the website?

peteruithoven avatar Mar 17 '14 23:03 peteruithoven

I've expanded on the above trick with a dynamically filled offline bookmarklet: https://github.com/peteruithoven/jetzt/blob/add-bookmarklet/addbookmarklet.html

In the end I would like to do something like setup on the following bookmarklet page: http://readable.tastefulwords.com/ > show setup

Would be awesome if we could reuse the options page for this: https://github.com/ds300/jetzt/pull/85

peteruithoven avatar Mar 18 '14 01:03 peteruithoven

I vote for a hybrid lovechild of the options page (a la Chrome's default stylin) and the Initializr customization page. That way, we're not stylistically limited by the 'default' Chrome CSS, and we can have a glamorous sexytastic splash page.

j6k4m8 avatar Mar 18 '14 01:03 j6k4m8

note to self, link to the following page for more info on bookmarklets: http://marklets.com/FAQ.aspx

peteruithoven avatar Mar 19 '14 16:03 peteruithoven

I am about to PR the website tonight, hopefully. This appears to still be in flux. Am I okay to just use the existing code, and we can update it after this is sorted out?

roselint avatar Mar 20 '14 19:03 roselint