/* File name : comparator.js Description : Allow the user to compare multiple characters */ const GRAPH_CONTAINER_COMPARATOR_ID = "container-comparator"; const ID_GENDER_NON_RESTRICTED = 1; const BUTTON_ACTIVE_CLASS_NAME = "button-active"; let smartComparator; let selectedCharacters = []; function configureSmartSelectOfCharacters() { const characters = feData.characters; const houses = feData.houses; // Create the options of the select houses.forEach(house => { const optgroup = ""; $$("#select-compare").append(optgroup); }); characters.forEach(char => { const option = ""; $$("#optgroup-house-" + char.idHouse).append(option); }); // Configure the smartselect smartComparator = app.smartSelect.create({ el: '.smart-select', }); smartComparator.open(); smartComparator.on("close", () => { displayComparedCharacters(); }); $$("#btn-compare").on("click", () => { smartComparator.open(); }); } function displayComparedCharacters() { const selectedCharactersName = smartComparator.getValue(); selectedCharacters = []; selectedCharactersName.forEach(name => { selectedCharacters.push(feData.characters.find(x => x.firstName == name)); }); $$("#table-comparator-content").empty(); selectedCharacters.forEach(char => { const availableClasses = getAvailableClassesForCharacter(char); // Create the select of available classes const selectContainer = $$("
"); const select = $$("