|
|
(12 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| /* 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");
| |
| if (calculator_element !== null) {
| |
| 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;
| |
| }
| |
| });
| |