Created
3 years agoJune 29, 2021 13:04
Bookmarklet for Pins.app (1.6+)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bookmarklet for [Pins.app](https://get-pins.app/) (requires version 1.6+) | |
// Removes Google Analytics strings | |
// Removes Product Hunt query string | |
// Prefers canonical url if defined | |
// Uses selected text for description, falling back to meta description | |
// Removes pipes (|) from title | |
// To allow use on any website in Firefox, go to about:config and set security.external_protocol_requires_permission to false | |
// Copy this to your URL bar: | |
javascript:!function(){function e(e){var n="pins://launch?screen=newPost&",i=o();""===i&&(i=r()),n+="url="+encodeURIComponent(e),n+="&",n+="title="+encodeURIComponent(t()),n+="&",n+="description="+encodeURIComponent(i),document.location.href=n}function t(){var e=document.title;return e.replace(/\|/g,"-")}function n(){for(var e=document.getElementsByTagName("link"),t=0;t<e.length;t++)if(e[t].attributes.hasOwnProperty("rel")&&"canonical"===e[t].attributes.rel.textContent.toLowerCase())return e[t].attributes.href.textContent;var n,o=document.location.href.split(/[?&]([^&]+)/gim).filter(i);return n=o.length>1?o[0]+"?"+o.slice(1,-1).join("&"):o[0]}function o(){var e;if(window.getSelection)e=window.getSelection();else if(document.getSelection)e=document.getSelection();else{if(!document.selection)return;e=document.selection.createRange().text}return e.toString()}function r(){for(var e=document.getElementsByTagName("meta"),t=0;t<e.length;t++)if("description"===e[t].name.toLowerCase())return e[t].content;return""}function i(e){return!e.match(/(utm_[^&]+|ref=producthunt|^$)/)}e(n())}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment