如何创建 JS 书签?
发表于 : 2023年 9月 1日 13:45
版本:3.9.1+
首先添加一个新书签
网址 javascript:code
注意: 由于书签在内核里是以 GURL 类解析,请不要乱使用%,如果一定要用建议使用转义符替换
百分比号(%)---->转义符:%25
如:left: 24%;right: 24%; ---》 left: 24%25;right: 24%25;
%事例:
功能举例
解除页面限制
显示密码
首先添加一个新书签
网址 javascript:code
注意: 由于书签在内核里是以 GURL 类解析,请不要乱使用%,如果一定要用建议使用转义符替换
百分比号(%)---->转义符:%25
如:left: 24%;right: 24%; ---》 left: 24%25;right: 24%25;
%事例:
代码: 全选
javascript:(function(){window._jumpName=function(_na){window.open("https://www.baidu.com/s?wd="+document.getElementById("_Name").value);_close()};window._close=function(){var d=document.getElementById("_j");if(d){d.remove();return true}};if(_close()){return};var _co1=getSelection().toString();var _code=`<div id="_j"style="position: fixed;background-color: #f1fff7;text-align: center;z-index: 99999;top: 0px;left: 24%25;right: 24%25;border-radius: 0px 0px 30px 30px;padding: 14px;box-shadow: 0px 0px 8px 3px #4279ff;"><h4 style="margin-bottom:15px;"><a target="_blank"href="https://www.baidu.com/">百度-首页</a></h4><h4 </h4><div><input style="font-size:17px;padding:4px;width:40%25;"type="text"placeholder="请输入内容"id="_Name"/><button style="font-size:17px;padding:4px;margin-left:3px;"onclick="_jumpName();">百度</button><button style="font-size:17px;padding:4px;margin-left:3px;"onclick="_close();">关闭</button></div><br/></div>%60;_code=_code.replace("_u_",location.href).replace("*t",Date.parse(new Date())).replace(/_c_/g,_co1);if(_co1){_code=_code.replace("none","")}document.body.insertAdjacentHTML("afterbegin",_code)})();
功能举例
解除页面限制
代码: 全选
javascript:"use strict";!function(){var t=function(t){t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation()};["copy","cut","contextmenu","selectstart","mousedown","mouseup","keydown","keypress","keyup"].forEach(function(e){document.documentElement.addEventListener(e,t,{capture:!0})}),alert("解除限制成功啦!")}();
代码: 全选
javascript:"use strict";!function(){var e,t;e=document.getElementsByTagName("input");for(var a=0;a<e.length;a++)if(t=e[a],"password"==t.type.toLowerCase())try{t.type="text"}catch(e){var r,n;r=document.createElement("input"),n=t.attributes;for(var o=0;o<n.length;o++){var i,c,d;i=n[o],c=i.nodeName,d=i.nodeValue,"type"!=c.toLowerCase()&&"height"!=c&&"width"!=c&!!d&&(r[c]=d)}t.parentNode.replaceChild(r,t)}}();