Hacker News new | ask | show | jobs
by tompark 453 days ago
Oh it's nice to see productivity ones. I mostly use bookmarklets on my phone to fix annoyances bc on a desktop browser you can just open the js console or inspector.

I beefed up the 'kill sticky' one <https://news.ycombinator.com/item?id=32998091> but that's not very interesting. Here are some other ones:

* Re-enable zoom on iPhone (for pages that disable it)

    javascript:document.querySelector('meta%5Bname=viewport%5D').setAttribute('content','width=device-width,initial-scale=1.0,maximum-scale=10.0,user-scalable=1');
* Open same page in new tab with js script tags removed (you must click to allow it to open a new tab)

    javascript:(window.openPageWithoutScripts=async%20function()%7Bconst%20resp=await%20fetch(window.location.href);const%20text=await%20resp.text();const%20doc=new%20DOMParser().parseFromString(text,'text%2Fhtml');doc.querySelectorAll('script').forEach(script=%3Escript.remove());const%20w=window.open();w.document.head.innerHTML=doc.head.innerHTML;w.document.body.innerHTML=doc.body.innerHTML;%7D)(); 
* Show page source

    javascript:(function()%7Bvar%20a=window.open('about:blank').document;a.write('%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Ctitle%3ESource%20of%20'+location.href+'%3C/title%3E%3Cmeta%20name=%22viewport%22%20content=%22width=device-width%22%20/%3E%3C/head%3E%3Cbody%3E%3C/body%3E%3C/html%3E');a.close();var%20b=a.body.appendChild(a.createElement('pre'));b.style.overflow='auto';b.style.whiteSpace='pre-wrap';b.appendChild(a.createTextNode(document.documentElement.innerHTML))%7D)();
* Re-enable long-press context menu (for pages that disable it)

    javascript:(function()%7Bdocument.oncontextmenu=null;window.oncontextmenu=null;%7D)();
* Re-enable text selection (for pages that disable it)

    javascript:(function()%7B;document.onselectstart=null;document.onselectchange=null;document.ondragstart=null;document.onmousedown=null;window.ontouchstart=null;window.ontouchend=null;%7D)();