TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What bookmarklets do you use?

19 点作者 dannyphantom6 个月前
Threw together a bookmarklet that sends a page over to a personal, private subreddit the other day that I&#x27;ve been using a ton. Also a HUGE fan of kill-sticky.<p>Would love to throw some other good ones up there.<p>https:&#x2F;&#x2F;github.com&#x2F;t-mart&#x2F;kill-sticky<p><pre><code> javascript:(function()%7Bdocument.querySelectorAll(%22body%20*%22).forEach(function(node)%7Bif(%5B%22fixed%22%2C%22sticky%22%5D.includes(getComputedStyle(node).position))%7Bnode.parentNode.removeChild(node)%7D%7D)%3Bdocument.querySelectorAll(%22html%20*%22).forEach(function(node)%7Bvar%20s%3DgetComputedStyle(node)%3Bif(%22hidden%22%3D%3D%3Ds%5B%22overflow%22%5D)%7Bnode.style%5B%22overflow%22%5D%3D%22visible%22%7Dif(%22hidden%22%3D%3D%3Ds%5B%22overflow-x%22%5D)%7Bnode.style%5B%22overflow-x%22%5D%3D%22visible%22%7Dif(%22hidden%22%3D%3D%3Ds%5B%22overflow-y%22%5D)%7Bnode.style%5B%22overflow-y%22%5D%3D%22visible%22%7D%7D)%3Bvar%20htmlNode%3Ddocument.querySelector(%22html%22)%3BhtmlNode.style%5B%22overflow%22%5D%3D%22visible%22%3BhtmlNode.style%5B%22overflow-x%22%5D%3D%22visible%22%3BhtmlNode.style%5B%22overflow-y%22%5D%3D%22visible%22%7D)()%3B%0A </code></pre> - bookmarklet to shoot pages over to Reddit, just swap out r&#x2F;xyz:<p><pre><code> javascript:(function(){ var url = encodeURIComponent(window.location.href); window.open(&#x27;https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;jchromebook&#x2F;submit?url=&#x27; + url);})();</code></pre>

7 条评论

al_borland6 个月前
I made a basic one for Kagi’s summarizer service.<p>javascript:(function()%7Bwindow.location.href%20%3D%20%60https%3A%2F%2Fkagi.com%2Fsummarizer%2Findex.html%3Ftarget_language%3D%26summary%3Dtakeaway%26url%3D%24%7BencodeURIComponent(window.location.href)%7D%60%7D)()<p>I have it in my todos to make some for their other offerings, like the new translations service they just released.<p>This one is very niche, but I was getting 100% in Tears of the Kingdom and the map didn’t tell me how many Koroks (or whatever else) I had left. So I threw this one together to tell me. It just counts the elements of a certain type and displays an alert with the number.<p>javascript:(function()%7Bfunction%20countTitles(title)%20%7Bconst%20elementsWithTitle%20%3D%20document.querySelectorAll(%60%5Btitle%3D%22%24%7Btitle%7D%22%5D%60)%3Bconst%20count%20%3D%20elementsWithTitle.length%3Breturn%20count%3B%7Dalert(countTitles(%22Korok%20Seed%22)%20%2B%20(countTitles(%22Korok%20Seed%20x2%22)*2))%7D)()
评论 #42094982 未加载
评论 #42138470 未加载
wruza6 个月前
Show all images on the page in a grid with size and megapixel tags. Useful for manual scraping.<p>Dereferer current tab in a new tab. Some sites refuse to be referred from search&#x2F;etc but copy-pasting an url into a new tab works.<p>Various “save” bms. Picks up a resource and opens it in new tab for a specific site that disallows right-click or hides an image in css bg, etc.<p>“Video”. Turns yt short into normal video (short id is regular video id).<p>It’s a shame that bookmarklets can’t refer to a file and require this %%% inlining. Probably solvable with tampermonkey, but not worth the research.
评论 #42094110 未加载
评论 #42091387 未加载
gabrielsroka6 个月前
This seems to work as well:<p><pre><code> javascript:open(&#x27;https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;xyz&#x2F;submit?url=&#x27; + encodeURIComponent(location.href)) </code></pre> Notes:<p>1. u don&#x27;t have to use `window.`, window is the default object (maybe less readable, but folks don&#x27;t use window.fetch either)<p>2. using an IIFE is sometimes useful and necessary, but this is a simple bookmarklet<p>3. as i wrote in the other comment, u don&#x27;t need to encode it, and if u did, you could use encodeURIComponent to do it for you. ie, show the plain code here and let someone encode it if necessary (but i&#x27;ve never encoded mine)<p>I&#x27;ve posted several bookmarklets here: <a href="https:&#x2F;&#x2F;hn.algolia.com&#x2F;?dateRange=all&amp;page=0&amp;prefix=true&amp;query=bookmarklet%20gabrielsroka&amp;sort=byDate&amp;type=all" rel="nofollow">https:&#x2F;&#x2F;hn.algolia.com&#x2F;?dateRange=all&amp;page=0&amp;prefix=true&amp;que...</a>
mattcanhack6 个月前
For archiving a page:<p><pre><code> javascript:void(window.open(&#x27;https:&#x2F;&#x2F;web.archive.org&#x2F;save&#x2F;&#x27;+location.href)); </code></pre> Should probably encode the href but it has worked so far
评论 #42092892 未加载
justtinker6 个月前
I have used variations of password revel bookmarklets. I keep searching for new one when I need them again. Most recent find was.<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;robbiet480&#x2F;4711696" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;robbiet480&#x2F;4711696</a>
评论 #42091655 未加载
ashconnor6 个月前
Add all Amex offers:<p><pre><code> javascript: var index,offerButtons=Array.from(document.getElementsByClassName(&quot;offer-cta&quot;)).filter(a=&gt;&quot;Add to Card&quot;==a.title);for(index=0;index&lt;offerButtons.length;++index)console.log(&quot;Clicking offer button&quot;),offerButtons[index].click(),(async()=&gt;{await new Promise(a=&gt;setTimeout(a,2e3))})(); </code></pre> Force paste (works sometimes)<p><pre><code> javascript:forceBrowserDefault=(e=&gt;{e.stopImmediatePropagation();return true;});[&#x27;copy&#x27;,&#x27;cut&#x27;,&#x27;paste&#x27;].forEach(e=&gt;document.addEventListener(e,forceBrowserDefault,true)); </code></pre> Facebook Marketplace delete all sold<p><pre><code> javascript:(async()=&gt;{var e,l,a=Array.from(document.getElementsByClassName(&quot;x193iq5w&quot;)).filter(e=&gt;&quot;Sold&quot;==e.innerHTML);for(let i=0;i&lt;a.length;++i)console.log(&quot;Clicking Sold Listing&quot;),a[i].click(),await new Promise(e=&gt;setTimeout(e,3e3)),document.querySelector(&#x27;[aria-label=&quot;Save&quot;]&#x27;).click(),await new Promise(e=&gt;setTimeout(e,1e3)),document.querySelector(&#x27;[aria-label=&quot;Close&quot;]&#x27;).click(),await new Promise(e=&gt;setTimeout(e,2e3));location.reload()})(); </code></pre> I should really convert these to Tampermonkey scripts
评论 #42091472 未加载
runjake6 个月前
Fetch the latest version of an unpaywalled article with archive.ph:<p><pre><code> javascript:location.href = &#x27;&#x2F;&#x2F;archive.ph&#x2F;newest&#x2F;&#x27; + location.href.split(&#x27;?&#x27;)[0];</code></pre>