Browse Source

Replace cd.js

master
Patrick Engel 4 years ago
parent
commit
93543c0389
  1. 28
      cd.js

28
cd.js

@ -2,6 +2,26 @@ const fflog = "https://www.fflogs.com:443/v1/report/fights/";
const api = "?api_key=";
var indexViewModel;
var classColors = {
"Scholar": "#4c49b2",
"WhiteMage": "#c7bf8e",
"Astrologian": "#8c501e",
"Paladin": "#8aa8a8",
"Gunbreaker": "#6c6433",
"Warrior": "#610e0a",
"DarkKnight": "#241011",
"Ninja": "#b30000",
"Dragoon": "#3b4ba0",
"Monk": "#c58d1c",
"Samurai": "#9e6d35",
"RedMage": "#47132a",
"BlackMage": "#261947",
"Summoner": "#59922b",
"Dancer": "#ceb8ab",
"Machinist": "#6c6433",
"Barde": "#6d8432"
};
// Do stuff when HTML parsing is ready
$(() => {
@ -9,7 +29,7 @@ $(() => {
function IndexViewModel() {
var self = this;
self.apiKey = ko.observable(localStorage.getItem("apikey"));
self.logID = ko.observable("");
self.logID = ko.observable(localStorage.getItem("fflogid"));
self.fights = ko.observableArray();
self.friendlies = ko.observableArray();
self.displayFightPicker = ko.observable(false);
@ -33,11 +53,17 @@ $(() => {
self.apiKeyChanged = function() {
console.log("Setting apiKey to ",self.apiKey());
localStorage.setItem("apikey",self.apiKey());
localStorage.setItem("fflogid", self.logID());
};
self.fightChanged = function() {
console.log("Fight has changed to ",self.selectedFight());
};
self.textColor = function(job) {
console.log(job.type)
return classColors[job.type];
}
};
indexViewModel = new IndexViewModel();
ko.applyBindings(indexViewModel);

Loading…
Cancel
Save