Widget:EnemyMapDropdown

const maps = ;

RLQ.push(['jquery', function {	$(document).ready(function { initializeMapList; }); }]);

function initializeMapList { if (!maps) { return; }	let mapSelect = document.getElementById("mapSelect"); let mapList = []; mapList.push("Display All Quests"); for (const map of maps) { mapList.push(map); }	_populateSelectBox(mapSelect, mapList); mapSelect.value = checkURL; displayEnemyMapInfo(mapSelect); }

function checkURL { var url = window.location.href; var hashIndex = url.indexOf("#");

if (hashIndex > -1) { var map = decodeURI(url.substring(hashIndex+1).replace(/_/g," ")); if (maps.includes(map)) { return map; }	}

return "Display All Quests"; }

function _populateSelectBox(ele, list, defaultIndex = 0) { ele.options.length = 0; for (let i = 0; i < list.length; i++) { let opt = document.createElement('option'); opt.innerHTML = list[i]; opt.value = list[i]; ele.appendChild(opt); }   ele.selectedIndex = defaultIndex; }

function displayEnemyMapInfo(obj) { var enemyTables = $(".enemy-info-table table");

for (enemyTable of enemyTables) { for (let i = 1; i < enemyTable.rows.length; i++) { var row = enemyTable.rows[i]; if (obj.value == "Display All Quests") { row.style.display = ""; }			else { if (row.cells[0].innerHTML == obj.value) { row.style.display = ""; } else { row.style.display = "none"; }			}		}	} }

