update missions
This commit is contained in:
61
src/watch_missions.js
Normal file
61
src/watch_missions.js
Normal file
@@ -0,0 +1,61 @@
|
||||
// ==UserScript==
|
||||
// @name Mission Watcher
|
||||
// @version 1.0.0
|
||||
// @run-at document-end
|
||||
// @require https://cdnjs.cloudflare.com/ajax/libs/dexie/2.0.4/dexie.min.js
|
||||
// ==/UserScript==
|
||||
|
||||
|
||||
class WatchMissions {
|
||||
|
||||
constructor(){
|
||||
let self = this;
|
||||
self.DB = new Dexie('LSS_AutomaticDispo');
|
||||
|
||||
|
||||
self.DB.version(1).stores({
|
||||
/**
|
||||
* Missions to Watch
|
||||
* - missionID - Mission ID that should be watched.
|
||||
* - limit - If the Mission turns green more than 6 times, no more requests will be sent.
|
||||
*/
|
||||
Missions: "++missionID"
|
||||
});
|
||||
self.DB.open().catch((err) => {
|
||||
console.error(err.stack || err);
|
||||
});
|
||||
self.DB.on("ready", async () => {
|
||||
// index page
|
||||
if (window.location.pathname === "/" || window.location.pathname === "/#" || window.location.pathname === "/#_=_") {
|
||||
self.RegisterIndexPage();
|
||||
}
|
||||
// mission page
|
||||
else if (window.location.pathname.indexOf("/missions/") !== -1 && window.name == 'watchMission') {
|
||||
self.RegisterMissionPage();
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
get RandomTime() {
|
||||
const max = 6;
|
||||
const min = 1;
|
||||
return Math.floor((Math.random()*(max-min+1)+min)*1000);
|
||||
}
|
||||
|
||||
RegisterIndexPage() {
|
||||
|
||||
}
|
||||
|
||||
RegisterMissionPage() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
(() => {
|
||||
'use strict';
|
||||
|
||||
new WatchMissions();
|
||||
|
||||
})()
|
||||
Reference in New Issue
Block a user