Last active
August 13, 2021 07:06
-
-
Save jinuljt/b8c3a2ee5a61bc81cc20b163fd7d30de to your computer and use it in GitHub Desktop.
report_export.user.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name report export | |
// @namespace https://gist.github.com/jinuljt/b8c3a2ee5a61bc81cc20b163fd7d30de/ | |
// @version 0.1 | |
// @description 导出坎弓骑会战报表 | |
// @author gugu | |
// @match https://www.bigfun.cn/tools/gt/t_report | |
// @icon https://www.google.com/s2/favicons?domain=bigfun.cn | |
// @grant GM_setClipboard | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function exportReport() { | |
var s = "" | |
console.log("export report clicked"); | |
var rows = document.getElementsByClassName("tbody"); | |
for (var row of rows) { | |
for (var col of row.childNodes) { | |
s += col.innerText.replace(/\n/g,' ') + "\t"; | |
} | |
s += "\n"; | |
} | |
GM_setClipboard(s); | |
} | |
console.log("find name, bind click event"); | |
var elements = document.getElementsByClassName("name"); | |
for (var element of elements) { | |
var button = document.createElement("button"); | |
button.innerText = "复制报表"; | |
button.onclick = exportReport; | |
console.log("add export button"); | |
element.after(button); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment