Skip to content

Instantly share code, notes, and snippets.

@jinuljt
Last active August 13, 2021 07:06
Show Gist options
  • Save jinuljt/b8c3a2ee5a61bc81cc20b163fd7d30de to your computer and use it in GitHub Desktop.
Save jinuljt/b8c3a2ee5a61bc81cc20b163fd7d30de to your computer and use it in GitHub Desktop.
report_export.user.js
// ==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