Skip to content

Instantly share code, notes, and snippets.

@mmqmzk
Last active February 12, 2023 10:20
Show Gist options
  • Save mmqmzk/428b715d0d20b31551c3adee84609866 to your computer and use it in GitHub Desktop.
Save mmqmzk/428b715d0d20b31551c3adee84609866 to your computer and use it in GitHub Desktop.
My bookmarklets.
javascript:scrollTo(0,0); // Scroll to top
javascript:scrollTo(0,document.documentElement.scrollHeight) // Scroll to bottom
javascript:(function(){location=location.protocol+'//'+location.hostname})() // Site top
javascript:(function(){if(location.pathname=='/');else if(location.pathname.charAt(location.pathname.length-1)=='/')location='..';else location='.'})() // Up one level
javascript:(function(){setTimeout(()=>document.cookie.length<1?alert('No cookie for this site.'):open('').document.write(document.cookie),0)})(); // Show cookies
javascript:(function(){location='https://simp.red/trans?url='+decodeURIComponent(location.href)})(); // Simpread @broken
javascript:(function(){location='https://cn.similarsites.com/site/'+location.hostname.replace(/^(.+\.)?([^.]+\.[^.]+)$/,'$2')})(); // Similar sites
javascript:(function(){location='http://www.google.com/search?q=cache:'+decodeURIComponent(location.href)})(); // Google cached
javascript:(function(){location='https://web.archive.org/web/*/'+decodeURIComponent(location.href)})() // Way Back Machine
javascript:(function(){location.href='http://www.google.com/gwt/x?noimg=1&btnGo=Go&source=wax&ie=UTF-8&oe=UTF-8&u='+encodeURIComponent(location.href);}()) // Mobilizer
javascript:(function(){location.href=location.href.replace('github.com','github1s.com')}()) // Github 1s
javascript:(function(){location='https://outline.com/'+decodeURIComponent(location.href)})() //
javascript:(function(){location='http://www.instapaper.com/text?u='+decodeURIComponent(location.href)})(); //
javascript:var url=location.href,title=document.getElementsByTagName('sr-rd-title'),desc=document.getElementsByTagName('sr-rd-desc'),fav=function(){var links=document.getElementsByTagName('link'),href='';for(var i=0;i<links.length;i++){var link=links[i];if(link.rel&&link.rel.includes('icon')){href=link.href;break;}}href!=''&&(href='&favicon='+encodeURIComponent(href));return href;};if(title.length==0){title=document.getElementsByTagName('title')[0].innerText;}else title=title[0].innerText||'';title!=''&&(title='&title='+encodeURIComponent(title));if(desc.length==0){var tag=document.querySelector('[name=description]')||document.querySelector('[name=Description]');desc=tag?tag.getAttribute('content'):'';}else desc=desc[0].innerText||'';desc!=''&&(desc='&desc='+encodeURIComponent(desc));void(window.open('http://localhost:7026/bookmark?mode=quick&url='+encodeURIComponent(url)+title+desc+''+fav()+'&port=7026','简悦·小书签','toolbar=no,resizable=no,location=no,menubar=no,location=no,width=455,height=550')); // Simpread
javascript:void((function(){if(!document.body){return}var popup=document.querySelectorAll('.cyxy-target-popup');if(popup&&popup.length>0){return}try{var trs=document.createElement('script');trs.type='text/javascript';trs.charset='UTF-8';trs.src=('https:'==document.location.protocol?'https://':'http://')+'caiyunapp.com/dest/trs.js';document.body.appendChild(trs);}catch(e){alert(e);}document.addEventListener('securitypolicyviolation',function handler(e){console.error('securitypolicyviolation',e);alert('由于当前网站的内容安全策略(Content Security Policy),小译无法启动翻译程序,您可以在Chrome Web商店搜索彩云小译(LingoCloud)下载插件,或者将网页保存在本地(右键->另存为)进行翻译,也欢迎您在手机应用商店下载彩云小译App:)');document.removeEventListener('securitypolicyviolation',handler);});})());
javascript:(function(){function allowTextSelection(){window.console&&console.log('allowTextSelection');var style=document.createElement('style');style.type='text/css';style.innerHTML='*,p,div{user-select:text !important;-moz-user-select:text !important;-webkit-user-select:text !important;}';document.head.appendChild(style);var elArray=document.body.getElementsByTagName('*');for(var i=0;i<elArray.length;i++){var el=elArray[i];el.onselectstart=el.ondragstart=el.ondrag=el.oncontextmenu=el.onmousedown=el.onmouseup=function(){return true};if(el instanceof HTMLInputElement&&['text','password','email','number','tel','url'].indexOf(el.type.toLowerCase())>-1){el.removeAttribute('disabled');el.onkeydown=el.onkeyup=function(){return true};}}}allowTextSelection();})(); // Allow Text Selection
javascript:!function(){function t(e){e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation()}document.querySelectorAll("*").forEach(e=>{"none"===window.getComputedStyle(e,null).getPropertyValue("user-select")&&e.style.setProperty("user-select","text","important")}),["copy","cut","contextmenu","selectstart","mousedown","mouseup","mousemove","keydown","keypress","keyup"].forEach(function(e){document.documentElement.addEventListener(e,t,{capture:!0})}),alert("解除限制成功啦!")}() // Liberate Mouse
javascript:(function(){location='https://12ft.io/'+decodeURIComponent(location.href)})(); // Pass pay wall
javascript:(function(){location.href=location.href.replace('steamcommunity.com', 'store.steampowered.com')})(); // Steam Store
javascript:(function(){document.querySelectorAll("body *").forEach(function(node){if(["fixed","sticky"].includes(getComputedStyle(node).position)){node.parentNode.removeChild(node)}});document.querySelectorAll("html *").forEach(function(node){var s=getComputedStyle(node);if("hidden"===s["overflow"]){node.style["overflow"]="visible"}if("hidden"===s["overflow-x"]){node.style["overflow-x"]="visible"}if("hidden"===s["overflow-y"]){node.style["overflow-y"]="visible"}});var htmlNode=document.querySelector("html");htmlNode.style["overflow"]="visible";htmlNode.style["overflow-x"]="visible";htmlNode.style["overflow-y"]="visible"})(); // Kill Sticky
javascript:scrollTo(0,0); // Scroll to top
javascript:scrollTo(0,document.documentElement.scrollHeight) // Scroll to bottom
javascript:(function(){location=location.protocol+'//'+location.hostname})() // Site top
javascript:(function(){if(location.pathname=='/');else if(location.pathname.charAt(location.pathname.length-1)=='/')location='..';else location='.'})() // Up one level
javascript:(function(){setTimeout(()=>document.cookie.length<1?alert('No cookie for this site.'):open('').document.write(document.cookie),0)})(); // Show cookies
javascript:(function(){location='https://simp.red/trans?url='+decodeURIComponent(location.href)})(); // Simpread @broken
javascript:(function(){location='https://cn.similarsites.com/site/'+location.hostname.replace(/^(.+\.)?([^.]+\.[^.]+)$/,'$2')})(); // Similar sites
javascript:(function(){location='http://www.google.com/search?q=cache:'+decodeURIComponent(location.href)})(); // Google cached
javascript:(function(){location='https://web.archive.org/web/*/'+decodeURIComponent(location.href)})() // Way Back Machine
javascript:(function(){location.href='http://www.google.com/gwt/x?noimg=1&btnGo=Go&source=wax&ie=UTF-8&oe=UTF-8&u='+encodeURIComponent(location.href);}()) // Mobilizer
javascript:(function(){location.href=location.href.replace('github.com','github1s.com')}()) // Github 1s

javascript:(function(){location='https://outline.com/'+decodeURIComponent(location.href)})() //
javascript:(function(){location='http://www.instapaper.com/text?u='+decodeURIComponent(location.href)})(); //
javascript:var url=location.href,title=document.getElementsByTagName('sr-rd-title'),desc=document.getElementsByTagName('sr-rd-desc'),fav=function(){var links=document.getElementsByTagName('link'),href='';for(var i=0;i<links.length;i++){var link=links[i];if(link.rel&&link.rel.includes('icon')){href=link.href;break;}}href!=''&&(href='&favicon='+encodeURIComponent(href));return href;};if(title.length==0){title=document.getElementsByTagName('title')[0].innerText;}else title=title[0].innerText||'';title!=''&&(title='&title='+encodeURIComponent(title));if(desc.length==0){var tag=document.querySelector('[name=description]')||document.querySelector('[name=Description]');desc=tag?tag.getAttribute('content'):'';}else desc=desc[0].innerText||'';desc!=''&&(desc='&desc='+encodeURIComponent(desc));void(window.open('http://localhost:7026/bookmark?mode=quick&url='+encodeURIComponent(url)+title+desc+''+fav()+'&port=7026','简悦·小书签','toolbar=no,resizable=no,location=no,menubar=no,location=no,width=455,height=550')); // Simpread

javascript:void((function(){if(!document.body){return}var popup=document.querySelectorAll('.cyxy-target-popup');if(popup&&popup.length>0){return}try{var trs=document.createElement('script');trs.type='text/javascript';trs.charset='UTF-8';trs.src=('https:'==document.location.protocol?'https://':'http://')+'caiyunapp.com/dest/trs.js';document.body.appendChild(trs);}catch(e){alert(e);}document.addEventListener('securitypolicyviolation',function handler(e){console.error('securitypolicyviolation',e);alert('由于当前网站的内容安全策略(Content Security Policy),小译无法启动翻译程序,您可以在Chrome Web商店搜索彩云小译(LingoCloud)下载插件,或者将网页保存在本地(右键->另存为)进行翻译,也欢迎您在手机应用商店下载彩云小译App:)');document.removeEventListener('securitypolicyviolation',handler);});})());

javascript:(function(){function allowTextSelection(){window.console&&console.log('allowTextSelection');var style=document.createElement('style');style.type='text/css';style.innerHTML='*,p,div{user-select:text !important;-moz-user-select:text !important;-webkit-user-select:text !important;}';document.head.appendChild(style);var elArray=document.body.getElementsByTagName('*');for(var i=0;i<elArray.length;i++){var el=elArray[i];el.onselectstart=el.ondragstart=el.ondrag=el.oncontextmenu=el.onmousedown=el.onmouseup=function(){return true};if(el instanceof HTMLInputElement&&['text','password','email','number','tel','url'].indexOf(el.type.toLowerCase())>-1){el.removeAttribute('disabled');el.onkeydown=el.onkeyup=function(){return true};}}}allowTextSelection();})(); // Allow Text Selection
javascript:!function(){function t(e){e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation()}document.querySelectorAll("*").forEach(e=>{"none"===window.getComputedStyle(e,null).getPropertyValue("user-select")&&e.style.setProperty("user-select","text","important")}),["copy","cut","contextmenu","selectstart","mousedown","mouseup","mousemove","keydown","keypress","keyup"].forEach(function(e){document.documentElement.addEventListener(e,t,{capture:!0})}),alert("解除限制成功啦!")}() // Liberate Mouse
javascript:(function(){location='https://12ft.io/'+decodeURIComponent(location.href)})(); // Pass pay wall
javascript:(function(){location.href=location.href.replace('steamcommunity.com', 'store.steampowered.com')})(); // Steam Store
javascript:(function(){document.querySelectorAll("body *").forEach(function(node){if(["fixed","sticky"].includes(getComputedStyle(node).position)){node.parentNode.removeChild(node)}});document.querySelectorAll("html *").forEach(function(node){var s=getComputedStyle(node);if("hidden"===s["overflow"]){node.style["overflow"]="visible"}if("hidden"===s["overflow-x"]){node.style["overflow-x"]="visible"}if("hidden"===s["overflow-y"]){node.style["overflow-y"]="visible"}});var htmlNode=document.querySelector("html");htmlNode.style["overflow"]="visible";htmlNode.style["overflow-x"]="visible";htmlNode.style["overflow-y"]="visible"})(); // Kill Sticky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment