Files
automatic-dispose/autoload.js
2018-11-24 14:43:59 +01:00

186 lines
6.4 KiB
JavaScript
Executable File

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// -
// - Automatic Dispose - Autoloader
// -
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
var AutomaticDispose_Branch = "master";
var AutomaticDispose_URL = "https://raw.josef-froehle.de/Dexus/automatic-dispose/";
var da_lss_adis_time = new Date().getTime();
var ADis_MyHead = document.getElementsByTagName('head')[0];
var ADis_MyBody = document.getElementsByTagName('body')[0];
// -
// - Settings
// -
if (localStorage.getItem("ADis-Settings-Krankentransport-Automatic") == null) {
localStorage.setItem("ADis-Settings-Krankentransport-Automatic", 'false');
}
if (localStorage.getItem("ADis-Settings-Full-Automatic") == null) {
localStorage.setItem("ADis-Settings-Full-Automatic", 'false');
}
if (localStorage.getItem("ADis-Settings-SEGELW1-Automatic") == null) {
localStorage.setItem("ADis-Settings-SEGELW1-Automatic", 'false');
}
if (localStorage.getItem("ADis-Settings-Sprechwunsch-Automatic") == null) {
localStorage.setItem("ADis-Settings-Sprechwunsch-Automatic", 'false');
}
if (localStorage.getItem("ADis-Settings-Alliance-Automatic") == null) {
localStorage.setItem("ADis-Settings-Alliance-Automatic", 'false');
}
if (localStorage.getItem("ADis-Krankentransporte") == null) {
localStorage.setItem("ADis-Krankentransporte", JSON.stringify({}));
}
// -
// - Google Font
// -
var styleElement = document.createElement("link");
styleElement.rel = "stylesheet";
styleElement.href = "https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700";
ADis_MyHead.appendChild(styleElement);
// -
// - FontAwesome 5
// -
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = "https://use.fontawesome.com/releases/v5.5.0/js/all.js";
ADis_MyHead.appendChild(scriptElement);
// -
// - Navbar Dashboard
// -
if (window.location.pathname === "/" || window.location.pathname === "/#") {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/interface.js";
ADis_MyBody.appendChild(scriptElement);
var styleElement = document.createElement("link");
styleElement.rel = "stylesheet";
styleElement.type = "text/css";
styleElement.media = "screen";
styleElement.href = AutomaticDispose_URL + AutomaticDispose_Branch + "/style/interface.css";
ADis_MyHead.appendChild(styleElement);
}
/*
// -
// - Load Automatic Modes
// -
if (window.location.pathname === "/" || window.location.pathname === "/#") {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/mission-manager.js";
ADis_MyBody.appendChild(scriptElement);
}
// -
// - Load Mission Opener
// -
if (window.location.pathname === "/" || window.location.pathname === "/#") {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/mission-opener.js";
ADis_MyBody.appendChild(scriptElement);
}
// -
// - Vehicle Alert
// -
if (window.location.pathname.indexOf("/missions/") !== -1) {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/mission-handling.js";
ADis_MyBody.appendChild(scriptElement);
}
*/
// -
// - Load Sprechwunsch Opener
// -
if (window.location.pathname === "/" || window.location.pathname === "/#") {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/sprechwunsch-opener.js";
ADis_MyBody.appendChild(scriptElement);
}
// -
// - Sprechwunsch Handler
// -
if (window.location.pathname.indexOf("/vehicles/") !== -1) {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/sprechwunsch-handler.js";
ADis_MyBody.appendChild(scriptElement);
}
// -
// - Load Krankentransporte Opener
// -
if (window.location.pathname === "/" || window.location.pathname === "/#") {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/krankentransporte-opener.js";
ADis_MyBody.appendChild(scriptElement);
}
// -
// - Krankentransporte Handler
// -
/*
if (window.location.pathname.indexOf("/vehicles/") !== -1) {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.src = AutomaticDispose_URL + AutomaticDispose_Branch + "/script/sprechwunsch-handler.js";
ADis_MyBody.appendChild(scriptElement);
}
*/
// -
// - Start Handler
// -
/*
if (!(window.location.pathname === "/" && window.location.pathname === "/#")) {
var scriptElement = document.createElement("script");
scriptElement.type = "text/javascript";
scriptElement.innerText = `
setTimeout(function(){
console.log(window.name);
console.log(window);
MissionID = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1);
var help_el = $('a#mission_help');
if (help_el.length > 0) {
MissionType = help_el[0].href.split("?")[0];
var re = /\d+$/i;
var found = MissionType.match(re);
MissionType = Number(found[0]);
}
console.log(MissionType);
CurrentTime = Math.floor(new Date().getTime() / 1000);
if (MissionType !== null) {
setTimeout(function () {
ADis_CheckMissionAutomatic();
}, 100);
}
}, 250);
`;
ADis_MyBody.appendChild(scriptElement);
}
*/