Bookmarklets are smart bookmarks. They usually allow one to perform complex task via a single click (bookmark-toolbar).


Inspired by Dokuwiki-Weblog.

This bookmarklet directly POSTS to DokuWiki - it opens up a popup-window to create/preview a DokuWiki page about the currently browsed page, using the current selection as wiki-page text.

javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();L=location.href;D=document.title;d=new Date();I=d.getFullYear()+':'+(d.getUTCMonth()+1)+'_'+d.getUTCDay()+'_'+d.getUTCHours()+''+d.getUTCMinutes()+''+d.getUTCSeconds();'','dokuwikiadd','scrollbars=yes,resizable=yes,toolbars=yes,width=640,height=420,left=200,top=160,status=yes');f=myWindow.document.createElement('form');f.method='post';f.action=''+I;i0=document.createElement('input');i0.type='hidden';'wikitext';i0.value='===== '+D+' =====\n  * '+L+'\n'+Q+'\n{{tag>Bookmark}}';i1=document.createElement('input');i1.type='hidden';'do';i1.value='preview';f.appendChild(i0);f.appendChild(i1);b=myWindow.document.getElementsByTagName('body')[0]; b.appendChild(f); f.submit();

This script may be too long for some browsers, see dokubookmark for an alternative.

Modify the action URL (, ID (wiki:weblog:<DATE>) and the wiki-page template wikitext=.. to your preference.

Note: the date syntax is not the same as the Dokuwiki-Weblog mentioned above. javascript's UTCMonth and UTCDay are values 1-12 and 1-31 rather than 01-12 or 01-31.

Misc Bookmarklets

Javascript bookmarklet to HTTP-POST.

javascript: (
  function() {;                                        //  Empties the current browser page
    uri      = '';   //  Destination URI for the POST request
    f        = document.createElement('form');              //  Form creation
    f.method = 'post';                                      //    of POST type
    f.action = uri;                                         //    using the URI given above.
    i0       = document.createElement('input');             //  Field creation
    i0.type  = 'text';                                      //    of text type  = 'text';                                      //    called "text"
    i0.value = '%s';                                        //    which takes as input the words
                                                            //      given in the navigation bar
    i1       = document.createElement('input');             //  Second field creation
    i1.type  = 'hidden';                                    //    of hidden type  = 'langpair';                                  //    called "langpair"
    i1.value = 'fr|en';                                     //    that takes "fr|en", as argument,
                                                            //      understood by Google as
                                                            //      "translate from french to english"
    f.appendChild(i0);                                      //  Ties the first field to the form
    f.appendChild(i1);                                      //  Ties the second field to the form
    b        = document.createElement('body');              //  <body> element creation
    b.appendChild(f);                                       //  Ties the form to the <body>
    h        = document.getElementsByTagName('html')[0];    //  Get anchor point for <body>
    h.appendChild(b);                                       //  Ties the <body> to the current page
    f.submit();                                             //  Submits the form


wiki/bookmarklet.txt · Last modified: 01.01.2009 03:47 by rgareus