Last active
May 3, 2017 01:57
-
-
Save Icelys/fe2e906a74c5b998d56620f623f0a32f to your computer and use it in GitHub Desktop.
Staff helper userscript for enjin
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
// ==UserScript== | |
// @name StaffHelperEnjin | |
// @namespace Icelys | |
// @author icelys.github.io/staffhelper | |
// @include https://armonicpvp.enjin.com/forum/* | |
// @version 1 | |
// @grant none | |
// @run-at document-idle | |
// ==/UserScript== | |
var qs = document.createElement("select"); | |
var formtags = document.getElementsByTagName("form"); | |
var parent = 0; | |
for (i = 0; i < formtags.length; i++){ | |
if (formtags[i].name == "postform"){ | |
parent = formtags[i]; | |
} | |
} | |
if (parent != 0){ | |
// Post is probably locked | |
var blank = document.createElement("option"); | |
blank.text = "Select a shortcut"; | |
blank.value = "nil"; | |
var format = document.createElement("option"); | |
format.text = "Use the format."; | |
format.value = "uform"; | |
var accepted = document.createElement("option"); | |
accepted.text = "Accepted. -Locked"; | |
accepted.value = "acclkd"; | |
var denied = document.createElement("option"); | |
denied.text = "Denied. -Locked"; | |
denied.value = "denlkd"; | |
var unban = document.createElement("option"); | |
unban.text = "You're unbanned."; | |
unban.value = "unb"; | |
var unmute = document.createElement("option"); | |
unmute.text = "You're unmuted."; | |
unmute.value = "unmt"; | |
var xray = document.createElement("option"); | |
xray.text = "Xray Trap"; | |
xray.value = "xrayt"; | |
qs.add(blank); | |
qs.add(format); | |
qs.add(accepted); | |
qs.add(denied); | |
qs.add(unban); | |
qs.add(unmute); | |
qs.add(xray); | |
qs.id = "quickstaff"; | |
parent.appendChild(qs); | |
function changeEventHandler(event) { | |
if(!event.target.value) console.log("skipping"); | |
var text = ""; | |
var s = qs.options[qs.selectedIndex].value; | |
if (s == "nil"){ | |
text = ""; | |
} else if (s == "acclkd"){ | |
text = "Accepted. \n-Locked"; | |
} else if (s == "denlkd") { | |
text = "Denied. \n-Locked"; | |
} else if (s == "unb" ){ | |
text = "You're unbanned."; | |
} else if (s == "unmt") { | |
text = "You're unmuted."; | |
} else if (s == "xrayt") { | |
text = "You xrayed an xray trap. \n-Locked"; | |
} else if (s == "uform") { | |
text = "Use the [url=https://armonicpvp.enjin.com/forum/m/35672628/viewthread/25692362-ban-appeal-format]format[/url]. \n-Locked"; | |
} | |
$("#content").val(text); | |
} | |
qs.onchange=changeEventHandler; | |
} else { | |
console.log("Post locked"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment