This commit is contained in:
2019-01-11 01:31:59 +01:00
parent 8909a25074
commit e650e0770f

View File

@@ -123,7 +123,7 @@ class AutomaticDispose {
'AllianceEvent-Automatic': false 'AllianceEvent-Automatic': false
} }
self.genSettings() self.genSettings()
if (window.location.pathname === "/" || window.location.pathname === "/#") { if (window.location.pathname === "/" || window.location.pathname === "/#") {
self.GetAvailableMissions() self.GetAvailableMissions()
@@ -1358,70 +1358,71 @@ class AutomaticDispose {
} }
StartAlarmProcessProc() {
const self = this;
new Dexie.Promise.resolve().then(() => {
return self.PrepareVehicleNeedList();
}).then(() => {
return self.CollectInvolvedVehicles();
}).then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.CollectPatients();
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessEmergencyMedicalService()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessFireDepartment()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessPoliceDepartment()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessTechnicalEmergencyService()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessWaterRescue()
})
.then(() => {
if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) {
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').length > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)')[0].click();
}
}
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")
setTimeout(() => {
window.console.log("WILL KLICK SEND2")
self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click();
});
}, 250);
})
}
StartAlarmProcess() { StartAlarmProcess() {
const self = this; const self = this;
const alarming = function alarming(self) {
new Dexie.Promise.resolve().then(() => {
return self.PrepareVehicleNeedList();
}).then(() => {
return self.CollectInvolvedVehicles();
}).then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.CollectPatients();
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessEmergencyMedicalService()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessFireDepartment()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessPoliceDepartment()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessTechnicalEmergencyService()
})
.then(() => {
if (self.MyRunner == 'os' && self.Vehicles.length > 0) {
return
}
return self.ProcessWaterRescue()
})
.then(() => {
if (self.OweSecure && $('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:checked').length == 0) {
if ($('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)').length > 0) {
$('#vehicle_show_table_all tr[vehicle_type="FuStW"] input[type="checkbox"]:not(:checked)')[0].click();
}
}
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")
setTimeout(() => {
window.console.log("WILL KLICK SEND2")
self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click();
});
}, 250);
})
};
var $div = $("#mission-form > div:nth-child(7) > a"); var $div = $("#mission-form > div:nth-child(7) > a");
var isShow = $div.is(':hidden'); var isShow = $div.is(':hidden');
@@ -1429,22 +1430,21 @@ class AutomaticDispose {
if ($div.length && isShow && 1 == 0) { if ($div.length && isShow && 1 == 0) {
var observer = new MutationObserver(function (mutations) { var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
console.log(mutation.type, self.MissionID);
console.table(mutation, self.MissionID);
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { self.StartAlarmProcessProc()
alarming(self)
}, 1500);
} }
}); });
}); });
observer.observe($div[0], { observer.observe($div[0], {
attributes: true attributes: true,
characterData: true
}); });
$div.click(); $div.click();
} else { } else {
setTimeout(function () { self.StartAlarmProcessProc()
alarming(self)
}, 500);
} }