您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a QR Code of the "lightsaber URL" to the front page of Lightsaber Escape
当前为
// ==UserScript== // @name Lightsaber Escape QR Code Display // @namespace DoomTay // @description Adds a QR Code of the "lightsaber URL" to the front page of Lightsaber Escape // @version 1.0.0 // @include https://lightsaber.withgoogle.com/ // @grant GM_xmlhttpRequest // ==/UserScript== var mobileCheck = setInterval(findMobileURL, 1000); function findMobileURL() { if(document.getElementById("url") && document.getElementById("url").textContent.indexOf("g.co") > -1) { clearInterval(mobileCheck); lightsaberURL = document.getElementById("url"); GM_xmlhttpRequest({ method: "GET", url: "https://chart.googleapis.com/chart?chs=120x120&cht=qr&chl=" + lightsaberURL.textContent + "&chld=L|1&choe=UTF-8", overrideMimeType: "text/plain; charset=x-user-defined", onload: function(response) { var QRCode = document.createElement("img"); QRCode.id = "LSCode"; QRCode.src = "data:image/png;base64," + customBase64Encode(response.responseText); document.getElementsByClassName("centered")[0].insertBefore(QRCode,document.getElementsByClassName("connection-url-wrapper style-scope sw-page-landing")[0]); QRCode.width = 120; QRCode.height = 120; QRCode.style.position = "absolute"; QRCode.style.left = "45%"; QRCode.style.bottom = "-35px"; } }); } } function customBase64Encode (inputStr) { var bbLen = 3, enCharLen = 4, inpLen = inputStr.length, inx = 0, jnx, keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789+/=", output = "", paddingBytes = 0; var bytebuffer = new Array (bbLen), encodedCharIndexes = new Array (enCharLen); while (inx < inpLen) { for (jnx = 0; jnx < bbLen; ++jnx) { /*--- Throw away high-order byte, as documented at: https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data */ if (inx < inpLen) bytebuffer[jnx] = inputStr.charCodeAt (inx++) & 0xff; else bytebuffer[jnx] = 0; } /*--- Get each encoded character, 6 bits at a time. index 0: first 6 bits index 1: second 6 bits (2 least significant bits from inputStr byte 1 + 4 most significant bits from byte 2) index 2: third 6 bits (4 least significant bits from inputStr byte 2 + 2 most significant bits from byte 3) index 3: forth 6 bits (6 least significant bits from inputStr byte 3) */ encodedCharIndexes[0] = bytebuffer[0] >> 2; encodedCharIndexes[1] = ( (bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4); encodedCharIndexes[2] = ( (bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6); encodedCharIndexes[3] = bytebuffer[2] & 0x3f; //--- Determine whether padding happened, and adjust accordingly. paddingBytes = inx - (inpLen - 1); switch (paddingBytes) { case 1: // Set last character to padding char encodedCharIndexes[3] = 64; break; case 2: // Set last 2 characters to padding char encodedCharIndexes[3] = 64; encodedCharIndexes[2] = 64; break; default: break; // No padding - proceed } /*--- Now grab each appropriate character out of our keystring, based on our index array and append it to the output string. */ for (jnx = 0; jnx < enCharLen; ++jnx) output += keyStr.charAt ( encodedCharIndexes[jnx] ); } return output; }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址