My bookmarklets

What's a bookmarklet?

My simplest definition is as follows: a bookmarklet is JavaScript code stored in a bookmark. It will perform a desired action or modification on the current page as to increase your productivity and convenience or to bypass stupid design decisions. The same code can be used in other browsers or with Greasemonkey and similar extensions.

Access all Instagram links and video controls from the home page

Instagram's web version is very agressive in its efforts for a "clean", "simple" interface. The commands to get an image URL or open it in a new tab are unavailable and the only thing you can do with videos is clicking: no volume control, no way to set position, no way to disable that horrible looping. I guess they try to harmonize with the app version and to the Vine'y origins of that feature. Either way, it's stupid that they bring mobile app limitations to the web when mobile device should be doing the jump computers made since the so called Web 2.0. The only "apps" you should need locally are behemoths like Photoshop or AAA games or things that need to work offline.

What this bookmarklet does:
- Adds very visible links to images and videos just above them.
- Makes videos bearable. No autoloop, no blaring volume (they stared muted) and returns
video controls (length, position and volume).
- It refreshes every 1 second so it keeps working while you scroll.

javascript:var mediaLinks=[],mediaSrcs=[];function linker(){var e=document.getElementsByClassName("videoSpritePlayButton");for(i=0;i< e.length;i++)e[i].parentNode.removeChild(e[i]);var t=document.getElementsByTagName("a");for(i=0;i< t.length;i++)"button"!=t[i].getAttribute("role")&&-1==t[i].href.indexOf(".instagram.")||"javascript:;"==t[i].href||(t[i].style.zIndex=10001);Array.from(document.getElementsByClassName("coreSpriteRightChevron")).concat(Array.from(document.getElementsByClassName("coreSpriteLeftChevron"))).forEach(function(e){}),Array.from(document.getElementsByTagName("video")).concat(Array.from(document.getElementsByTagName("img"))).forEach(function(e){if(!e.brelsMediaLink){if("IMG"==e.tagName&&!e.srcset)return;for(var t=e;t.parentNode&&"ARTICLE"!=t.parentNode.tagName;)t=t.parentNode;if(t==document)return;var r=1;for(i=0;i< e.src.length;i++)r+=e.src.charCodeAt(i)*(1+(r^i));e.brelsBadHash="brels"+r;var n=document.getElementById(e.brelsBadHash);if(n||(n=document.createElement("a")),!t.brelsLinkHeader){var a=document.createElement("div");"inline-block","solid","1px","black","white","min-content","nowrap",a.innerHTML="Links: ",t.insertBefore(a,t.firstElementChild),"brelsLinkHeader"+Math.floor(*Math.random())}(t=document.getElementById(t.brelsLinkHeader)).contains(n)||(mediaLinks.push(n),mediaSrcs.push(e.src),,,t.brelsMediaLinkCount||(t.brelsMediaLinkCount=0),n.innerHTML=++t.brelsMediaLinkCount,"_blank",,"blue","underline","inline-block","min-content","8px",t.appendChild(n)),,e.controls=!0,e.muted=!0,e.loop=!1,e.setAttribute("brelsMediaLink",e.brelsBadHash),n.href=e.src}}),setTimeout(function(){linker()},500)}linker();

Link for drag'n'drop bookmarking: Instagram: Reveal picture and video links and controls

Open a full-resolution Instagram .jpg or video.mp4

Instagram hides the original .jpg behind a "CSS Wall". You can't use a right-click menu command to open the picture in a new window or copy the direct link. Bookmark this code and you get to access it with a single click:

javascript:var metas=document.head.getElementsByTagName("meta"); for (i=0; i < metas.length; i++) if (((metas[i].getAttribute("property")=="og:image") && (document.head.innerHTML.indexOf("og:video")==-1)) || (metas[i].getAttribute("property")=="og:video:secure_url")) { location.href=metas[i].getAttribute("content"); break;}

Link for drag'n'drop bookmarking: Instagram: Reveal picture or video link

If you want the picture to be shown on a new tab:

javascript:var metas=document.head.getElementsByTagName("meta"); for (i=0; i < metas.length; i++) if (((metas[i].getAttribute("property")=="og:image") && (document.head.innerHTML.indexOf("og:video")==-1)) || (metas[i].getAttribute("property")=="og:video:secure_url")) {[i].getAttribute("content")); break;}

Link for drag'n'drop bookmarking: Instagram: Reveal picture or video link in a new tab

It uses the picture page name as a new tab name so it won't open two tabs for the same picture.

Getting rid of the Who to follow list on Twitter

If you're like me, you've been very annoyed by that "Who to follow" list Twitter introduced some time ago. Such addition was well-intentioned as a means for new users to find new accounts to follow, but Twitter old-timers know that the best recommendations come from those snarky RTs we get from the people we already follow. The good news is that you can make the Who to follow list go by emptying it. The bad news is that you're supposed to do it manually. I've been using this bookmarklet to empty whevener it crawls back from the oblivion I send it to periodically.

javascript:{function dismiss() { var x=document.getElementsByClassName("dismiss js-action-dismiss"); if (x[0]) x[0].click(); if (x.length) setTimeout(function() { dismiss(); }, 100); }; dismiss();}

Link for drag'n'drop bookmarking: Twitter: remove who to follow

Full-windowed video on Youtube

I don't like watching Youtube videos fullscreen. I generally get the video handle and open another window with the embed option. This allows me to have a full resizable window I can place in the most appropriate spot. This way, I can wait for the relevant parts of the video while reading and doing other things, especially in those videos that are just some lines of text read aloud.

javascript:var v="","&");for(i=0;i<s.length;i++) if (s[i].indexOf("v=")!=-1) {v=s[i];break;} location.href=""+v.split("=")[1];

Link for drag'n'drop bookmarking: Youtube: full-windowed video

Remove all stylesheets from a page

It's just as the title says. Sometimes useful information that you could read or search from the start is hidden by CSS in the name of aesthetics or navigational consistency. I use this to reveal all text in a page.

javascript:x=document.head.getElementsByTagName("link"); for (i=x.length-1; i >=0; i--) if (x[i].rel.toLowerCase()=="stylesheet") x[i].parentElement.removeChild(x[i]);x=document.head.getElementsByTagName("style"); for (i=x.length-1; i >=0; i--)x[i].parentElement.removeChild(x[i]);

Link for drag'n'drop bookmarking: Remove all stylesheets

Remove annoying Facebook login prompt

When you're not signed in, Facebook covers its page with an annoying login/signup prompt that can only be minimized. This bookmarklet hides such prompt. Use the extension if you want it to be hidden automatically.

javascript:var nagbig = document.getElementById("expanding_cta_close_button");if (nagbig);var nagsmall = document.getElementById("headerArea");if (nagsmall)"none";var nagsmall2 = document.getElementById("pagelet_growth_expanding_cta");if (nagsmall2);

Link for drag'n'drop bookmarking: Remove FacePrompt

Make all page text selectable.

Some pages or web applications make onscreen text unselectable for style or usability's sake or yet to prevent less knowlegdeable users from copying content. However, there are situations when you do want to quickly copy something. Use this bookmarklet to make all text available without messing with the page or needing to access source code.

javascript:Array.from(document.all).forEach(function(x) {"text";} );

Link for drag'n'drop bookmarking: Make text selectable

Make all browser images and videos lighter with brightness and contrast controls.

Nowadays, most pages aimed to a general public use a black on white theme for reading comfort. Despite white on black being less luminous, it is usually perceived as more straining to the eye. White backgrounds are good for reading while you keep you display brightness and contrast settings low. This, however, leads to the side effect of images, both static and video, being dark. Adjusting the display or video card settings can be clunky and inconvenient, and you end up going back and forth on these settings whenever you change focus from text to image or vice-versa. That's why I devised this solution to make images clearer while keeping text legible in an automated way.

What this bookmarklet does:
- Increases the brightness by 40% and decreases contrast by 20% on videos and images for better luminosity. The effect is similar to increase the gamma settings.
- Puts an overlay on every image and video to adjust brightness and contrast individually, at 3% increments.
- The overlay contains a toggle button to alternate between default and increased luminosity settings.
- The overlay also contains a "panic" toggle button to alternate between default and increased luminosity settings for all images and videos at the same time.
- As to not affect a page's user interface, only images with a pixel area above 100x100 are affected.

javascript:var globalVideoBrightness=140.0; var globalVideoContrast=80.0; var globalImageBrightness=120.0; var globalImageContrast=80.0; var globalStep=1.03;var globalPanicDisable=false;function globalBrightness(x) { return /*( &&<100.0)?100.0:*/(x.tagName=="VIDEO"?globalVideoBrightness:globalImageBrightness); }function globalContrast(x) { return /*( &&<100.0)?100.0:*/(x.tagName=="VIDEO"?globalVideoContrast:globalImageContrast); }function getCurrentLuminosity(x){ return ( ( ((x.brelsBrightness==globalVideoBrightness) && (x.brelsContrast==globalVideoContrast))? ( 'v' ) : ( ((x.brelsBrightness==globalImageBrightness) && (x.brelsContrast==globalImageContrast))? ( 'i' ) : ( ((x.brelsBrightness==100.0) && (x.brelsContrast==100.0))? ( 'd' ) : ( (x.brelsCustomLuminosity)? ( 'u' ) : ( 'o' ) ) ) ) )); }function notifyLuminosity(x){; }function applyFilter(x, n) { var c=getCurrentLuminosity(x);"brightness(" + (globalPanicDisable?100.0:x.brelsBrightness) + "%) contrast(" + (globalPanicDisable?100.0:x.brelsContrast) + "%)"; if (n) notifyLuminosity(x.brelsNotifier); x.brelsOverlay.childNodes[4].style.color= ( (c=='v')? ( "yellow" ) : ( (c=='i')? ( "orange" ) : ( ((c=='u') && x.brelsCustomLuminosity)? ( "lime" ) : ( (c=='d')?"black":"fuchsia" ) ) ) );}function changeBrightness(x,v){ x.brelsUserBrightness = x.brelsBrightness*=Math.pow(globalStep,v); x.brelsUserContrast = x.brelsContrast; x.brelsCustomLuminosity=true; applyFilter(x,true); }function changeContrast(x,v) { x.brelsUserBrightness = x.brelsBrightness; x.brelsUserContrast = x.brelsContrast*=Math.pow(globalStep,v); x.brelsCustomLuminosity=true; applyFilter(x,true); }function getToggledLuminosity(x, image, video, user, reverse){ var c=getCurrentLuminosity(x); return ( ( (c=='i') ? ( !reverse?video:((x.brelsCustomLuminosity)?user:100.0) ) : ( (c=='v') ? ( !reverse?100.0:image ) : ( (c=='d') ? ( !reverse?((x.brelsCustomLuminosity)?user:image):video ) : ( (c=='u')?(!reverse?image:100.0):50.0 ) ) ) )); }function toggleLuminosity(x,reverse) { var nb, nc; nb=getToggledLuminosity(x, globalImageBrightness, globalVideoBrightness, x.brelsUserBrightness, reverse); nc=getToggledLuminosity(x, globalImageContrast, globalVideoContrast, x.brelsUserContrast, reverse); x.brelsBrightness=nb; x.brelsContrast=nc; applyFilter(x,true); }function globalPanicDisableLuminosity(){ globalPanicDisable=!globalPanicDisable; document.cookie="brelsGlobalPanicDisabled="+globalPanicDisable; brelsOverlays.forEach(function (x) { var img=x.brelsOverlayedImage; x.childNodes[5].style.color=globalPanicDisable?"red":"black"; applyFilter(img, false); });}function styleControl(x, ov) { var defs=["click","dblclick","mousedown","mouseup","mouseenter","mouseleave","mousemove","contextmenu"];"inline-block";"bolder";"monospace";"14px";"solid";"1px";"black";"white";"black";"16px";"center";"0px";"0px"; defs.forEach(function(ev) { if (ov && (ov.indexOf(ev)==-1)) x.addEventListener(ev, function(event) { event.stopPropagation(); event.preventDefault(); }); });}function showOverlay(x){ var irect=x.brelsOverlayedImage.getBoundingClientRect(); var prect=x.brelsOverlayedImage.parentElement.getBoundingClientRect(); var childOverlapsParent; var top, left; childOverlapsParent=(x.brelsOverlayedImage.parentElement.computedStyleMap().get("display")!="inline") && (irect.left<=prect.left) && (< && (irect.right>=prect.right) && (irect.bottom>=prect.bottom); top=childOverlapsParent?prect.y:irect.y; left=childOverlapsParent?prect.x:irect.x;"absolute":"fixed";"inline-block";"px";"px";}var brelsOverlays=[];function createOverlay(img){ var area=img.clientWidth*img.clientHeight; var lazyratio=img.clientWidth/(img.clientHeight+1); if (((area)>10000) && (lazyratio>=0.20) && (lazyratio<=5.0)) { if (!img.brelsOverlay && !img.brelsOverlapped) { var controlsContainer, badder, bsubber, cadder, csubber, notifier, overlaps; var irect=img.getBoundingClientRect(); overlaps=false; for (var i=0;i < brelsOverlays.length;i++) { var x=brelsOverlays[i].brelsOverlayedImage; var xrect=x.getBoundingClientRect(); if ((x!=img) && (xrect.height && irect.height && (< && (xrect.left<=irect.left) && (xrect.bottom>=irect.bottom) && (xrect.right>=irect.right)) || x.contains(img) ) { overlaps=true; break; } }; if (overlaps) { img.brelsOverlapped=true; return; } controlsContainer=document.createElement("div");"brelsOverlay"+brelsOverlays.length;"none";"absolute";;"0px";"0px";"max-content"; controlsContainer.brelsOverlayedImage=img; brelsOverlays.push(controlsContainer); badder=document.createElement("span"); badder.title="Increase brigthness";"zoom-in"; badder.innerHTML="☼"; styleControl(badder, ["mouseup"]); badder.addEventListener('mouseup', function(event) { changeBrightness(img, 1); event.stopPropagation(); event.preventDefault(); }); bsubber=document.createElement("span"); bsubber.title="Decrease brightness";"zoom-out"; bsubber.innerHTML="☀"; styleControl(bsubber, ["mouseup"]); bsubber.addEventListener('mouseup', function(event) { changeBrightness(img, -1); event.stopPropagation(); event.preventDefault(); }); cadder=document.createElement("span"); cadder.title="Increase contrast";"zoom-in"; cadder.innerHTML="🌕"; styleControl(cadder, ["mouseup"]); cadder.addEventListener('mouseup', function(event) { changeContrast(img, 1); event.stopPropagation(); event.preventDefault(); }); csubber=document.createElement("span"); csubber.title="Decrease contrast";"zoom-out"; csubber.innerHTML="🌙"; styleControl(csubber, ["mouseup"]); csubber.addEventListener('mouseup', function(event) { changeContrast(img, -1); event.stopPropagation(); event.preventDefault(); }); toggler=document.createElement("span"); toggler.title="Toggles between enhanced, default and user adjustments"; toggler.innerHTML="💡"; styleControl(toggler, ["mouseup"]);"yellow";"default"; toggler.addEventListener('mouseup', function(event) { toggleLuminosity(img, event.button!=0); event.stopPropagation(); event.preventDefault(); }); var panic=document.createElement("span"); panic.innerHTML="🚨"; panic.title="Globally turns adjustments on/off"; styleControl(panic, ["mouseup"]);"red":"black";"default"; panic.addEventListener('mouseup', function(event) { globalPanicDisableLuminosity(); event.stopPropagation(); event.preventDefault();}); notifier=document.createElement("span"); styleControl(notifier, ["mouseup"]);"inline-block";"fit-content"; notifier.brelsNotified=img; notifier.addEventListener('mouseup', function(event) {"none"; event.stopPropagation(); event.preventDefault();}); controlsContainer.appendChild(badder); controlsContainer.appendChild(bsubber); controlsContainer.appendChild(cadder); controlsContainer.appendChild(csubber); controlsContainer.appendChild(toggler); controlsContainer.appendChild(panic); controlsContainer.appendChild(notifier); controlsContainer.addEventListener("mouseleave", function (event) { if (event.relatedTarget!"none"; event.stopPropagation(); event.preventDefault(); } ); img.brelsOverlay=controlsContainer; img.setAttribute("brelsOverlay",; img.brelsBrightness=globalBrightness(img); img.brelsContrast=globalContrast(img); img.brelsUserBrightness=globalBrightness(img); img.brelsUserContrast=globalContrast(img); img.brelsNotifier=notifier; img.brelsCustomLuminosity=false; applyFilter(img, true); img.addEventListener("mouseenter", function (event) { if (! { showOverlay(; } event.stopPropagation(); event.preventDefault(); } ); img.addEventListener("mouseleave", function (event) { if (!"none"; event.stopPropagation(); event.preventDefault(); } ); img.parentElement.brelsHasOverlay=true; document.body.appendChild(controlsContainer); } }; }; var terer=0;function brelsLuminosityOverlays(){ var; var fakeimgs=[]; var divs=document.evaluate("//div[contains(@style, 'background-image')]", document, null, XPathResult.ANY_TYPE, null); var fakeimg=null; do try { fakeimg=divs.iterateNext(); if (fakeimg) fakeimgs.push(fakeimg); } catch(e) { } while (fakeimg); var imgs=Array.from(document.getElementsByTagName("img")); var videos=Array.from(document.getElementsByTagName("video")); var canvas=Array.from(document.getElementsByTagName("canvas")); fakeimgs.concat(videos, canvas, imgs).forEach(function (x) { createOverlay(x); }); setTimeout(function() { brelsLuminosityOverlays(); }, 500);}var cookie=document.cookie.indexOf("brelsGlobalPanicDisabled=");globalPanicDisable=(cookie==-1)?false:(document.cookie[cookie+25]=="t"?true:false);brelsLuminosityOverlays();

Link for drag'n'drop bookmarking: Increase images and videos luminosity