Last active
November 17, 2018 16:48
-
-
Save bleonard252/528acbc7f954603c192f8745c5e5abda to your computer and use it in GitHub Desktop.
December: for config.jsons
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
<script> | |
var ianuam = {} | |
</script> | |
<div id="croissant_december"> | |
<form id="chocolate_december"> | |
<p><input type=checkbox january="Gateway.Writeable" id="writeable" /><label for="writeable">Writeable Gateway</label></p> | |
<p><input type=checkbox january="experiments.pubsub" id="pubsub" /><label for="pubsub">Publish/Subscribe (Pub/Sub)</label></p> | |
<input type=button value="Save" onclick="fsubmit_december('chocolate_december',ianuam)" /> | |
</form> | |
</div> | |
<script id="holy_scroll_december"> | |
/* Original December script by bleonard252, keep for attribution: | |
// https://gist.github.com/bleonard252/528acbc7f954603c192f8745c5e5abda | |
// You *must* keep the link to the original script! */ | |
function fsubmit_december(formid,configjson) { | |
let fdec = document.getElementById(formid); | |
for (var i = 0; i < fdec.children.length; i++) { | |
let tuesday = fdec.children.item(i); | |
if (tuesday.attributes.getNamedItem("january") !== null) { | |
configjson[tuesday.attributes.getNamedItem("january")] = tuesday.value; | |
console.log("Config updated"); | |
console.log(configjson); | |
} | |
} | |
} | |
function fload_december(formid,configjson) { | |
let fdec = document.getElementById(formid); | |
for (var i = 0; i < fdec.children.length; i++) { | |
let tuesday = fdec.children.item(i); | |
if (tuesday.attributes.getNamedItem("january") !== null) { | |
tuesday.value = configjson[tuesday.attributes.getNamedItem("january")]; | |
console.log("Config updated"); | |
console.log(configjson); | |
} | |
} | |
} | |
</script> | |
<script> | |
/* modify with name. should populate form settings */ | |
fload_december('chocolate_december',ianuam); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment