-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: blog
action: blob
revision:
path_from: bookmarklets
revision_from: refs/heads/master:
path_to:
revision_to:

git.thebackupbox.net

blog

git://git.thebackupbox.net/blog

blob of:

blog

/ bookmarklets

refs/heads/master:/bookmarklets
 # bookmarklet collection!

 (note: this isn't for gemini)
 => https://thebackupbox.net/~epoch/blog/bookmarklets you can play with this page over http

 I'm collecting bookmarklets because it seems a lot of people forget they exist, or what they're capable of, then end up making add-ons when they don't need to.

 ## mastodon share

 => javascript:location.href="https://tilde.zone/share?text="+escape(location.href); bookmarklet to share current URL with your tilde.zone account.
 change the domain in the bookmarklet to suit your needs.
 ```
 javascript:location.href="https://tilde.zone/share?text="+escape(location.href);
 ```

 ## random tvtrope

 => javascript:location.href="http://tvtropes.org/pmwiki/randomitem.php?__cache_breaker__="+Math.random(); random tvtropes trope page.
 ```
 javascript:location.href="http://tvtropes.org/pmwiki/randomitem.php?__cache_breaker__="+Math.random();
 ```
 I found the randomitem.php URL in an add-on that no longer worked and added a random value to it to get around a cache that seems
 to have been preventing this from just being a basic link.

 ## invert lightness

 this next one is kind of long so I won't put a link to it.
 I stole it from stack overflow I think. it is to invert the lightness of a page.

 => javascript:(function(){function%20RGBtoHSL(RGBColor){with(Math){var%20R,G,B;var%20cMax,cMin;var%20sum,diff;var%20Rdelta,Gdelta,Bdelta;var%20H,L,S;R=RGBColor[0];G=RGBColor[1];B=RGBColor[2];cMax=max(max(R,G),B);cMin=min(min(R,G),B);sum=cMax+cMin;diff=cMax-cMin;L=sum/2;if(cMax==cMin){S=0;H=0;}else{if(L<=(1/2))S=diff/sum;else%20S=diff/(2-sum);Rdelta=R/6/diff;Gdelta=G/6/diff;Bdelta=B/6/diff;if(R==cMax)H=Gdelta-Bdelta;else%20if(G==cMax)H=(1/3)+Bdelta-Rdelta;else%20H=(2/3)+Rdelta-Gdelta;if(H<0)H+=1;if(H>1)H-=1;}return[H,S,L];}}function%20getRGBColor(node,prop){var%20rgb=getComputedStyle(node,null).getPropertyValue(prop);var%20r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return%20rgb;}function%20hslToCSS(hsl){return%20"hsl("+Math.round(hsl[0]*360)+",%20"+Math.round(hsl[1]*100)+"%,%20"+Math.round(hsl[2]*100)+"%)";}var%20props=["color","background-color","border-left-color","border-right-color","border-top-color","border-bottom-color"];var%20props2=["color","backgroundColor","borderLeftColor","borderRightColor","borderTopColor","borderBottomColor"];if(typeof%20getRGBColor(document.documentElement,"background-color")=="string")document.documentElement.style.backgroundColor="white";revl(document.documentElement);function%20revl(n){var%20i,x,color,hsl;if(n.nodeType==Node.ELEMENT_NODE){for(i=0;x=n.childNodes[i];++i)revl(x);for(i=0;x=props[i];++i){color=getRGBColor(n,x);if(typeof(color)!="string"){hsl=RGBtoHSL(color);hsl[2]=1-hsl[2];n.style[props2[i]]=hslToCSS(hsl);}}}}})() invert page lightness

 ```
 javascript:(function(){function%20RGBtoHSL(RGBColor){with(Math){var%20R,G,B;var%20cMax,cMin;var%20sum,diff;var%20Rdelta,Gdelta,Bdelta;var%20H,L,S;R=RGBColor[0];G=RGBColor[1];B=RGBColor[2];cMax=max(max(R,G),B);cMin=min(min(R,G),B);sum=cMax+cMin;diff=cMax-cMin;L=sum/2;if(cMax==cMin){S=0;H=0;}else{if(L<=(1/2))S=diff/sum;else%20S=diff/(2-sum);Rdelta=R/6/diff;Gdelta=G/6/diff;Bdelta=B/6/diff;if(R==cMax)H=Gdelta-Bdelta;else%20if(G==cMax)H=(1/3)+Bdelta-Rdelta;else%20H=(2/3)+Rdelta-Gdelta;if(H<0)H+=1;if(H>1)H-=1;}return[H,S,L];}}function%20getRGBColor(node,prop){var%20rgb=getComputedStyle(node,null).getPropertyValue(prop);var%20r,g,b;if(/rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(rgb)){r=parseInt(RegExp.$1,10);g=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return[r/255,g/255,b/255];}return%20rgb;}function%20hslToCSS(hsl){return%20"hsl("+Math.round(hsl[0]*360)+",%20"+Math.round(hsl[1]*100)+"%,%20"+Math.round(hsl[2]*100)+"%)";}var%20props=["color","background-color","border-left-color","border-right-color","border-top-color","border-bottom-color"];var%20props2=["color","backgroundColor","borderLeftColor","borderRightColor","borderTopColor","borderBottomColor"];if(typeof%20getRGBColor(document.documentElement,"background-color")=="string")document.documentElement.style.backgroundColor="white";revl(document.documentElement);function%20revl(n){var%20i,x,color,hsl;if(n.nodeType==Node.ELEMENT_NODE){for(i=0;x=n.childNodes[i];++i)revl(x);for(i=0;x=props[i];++i){color=getRGBColor(n,x);if(typeof(color)!="string"){hsl=RGBtoHSL(color);hsl[2]=1-hsl[2];n.style[props2[i]]=hslToCSS(hsl);}}}}})()
 ```

 ## change tab title

 => javascript:{document.title=prompt("new\x20title");void(0)} change current tab's title.
 ```
 javascript:{document.title=prompt("new title");void(0)}
 ```

 ## linkify minetest

 this one converts the list at
 => https://minetest.servers.net/
 to include minetest:// links for each server if you decide to write you own minetest:// support for your computer... I did.

 => javascript:{a=document.getElementsByClassName("address");for(i=0;i<a.length;i++){if(a[i].children[0].title){c=a[i].children[0].title;d=a[i].children[0].innerHTML}else{c=a[i].children[0].innerHTML;d=c;}a[i].children[0].innerHTML='<a%20href="minetest://'+c+'">'+d+'</a>'}};void(0); don't bother clicking here, it won't do anything.
 bookmark this link first, then go to minetest.servers.net, THEN click the bookmarklet to get links in the server list. :)

 => https://thebackupbox.net/~epoch/minetest.html (or just use the minetest server list I made)

 ```
 javascript:{a=document.getElementsByClassName("address");for(i=0;i<a.length;i++){if(a[i].children[0].title){c=a[i].children[0].title;d=a[i].children[0].innerHTML}else{c=a[i].children[0].innerHTML;d=c;}a[i].children[0].innerHTML='<a%20href="minetest://'+c+'">'+d+'</a>'}};void(0);
 ```

-- Response ended

-- Page fetched on Sun Jun 2 17:54:32 2024