Skip to content

Instantly share code, notes, and snippets.

@nsdimitri
Last active May 16, 2023 09:17
Show Gist options
  • Save nsdimitri/f0fb14372d503a519efdf3fcc7f53ca0 to your computer and use it in GitHub Desktop.
Save nsdimitri/f0fb14372d503a519efdf3fcc7f53ca0 to your computer and use it in GitHub Desktop.
NSNationCreationAutoFill
// ==UserScript==
// @name NSNationCreationAutoFill
// @version 2.0
// @description Autofill most fields except name, passwords and tick boxes
// @author nsdimitri, Assisted by sitethief on NS Cards Discord
// @noframes
// @copyright MIT https://mit-license.org/
// @match https://www.nationstates.net/page=create_nation1
// @grant none
// ==/UserScript==
(function () {
'use strict';
const options = {
slogan: "",
currency: "",
animal: "",
email: "",
desc: "", // Must be a number between 100-138 inclusive
flag: "" // Must be a flag file name
};
// End of customizable options
function setFieldValue(fieldName, fieldValue) {
const field = document.querySelector(`input[name="${fieldName}"]`);
if (field) {
field.value = fieldValue;
}
}
setFieldValue("currency", options.currency);
setFieldValue("slogan", options.slogan);
setFieldValue("animal", options.animal);
setFieldValue("email", options.email);
document.getElementById('type').value = options.desc;
document.getElementById('flag').value = options.flag;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment