diff --git a/dist/autoloader.js b/dist/autoloader.js index 263e822..1c2b061 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -1,4 +1,4 @@ -/*Generated on:Wed Feb 20 2019 00:03:28 GMT+0100 (CET)*/ +/*Generated on:Wed Feb 20 2019 00:24:23 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 5539b7a..48e2db3 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -1,4 +1,4 @@ -/*Generated on:Wed Feb 20 2019 00:03:28 GMT+0100 (CET)*/ +/*Generated on:Wed Feb 20 2019 00:24:23 GMT+0100 (CET)*/ /* * Dexie.js - a minimalistic wrapper for IndexedDB * =============================================== @@ -4513,20 +4513,24 @@ class AutomaticDisposeFaye { } replaceWithPrefix(data) { - return data.replaceAll('allianceChat', 'this.allianceChat') + return data.replaceAll('user_id', 'window.user_id') + .replaceAll('"window.user_id"', 'user_id') + .replaceAll('allianceChat', 'this.allianceChat') .replaceAll('mission_participation_add', 'this.mission_participation_add') .replaceAll('missionDelete', 'this.missionDelete') + .replaceAll('missionFinish', 'this.missionFinish') .replaceAll('missionInvolved', 'this.missionInvolved') .replaceAll('missionMarkerAdd', 'this.missionMarkerAdd') .replaceAll('patientDelete', 'this.patientDelete') - .replaceAll('patientMarkerAddCombined', 'this.patientMarkerCombinedAdd') + .replaceAll('patientFinish','this.patientFinish') .replaceAll('patientMarkerAdd', 'this.patientMarkerAdd') + .replaceAll('patientMarkerAddCombined', 'this.patientMarkerCombinedAdd') + .replaceAll('prisonerDelete','this.prisonerDelete') .replaceAll('prisonerMarkerAdd', 'this.prisonerMarkerAdd') .replaceAll('radioMessage', 'this.radioMessage') + .replaceAll('subscribe','this.subscribe') .replaceAll('vehicleDrive', 'this.vehicleDrive') .replaceAll('vehicleMarkerAdd', 'this.vehicleMarkerAdd') - .replaceAll('user_id', 'window.user_id') - .replaceAll('"window.user_id"', 'user_id') } subscribe(data) { @@ -17976,10 +17980,10 @@ class AutomaticDispose { }`), name: this.name, runner: ['kt', 'om', 'os', 'vm', 've'], - runner_divs: ['mission_list_krankentransporte', 'mission_list', /*'mission_list_sicherheitswache',*/ 'mission_list_alliance', 'mission_list_alliance_event'], - runner_settings: ['Krankentransport-Automatic', 'MissionsOwn-Automatic', /*'MissionsOwn-Automatic',*/ 'Alliance-Automatic', 'AllianceEvent-Automatic'], - runner_iframesName: ['adis-krankentransporte', 'adis-ownmissions', /*'adis-plannedevents',*/ 'adis-verbandmission', 'adis-verbandmission-event'], - runner_iframes: ['adis-krankentransporte-frame', 'adis-ownmissions-frame', /*'adis-plannedevents-frame',*/ 'adis-verbandmission-frame', 'adis-verbandmission-event-frame'] + runner_divs: ['mission_list_krankentransporte', 'mission_list', 'mission_list_sicherheitswache', 'mission_list_alliance', 'mission_list_alliance_event'], + runner_settings: ['Krankentransport-Automatic', 'MissionsOwn-Automatic', 'MissionsOwn-Automatic', 'Alliance-Automatic', 'AllianceEvent-Automatic'], + runner_iframesName: ['adis-krankentransporte', 'adis-ownmissions', 'adis-plannedevents', 'adis-verbandmission', 'adis-verbandmission-event'], + runner_iframes: ['adis-krankentransporte-frame', 'adis-ownmissions-frame', 'adis-plannedevents-frame', 'adis-verbandmission-frame', 'adis-verbandmission-event-frame'] } } @@ -18090,7 +18094,6 @@ class AutomaticDispose { } self.genSettings() - if (window.location.pathname === "/" || window.location.pathname === "/#") { self.GetAvailableMissions() self.IndexPage() @@ -19564,15 +19567,13 @@ class AutomaticDispose { CheckMissionAutomatic() { const self = this; - var setOpt; - if (window.name == 'adis-ownmissions' || window.name == 'adis-plannedevents') { - setOpt = 'MissionsOwn-Automatic'; - } else if (window.name == 'adis-krankentransporte') { - setOpt = 'Krankentransport-Automatic'; - } - if (setOpt && self.MyRunner) { + const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name); + self.MyRunner = self.ADisSettings.runner[runnerID]; + self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID]; + + if (self.MyRunnerSettings && self.MyRunner) { self.ADSettings().then((setting) => { - if (setting[setOpt] == 'true') { + if (setting[self.MyRunnerSettings] == 'true') { let where = { missionID: self.MissionID, runner: self.MyRunner, @@ -19589,7 +19590,7 @@ class AutomaticDispose { }).then((Missions) => { if (Missions.length > 0) { var Mission = Missions[0]; - if (self.MyRunner == 'os') { + if (self.MyRunner == 'os' && (self.includesString($('#missionH1').text(), '[verband]') || !self.includesString($('#missionH1').text(), '[event]'))) { self.OweSecure = true; } self.GetMissionConfiguration(Mission.type); @@ -19630,37 +19631,37 @@ class AutomaticDispose { }).then(() => { return self.CollectInvolvedVehicles(); }).then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.CollectPatients(); }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessEmergencyMedicalService() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessFireDepartment() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessPoliceDepartment() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessTechnicalEmergencyService() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessWaterRescue() @@ -19670,6 +19671,7 @@ class AutomaticDispose { 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(); + return; } } @@ -19700,34 +19702,7 @@ class AutomaticDispose { StartAlarmProcess() { const self = this; - - var $div = $("#mission-form > div:nth-child(7) > a"); - var isShow = $div.is(':hidden'); - //console.log($div, isShow); - /* - if ($div.length && isShow && 1 == 0) { - var observer = new MutationObserver(function (mutations) { - mutations.forEach(function (mutation) { - console.log(mutation.type, self.MissionID); - console.table(mutation, self.MissionID); - if (mutation.attributeName === "style") { - self.StartAlarmProcessProc() - } - }); - }); - observer.observe($div[0], { - attributes: true, - characterData: true - }); - - $div.click(); - } else { - */ - //window.console.log('StartAlarmProcessProc()'); self.StartAlarmProcessProc() - //} - - } // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index daffb44..0770cd5 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -38,20 +38,24 @@ class AutomaticDisposeFaye { } replaceWithPrefix(data) { - return data.replaceAll('allianceChat', 'this.allianceChat') + return data.replaceAll('user_id', 'window.user_id') + .replaceAll('"window.user_id"', 'user_id') + .replaceAll('allianceChat', 'this.allianceChat') .replaceAll('mission_participation_add', 'this.mission_participation_add') .replaceAll('missionDelete', 'this.missionDelete') + .replaceAll('missionFinish', 'this.missionFinish') .replaceAll('missionInvolved', 'this.missionInvolved') .replaceAll('missionMarkerAdd', 'this.missionMarkerAdd') .replaceAll('patientDelete', 'this.patientDelete') - .replaceAll('patientMarkerAddCombined', 'this.patientMarkerCombinedAdd') + .replaceAll('patientFinish','this.patientFinish') .replaceAll('patientMarkerAdd', 'this.patientMarkerAdd') + .replaceAll('patientMarkerAddCombined', 'this.patientMarkerCombinedAdd') + .replaceAll('prisonerDelete','this.prisonerDelete') .replaceAll('prisonerMarkerAdd', 'this.prisonerMarkerAdd') .replaceAll('radioMessage', 'this.radioMessage') + .replaceAll('subscribe','this.subscribe') .replaceAll('vehicleDrive', 'this.vehicleDrive') .replaceAll('vehicleMarkerAdd', 'this.vehicleMarkerAdd') - .replaceAll('user_id', 'window.user_id') - .replaceAll('"window.user_id"', 'user_id') } subscribe(data) { @@ -177,10 +181,10 @@ class AutomaticDispose { all_missions: /***ADis_AllMissions***/ 0, name: this.name, runner: ['kt', 'om', 'os', 'vm', 've'], - runner_divs: ['mission_list_krankentransporte', 'mission_list', /*'mission_list_sicherheitswache',*/ 'mission_list_alliance', 'mission_list_alliance_event'], - runner_settings: ['Krankentransport-Automatic', 'MissionsOwn-Automatic', /*'MissionsOwn-Automatic',*/ 'Alliance-Automatic', 'AllianceEvent-Automatic'], - runner_iframesName: ['adis-krankentransporte', 'adis-ownmissions', /*'adis-plannedevents',*/ 'adis-verbandmission', 'adis-verbandmission-event'], - runner_iframes: ['adis-krankentransporte-frame', 'adis-ownmissions-frame', /*'adis-plannedevents-frame',*/ 'adis-verbandmission-frame', 'adis-verbandmission-event-frame'] + runner_divs: ['mission_list_krankentransporte', 'mission_list', 'mission_list_sicherheitswache', 'mission_list_alliance', 'mission_list_alliance_event'], + runner_settings: ['Krankentransport-Automatic', 'MissionsOwn-Automatic', 'MissionsOwn-Automatic', 'Alliance-Automatic', 'AllianceEvent-Automatic'], + runner_iframesName: ['adis-krankentransporte', 'adis-ownmissions', 'adis-plannedevents', 'adis-verbandmission', 'adis-verbandmission-event'], + runner_iframes: ['adis-krankentransporte-frame', 'adis-ownmissions-frame', 'adis-plannedevents-frame', 'adis-verbandmission-frame', 'adis-verbandmission-event-frame'] } } @@ -291,7 +295,6 @@ class AutomaticDispose { } self.genSettings() - if (window.location.pathname === "/" || window.location.pathname === "/#") { self.GetAvailableMissions() self.IndexPage() @@ -1531,15 +1534,13 @@ class AutomaticDispose { CheckMissionAutomatic() { const self = this; - var setOpt; - if (window.name == 'adis-ownmissions' || window.name == 'adis-plannedevents') { - setOpt = 'MissionsOwn-Automatic'; - } else if (window.name == 'adis-krankentransporte') { - setOpt = 'Krankentransport-Automatic'; - } - if (setOpt && self.MyRunner) { + const runnerID = self.ADisSettings.runner_iframesName.indexOf(window.name); + self.MyRunner = self.ADisSettings.runner[runnerID]; + self.MyRunnerSettings = self.ADisSettings.runner_settings[runnerID]; + + if (self.MyRunnerSettings && self.MyRunner) { self.ADSettings().then((setting) => { - if (setting[setOpt] == 'true') { + if (setting[self.MyRunnerSettings] == 'true') { let where = { missionID: self.MissionID, runner: self.MyRunner, @@ -1556,7 +1557,7 @@ class AutomaticDispose { }).then((Missions) => { if (Missions.length > 0) { var Mission = Missions[0]; - if (self.MyRunner == 'os') { + if (self.MyRunner == 'os' && (self.includesString($('#missionH1').text(), '[verband]') || !self.includesString($('#missionH1').text(), '[event]'))) { self.OweSecure = true; } self.GetMissionConfiguration(Mission.type); @@ -1597,37 +1598,37 @@ class AutomaticDispose { }).then(() => { return self.CollectInvolvedVehicles(); }).then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.CollectPatients(); }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessEmergencyMedicalService() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessFireDepartment() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessPoliceDepartment() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessTechnicalEmergencyService() }) .then(() => { - if (self.MyRunner == 'os' && self.Vehicles.length > 0) { + if (self.MyRunner == 'os' && self.OweSecure) { return } return self.ProcessWaterRescue() @@ -1637,6 +1638,7 @@ class AutomaticDispose { 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(); + return; } } @@ -1667,34 +1669,7 @@ class AutomaticDispose { StartAlarmProcess() { const self = this; - - var $div = $("#mission-form > div:nth-child(7) > a"); - var isShow = $div.is(':hidden'); - //console.log($div, isShow); - /* - if ($div.length && isShow && 1 == 0) { - var observer = new MutationObserver(function (mutations) { - mutations.forEach(function (mutation) { - console.log(mutation.type, self.MissionID); - console.table(mutation, self.MissionID); - if (mutation.attributeName === "style") { - self.StartAlarmProcessProc() - } - }); - }); - observer.observe($div[0], { - attributes: true, - characterData: true - }); - - $div.click(); - } else { - */ - //window.console.log('StartAlarmProcessProc()'); self.StartAlarmProcessProc() - //} - - } // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --