Welcome to IOPWiki, Commander.
With the release of the new game, we encourage contributions to topics related to Girls' Frontline 2. Learn how to contribute, read the maintenance guide, and join our Discord server to discuss major changes.
If you or someone you know can help deciphering the game files, contact our administrator.

MediaWiki:Common.js: Difference between revisions

Welcome to IOP Wiki. This website is maintained by the Girls' Frontline community and is free to edit by anyone.
Jump to navigation Jump to search
No edit summary
Pianoforte (talk | contribs)
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
/* skilldata.js object code to gf-table conversion */
$(document).ready(function() {
calculator_element = document.getElementById("convertDiv");
data = calculator_element.innerHTML;
output = "{| class=gf-table<br>";
$.each(data.split("\n"), function(index, value) {
if (value.charAt(0) !== "") {
key = value.substring(0,value.lastIndexOf(":")).trim();
output = output + "! " + key + "<br>";
if (key == "text") {
output = output + "| colspan=10 | " + value.substring(value.indexOf("\"")+1, value.lastIndexOf("\"")) + "<br>|-<br>";
console.log(output);
} else if (key == "initial") {
output = output + "| colspan=10 | " + value.substring(value.indexOf(":")+1, value.lastIndexOf(",")) + "<br>|-<br>";
} else {
output = output + "| " + value.substring(value.indexOf("[")+1, value.lastIndexOf("]")).split(",").join(" ||") + "<br>|-<br>";
}
}
});
output = output.substring(0, output.length - 6) + "|}";
output = output.split("\'").join("");
document.getElementById("convertedDiv").innerHTML = output;
});

Revision as of 11:48, 10 April 2017

/* Any JavaScript here will be loaded for all users on every page load. */

/* skilldata.js object code to gf-table conversion */
$(document).ready(function() {
	calculator_element = document.getElementById("convertDiv");
	data = calculator_element.innerHTML;
	output = "{| class=gf-table<br>";
	
	$.each(data.split("\n"), function(index, value) {
		if (value.charAt(0) !== "") {
			key = value.substring(0,value.lastIndexOf(":")).trim();
			output = output + "! " + key + "<br>";
			if (key == "text") {
				output = output + "| colspan=10 | " + value.substring(value.indexOf("\"")+1, value.lastIndexOf("\"")) + "<br>|-<br>";
				console.log(output);
			} else if (key == "initial") {
				output = output + "| colspan=10 | " + value.substring(value.indexOf(":")+1, value.lastIndexOf(",")) + "<br>|-<br>";			
			} else {
				output = output + "| " + value.substring(value.indexOf("[")+1, value.lastIndexOf("]")).split(",").join(" ||") + "<br>|-<br>";
			}
		}
	});
	output = output.substring(0, output.length - 6) + "|}";
	output = output.split("\'").join("");
	document.getElementById("convertedDiv").innerHTML = output;
});