This commit is contained in:
2019-01-11 02:41:19 +01:00
parent e8da6536d9
commit 22b2bca429
3 changed files with 68 additions and 40 deletions

View File

@@ -972,7 +972,6 @@ class AutomaticDispose {
console.log(count, runnerOpt);
if (count > 0) {
return Missions.each((Mission) => {
console.table(Mission);
var MissionElement = $("#mission_" + ID);
var _MissionID = MissionElement.attr("mission_id");
var _MissionType = MissionElement.attr("mission_type_id");
@@ -984,6 +983,19 @@ class AutomaticDispose {
return self.ADisDB.ADisAvailabelMissions.get({
type: _MissionType
}).then((available) => {
console.table(Mission)
console.table({
"missionID": _MissionID,
"type": _MissionType,
"runner": runnerOpt,
"name": MissionName,
"street": MissionStreet,
"village": MissionVillage,
"available": (available !== undefined) ? 'true' : 'false',
"done": "false",
"last_check": Mission.last_check,
"next_check": Mission.next_check
})
return self.UpdateMissions({
"missionID": _MissionID,
"type": _MissionType,
@@ -1218,13 +1230,15 @@ class AutomaticDispose {
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 if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") ) {
console.log("SEND");
console.log("SEND: ", self.MissionID);
return self.UpdateMissionsToDone(self.MissionID).then(() => {
return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
});
} */ else {
}
/*else if (self.includesString($('#iframe-inside-container > div.alert.fade.in.alert-success').text(), "wurde erfolgreich informiert") ) {
console.log("SEND");
console.log("SEND: ", self.MissionID);
return self.UpdateMissionsToDone(self.MissionID).then(() => {
return tellParent(`console.log('handler:2000:update:${window.name}:${self.MissionID}');window.AutomaticDisposeCall.FreeIframe('${self.MyRunner}');`); // update Mission here as updated or full
});
} */
else {
setTimeout(function () {
if (['adis-ownmissions', 'adis-plannedevents', 'adis-krankentransporte'].indexOf(window.name) != -1) {
console.log("WILL SEND?")
@@ -1412,7 +1426,7 @@ class AutomaticDispose {
window.console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked'));
window.console.log("WILL KLICK SEND", self.MissionID, window.name)
self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
if ($('#vehicle_show_table_all input[type="checkbox"]:checked').length == 0) {
@@ -2417,24 +2431,24 @@ $(document).ready(function () {
var $div = $("a:contains('Fahrzeuganzeige begrenzt! Fehlende Fahrzeuge laden!')");
var isShow = $div.is(':hidden');
var ppppp = undefined;
var MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
console.log($div, isShow, MissionID);
//var MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
//console.log($div, isShow, MissionID);
if ($div.length && isShow) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
console.log(mutation.type, MissionID);
console.table(mutation, MissionID);
if (mutation.attributeName === "style") {
if (typeof ppppp != 'undefined'){
clearTimeout(ppppp);
if ($(mutation.target).css('display') == 'none') {
if (typeof ppppp != 'undefined') {
clearTimeout(ppppp);
}
ppppp = setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose();
}, 250);
}
ppppp = setTimeout(function () {
window.AutomaticDisposeCall = new AutomaticDispose();
}, 1500);
}
});
});
$div.each(function(index,item){
$div.each(function (index, item) {
observer.observe(item, {
attributes: true,
characterData: true,