网页文字编辑

将网页一键开启可编辑按钮,选中即可把当前网页当作TXT随意删除修改,注意:仅在编辑完记得关闭,不然部分链接无法点击

目前為 2020-07-14 提交的版本,檢視 最新版本

// ==UserScript==
// @name         网页文字编辑
// @namespace    xuexizuoye.com
// @version      1.00
// @description  将网页一键开启可编辑按钮,选中即可把当前网页当作TXT随意删除修改,注意:仅在编辑完记得关闭,不然部分链接无法点击
// @author       huansheng
// @run-at       document-start
// @match        htt*://*/*
// @grant        none
// ==/UserScript==
window.changeCss = function changeCss(){
    console.log('当前按钮是否选中:' + document.querySelector("#checkBt").checked)
    document.body.contentEditable = document.querySelector("#checkBt").checked;
}
window.changeCss2 = function changeCss2(){
    //document.querySelector(".checkBt").innerText = '是否 编辑'
}
var styledom = document.createElement("style");
styledom.setAttribute("type", "text/css");
styledom.innerHTML = '.checkBt:hover{left:3px;}.checkBt{position:fixed;left:-42px;bottom:8vh;border:1px solid;border-radius:23%;background-color:#6cbd45;color:#fff;padding:5px;z-index:999;'
document.querySelector("head").appendChild(styledom);
document.body.innerHTML = document.body.innerHTML + '<div class="checkBt" onMouseOver="changeCss()" onMouseOut="changeCss2()"><label for="checkBt"><input type="checkbox" name="editable" id="checkBt">是否 编辑</label></div>'