mirror of
https://github.com/AsgardEternal/squad-js-map-vote.git
synced 2025-01-23 17:13:54 -06:00
added a bandaid fix for repeat blacklist to html config tool
This commit is contained in:
parent
67d458fa80
commit
42c1552f0c
@ -1 +1 @@
|
||||
{"modes":["AAS","RAAS","Invasion"],"rules":{"default":[{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Chora","modes":["Any"],"versions":["Any"]},{"map":"Narva","modes":["Any"],"versions":["Any"]}],"Albasrah":[{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Skorpo","modes":["RAAS"],"versions":["v2"]},{"map":"Narva","modes":["Any"],"versions":["Any"]}],"Anvil":[{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Logar","modes":["Any"],"versions":["Any"]},{"map":"FoolsRoad","modes":["Any"],"versions":["Any"]}],"Belaya":[{"map":"Sumari","modes":["Any"],"versions":["Any"]},{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Narva","modes":["Any"],"versions":["Any"]}],"Fallujah":[{"map":"Yehorivka","modes":["RAAS"],"versions":["v4"]},{"map":"Narva","modes":["Any"],"versions":["Any"]},{"map":"Mestia","modes":["AAS","RAAS"],"versions":["Any"]}],"Gorodok":[{"map":"Kokan","modes":["RAAS"],"versions":["Any"]},{"map":"Logar","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Mestia","modes":["Any"],"versions":["Any"]}],"Kamdesh":[{"map":"Gorodok","modes":["Any"],"versions":["Any"]},{"map":"Skorpo","modes":["Any"],"versions":["Any"]}],"Kokan":[{"map":"Fallujah","modes":["Any"],"versions":["Any"]},{"map":"Belaya","modes":["Any"],"versions":["Any"]},{"map":"Logar","modes":["Any"],"versions":["Any"]}],"LashkarValley":[{"map":"Mestia","modes":["Any"],"versions":["Any"]},{"map":"Kokan","modes":["Any"],"versions":["Any"]},{"map":"FoolsRoad","modes":["Any"],"versions":["Any"]}],"Narva":[{"map":"Kohat","modes":["Any"],"versions":["Any"]},{"map":"Tallil","modes":["Any"],"versions":["Any"]},{"map":"Albasrah","modes":["Invasion"],"versions":["v2"]}],"Skorpo":[{"map":"Chora","modes":["Any"],"versions":["Any"]},{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Kokan","modes":["AAS","RAAS"],"versions":["Any"]}],"Sumari":[{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Belaya","modes":["Any"],"versions":["Any"]},{"map":"CAF_Manic","modes":["Any"],"versions":["Any"]}],"Tallil":[{"map":"FoolsRoad","modes":["Any"],"versions":["Any"]},{"map":"CAF_Manic","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Mestia","modes":["AAS","RAAS"],"versions":["Any"]}],"Yehorivka":[{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Narva","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Mutaha","modes":["Any"],"versions":["Any"]}],"Chora":[{"map":"Gorodok","modes":["Any"],"versions":["Any"]},{"map":"CAF_Manic","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Anvil","modes":["RAAS","Invasion"],"versions":["Any"]}],"Kohat":[{"map":"Gorodok","modes":["Any"],"versions":["Any"]},{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Kokan","modes":["Any"],"versions":["Any"]}],"Logar":[{"map":"Tallil","modes":["Any"],"versions":["Any"]},{"map":"CAF_GooseBay","modes":["Any"],"versions":["Any"]},{"map":"Kohat","modes":["Any"],"versions":["Any"]}]},"addon_map_layer_strings":[]}
|
||||
{"modes":["AAS","RAAS","Invasion"],"rules":{"default":[{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Chora","modes":["Any"],"versions":["Any"]},{"map":"Narva","modes":["Any"],"versions":["Any"]}],"Albasrah":[{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Skorpo","modes":["RAAS"],"versions":["v2"]},{"map":"Narva","modes":["Any"],"versions":["Any"]}],"Anvil":[{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Logar","modes":["Any"],"versions":["Any"]},{"map":"FoolsRoad","modes":["Any"],"versions":["Any"]}],"Belaya":[{"map":"Sumari","modes":["Any"],"versions":["Any"]},{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Narva","modes":["Any"],"versions":["Any"]}],"Fallujah":[{"map":"Yehorivka","modes":["RAAS"],"versions":["v4"]},{"map":"Narva","modes":["Any"],"versions":["Any"]},{"map":"Mestia","modes":["AAS","RAAS"],"versions":["Any"]}],"Gorodok":[{"map":"Kokan","modes":["RAAS"],"versions":["Any"]},{"map":"Logar","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Mestia","modes":["Any"],"versions":["Any"]}],"Kamdesh":[{"map":"Gorodok","modes":["Any"],"versions":["Any"]},{"map":"Skorpo","modes":["Any"],"versions":["Any"]}],"Kokan":[{"map":"Fallujah","modes":["Any"],"versions":["Any"]},{"map":"Belaya","modes":["Any"],"versions":["Any"]},{"map":"Logar","modes":["Any"],"versions":["Any"]}],"LashkarValley":[{"map":"Mestia","modes":["Any"],"versions":["Any"]},{"map":"Kokan","modes":["Any"],"versions":["Any"]},{"map":"FoolsRoad","modes":["Any"],"versions":["Any"]}],"Narva":[{"map":"Kohat","modes":["Any"],"versions":["Any"]},{"map":"Tallil","modes":["Any"],"versions":["Any"]},{"map":"Albasrah","modes":["Invasion"],"versions":["v2"]}],"Skorpo":[{"map":"Chora","modes":["Any"],"versions":["Any"]},{"map":"Mutaha","modes":["Any"],"versions":["Any"]},{"map":"Kokan","modes":["AAS","RAAS"],"versions":["Any"]}],"Sumari":[{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Belaya","modes":["Any"],"versions":["Any"]},{"map":"CAF_Manic","modes":["Any"],"versions":["Any"]}],"Tallil":[{"map":"FoolsRoad","modes":["Any"],"versions":["Any"]},{"map":"CAF_Manic","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Mestia","modes":["AAS","RAAS"],"versions":["Any"]}],"Yehorivka":[{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Narva","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Mutaha","modes":["Any"],"versions":["Any"]}],"Chora":[{"map":"Gorodok","modes":["Any"],"versions":["Any"]},{"map":"CAF_Manic","modes":["AAS","RAAS"],"versions":["Any"]},{"map":"Anvil","modes":["RAAS","Invasion"],"versions":["Any"]}],"Kohat":[{"map":"Gorodok","modes":["Any"],"versions":["Any"]},{"map":"Yehorivka","modes":["Any"],"versions":["Any"]},{"map":"Kokan","modes":["Any"],"versions":["Any"]}],"Logar":[{"map":"Tallil","modes":["Any"],"versions":["Any"]},{"map":"CAF_GooseBay","modes":["Any"],"versions":["Any"]},{"map":"Kohat","modes":["Any"],"versions":["Any"]}]},"addon_map_layer_strings":[], "mode_repeat_blacklist":[]}
|
59
index.html
59
index.html
@ -129,6 +129,13 @@
|
||||
<button>add</button>
|
||||
<button>remove</button>
|
||||
</div>
|
||||
<div id="blacklist">
|
||||
<h3>mode repeat blacklist strings (case sensitive):</h3>
|
||||
<ul id="blacklist_list" class="border_list"></ul>
|
||||
<input type="text" id="blacklist_input">
|
||||
<button id="add_blacklist">add</button>
|
||||
<button id="remove_blacklist">remove</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="info">
|
||||
<button onclick="render_graph()">render graph</button>
|
||||
@ -186,8 +193,14 @@
|
||||
const remove_mode_button = document.getElementById("remove_mode");
|
||||
const mode_input = document.getElementById("mode_input");
|
||||
const modes_list = document.getElementById("modes_list");
|
||||
let selected_mode = null;
|
||||
//blacklist
|
||||
const add_blacklist_button = document.getElementById("add_blacklist");
|
||||
const remove_blacklist_button = document.getElementById("remove_blacklist");
|
||||
const blacklist_input = document.getElementById("blacklist_input");
|
||||
const blacklist_list = document.getElementById("blacklist_list");
|
||||
|
||||
let selected_mode = null;
|
||||
let selected_blacklist_item = null;
|
||||
let svg_element = null;
|
||||
|
||||
function fetch_layer_strings()
|
||||
@ -264,15 +277,21 @@
|
||||
let vote_rules = {
|
||||
"modes": [],
|
||||
"rules": {},
|
||||
"addon_map_layer_strings": []
|
||||
"addon_map_layer_strings": [],
|
||||
"mode_repeat_blacklist": []
|
||||
};
|
||||
|
||||
for(let mode of modes_list.children)
|
||||
for (let mode of modes_list.children)
|
||||
{
|
||||
vote_rules.modes.push(mode.innerHTML.trim());
|
||||
}
|
||||
|
||||
for(let rule_element of rules_list.children)
|
||||
for (let blacklist_item of blacklist_list.children)
|
||||
{
|
||||
vote_rules.mode_repeat_blacklist.push(blacklist_item.innerHTML.trim());
|
||||
}
|
||||
|
||||
for (let rule_element of rules_list.children)
|
||||
{
|
||||
let rule = {
|
||||
"name": rule_element.rule_string_input.value,
|
||||
@ -292,6 +311,12 @@
|
||||
return vote_rules;
|
||||
}
|
||||
|
||||
add_blacklist_button.onclick = ()=>{
|
||||
if (blacklist_input.value == "")
|
||||
return;
|
||||
add_blacklist_item(blacklist_input.value);
|
||||
};
|
||||
|
||||
add_rule_button.onclick = ()=>{
|
||||
let rule = build_rule_element();
|
||||
rules_list.appendChild(rule);
|
||||
@ -318,6 +343,29 @@
|
||||
};
|
||||
}
|
||||
|
||||
function add_blacklist_item(blacklist_string)
|
||||
{
|
||||
let blacklist_item = document.createElement("li");
|
||||
blacklist_item.innerHTML = blacklist_string;
|
||||
blacklist_list.appendChild(blacklist_item);
|
||||
blacklist_item.onclick = () => {
|
||||
if (selected_blacklist_item)
|
||||
{
|
||||
selected_blacklist_item.classList.remove("selected");
|
||||
}
|
||||
selected_blacklist_item = blacklist_item;
|
||||
selected_blacklist_item.classList.add("selected");
|
||||
};
|
||||
}
|
||||
|
||||
remove_blacklist_button.onclick = () => {
|
||||
if (selected_blacklist_item)
|
||||
{
|
||||
selected_blacklist_item.parentNode.removeChild(selected_blacklist_item);
|
||||
selected_blacklist_item = null;
|
||||
}
|
||||
};
|
||||
|
||||
remove_mode_button.onclick = () => {
|
||||
if (selected_mode)
|
||||
{
|
||||
@ -344,6 +392,9 @@
|
||||
for (let mode of vote_rules.modes)
|
||||
add_mode(mode);
|
||||
|
||||
for (let blacklist_item of vote_rules.mode_repeat_blacklist)
|
||||
add_blacklist_item(blacklist_item);
|
||||
|
||||
let rules = Object.keys(vote_rules.rules).sort();
|
||||
|
||||
for (let rule of rules)
|
||||
|
Loading…
x
Reference in New Issue
Block a user