您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
6/8/2023, 1:09:32 PM
// ==UserScript== // @name GET PGN - followchess.com // @namespace Violentmonkey Scripts // @match https://live.followchess.com/* // @grant none // @version 1.0 // @author - // @description 6/8/2023, 1:09:32 PM // @run-at document-idle // @license MIT // ==/UserScript== function print_pgn() { var x = document.querySelectorAll("*[class^='live-game_chesspgnbox']"); var pgn = ""; for(var i=0;i < x[0].children.length; i++){ if(i == 0) { pgn = pgn + x[0].children[i].textContent } else { pgn = pgn +' ' + x[0].children[i].textContent; } } console.log(pgn); window.location = encodeURI("https://lichess.org/analysis/pgn/" + pgn + "?color=white"); } function add_button() { var element = document.createElement("button"); //Assign different attributes to the element. element.type = "button"; element.innerHTML = "analyze"; // Really? You want the default value to be the type string? element.name = "analyze"; // And the name too? element.onclick = print_pgn; var foo = document.querySelectorAll("*[class^='live-game_controlbox']")[0]; //Append the element in page (in span). foo.appendChild(element); } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } window.onload = async function () { await sleep(4000); console.log("loaded"); add_button(); }