/r/bookmarklets

Photograph via snooOG

A javascript bookmarklet aims to modify the display of a website, but it can do much more.

Post your favorite bookmarklets here.


A javascript bookmarklet aims to modify the display of a website, but it can do much more.

Share and find new bookmarklets to make your surfing easier. Or harder.


Read the subreddit introduction & How-To

Posting Guidelines:

  • Put the javascript code in the self post.
  • Specify if the bookmarklet is specific for [reddit]
  • Specify [Firefox] [Safari] [Chrome]... as needed.
  • Make clear any restrictions or limitations.
  • A link to the original article/author is encouraged.

Hint: 4 spaces before "javascript: ..." will format the text as code.

And you, reader, don't execute scrambled code!

Recommended Subreddits:


/r/bookmarklets

2,154 Subscribers

3

Fake hacking a webpage bookmarklet

javascript:(function(){var commands=['breachFirewall','injectVirus','decryptData','bypassSecurity','overrideSystem','accessDatabase','initiateProtocol','scanNetwork','executeExploit','uploadPayload','downloadLogs','compileSource','allocateMemory','grantAdminAccess','terminateProcess','establishConnection','encryptFile','monitorTraffic','triggerAlarm','disableCamera','spoofIP','bruteForcePassword','crackEncryption','bypassCaptcha','disableFirewall','downloadSourceCode','exploitSQLInjection','accessAdminPanel','rebootServer','phishCredentials','scanForOpenPorts','traceNetworkRoute','startReverseShell','uploadMalware','removeLogs','modifyUserPermissions','installBackdoor','encryptTraffic','generateSessionTokens','accessShell','escalatePrivileges','disableAntivirus','decryptSSL','manipulateCookies','injectScript','redirectTraffic','spoofMACAddress','copyDatabase','monitorKeyPresses','initiateDDoS','blockIPRange','scanForVulnerabilities','decodeBase64','crashServer','bypassAuthentication','enumerateUsers','uploadRootkit','analyzeTraffic','uninstallSecurityPatches','captureNetworkPackets','interceptRequests','startBotnet','executeRemoteCommands','deleteLogs','corruptData','monitorAdminActivity','lockUserAccounts','scrapeWebsiteData','checkForWeakPasswords','spoofUserAgent','accessHiddenDirectories','manipulateSession','cloneWebsite','scanForBackdoors','overrideAccessControl','patchVulnerability','bypassTwoFactor','disableLogging','uploadExploit','interceptSSH','resetServerSettings','extractDatabase','executePayload','runShellCommand','scanForSSL','spoofDNS','disableAuditLogs','bypassContentFilter','openReverseShell','manipulateHeaders','bypassRateLimit','copyFiles','spoofEmail','crackHash','exploitRemoteCode','uploadShell','modifyConfigFile','disableSecuritySoftware','siphonData','forceSystemRestart','extractCookies','bypassFirewallRules','manipulateWebsiteCode','spoofSSL','cloneDatabase','disableEncryption','bruteForceFTP','exploitBufferOverflow','uploadTrojan','redirectNetworkTraffic','enumerateDirectories','interceptEmails','blockSystemProcesses','monitorNetworkTraffic','downloadFileSystem','exploitOpenPort','uploadExploitKit','disableNetworkAdapter','accessHiddenFiles','spoofSSLCertificate','scanForExploits','deleteDatabaseRecords','installKeylogger','createMaliciousScript','escalateRootPrivileges','enumerateProcessList','manipulateLogs','bypassLogin','uploadRansomware','redirectTrafficToBotnet','monitorLoginAttempts','copyServerFiles','accessProtectedFolders','manipulateAPIRequests','spoofSSHKey','disableWebApplicationFirewall','interceptCookies','exploitWeakCipher','executeSQLInjection','resetUserPassword','uploadExploitModule','crashService','enumeratePlugins','uploadExploitFramework','decryptNetworkTraffic','disableUserAccount','bypassSingleSignOn','uploadPersistenceScript','scanForWeakKeys','exploitShellshock','interceptNetworkResponse','executeCodeInjection','spoofUserSession','copyUserData','manipulateInput','disableSSLVerification','cloneGitRepository','manipulateDatabaseQueries','uploadPersistenceMechanism','enumerateNetworkDevices','bypassMalwareDetection','manipulateRegistryKeys','spoofNetworkAddress','crackPasswordHash','uploadExploitPayload','exploitCSRF','redirectSession','uploadShellcode','resetFirewall','manipulateRequestHeaders','disableSystemProcess','extractDataFromResponse','redirectUserTraffic','executePrivilegeEscalation','bypassServerRestrictions','enumerateSSHKeys','exploitCommandInjection','uploadSpyware','manipulateAuthentication','spoofMAC','enumerateSecurityGroups','disableServerLogins','monitorSystemProcesses','installRootCertificate','executeShellCommand','scanForSSLWeakness','redirectAPIRequest','disableApplication','uploadWebShell','extractWebsiteFiles'];el=document.createElement('pre');document.body.appendChild(el);el.style.position='fixed';el.style.top='0';el.style.left='0';el.style.height='25vh';el.style.width='100vw';el.style.overflowY='auto';el.style.background='black';el.style.color='lime';el.style.padding='10px';el.style.zIndex=9999;el.style.fontSize='12px';el.style.fontFamily='monospace';el.style.whiteSpace='pre-wrap';document.body.style.paddingTop='25vh';document.documentElement.style.overflowY='auto';var input='',index=0,command='',typing=false;function generateNestedCommand(){var depth=Math.floor(Math.random()*3)+2;var nestedCommand='';for(var i=0;i<depth;i++){var commandName=commands[Math.floor(Math.random()*commands.length)];nestedCommand+=' '.repeat(i)+'task '+commandName+' {\n';for(var j=0;j<Math.floor(Math.random()*3)+1;j++){var cmd=commands[Math.floor(Math.random()*commands.length)];nestedCommand+=' '.repeat(i+1)+cmd+'();\n';if(Math.random()<0.3){nestedCommand+=' '.repeat(i+1)+'{\n';nestedCommand+=' '.repeat(i+2)+commands[Math.floor(Math.random()*commands.length)]+'();\n';nestedCommand+=' '.repeat(i+1)+'}\n';}}}for(var k=depth-1;k>=0;k--){nestedCommand+=' '.repeat(k)+'}\n';}return nestedCommand;}function typeCharacter(){if(index<command.length){input+=command.charAt(index);el.textContent=input;el.scrollTop=el.scrollHeight;index++;}else{typing=false;startTyping();}}function startTyping(){if(!typing){typing=true;command=generateNestedCommand();index=0;}typeCharacter();}document.addEventListener('keypress',startTyping);})();

Using chatgpt, I finally did it. this adds a little black place with fake commands that can be typed, and it works really well

3 Comments
2024/10/09
18:31 UTC

2

How do I create a bookmarklet for redditp (image viewing?)

it seems pretty simple, just replace the reddit with redditp

1 Comment
2024/10/06
10:36 UTC

3

I cant use bookmarklets because my Chromebook is managed by my school. Is there a way to bypass this?

I found a website with some nice bookmarklets (pop up browser, pop up proxy, etc) but i cant use them because my Chromebook is managed by an administrator. Any way around this?

6 Comments
2024/09/25
16:24 UTC

4

Go offline - bookmarklet to block connections

https://getbookmarklets.com/scripts#https://raw.githubusercontent.com/madacol/web-automation/master/bookmarklets/go%20offline.js

javascript:(function() {
    const meta = document.createElement('meta');
    meta.httpEquiv = 'Content-Security-Policy';
    meta.content = "default-src 'unsafe-eval' data: blob:;";
    document.head.appendChild(meta);

    /* stop open connections like websockets */
    window.stop();
})();

What do you think of this approach of adding a very restrictive CSP? Do you see any way to bypass this?

4 Comments
2024/09/20
17:30 UTC

2

RSS feed for Blogger label

Click the Label that you want to follow on someone's Blogger blog. When you're viewing that results page, click this bookmarklet to get the RSS feed for all posts with that label.

javascript:(function()%7Blocation.href=location.href.replace('/search/label/',%20%20%20%20%20%20'/feeds/posts/default/-/')%7D)();

0 Comments
2024/09/03
10:33 UTC

2

Search a user's X timeline for "term"

Navigate to the user's profile page (x.com/user) and then click this bookmarklet. A pop-up window appears, asking for your search term. Returns the native X search results page, prepopulated with that term and limited to that user.

Edited for better clarity and functionality thanks to u/ichmoimeyo:

javascript:(function(){const term=prompt('Term?');if(term){const username=new URL(location.href).pathname.split("/")[1];window.location.href=\https://x.com/search?q=${encodeURIComponent(term)}%20(from%3A${encodeURIComponent(username)})&src=typed_query&f=live\`;}})();`

4 Comments
2024/09/03
10:30 UTC

1

[firefox] bookmarklet not working or not adding to bookmarks

i got this long bookmarklet https://pastebin.com/MZmzEy5C and its working on google chrome but not on firefox when i add it on firefox nothing happens no errors too so whats wrong? thanks for advance replies

4 Comments
2024/09/02
16:19 UTC

2

I'm looking for a bookmarklet that changes a range of two dates in a URL by -1 and -2 days according to the current date

*and opens the url after it has been modified

Here's an example URL:

https://twitter.com/search?q=until%3A2024-08-06%20since%3A2024-08-05&src=typed_query&f=media

Browser: chrome

5 Comments
2024/08/06
23:15 UTC

1

The best bookmarking tool I have used so far

I think i have found the best bookmarking tool. http://bookmarkshelf.com/

Its so minimalistic, and the best part is they don't ask for signups or any other bs like the other tools. You guys should check it out. You are welcome lol

1 Comment
2024/07/25
23:14 UTC

1

Bookmarklet replaces page with [object Window] after running

I'm trying to make a bookmarklet that opens the thumbnail of the current youtube video in a new tab, but it always replaces the youtube page with a page that says [object Window\] whenever I run it. Here's my code right now:

let str = location.href;
let char = "?v=";
let index = str.indexOf("?v=");
let vid = str.substr(index + 3,13);
window.open("https://img.youtube.com/vi/" + vid + "/maxresdefault.jpg");

Anybody know how to fix this?

6 Comments
2024/07/24
00:44 UTC

2

Delete Elements

Elo is there a way to delete elements from a page with a bookmarklet? Or even better, would it be possible so save an edited page as a bookmark?

This is the site I want to edit: https://www.twitch.tv/popout/USERNAME/chat I want to remove the Header the textbox and the bar below to have clean chat only window

EDIT Not sure if I bump this post by editing but in case somebody is looking for the same thing:

javascript:(function() { document.querySelector('.Layout-sc-1xcs6mc-0.cwtKyw')?.remove(); document.querySelector(%27.Layout-sc-1xcs6mc-0.fiHaCw.stream-chat-header%27)?.remove(); })();

this is a solution I came up with :)

I'm not streaming actively, but I got a small display and I open the chat in a pre-placed browser with saved tabs on quit, so it will just open up in that display everytime, it's small so I adjusted the text size in Twitch chat settings and zoomed the browser since the build in settings weren't enough, the problem was the typing-window and chat header which only said "Twitch chat" were really big because of the zoom so I had to delete them via hand which was really annoying, now I just gotta find a way to execute that javascript/bookmarklet via streamdeck and it's even easier. Make sure to press F11 to go into fullscreen mode, it looks very clean, only chat.

8 Comments
2024/06/23
16:05 UTC

4

Read content one word at a time

I loved Spreeder and Spritz but in my mind they both lacked major usability features like dyslexic fonts and general ease of use.

This bookmarklet allows you to either highlight text and have it display in an overlay OR if you have nothing selected when you click the bookmarklet, you can use the mouse to hover over the element or element group you want it to read then click to start.

Pressing esc at any time kills the script. The default WPM speed is 500, but you can press any of the number keys to set it at that number x 100 WPM. Also pressing the left or right arrows will decrease or increase the speed.

Pressing R restarts the reader.

javascript:(function(){function copyToClipboard(text){var textArea=document.createElement("textarea");textArea.style.position='fixed';textArea.style.top=0;textArea.style.left=0;textArea.style.width='2em';textArea.style.height='2em';textArea.style.padding=0;textArea.style.border='none';textArea.style.outline='none';textArea.style.boxShadow='none';textArea.style.background='transparent';textArea.value=text;document.body.appendChild(textArea);textArea.focus();textArea.select();try{var successful=document.execCommand('copy');var msg=successful?%27successful%27:%27unsuccessful%27;console.log(%27Copying text command was %27+msg);}catch(err){console.log(%27Oops, unable to copy%27);}document.body.removeChild(textArea);}function getAllText(element){var text=%27%27;var walker=document.createTreeWalker(element,NodeFilter.SHOW_TEXT,{acceptNode:function(node){var parentNode=node.parentNode;while(parentNode){if(parentNode.nodeName.toLowerCase()===%27script%27||parentNode.nodeName.toLowerCase()===%27style%27||parentNode.nodeName.toLowerCase()===%27noscript%27||parentNode.nodeName.toLowerCase()===%27table%27){return NodeFilter.FILTER_REJECT;}parentNode=parentNode.parentNode;}return NodeFilter.FILTER_ACCEPT;}},false);var node;while(node=walker.nextNode()){text+=node.nodeValue+%27 %27;}return text.trim();}var selectedText=window.getSelection().toString();if(selectedText){copyToClipboard(selectedText);console.log(%27Copied to clipboard: %27+selectedText);startsprite(selectedText);}else{var highlightedElement;var rectangles=[];var elementsUnderCursor=[];var currentElementIndex=0;function highlightElement(event){elementsUnderCursor=Array.from(document.elementsFromPoint(event.clientX,event.clientY)).filter(el=>{const text=el.innerText.trim();const style=window.getComputedStyle(el);return text.length>0&&style.visibility!==%27hidden%27&&style.display!==%27none%27;});if(elementsUnderCursor.length>0){if(highlightedElement!==elementsUnderCursor[currentElementIndex]){removeHighlight();highlightedElement=elementsUnderCursor[currentElementIndex];drawHighlight(highlightedElement);}}}function drawHighlight(element){if(element){var rect=element.getBoundingClientRect();var rectangle=document.createElement("div");rectangle.style.position="absolute";rectangle.style.top=rect.top+window.scrollY+"px";rectangle.style.left=rect.left+window.scrollX+"px";rectangle.style.width=rect.width+"px";rectangle.style.height=rect.height+"px";rectangle.style.border="2px solid red";rectangle.style.backgroundColor="rgba(255, 0, 0, 0.2)";rectangle.style.pointerEvents="none";document.body.appendChild(rectangle);rectangles.push(rectangle);}}function removeHighlight(){while(rectangles.length){var rectangle=rectangles.pop();document.body.removeChild(rectangle);}}function handleClick(event){event.stopPropagation();event.preventDefault();var text=getAllText(highlightedElement);copyToClipboard(text);console.log(%27Copied to clipboard: %27+text);startsprite(text);stopScript();}function handleTab(event){if(event.key===%27Tab%27){event.preventDefault();currentElementIndex=(currentElementIndex+1)%elementsUnderCursor.length;removeHighlight();highlightedElement=elementsUnderCursor[currentElementIndex];drawHighlight(highlightedElement);}}function handleEsc(event){if(event.key===%27Escape%27){event.stopImmediatePropagation();stopScript();}}function updateHighlight(){if(highlightedElement){removeHighlight();drawHighlight(highlightedElement);}}function stopScript(){removeHighlight();document.removeEventListener(%27mousemove%27,highlightElement);document.removeEventListener(%27click%27,handleClick);document.removeEventListener(%27keydown%27,handleTab);document.removeEventListener(%27keydown%27,handleEsc);window.removeEventListener(%27scroll%27,updateHighlight);}document.addEventListener(%27mousemove%27,highlightElement);document.addEventListener(%27click%27,handleClick);document.addEventListener(%27keydown%27,handleTab);document.addEventListener(%27keydown%27,handleEsc);window.addEventListener(%27scroll%27,updateHighlight);}function startsprite(text){var wpm=400;var $container=document.createElement(%27div%27);$container.className=%27sprite%27;var $space=document.createElement(%27div%27);$space.className=%27sprite-word%27;$container.appendChild($space);document.body.appendChild($container);var $overlay=document.createElement(%27div%27);$overlay.style.position=%27fixed%27;$overlay.style.top=0;$overlay.style.left=0;$overlay.style.width=%27100%%27;$overlay.style.height=%27100%%27;$overlay.style.backgroundColor=%27rgba(0, 0, 0, 0.75)%27;$overlay.style.zIndex=9998;$overlay.style.transition=%27opacity 0.5s%27;$overlay.style.opacity=0;document.body.appendChild($overlay);setTimeout(function(){$overlay.style.opacity=1;},0);var style=document.createElement(%27style%27);style.innerHTML=`@font-face{font-family:%27OpenDyslexic%27;src:url(%27https://cdn.jsdelivr.net/gh/antijingoist/open-dyslexic/otf/OpenDyslexic-Regular.otf%27)format(%27opentype%27);font-weight:normal;font-style:normal;}.sprite{color:#ddd;position:fixed;width:30rem;padding:-1.5rem 1rem 5rem;border-top:2px solid #ddd;border-bottom:2px solid #ddd;top:20%;left:50%;transform:translate(-50%,-50%);font-family:'OpenDyslexic',sans-serif;font-size:2.4rem;line-height:3.2rem;height:3.2rem;font-weight:600;z-index:9999;}.sprite-word div{display:table-cell;}.sprite-word div:nth-child(2){color:red;}.sprite-word div:first-child{width:40%;text-align:right;}.sprite-word div:last-child{width:60%;text-align:left;}.sprite::before,.sprite::after{content:'';position:absolute;height:.25rem;width:2px;background-color:#ddd;top:0rem;left:40%;transform:translateX(-1px);}.sprite::after{top:auto;bottom:0rem;}%60;document.head.appendChild(style);var i=0;var words;var sprite;function words_set(text){words=text.replace(/\s{2,}/g,' ').split(' ').filter(word=>word);for(let j=0;j<words.length-1;j++){if(/^[.,!?;:]$/.test(words[j+1])){words[j]+=words[j+1];words.splice(j+1,1);}}}function word_show(i){var word=words[i];if(word===undefined)return;var stop=Math.round((word.length+1)*0.4)-1;$space.innerHTML='<div>'+word.slice(0,stop)+'</div><div>'+word[stop]+'</div><div>'+word.slice(stop+1)+'</div>';}function word_update(){if(i<words.length){word_show(i);var currentInterval=calculateInterval(words[i]);i++;sprite=setTimeout(word_update,currentInterval);}else{setTimeout(function(){$space.innerHTML='';removesprite();},500);}}function calculateInterval(word){var baseInterval=Math.max(100,Math.round((60000/wpm)*(word.length/5)));if(word.includes(',')){baseInterval+=200;}else if(/[.;:!?]/.test(word)){baseInterval+=400;}return baseInterval;}function startsprite(text){words_set(text);i=0;word_show(0);setTimeout(word_update,1500);}function removesprite(){clearTimeout(sprite);$container.remove();$overlay.style.opacity=0;setTimeout(function(){$overlay.remove();},500);style.remove();document.removeEventListener('keydown',keydownHandler);document.removeEventListener('click',clickHandler);}function keydownHandler(event){if(event.key==='Escape'){event.stopPropagation();event.preventDefault();removesprite();}else if(event.key>='1'&&event.key<='9'){event.stopPropagation();event.preventDefault();wpm=parseInt(event.key)*100;clearTimeout(sprite);word_update();}else if(event.key==='ArrowLeft'||event.key==='-'||event.key==='_'){event.stopPropagation();event.preventDefault();wpm=Math.max(100,wpm-100);clearTimeout(sprite);word_update();}else if(event.key==='ArrowRight'||event.key==='='||event.key==='+'||event.key==='Shift'){event.stopPropagation();event.preventDefault();wpm+=100;clearTimeout(sprite);word_update();}else if(event.key==='r'||event.key==='R'){event.stopPropagation();event.preventDefault();clearTimeout(sprite);startsprite(window.getSelection?window.getSelection().toString():document.selection.createRange().text);}}function clickHandler(){removesprite();}startsprite(text);document.addEventListener('keydown',keydownHandler);document.addEventListener('click',clickHandler);}})();
2 Comments
2024/06/07
20:22 UTC

4

A quick and dirty Google Sheet scraping bookmarklet

If you're on a site and see dynamic content you might want to scrape, this bookmarklet will generate an importXML Google Sheet formula and copy it to the clipboard. Then all you need to do is ctrl+v into an empty Google Sheet cell.

If you execute the script with nothing selected, you can use the mouse to hover over the element you want to scrape. Clicking on the element will copy the formula to your clipboard.

You can also highlight the content and then execute the script which will directly generate the formula and copy it to the clipboard.

Happy scraping!

javascript:(function() { let hoverElement, highlightDiv, messageDiv, backgroundDiv, coffeeDiv, cancelScript; function getXPath(element) { if (element.id !== '') { return '//*[@id=\'' + element.id.replace(/'/g, "\\'") + '\']'; } if (element === document.body) { return '/' + element.tagName.toLowerCase(); } let ix = 0; let siblings = element.parentNode.childNodes; for (let i = 0; i < siblings.length; i++) { let sibling = siblings[i]; if (sibling === element) { return getXPath(element.parentNode) + '/' + element.tagName.toLowerCase() + '[' + (ix + 1) + ']'; } if (sibling.nodeType === 1 && sibling.tagName === element.tagName) { ix++; } } } function getSelectedXPath() { let selection = window.getSelection(); if (selection.rangeCount > 0) { let range = selection.getRangeAt(0); let container = range.commonAncestorContainer; if (container.nodeType !== 1) { container = container.parentNode; } return getXPath(container); } return null; } function copyFormulaToClipboard(formula) { let dummy = document.createElement("textarea"); document.body.appendChild(dummy); dummy.value = formula; dummy.select(); document.execCommand("copy"); document.body.removeChild(dummy); showMessage("Formula copied to clipboard: " + formula); } function showMessage(text) { messageDiv = document.createElement("div"); messageDiv.textContent = text; messageDiv.style.position = "fixed"; messageDiv.style.top = "25px"; messageDiv.style.left = "50%"; messageDiv.style.transform = "translateX(-50%)"; messageDiv.style.fontSize = "24pt"; messageDiv.style.color = "#cc3333"; messageDiv.style.fontFamily = "'Lucida Console', Monaco, monospace"; messageDiv.style.fontWeight = "bold"; messageDiv.style.zIndex = "9999"; messageDiv.style.opacity = "0"; messageDiv.style.transition = "opacity 0.5s"; messageDiv.style.textShadow = "0.5px 0.5px 2px rgb(50, 25, 25)"; document.body.appendChild(messageDiv); let messageRect = messageDiv.getBoundingClientRect(); backgroundDiv = document.createElement("div"); backgroundDiv.style.position = "fixed"; backgroundDiv.style.top = %60${messageRect.top - 15}px%60; backgroundDiv.style.left = "50%"; backgroundDiv.style.transform = "translateX(-50%)"; backgroundDiv.style.width = %60${messageRect.width + 30}px%60; backgroundDiv.style.height = %60${messageRect.height + 30}px%60; backgroundDiv.style.backgroundColor = "rgba(100, 100, 100, 0.3)"; backgroundDiv.style.borderRadius = "15px"; backgroundDiv.style.backdropFilter = "blur(5px)"; backgroundDiv.style.zIndex = "9998"; backgroundDiv.style.opacity = "0"; backgroundDiv.style.transition = "opacity 0.5s"; document.body.appendChild(backgroundDiv); coffeeDiv = document.createElement("div"); coffeeDiv.style.position = "fixed"; coffeeDiv.style.fontFamily = "'Lucida Console', Monaco, monospace"; coffeeDiv.style.fontSize = "6pt"; coffeeDiv.style.top = "10px"; coffeeDiv.style.right = "10px"; coffeeDiv.style.zIndex = "9999"; coffeeDiv.style.cursor = "pointer"; coffeeDiv.style.opacity = "0"; coffeeDiv.style.transition = "opacity 0.5s"; coffeeDiv.innerHTML = %60 <div style="background: rgba(100, 100, 100, 0.75); border-radius: 15px; padding: 10px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center;"> <img src="https://i.imgur.com/UylSBV7.png" style="width: 100px; height: auto;"/> <div style="color: white; font-size: 14px; margin-top: 5px;">Buy me a coffee</div> </div> %60; coffeeDiv.addEventListener('click', function(event) { event.stopPropagation(); window.open('https://account.venmo.com/pay?recipients=oddmedium', '_blank'); }); document.body.appendChild(coffeeDiv); setTimeout(() => { messageDiv.style.opacity = "1"; backgroundDiv.style.opacity = "1"; coffeeDiv.style.opacity = "1"; }, 0); setTimeout(() => { messageDiv.style.opacity = "0"; backgroundDiv.style.opacity = "0"; if (!cancelScript) { setTimeout(() => { document.body.removeChild(messageDiv); document.body.removeChild(backgroundDiv); }, 500); } }, 3500); } function removeEventListeners() { document.removeEventListener("mousemove", onMouseMove); document.removeEventListener("click", onClick, true); document.removeEventListener("keydown", onKeyDown); } function onMouseMove(event) { if (cancelScript) return; let target = event.target; if (target !== hoverElement && !coffeeDiv.contains(target) && target !== messageDiv && target !== backgroundDiv) { hoverElement = target; let rect = hoverElement.getBoundingClientRect(); highlightDiv.style.width = rect.width + "px"; highlightDiv.style.height = rect.height + "px"; highlightDiv.style.left = rect.left + window.scrollX + "px"; highlightDiv.style.top = rect.top + window.scrollY + "px"; } } function onClick(event) { if (cancelScript) return; if (!coffeeDiv.contains(event.target)) { event.preventDefault(); event.stopImmediatePropagation(); if (hoverElement) { let xpath = getXPath(hoverElement).replace(/"/g, "'"); let url = window.location.href; let formula = %60=importxml("${url}", "${xpath}")%60; copyFormulaToClipboard(formula); document.body.removeChild(highlightDiv); removeCoffeeAndHighlight(); } } } function onKeyDown(event) { if (event.key === "Escape") { cancelScript = true; if (highlightDiv) { document.body.removeChild(highlightDiv); } fadeOutCoffeeAndHighlight(); } } function removeCoffeeAndHighlight() { setTimeout(() => { if (coffeeDiv) { coffeeDiv.style.opacity = "0"; setTimeout(() => { document.body.removeChild(coffeeDiv); }, 500); } removeEventListeners(); }, 0); } function fadeOutCoffeeAndHighlight() { if (coffeeDiv) { coffeeDiv.style.opacity = "0"; setTimeout(() => { document.body.removeChild(coffeeDiv); }, 500); } removeEventListeners(); } function initializeSelectionTool() { hoverElement = null; highlightDiv = document.createElement("div"); highlightDiv.style.position = "absolute"; highlightDiv.style.border = "2px solid red"; highlightDiv.style.background = "rgba(255, 0, 0, 0.1)"; highlightDiv.style.pointerEvents = "none"; document.body.appendChild(highlightDiv); cancelScript = false; document.addEventListener("mousemove", onMouseMove); document.addEventListener("click", onClick, true); document.addEventListener("keydown", onKeyDown); showMessage("Hover over elements to highlight. Click to copy XPath."); } let xpath = getSelectedXPath(); if (xpath) { let url = window.location.href; let formula = %60=importxml("${url}", "${xpath}")%60; copyFormulaToClipboard(formula); } else { initializeSelectionTool(); }})();

1 Comment
2024/06/07
16:06 UTC

13

I am building a site to share bookmarklets

6 Comments
2024/05/26
20:51 UTC

5

Facebook official bookmarklet is dead

Facebook shows their own "Share to Facebook" bookmarklet here:

https://www.facebook.com/share_options.php

With this bookmarklet code:

javascript:var d=document,f='``https://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1716521871&u=%27+e(l.href)+%27&t=%27+e(d.title);1;try{if%20(!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z)%20{a=function()%20{if%20(!window.open(f+%27r%27+p,%27sharer%27,%27toolbar=0,status=0,resizable=1,width=626,height=436%27))l.href=f+p};if%20(/Firefox/.test(navigator.userAgent)``)setTimeout(a,0);else{a()}}void(0)

However, it is dead. It only let's you share the page to your own timeline. No more Group or Page sharing.

Anyone have a workaround? I used this all the time to share stuff to Facebook Groups.

0 Comments
2024/05/24
03:41 UTC

3

Remove WebArchive Added HTMLs

Bookmarklet to remove webarchive.org Wayback Machine's HTML code from archived page. To remove Wayback Machine's sticky top panel and HTML code comments. Restoring the original site page's HTML code.

The bookmarklet will however, insert a HTML comment containing the URL of the archived page for reference, at the end of the page HTML code.

javascript:/*RemoveWebArchiveAddedHTMLs*/
((a, b, c) => {
  if (!document.querySelector('#wm-ipp-base')) return alert("Not a Wayback Machine archived page.");
  a = document.head;
  while (b = a.firstChild) {
    a.removeChild(b);
    if ((b.nodeType === Node.COMMENT_NODE) && /^\s*end wayback/i.test(b.nodeValue)) break
  }
  a = document.body.firstChild;
  while (a) {
    if ((a.nodeType === Node.COMMENT_NODE) && /^\s*begin wayback/i.test(a.nodeValue)) {
      b = a; c = [a];
      while (b = b.nextSibling) {
        c.push(b);
        if ((b.nodeType === Node.COMMENT_NODE) && /^\s*end wayback/i.test(b.nodeValue)) {
          c.forEach(e => document.body.removeChild(e));
          break
        }
      }
      break
    }
    a = a.nextSibling
  }
  document.removeChild(document.lastChild);
  document.lastChild.nodeValue = location.href
})()
0 Comments
2024/03/13
14:38 UTC

4

Move to new tab

Bookmarklet to move a site to a new tab and close the old one, to start a fresh page view.

Intended to be used for memory leaking sites such as Google Maps which kept consuming more and more memory over time. Reopening it in a new tab and close the old one will free up the leaked memory.

javascript:/*MoveToNewTab*/open(location.href)&&close()
0 Comments
2024/02/27
02:32 UTC

4

Removing Shorts from Youtube's History page

Huge fan of js bookmarks, wish i discovered this sub sooner. Here's my first contribjavascript:(function(){var e=document.querySelectorAll('a[href*="/shorts/"]');e.forEach(function(e){var t=e.parentNode;while(t&&t.parentNode){if("ytd-video-renderer"===t.tagName.toLowerCase()||"ytd-rich-item-renderer"===t.tagName.toLowerCase())break;t=t.parentNode}t&&t.parentNode&&t.parentNode.removeChild(t)})})();

Read more at https://www.reddit.com/r/revancedapp/comments/1as3za0/removing_shorts_from_history_in_web/

https://www.reddit.com/r/youtube/comments/1askhki/how_to_delete_shorts_so_you_can_view_your_actual/

7 Comments
2024/02/16
08:54 UTC

2

Go back to previous reddit

The new interface sucks, this will take you back to the previous interface.

javascript: window.open(document.URL.replace(/\/www./, "/new."), "_self")

edit: I mean the previous UI not old old UI.

7 Comments
2024/02/01
18:02 UTC

7

Redirect staticflickr.com Flickr image to full Flickr image page

javascript:(function(){if(window.location.hostname.indexOf('staticflickr.com')!==-1){var flickrImageID=window.location.pathname.match(/\/(\d+)_/)[1];var flickrPageURL="https://www.flickr.com/photo.gne?rb=1&id="+flickrImageID;window.location.href=flickrPageURL;}else{alert("This bookmarklet only works on staticflickr.com");}})();

https://gist.github.com/jesterjunk/722d9dcfeacc0414e7315846db3215db

screenshot of the Gist page

https://preview.redd.it/8qm00zm850gc1.png?width=1600&format=png&auto=webp&s=77523992c2f814c25d0d3a21a85de98372777d93

0 Comments
2024/02/01
16:35 UTC

2

How to change window title on a window.open?

Hi all, new to the concept of bookmarklets. I have a little bit of JS knowledge but not great. I'm trying to get this example bookmark to open with a custom window title but I can't quite figure out how. Any pointers? This is exactly what I'm using as my bookmark which is opening the window as I want it; I just need to change the window title so I can set it up in a DisplayFusion window position profile.

I might have achieved what I need using this extension, but wouldn't hurt to learn how this can be done from JS. https://chromewebstore.google.com/detail/change-page-title/ebbfpplpmnoblfmdkbicmakmbbjijdpg

javascript:void(window.open('https://player.twitch.tv/?channel=shroud&enableExtensions=true&muted=true&parent=twitch.tv&player=popout&volume=0%27,%27popout_chat%27,%27width=800,height=400%27))

6 Comments
2024/01/16
21:41 UTC

2

Javascript REPL

This bookmarklet will execute the Javascript expression you've entered and show the result. If you for some reason don't want to use the developer console you can use this.
javascript:for((function(){try{eval('')}catch(e){throw alert("Sorry, this webpage has blocked eval(): "+e)}})();;alert((function(a){if(a===null){throw a;}try{return eval(a);}catch(e){return e;}})(prompt())));

0 Comments
2024/01/15
11:43 UTC

2

Running bookmarklets without bookmarking them.

I made a bookmarklet so that you can test it on a page without bookmarking it first:
javascript:void eval((function(x){try{return decodeURI(x)}catch(a){}return x;})(prompt("Try bookmarklets without bookmarking!")).replace(/javascript\:/, ''))
It works most of the time.

(Also, there's a functionality in Firefox called "Browser Console". Executing this in the browser console lets you run the bookmarklet on the entire Window rather than the current tab. But as of my testing most of the bookmarklets will break in such environment.)

1 Comment
2024/01/15
11:33 UTC

3

Hide everything that isn't a Reddit comment.

https://i.imgur.com/pqeOl9E.png

javascript:(function()%7B var style = document.createElement(%27style%27), styleContent = document.createTextNode(%27 * %7B visibility:hidden !important; %7D .md * %7B visibility:visible !important; %7D %27); style.appendChild(styleContent ); var caput = document.getElementsByTagName(%27head%27); caput%5B0%5D.appendChild(style); %7D)();
1 Comment
2024/01/13
19:26 UTC

1

Isthereanydeal.com bookmarklet please

I have created a bookmarklet for isthereanydeal website ( used for checking game prices history ) ? But seems to have run into bit of trouble.

Can anyone help me please write the following bookmarklet to work under Chrome/Chromium?

So this is what i have. Original game url -> https://store.steampowered.com/app/<game_name>

How do i selectively substring only the <game_name> from the original URL ??

My Bookmarklet with errors - javascript:void(window.location="https://isthereanydeal.com/game/?q="+encodeURIComponent(window.location.href)+"/info/");

im trying to get to this -> https://isthereanydeal.com/game/<game_name>/info/

This bookmarklet should be triggered whenever a webpage is viewed and passed through this bookmarklet, will show the search results of isthereanydeal.com for this particular game or (even better) actually opens up the actual the statistics page of the game price.

The bookmarklet should basically pick up the text selected from gamesale page, and search for this selected work word1 and automatically pass it through the website of isthereanydeal.com. Im currently doing this in round about way using some Chrome extension which i dont like and much prefer to use bookmarklet which saves me multiple clicks hopefully.

It seems to be simple but im not sure how to go about with this.

Any solution please? Thank you

2 Comments
2023/12/28
15:39 UTC

1

Convert link to youtu.be format

I'd think somebody that knows this craft of scripting bookmarklets would have a way to change a link to the shortened format from whatever is on the current clipboard.

(I swore this option used to be in the share menu, but now it seems those options are all being made longer with additional tracking data appended and I'm not exactly a fan of that.)

1 Comment
2023/12/17
20:41 UTC

5

Stop timers

Bookmarklets for stopping timeout, interval, and animation-frame based timers. Note: destructive / non resumable. It's not meant for and can not circumvent server tracked timers. Only for pausing/freezing page content changes/progress done by JS timers. Non effective for CSS based animations.

For all timer types:

javascript:/*StopTimers*/(() => {
  "setTimeout,clearTimeout;setInterval,clearInterval;requestAnimationFrame,cancelAnimationFrame".split(";").forEach((pair, tid) => {
    pair = pair.split(",");
    tid = window[pair[0]](() => {}, 0);
    while (tid) window[pair[1]](tid--);
  })
})()

For only timeout timers:

javascript:/*StopTimeoutTimers*/((pair, tid) => {
  pair = "setTimeout,clearTimeout".split(",");
  tid = window[pair[0]](() => {}, 0);
  while (tid) window[pair[1]](tid--);
})()

For only interval timers:

javascript:/*StopIntervalTimers*/((pair, tid) => {
  pair = "setInterval,clearInterval".split(",");
  tid = window[pair[0]](() => {}, 0);
  while (tid) window[pair[1]](tid--);
})()

For only animation-frame timers:

javascript:/*StopAnimationFrameTimers*/((pair, tid) => {
  pair = "requestAnimationFrame,cancelAnimationFrame".split(",");
  tid = window[pair[0]](() => {}, 0);
  while (tid) window[pair[1]](tid--);
})()
1 Comment
2023/12/03
09:23 UTC

Back To Top