Eval bookmarklet

This bookmarklet lets you run a line of JS without the console and see the result.


javascript:longAlert = function(textIn) { text = textIn.match(/[\s\S]{1,1000}/g) || [""]; for(var i in text) { i = parseInt(i); var isLast = (i == text.length - 1); if(isLast) { alert(text[i]) } else { var showNext = confirm(text[i]); if(!showNext) { break } } } }; BigInt.prototype.toJSON ??= function() { return `<BigInt ${this.toString()}>` }; var evalStatement = prompt("Enter JavaScript"); if(evalStatement !== null) { var evalResult; try { evalResult = eval(evalStatement) } catch(error) { evalResult = error }; var resultString = evalResult.toString(); longAlert(resultString) };

YouTube speed changer

This bookmarklet lets you set the speed of a YouTube playback within the range [0,16]. It uses code from Walter Nascimento.


javascript:var speed = prompt("Enter video speed"); if(speed !== null && speed !== "") { var speedFloat = parseFloat(speed); if(isNaN(speedFloat)) { alert("Please enter a valid speed") } else { if(speedFloat >= 0 && speedFloat <= 16) { document.getElementsByClassName("video-stream html5-main-video")[0].playbackRate = speedFloat; alert(`Speed set to ${speedFloat}`); } else { alert("Speed is out of bounds"); } } };

Change preview.redd.it image URLs to i.redd.it

This bookmarklet tries to change the low-quality preview.redd.it URLs on a Reddit page to higher-quality i.redd.it images, so that you can just right-click save without fiddling with the URL.


javascript:var count = 0; function previewDotRedditLinkToImageDotReddit(url) { var regexed = url.match(/(([A-Za-z0-9])+\.(png|jpg|webp|gif))/); if(!regexed) { return false }; var filename = regexed[0]; return `https://i.redd.it/${filename}` }; var images = Array.from(document.querySelectorAll("img") ); for(var i in images) { var image = images[i]; var oldSrc = image.getAttribute("src"); console.log(oldSrc); if(oldSrc == null) { continue }; if(oldSrc == "") { var parentHref = image.parentNode.getAttribute("href"); if(parentHref) { if(parentHref.includes("redd.it")) { oldSrc = parentHref.replace("i.redd.it","preview.redd.it") } } }; var newSrc = previewDotRedditLinkToImageDotReddit(oldSrc); if(newSrc) { if(oldSrc.includes("preview.redd")) { image.setAttribute("src",newSrc); count++ } } }; var priLinks = Array.from(document.querySelectorAll('a[href^="https://preview.redd.it/"]')); for(var j in priLinks) { var link = priLinks[j]; var oldHref = link.getAttribute("href"); var newHref = previewDotRedditLinkToImageDotReddit(oldHref); if(newHref) { link.setAttribute("href",newHref) } }; var thingsWithSrcset = Array.from(document.querySelectorAll('[srcset]')); for(var k in thingsWithSrcset) { var srcsetThing = thingsWithSrcset[k]; srcsetThing.setAttribute("srcset",srcsetThing.getAttribute("srcset").split(" ").map(x => previewDotRedditLinkToImageDotReddit(x) || x).join(" ")) }; alert(`${count} images changed.`);


go to main page