NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name 双击保存密码 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author echosun // @match *://*/* // @grant none // @license GPL-3.0-or-later // @copyright 2021, echosun (https://openuserjs.org/users/echosun) // ==/UserScript== (function() { 'use strict'; document.ondblclick=function (ev)//onmousedown { var oEvent=ev||event; //IE浏览器直接使用event或者window.event得到事件本身。 if(oEvent.button == 0){ //alert(oEvent.button);// IE下鼠标的 左键是1 , 右键是2 ff和chrome下 鼠标左键是0 右键是2 var x = document.querySelectorAll("input[type=password]"); for (var i = 0; i < x.length; i++) { if(x[i].value){ //console.log(x[i].value); var aux = document.createElement("input"); aux.setAttribute("value", x[i].value); document.body.appendChild(aux); aux.select(); document.execCommand("copy"); document.body.removeChild(aux); alert("复制成功"); break; } } }; }; // Your code here... })();