Last active
June 5, 2017 21:41
-
-
Save Brian151/b53db3a9155dd7a5eb1e3f499865cc84 to your computer and use it in GitHub Desktop.
Guild Data viewer for CloudStone MMORPG
This file contains 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
<html> | |
<head> | |
<meta charset="UTF-8"/> | |
<meta name="copyright" content="Brian151(github) https://github.com/Brian151/"/> | |
<meta name="original" content="https://gist.github.com/Brian151/b53db3a9155dd7a5eb1e3f499865cc84"/> | |
<title>Cloudstone Guild Data viewer</title> | |
<style type="text/css"> | |
h2 { | |
margin:0px; | |
} | |
</style> | |
</head> | |
<body> | |
<textarea rows="16" cols="120" id="in"></textarea> | |
<br/><button onclick="loadData()">load data!</button> | |
<button onclick="dumpList()">export list!</button> | |
<table align="center" border="1" id="contributionsList"> | |
<tr> | |
<td colspan="6"><h2 align="center"><span>Guild: </span><span id="guildID"></span></h2></td> | |
</tr> | |
<tr> | |
<th colspan="6">Contributions</th> | |
</tr> | |
<tr/> | |
<th>Player</th> | |
<th>Rubies</th> | |
<th>Shards</th> | |
<th>Wood</th> | |
<th>Stone</th> | |
<th>Gold</th> | |
<tr/> | |
</table> | |
<script type="text/javascript"> | |
var input = document.getElementById("in"); | |
var gTitle = document.getElementById("guildID"); | |
var gContrList = document.getElementById("contributionsList"); | |
var obj = {}; | |
var smallDB = []; | |
function wrapTag(type,data) { | |
return "<" + type + ">" + data + "</" + type + ">"; | |
} | |
function checkNull(check) { | |
if (!check) | |
return 0; | |
else | |
return check; | |
} | |
function loadData() { | |
obj = JSON.parse(input.value); | |
smallDB = []; | |
gTitle.innerHTML = obj.guildName; | |
var m = obj.guildMembers; | |
for (i in m) { | |
var curr = m[i].contributions; | |
var r = checkNull(curr.rubies); | |
var sh = checkNull(curr.shards); | |
var w = checkNull(curr.wood); | |
var st = checkNull(curr.stone); | |
var g = checkNull(curr.gold); | |
var currName = m[i].name; | |
gContrList.innerHTML += "<tr>" + | |
wrapTag("td",currName) + | |
wrapTag("td",r) + | |
wrapTag("td",sh) + | |
wrapTag("td",w) + | |
wrapTag("td",st) + | |
wrapTag("td",g) + | |
"</tr>"; | |
smallDB.push([currName,r,sh,w,st,g]); | |
} | |
} | |
function dumpList() { | |
var out = ""; | |
for (i =0; i < smallDB.length; i++) { | |
var curr = smallDB[i] | |
out += "\n" + curr[0] + " | " + | |
curr[1] + " rubies | " + | |
curr[2] + " shards | " + | |
curr[3] + " wood | " + | |
curr[4] + " stone | " + | |
curr[5] + " gold"; | |
} | |
alert(out); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment