From a7354d622dee7aa1daf152f5cd10c946d34a3daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Fr=C3=B6hle?= Date: Mon, 3 Dec 2018 20:20:03 +0100 Subject: [PATCH] v2 up ioago94it0a --- dist/autoloader.js | 2 +- dist/autoloaderV2.js | 56 ++++++++++++++++++++------------------------ src/autoloaderV2.js | 54 ++++++++++++++++++++---------------------- src/blub.js | 19 +++++++++++++++ 4 files changed, 71 insertions(+), 60 deletions(-) create mode 100644 src/blub.js diff --git a/dist/autoloader.js b/dist/autoloader.js index 0849926..fced564 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 03 2018 15:48:33 GMT+0100 (CET)*/ +/*Generated on:Mon Dec 03 2018 20:20:02 GMT+0100 (CET)*/ var AutomaticDispose_Branch = "master"; var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/"; var da_lss_adis_time = new Date().getTime(); diff --git a/dist/autoloaderV2.js b/dist/autoloaderV2.js index f5e0a3c..e33309a 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Mon Dec 03 2018 15:48:33 GMT+0100 (CET)*/ +/*Generated on:Mon Dec 03 2018 20:20:02 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -18647,37 +18647,33 @@ class AutomaticDispose { done: 'false' }).and(function (item) { return item.next_check <= Math.floor(new Date().getTime() / 1000) - }).limit(1) + }).toArray() } - }).then((Wunsch) => { - // console.table(Wunsch); - if (Wunsch !== undefined) { - return Wunsch.count(function (count) { - if (count > 0) { - return Wunsch.each((myWunsch) => { - // console.log("MYWUNSCH:") - // console.table(myWunsch); - let MissionID = myWunsch.missionID; - if ($('#' + runnerIframe).attr("mission_id") == "empty") { - $('#' + runnerIframe).attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); - $('#' + runnerIframe).attr("mission_id", MissionID); - // self.UpdateMissionsToDone(MissionID).then(() => { - // // console.log('done.... ' + Runner); - // $('#' + runnerIframe).attr("src", ''); - // $('#' + runnerIframe).attr("mission_id", 'empty'); - // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); - // }) - } else { - // only while - // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); - } - }); - } else { - return setTimeout(self.OpenNextMission.bind(self), 5000, Runner); - } - }); + }).then((Wunsche) => { + Wunsche.sort((a, b) => { + return a.next_check - b.next_check; + }); + // console.table(Wunsche); + if (Wunsche.length > 0) { + let myWunsch = Wunsche[0]; + // console.log("MYWUNSCH:") + // console.table(myWunsch); + let MissionID = myWunsch.missionID; + if ($('#' + runnerIframe).attr("mission_id") == "empty") { + $('#' + runnerIframe).attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); + $('#' + runnerIframe).attr("mission_id", MissionID); + // self.UpdateMissionsToDone(MissionID).then(() => { + // // console.log('done.... ' + Runner); + // $('#' + runnerIframe).attr("src", ''); + // $('#' + runnerIframe).attr("mission_id", 'empty'); + // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); + // }) + } else { + // only while + // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); + } } - return setTimeout(self.OpenNextMission.bind(self), 5000, Runner); + return setTimeout(self.OpenNextMission.bind(self), 1000, Runner); }); }); } diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index e1560cb..9136555 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -1055,37 +1055,33 @@ class AutomaticDispose { done: 'false' }).and(function (item) { return item.next_check <= Math.floor(new Date().getTime() / 1000) - }).limit(1) + }).toArray() } - }).then((Wunsch) => { - // console.table(Wunsch); - if (Wunsch !== undefined) { - return Wunsch.count(function (count) { - if (count > 0) { - return Wunsch.each((myWunsch) => { - // console.log("MYWUNSCH:") - // console.table(myWunsch); - let MissionID = myWunsch.missionID; - if ($('#' + runnerIframe).attr("mission_id") == "empty") { - $('#' + runnerIframe).attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); - $('#' + runnerIframe).attr("mission_id", MissionID); - // self.UpdateMissionsToDone(MissionID).then(() => { - // // console.log('done.... ' + Runner); - // $('#' + runnerIframe).attr("src", ''); - // $('#' + runnerIframe).attr("mission_id", 'empty'); - // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); - // }) - } else { - // only while - // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); - } - }); - } else { - return setTimeout(self.OpenNextMission.bind(self), 5000, Runner); - } - }); + }).then((Wunsche) => { + Wunsche.sort((a, b) => { + return a.next_check - b.next_check; + }); + // console.table(Wunsche); + if (Wunsche.length > 0) { + let myWunsch = Wunsche[0]; + // console.log("MYWUNSCH:") + // console.table(myWunsch); + let MissionID = myWunsch.missionID; + if ($('#' + runnerIframe).attr("mission_id") == "empty") { + $('#' + runnerIframe).attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); + $('#' + runnerIframe).attr("mission_id", MissionID); + // self.UpdateMissionsToDone(MissionID).then(() => { + // // console.log('done.... ' + Runner); + // $('#' + runnerIframe).attr("src", ''); + // $('#' + runnerIframe).attr("mission_id", 'empty'); + // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); + // }) + } else { + // only while + // setTimeout(self.OpenNextMission.bind(self), 5000, Runner); + } } - return setTimeout(self.OpenNextMission.bind(self), 5000, Runner); + return setTimeout(self.OpenNextMission.bind(self), 1000, Runner); }); }); } diff --git a/src/blub.js b/src/blub.js new file mode 100644 index 0000000..4c6510b --- /dev/null +++ b/src/blub.js @@ -0,0 +1,19 @@ +(() => { + let msis = (async () => { + return await AutomaticDisposeCall.ADisDB.ADisMissions.where({ + runner: 'om', + available: 'true', + done: 'false' + }).and(function (item) { + return item.next_check <= Math.floor(new Date().getTime() / 1000) + }).toArray() + })(); + msis.then((result) => { + result.sort((a, b) => { + return a.next_check > b.next_check; + }); + return result; + }).then((sortedResult) => { + console.table(sortedResult); + }); +})(); \ No newline at end of file