Gets the development progress of Sunless Sea and submits it to my google form
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
var formFields = { | |
"Sailing": "entry.376220540", | |
"Survival": "entry.197513274", | |
"Exploration": "entry.2132268405", | |
"UI": "entry.2043779183", | |
"World": "entry.1470664547", | |
"Combat": "entry.2099888301", | |
"Music": "entry.1305260500", | |
"Sound": "entry.2026300973", | |
"Economy & Trade": "entry.1749673763", | |
"Ambitions & Legacies": "entry.253097748", | |
"Fiction": "entry.358679505", | |
"Phenomena": "entry.997821975", | |
"Optimisation": "entry.702495680", | |
"Under the Unterzee": "entry.1646999836" | |
}; | |
var formUrlRoot = 'https://docs.google.com/forms/d/1xrFTn5fY58YI6iy4QLwfZaA7VhrL-409XfSuj33q8Hc/formResponse?submit=Submit&'; | |
var html = $('iframe').first().get(0).contentDocument.body.innerHTML; | |
var progress = $(html) | |
.find('.chart-entry') | |
.map(function () { | |
return { | |
label: $(this).find('.chart-label').text().trim(), | |
progress: $(this).find('.chart-bar').text().trim() | |
} | |
}) | |
.get(); | |
var urlComponent = progress | |
.map(function (item) { | |
return formFields[item.label] + "=" + (encodeURIComponent(item.progress) || "0"); | |
}) | |
.join('&'); | |
var destination = formUrlRoot += urlComponent; | |
$("<img src='" + destination + "' alt=''/>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment