您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
在页面左下角添加一个图标,点击后生成当前页面地址二维码
当前为
// ==UserScript== // @name 生成二维码图标 // @namespace chentao1006 // @version 1.0.1 // @description 在页面左下角添加一个图标,点击后生成当前页面地址二维码 // @match *://*/* // @grant GM_addStyle // ==/UserScript== (function () { 'use strict'; // 添加图标样式 GM_addStyle (` #qrCodeIcon { position: fixed; left: 10px; bottom: 10px; cursor: pointer; z-index: 99999; font-size: 12px; } `); // 创建图标元素 var qrCodeIcon = document.createElement ('div'); qrCodeIcon.id = 'qrCodeIcon'; qrCodeIcon.innerHTML = '🔗'; // 添加图标点击事件 qrCodeIcon.addEventListener ('click', function () { // 获取当前页面地址 var currentPageUrl = window.location.href; // 创建二维码图片元素 var qrCodeImg = document.createElement ('img'); qrCodeImg.src = 'https://api.qrserver.com/v1/create-qr-code/?data=' + encodeURIComponent (currentPageUrl); qrCodeImg.style.position = 'fixed'; qrCodeImg.style.bottom = '10px'; qrCodeImg.style.left = '10px'; qrCodeImg.style.zIndex = '9999'; qrCodeImg.addEventListener ('click', function () { document.body.removeChild (qrCodeImg); }) // 添加二维码图片到页面 document.body.appendChild (qrCodeImg); }); // 添加图标到页面 document.body.appendChild (qrCodeIcon); })();