v2 up af90u9

This commit is contained in:
2018-12-17 21:20:08 +01:00
parent eeccee2184
commit 4d4cb85484
3 changed files with 144 additions and 74 deletions

View File

@@ -1121,40 +1121,48 @@ class AutomaticDispose {
console.log("Window", window.name);
console.log("self.MyRunner", self.MyRunner);
console.log("self.MyRunnerSettings", self.MyRunnerSettings);
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
missionID: self.MissionID,
runner: self.MyRunner,
done: 'false'
}
console.log(where);
return self.ADisDB.ADisMissions.where(where).and(function (item) {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
return Wunsch.count(function (count) {
if (count > 0) {
return Wunsch.each((mywunsch) => {
return self.MainHandler()
});
} else {
return self.RemoveMissionsFromQueue(self.MissionID).then(() => {
return tellParent(`console.log('wunsch:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
})
}
});
} else {
return self.RemoveMissionsFromQueue(self.MissionID).then(() => {
return tellParent(`console.log('wunsch:2000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
})
}
if (self.includesString($('#iframe-inside-container > div.missionNotFound > div.missionNotFoundText').text(), 'Der Einsatz wurde erfolgreich abgeschlossen.')) {
console.log("DONE: " + self.MissionID);
return self.RemoveMissionsFromQueue(self.MissionID).then(() => {
return tellParent(`console.log('handler:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // delete Mission here as completed
})
})
} else {
return self.ADisDB.transaction('rw', [self.ADisDB.ADisMissions], () => {
self.ADSettings().then((setting) => {
if (setting[self.MyRunnerSettings] === 'true') {
let where = {
missionID: self.MissionID,
runner: self.MyRunner,
done: 'false'
}
console.log(where);
return self.ADisDB.ADisMissions.where(where).and(function (item) {
return item.next_check <= Math.floor(new Date().getTime() / 1000)
}).limit(1)
}
}).then((Wunsch) => {
if (Wunsch !== undefined) {
return Wunsch.count(function (count) {
if (count > 0) {
return Wunsch.each((mywunsch) => {
return self.MainHandler()
});
} else {
return self.RemoveMissionsFromQueue(self.MissionID).then(() => {
return tellParent(`console.log('wunsch:1000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
})
}
});
} else {
return self.RemoveMissionsFromQueue(self.MissionID).then(() => {
return tellParent(`console.log('wunsch:2000:done:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`);
})
}
})
})
}
}, 1500);
}
@@ -1312,7 +1320,7 @@ class AutomaticDispose {
StartAlarmProcess() {
const self = this;
setTimeout(function () {
const alarming = function alarming(self) {
Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList();
}).then(async () => {
@@ -1342,8 +1350,8 @@ class AutomaticDispose {
}
}
console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').size(), $('#vehicle_show_table_all input[type="checkbox"]:checked'));
console.log("WILL KLICK SEND")
// console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').size(), $('#vehicle_show_table_all input[type="checkbox"]:checked'));
// console.log("WILL KLICK SEND")
setTimeout(() => {
self.UpdateMissionsToDone(self.MissionID).then(() => {
@@ -1353,7 +1361,34 @@ class AutomaticDispose {
}, 250);
})
}, 500);
};
setTimeout(function () {
var $div = $("#mission-form > div:nth-child(7) > a");
var isShow = $div.is(':hidden');
//console.log($div, isShow);
if ($div.length && isShow) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") {
setTimeout(function () {
alarming(self)
}, 750);
}
});
});
observer.observe($div[0], {
attributes: true
});
$div.click();
} else {
setTimeout(function () {
alarming(self)
}, 250);
}
}, 150);
}
// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --