WF scientists overview easy export button

Adds a button onto the scientists overview to easily allow scientists export to sheets, excel, etc

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        WF scientists overview easy export button
// @namespace   http://www.war-facts.com/
// @include		http://www.war-facts.com/overview.php?view=13
// @description Adds a button onto the scientists overview to easily allow scientists export to sheets, excel, etc
// @version     1
// @grant       none
// ==/UserScript==
$(document).ready(function () {
	console.log('Adding export button to scientists overview')
	$('#hiredTable').before('<button id="export-btn">Export</button>')
	
	$('#export-btn').on('click', function () {
		var table = document.getElementById("hiredTable");
		scienceString = "<div><pre>"
		for (var i = 1, row; row = table.rows[i]; i++) {   
		  if (i == table.rows.length -1)
			break;
		  
		  for (var j = 0, col; col = row.cells[j]; j++) {
			scienceString += col.innerText
			scienceString += "\t"
		  }
		  scienceString += "</pre><pre>"
		}
		scienceString += "</p></div>"
		window.open().document.write(scienceString)
	})
})