one of my first programs

I thought I would share one of my most used programs, I made this after watching a video, I just did not like having to edit my bookmarks everytime a program didn’t work. This program will take any script you can add to a book mark and make it so all you need to do is copy code and then drag it to your book mark.

Bookmarklet Maker

Bookmarklet Maker

Paste ANY JavaScript code below:

It may seem a little boring but it does do the job.

<!DOCTYPE html>

<html>

<head>

<meta charset=”UTF-8″>

<title>Bookmarklet Maker</title>

<style>

    body { font-family: Arial; padding: 20px; }

    textarea { width: 100%; height: 200px; font-family: monospace; }

    #output a { 

        display: inline-block; padding: 10px 15px; background: #007bff;

        color: white; border-radius: 6px; text-decoration: none; margin-top: 10px;

    }

</style>

</head>

<body>

<h2>Bookmarklet Maker</h2>

<p>Paste ANY JavaScript code below:</p>

<textarea id=”code”></textarea>

<button onclick=”make()”>Generate Bookmarklet</button>

<div id=”output” style=”margin-top:20px;”></div>

<script>

function make() {

    let raw = document.getElementById(‘code’).value;

    if (!raw.trim()) {

        alert(‘No code entered!’);

        return;

    }

    // Collapse into one line

    let oneLine = raw.replace(/\s+/g, ” “).trim();

    // Encode safely for URL/bookmarklet

    let encodedJS = encodeURIComponent(“(function(){” + oneLine + “})();”);

    // Final bookmarklet

    let href = “javascript:” + encodedJS;

    document.getElementById(‘output’).innerHTML =

        ‘<a href=”‘ + href + ‘”>Drag Me to Bookmarks</a>’ +

        “<br><br><small>Bookmarklet generated successfully.</small>”;

}

</script>

</body>

</html>

Leave a Reply

Discover more from Freeview

Subscribe now to keep reading and get access to the full archive.

Continue reading