小墨の博客

梦想需要付诸行动,否则只能是梦

【HTML】一些实用的浏览器书签小工具 - JS

点标题可以快速体验,也可直接拖动到浏览器书签栏收藏。

夜间模式:本质是降低网页背景亮度,再次点击可取消夜间效果。

代码:

javascript:(function(){var%C2%A0night=function(w){(function(d){var%C2%A0css='html{opacity:0.7!important;background:black!important;}body{background:white!important;}';var%C2%A0s=d.getElementsByTagName('style');for(var%C2%A0i=0,si;si=s[i];i++){if(si.innerHTML==css){si.parentNode.removeChild(si);return}};var%C2%A0heads=d.getElementsByTagName('head');if(heads.length){var%C2%A0node=d.createElement('style');node.type='text/css';node.appendChild(d.createTextNode(css));heads[0].appendChild(node)}})(w.document);%C2%A0for(var%C2%A0i=0,f;f=w.frames[i];i++){try{arguments.callee(f)}catch(e){}}};night(window)})();

高亮关键词 :高亮显示网页查找的关键词。

代码:

javascript:%20(%20function%20()%7B%20var%20count=0,%20text,%20dv;text=prompt%20(%20%22%E8%AF%B7%E8%BE%93%E5%85%A5%E9%AB%98%E4%BA%AE%E5%85%B3%E9%94%AE%E8%AF%8D:%22,%20%22%22%20)%20;if%20(%20text==null%20%20%7C%7C%20%20text.length==0%20)%20return;dv=document.defaultView;function%20searchWithinNode%20(%20node,%20te,%20len%20)%7B%20var%20pos,%20skip,%20spannode,%20middlebit,%20endbit,%20middleclone;skip=0;if%20(%20%20node.nodeType==3%20%20)%7B%20pos=node.data.toUpperCase%20()%20.indexOf%20(%20te%20)%20;if%20(%20pos%3E=0%20)%7B%20spannode=document.createElement%20(%20%22SPAN%22%20)%20;spannode.style.backgroundColor=%22yellow%22;middlebit=node.splitText%20(%20pos%20)%20;endbit=middlebit.splitText%20(%20len%20)%20;middleclone=middlebit.cloneNode%20(%20true%20)%20;spannode.appendChild%20(%20middleclone%20)%20;middlebit.parentNode.replaceChild%20(%20spannode,middlebit%20)%20;++count;skip=1;%20%7D%7D%20else%20if%20(%20%20node.nodeType==1&&%20node.childNodes%20&&%20node.tagName.toUpperCase%20()%20!=%22SCRIPT%22%20&&%20node.tagName.toUpperCase!=%22STYLE%22%20)%7B%20for%20%20(%20var%20child=0;%20child%20%3C%20%20node.childNodes.length;%20++child%20)%7B%20child=child+searchWithinNode%20(%20node.childNodes%5Bchild%5D,%20te,%20len%20)%20;%20%7D%7D%20return%20skip;%20%7D%20window.status=%22Searching%20for%20'%22+text+%22'...%22;searchWithinNode%20(%20document.body,%20text.toUpperCase%20()%20,%20text.length%20)%20;window.status=%22Found%20%22+count+%22%20occurrence%22+%20(%20count==1?%22%22:%22s%22%20)%20+%22%20of%20'%22+text+%22'.%22;%20%7D)()%20;

URL解码后代码(仅供阅读,添加请用上方代码)

javascript: ( function (){ var count=0, text, dv;text=prompt ( "请输入高亮关键词:", "" ) ;if ( text==null  ||  text.length==0 ) return;dv=document.defaultView;function searchWithinNode ( node, te, len ){ var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if (  node.nodeType==3  ){ pos=node.data.toUpperCase () .indexOf ( te ) ;if ( pos>=0 ){ spannode=document.createElement ( "SPAN" ) ;spannode.style.backgroundColor="yellow";middlebit=node.splitText ( pos ) ;endbit=middlebit.splitText ( len ) ;middleclone=middlebit.cloneNode ( true ) ;spannode.appendChild ( middleclone ) ;middlebit.parentNode.replaceChild ( spannode,middlebit ) ;++count;skip=1; }} else if (  node.nodeType==1&& node.childNodes && node.tagName.toUpperCase () !="SCRIPT" && node.tagName.toUpperCase!="STYLE" ){ for  ( var child=0; child <  node.childNodes.length; ++child ){ child=child+searchWithinNode ( node.childNodes[child], te, len ) ; }} return skip; } window.status="Searching for '"+text+"'...";searchWithinNode ( document.body, text.toUpperCase () , text.length ) ;window.status="Found "+count+" occurrence"+ ( count==1?"":"s" ) +" of '"+text+"'."; })() ;

百度站内搜索:在弹出的输入框输入关键字跳转至百度站内搜索。

代码:

javascript:var%20Bar=location.host+%22%22;q%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt(%22u8BF7u8F93u5165u641Cu7D22u7684u5173u952Eu8BCD:%22,%20%22%22);%20if%20(q!=null)%20{var%20qlocation=%22%20%22;qlocation=('http://www.baidu.com/s?&ie=UTF-8&oe=UTF-8&cl=3&rn=100&wd=%20%20'+q+'%20%20%20site:%20'+Bar+'');window.open(qlocation);}%20void%200

URL解码后代码(仅供阅读,添加请用上方代码)

javascript:var Bar=location.host+"";q = "" + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt("u8BF7u8F93u5165u641Cu7D22u7684u5173u952Eu8BCD:", ""); if (q!=null) {var qlocation=" ";qlocation=('http://www.baidu.com/s?&ie=UTF-8&oe=UTF-8&cl=3&rn=100&wd=  '+q+'   site: '+Bar+'');window.open(qlocation);} void 0

收藏到有道云笔记:将网页内容保存至有道云笔记。

代码:

javascript:(function(){try{var a=document.createElement('SCRIPT');a.type='text/javascript',a.src='//note.youdao.com/yws/YNoteClipper.js?'+(new Date).getTime()/1e5,a.charset='utf-8',a.onerror=function(){function d(a){return a.indexOf('360ee')%3E-1||a.indexOf('360se')%3E-1||a.indexOf('se')%3E-1||a.indexOf('aoyou')%3E-1||a.indexOf('theworld')%3E-1||a.indexOf('worldchrome')%3E-1||a.indexOf('greenbrowser')%3E-1||a.indexOf('qqbrowser')%3E-1||a.indexOf('baidu')%3E-1}var a=document.createElement('div'),b=navigator.userAgent.toLowerCase(),c=b.match(/chrome/([d.]+)/)[1];a.style.cssText='position: absolute;top: 10px;right: 30px;padding: 5px;border-radius: 5px;box-shadow: rgb(92, 184, 229) 0px 0px 2px; -webkit-box-shadow: rgb(92, 184, 229) 0px 0px 2px;background-color: rgba(92, 184, 229, 0.498039) !important;z-index: 999999;',a.innerHTML=c&&!d(b)?'<div style=%22padding: 20px;border: 1px solid rgb(92, 184, 229);background: white;border-radius: 5px;width: 330px;%22%3E%E8%AF%A5%E6%89%A9%E5%B1%95%E6%9A%82%E4%B8%8D%E6%94%AF%E6%8C%81%E6%94%B6%E8%97%8F%E8%AF%A5%E7%B1%BB%E5%9E%8Bhttps%E7%B1%BB%E7%BD%91%E7%AB%99%EF%BC%8C%E5%8F%AF%E5%89%8D%E5%BE%80Chrome%E5%BA%94%E7%94%A8%E5%95%86%E5%BA%97 <a style=%22color:#1d7fe2%22 href=%22https://note.youdao.com/download.html#other%22 target=%22_blank%22%3E%E4%B8%8B%E8%BD%BD</a%3E %E6%9C%89%E9%81%93%E4%BA%91%E7%AC%94%E8%AE%B0%E7%BD%91%E9%A1%B5%E5%89%AA%E6%8A%A5%E6%8F%92%E4%BB%B6</div%3E':'<div style=%22padding: 20px;border: 1px solid rgb(92, 184, 229);background: white;border-radius: 5px;%22%3E%E8%AF%A5%E6%89%A9%E5%B1%95%E6%9A%82%E4%B8%8D%E6%94%AF%E6%8C%81%E6%94%B6%E8%97%8F%E8%AF%A5%E7%B1%BB%E5%9E%8Bhttps%E7%B1%BB%E7%BD%91%E7%AB%99</div%3E',document.body.appendChild(a),a.onclick=function(){a.style.display='none'},setTimeout(function(){a.click()},8e3)},document.getElementsByTagName('head')[0].appendChild(a)}catch(b){alert(b)}})();

收藏到 OneNote:将网页内容保存至OneNote。

代码:

javascript:(function(){var%20jsCode=document.createElement('script');jsCode.setAttribute('src','https://www.onenote.com/Clipper/Root?ClipperId=ON-95a88c52-50d6-4c35-b134-2bdd4f682242&amp;ClipperType=Bookmarklet&amp;ClipperVersion=2.0.2');jsCode.setAttribute('id','oneNoteCaptureRootScript');jsCode.setAttribute('type','text/javascript');document.body.appendChild(jsCode);})();

生成二维码:为当前网页生成二维码(使用 QR code API 服务)。

代码:

javascript:window.open('https://api.qrserver.com/v1/create-qr-code/?size=150x150&data='%20+%20decodeURIComponent(location.href));void(0);

用一个书签复制标题和网址

javascript:void(prompt('请复制。', document.title + '
' + document.URL));

本文参考:https://sspai.com/post/45662

张小弟之家

本文链接:
文章标题:

本站文章除注明转载/出处外,均为原创,若要转载请务必注明出处。转载后请将转载链接通过邮件告知我站,谢谢合作。本站邮箱:admin@only4.work

尊重他人劳动成果,共创和谐网络环境。点击版权声明查看本站相关条款。

    发表评论:

    搜索
    本文二维码
    标签列表
    站点信息
    • 文章总数:544
    • 页面总数:20
    • 分类总数:96
    • 标签总数:213
    • 评论总数:63
    • 浏览总数:284693

    | | |
    | |  Z-Blog PHP