FANDOM


This page can be used for converting javascripts into bookmarklets. Bookmarklets can be used on the currently loaded page in the browser and are called by typing the whole bookmarklet within the URL window.

You have not installed this script; see below for instructions.

InstallationEdit

To make this page work, simply include the source in your global JavaScript file. To make it work on your own page, place the following element anywhere in your body tag and link to the script from your head.

<div id="bookmarklet">You have not installed this script; <a href="#Installation">see below</a> for instructions.</div>

SourceEdit

window.onload = function(){
    var bookmarklet = document.getElementById('bookmarklet');
    if(bookmarklet){
        var input = document.createElement('input');
        var button = document.createElement('button');
        input.type = 'text';
        button.value = button.innerText = button.textContent = 'Make Bookmarklet';
        button.onclick = function makeBookmarklet() {
            input.value = 'javascript:' + input.value;
        };
        while(bookmarklet.hasChildNodes())
            bookmarklet.removeChild(bookmarklet.lastChild);
        bookmarklet.appendChild(input);
        bookmarklet.appendChild(button);
    }
};