User:Cephalon Scientia/common.js

// testing the use of an API to generate HTML for a page // working on automating Nightwave acts

// to map out act name to associated image in wiki let dailyActImageMap = new Map([   ['Accelerator', 'KillEnemiesWhileSliding.png'],    ['Agent', 'CompleteAnyMission.png'],    ['Air It Out', ],    ['Arsonist', 'KillEnemiesDamageTypeFire.png'],    ['Attractive', 'KillEnemiesDamageTypeMagnetic.png'],    ['Biohazard', 'KillEnemiesDamageTypeGas.png'],    ['Communicator', 'PlaceWaypoint.png'],    ['Deep Freeze', 'KillEnemiesDamageTypeCold.png'],    ['Detonator', 'KillEnemiesDamageTypeBlast.png'],    ['Energizing', 'EnergyOrbs.png'],    ['Everything Old is New Again', ],    ['Executioner', 'KillEnemiesFinishingMoves.png'],    ['Expressive', 'PerformEmote.png'],    ['Glider', 'AimGlide.png'],    ['Grafitti', 'PlaceGlyph.png'],    ['Hacker', 'SolveCipher.png'],    ['Kleptomaniac', 'OpenLootLocker.png'],    ['Loyalty', ''],    ['Marksman', 'GetHeadshots.png'],    ['Meltdown', 'KillEnemiesDamageTypeCorrosive.png'],    ['Mow Them Down', 'KillEnemiesWithPrimary.png'], ['Poisoner', 'KillEnemiesDamageTypePoison.png'], ['Power Trip', 'KillEnemiesWithAbilities.png'], ['Reactor', 'KillEnemiesDamageTypeRadiation.png'], ['Researcher', 'CodexScan.png'], ['Saver', 'CollectCredits.png'], ['Sharing is Caring', 'KillEnemiesDamageTypeViral.png'], ['Shiny', 'FindMod.png'], ['Short Circuit', 'KillEnemiesDamageTypeElectricty.png'], ['Smaller Is Bigger', 'KillEnemiesWithSecondary.png'], ['Sword Dance', 'KillEnemiesWithMelee.png'], ['The Hunt is On', ''], ['Trampoline', 'BulletJump.png'], ['Warning Shot', 'KillEnemies.png'], ]);

let weeklyActImageMap = new Map([   ['Animator', 'AyatanSculptures.png'],    ['Assassin', 'CompleteMissionTypesAssassination.png'],    ['Cache Hunter', 'SabotageCaches.png'],    ['Conservationist', 'PerfectConservations.png'],    ['Don\'t Blow It', ],    ['Don\'t Fear The Reaper', ],    ['Earth Bounty Hunter', 'BountiesPoE.png'],    ['Earth Fisher', 'RareFishPoE.png'],    ['Earth Miner', 'MineGemsPoE.png'],    ['Eliminator', 'MissionsOfXType.png'],    ['Enhance!', 'AcquireRareMods.png'],    ['Eximus Eliminator', 'KillEnemiesWeekly.png'],    ['Good Friend', 'HelpClem.png'],    ['Invader', 'InvasionMissions.png'],    ['Jailer', 'CompleteMissionTypesCapture.png'],    ['Not a Warning Shot', 'KillEnemiesWeekly.png'],    ['Now Boarding', ''],    ['Operative', 'CompleteMissionTypesSpy.png'],    ['Polarized', 'FormaWeapons.png'],    ['Protector', 'CompleteMissionTypeDefense.png'],    ['Rescuer', 'CompleteMissionTypesRescue.png'], ['Saboteur', 'CompleteMissionTypesSabotage.png'], ['Sanctuary Researcher', 'SynthesizeSimarisTargets.png'], ['Sound Sleeper', 'NightmareMissions.png'], ['Sortie Specialist', 'SortieWarframe.png'], ['Supporter', 'SyndicateDailies.png'], ['Test Subject', 'Weekly_EliteSanctuaryOnslaught.png'], ['Tusk Thumpin\, ], ['Unlock Relics', 'UnlockRelics.png'], ['Vault Looter', 'UnlockDragonVaults.png'], ['Venus Bounty Hunter', 'BountiesOrbVallis.png'], ['Venus Fisher', 'RareFishOrbVallis.png'], ['Venus Miner', 'MineGemsOrbVallis.png'], ]);

let eliteActImageMap = new Map([   ['Ascendant', 'HallsOfAscension.png'],    ['Day Trader', 'IndexRounds.png'],    ['Defense', 'DefenseMissionWaveXWithFriendsClan.png'],    ['Elite Test Subject', 'EliteSanctuaryOnslaught.png'],    ['Eximus Executioner', 'KillEnemiesHardcore.png'],    ['Flying High', ],    ['Grove Guardian', 'KillEnemiesHardcore.png'],    ['Hold Your Breath', 'KuvaSurvival.png'],    ['Hydrolyst Hunter', 'Hydrolists.png'],    ['Kill Profit-Taker', 'OrbHeistFullParty.png'],    ['Kill Shot', 'KillEnemiesHardcore.png'],    ['Night Terror', 'NightmareMissionsHardcore.png'],    ['Silent Eliminator', 'ExterminationWithoutAlarms.png'],    ['Sortie Expert', 'Hardcore_Sortie.png'],    ['Survival', 'HighLevelSurvivalWithFriendsClan.png'],    ['Unlock Relics', 'UnlockRelicsHardcore.png'],    ['Walk Without Rhythm', ], ]);

$(function {    const API_URL = 'https://api.warframestat.us/pc/nightwave';    const NUM_ACTS = 10;    enum ActType {        DAILY,        WEEKLY,        ELITE_WEEKLY    }    let json = $.get(API_URL);    let actsArr = [];    // adding acts into array    for (let i = 0; i < NUM_ACTS; i++) {    }    let myElement = document.getElementById('nightwave_acts');    let tableRowTest = $(' ', { append: [ $(' ', {               append: [                    $(' ', { class: 'center', append: [ $(' ', {                               class: 'floatnone'                            }) ]                   })                ]            }),            $(' ', {            }),            $(' ', {            }),        ]    });    for (let i = 0; i < NUM_ACTS; i++) {        let actName = ;        let actDesc = ;        let tableRow = '          <img src="https://vignette.wikia.nocookie.net/warframe/images/4/4b/KillEnemiesDamageTypeRadiation.png/revision/latest/scale-to-width-down/75?cb=20190318021734" alt="KillEnemiesDamageTypeRadiation" class="lzyPlcHld lzyTrns lzyLoaded" data-image-key="KillEnemiesDamageTypeRadiation.png" data-image-name="KillEnemiesDamageTypeRadiation.png" data-src="https://vignette.wikia.nocookie.net/warframe/images/4/4b/KillEnemiesDamageTypeRadiation.png/revision/latest/scale-to-width-down/75?cb=20190318021734" onload="if(typeof ImgLzy==='object'){ImgLzy.load(this)}" width="75" height="75">   Reactor Kill 150 Enemies with Radiation Damage 1,000 <img src="https://vignette.wikia.nocookie.net/warframe/images/9/92/ReputationLargeBlack.png/revision/latest/scale-to-width-down/20?cb=20141029201703" alt="ReputationLargeBlack" class="lzyPlcHld lzyTrns lzyLoaded" data-image-key="ReputationLargeBlack.png" data-image-name="ReputationLargeBlack.png" data-src="https://vignette.wikia.nocookie.net/warframe/images/9/92/ReputationLargeBlack.png/revision/latest/scale-to-width-down/20?cb=20141029201703" onload="if(typeof ImgLzy==='object'){ImgLzy.load(this)}" width="20" height="20">  ‍1,000 ( Ends in    2: 20: 29: 35  )  <span style="display:none" class="seedDate" id="seedDate_0">January 25, 2020 00:00:00 UTC <span style="display:none" class="loopTime" id="loopTime_0">3 <span style="display:none" class="loopTimeUnit" id="loopTimeUnit_0">D <span style="display:none" class="loopLimit" id="loopLimit_0">1 <span style="display:none" class="endText" id="endText_0">( Expired ) <span style="display:none" class="delayTime" id="delayTime_0"> <span style="display:none" class="delayTimeUnit" id="delayTimeUnit_0">s <span style="display:none" class="delayCountDisplay" id="delayCountDisplay_0"> <span style="display:none" class="dst" id="dst_0">t <span style="display:none" class="dateFormat" id="dateFormat_0">D hh mm ss <span style="display:none" class="dateLabels" id="dateLabels_0"> <span style="display:none" class="separators" id="separators_0">: ';   }    let actsTableHeader = '  <li class="tabberactive">♦ Daily</a></li> <li>♦♦ Weekly</a></li> <li>♦♦♦ Elite Weekly</a></li> </ul>'; let dailyActs = '<div class="tabbertab" title="♦ Daily" style="display: block;"> '; let weeklyActs = '  <div class="tabbertab" title="♦♦ Weekly" style="display: none;"> ';   let eliteWeeklyActs = '   <div class="tabbertab" title="♦♦♦ Elite Weekly" style="display: none;"> ';   myElement.innerHTML = actsTableHeader + dailyActs + weeklyActs + eliteWeeklyActs; function buildTableRow { return buildActNameCell + buildRepCell + buildTimerCell; }   function buildActNameCell(actName) { return ''; }   function buildRepCell(repAmount) { return ''; }   function buildTimerCell { return ''; } });