Swiper removed
- Swiper removal work in progress + Fine debugging for every js-file
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
// % INIT
|
||||
|
||||
// local debugging: print the name of every executed funtion to the console
|
||||
var debug_main_daniel = 0;
|
||||
|
||||
var MAXBLOCK = 4; // max number of blocks
|
||||
var elements = []; // grid elements
|
||||
var swiper = []; // This array contains main-swiper-Instances.
|
||||
@ -15,11 +18,16 @@ var writePermission = false;
|
||||
var menuMode = false;
|
||||
var panelOn = true;
|
||||
var firstState = 0;
|
||||
var showParams = 0;
|
||||
|
||||
function Settings() {
|
||||
if (debug_main_daniel) {
|
||||
console.log("%cfunction: Settings", "color:white;background:limegreen");
|
||||
}
|
||||
|
||||
// get key/value pairs from search part of the URL and fill into query
|
||||
var qstr = location.search;
|
||||
console.log(qstr);
|
||||
// console.log(qstr);
|
||||
if (qstr) {
|
||||
var a = (qstr[0] === '?' ? qstr.substr(1) : qstr).split('&');
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
@ -62,6 +70,10 @@ function Settings() {
|
||||
}
|
||||
|
||||
function to_bool(string) {
|
||||
if (debug_main_daniel) {
|
||||
console.log("%cfunction: to_bool", "color:white;background:limegreen");
|
||||
}
|
||||
|
||||
// everything else than false, 0 or an empty string is considered as true
|
||||
return !/^(false|FALSE|False|0|)$/.test(string);
|
||||
}
|
||||
@ -73,7 +85,7 @@ new Settings()
|
||||
.treat("debugGraphics", "dg", to_bool, false)
|
||||
.treat("hostPort", "hp", 0, location.hostname + ":" + location.port)
|
||||
.treat("showMain", "sm", to_bool, true)
|
||||
.treat("showConsole", "sc", to_bool, false)
|
||||
.treat("showConsole", "sc", to_bool, true)
|
||||
.treat("showOverview", "so", to_bool, false)
|
||||
.treat("showGraphics", "sg", to_bool, true) // false)
|
||||
.treat("hideRightPart", "hr", to_bool, false) //used to completely disable the right part
|
||||
@ -81,6 +93,9 @@ new Settings()
|
||||
.treat("showAsync", "sa", to_bool, false)
|
||||
|
||||
function loadFirstBlocks() {
|
||||
if (debug_main_daniel) {
|
||||
console.log("%cfunction: loadFirstBlocks", "color:white;background:limegreen");
|
||||
}
|
||||
|
||||
if (showMain) pushInitCommand("getblock?path=main&", "main")
|
||||
if (showConsole) pushInitCommand("console?", "console")
|
||||
@ -95,28 +110,36 @@ function loadFirstBlocks() {
|
||||
}
|
||||
|
||||
function nextInitCommand() {
|
||||
// do the next init request
|
||||
if (initCommands.length > 0) {
|
||||
next = initCommands.shift();
|
||||
cmd = next[0]
|
||||
text = next[1]
|
||||
var loadingSpan = document.getElementsByClassName("loading-span")[0];
|
||||
loadingSpan.innerHTML = loadingSpan.innerHTML + "<br>loading " + htmlEscape(text) + " ...";
|
||||
reqJSON(0, "http://" + hostPort + "/" + cmd + "id=" + clientID, successHandler, errorHandler);
|
||||
} else if (loadingShown) {
|
||||
var loadingScreen = document.getElementsByClassName("loading-div")[0];
|
||||
loadingScreen.style.display = "none";
|
||||
loadingShown = false;
|
||||
if (location.hash) { // there was a #hash part
|
||||
var slideNames = location.hash.substr(1);
|
||||
gotoGroups(slideNames);
|
||||
if (debug_main_daniel) {
|
||||
console.log("%cfunction: nextInitCommand", "color:white;background:limegreen");
|
||||
}
|
||||
|
||||
// do the next init request
|
||||
if (initCommands.length > 0) {
|
||||
next = initCommands.shift();
|
||||
cmd = next[0]
|
||||
text = next[1]
|
||||
var loadingSpan = document.getElementsByClassName("loading-span")[0];
|
||||
loadingSpan.innerHTML = loadingSpan.innerHTML + "<br>loading " + htmlEscape(text) + " ...";
|
||||
reqJSON(0, "http://" + hostPort + "/" + cmd + "id=" + clientID, successHandler, errorHandler);
|
||||
} else if (loadingShown) {
|
||||
var loadingScreen = document.getElementsByClassName("loading-div")[0];
|
||||
loadingScreen.style.display = "none";
|
||||
loadingShown = false;
|
||||
if (location.hash) { // there was a #hash part
|
||||
var slideNames = location.hash.substr(1);
|
||||
gotoGroups(slideNames);
|
||||
}
|
||||
console.log("loading finished");
|
||||
}
|
||||
console.log("loading finished");
|
||||
}
|
||||
}
|
||||
|
||||
function pushInitCommand(cmd, text) {
|
||||
initCommands.push([cmd, text]);
|
||||
if (debug_main_daniel) {
|
||||
console.log("%cfunction: pushInitCommand", "color:white;background:limegreen");
|
||||
}
|
||||
|
||||
initCommands.push([cmd, text]);
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
@ -139,57 +162,78 @@ window.onload = function() {
|
||||
}else{
|
||||
crossElement.onclick = function(){
|
||||
if(nColumns == 1){ // if the screen is small, the cross always slides to the next slide
|
||||
let someSwiper = swiper[0];
|
||||
someSwiper.enableSwiping(true); // needed because someSwiper might be the graphs swiper, and swiping is disable by default
|
||||
someSwiper.slideNext(); // someSwiper can be anything, it will swipe to the next slide
|
||||
// let someSwiper = swiper[0];
|
||||
// someSwiper.enableSwiping(true); // needed because someSwiper might be the graphs swiper, and swiping is disable by default
|
||||
// someSwiper.slideNext(); // someSwiper can be anything, it will swipe to the next slide
|
||||
console.log(elements[0].style.display);
|
||||
// adjustGrid();
|
||||
if (elements[0].style.display == "inline-block") { // only graphics is visible
|
||||
elements[0].style.display = "none"; // hide graphics
|
||||
elements[1].style.display = "inline-block"; // show modules
|
||||
elements[2].style.display = "none"; // hide parameters
|
||||
} else if (elements[1].style.display == "inline-block") { // only modules are visible
|
||||
elements[0].style.display = "inline-block"; // show graphics
|
||||
elements[1].style.display = "none"; // hide modules
|
||||
elements[2].style.display = "none"; // hide parameters
|
||||
} else if (elements[2].style.display == "inline-block") { // only parameters are visible
|
||||
elements[0].style.display = "none"; // hide graphics
|
||||
elements[1].style.display = "inline-block"; // show modules
|
||||
elements[2].style.display = "none"; // hide parameters
|
||||
}
|
||||
}else{ // else it toggles the graphs window's size and triggers the adjustGrid()
|
||||
window["wideGraphs"] = !window['wideGraphs'];
|
||||
adjustGrid();
|
||||
window["wideGraphs"] = !window['wideGraphs'];
|
||||
adjustGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOT USED ANYMORE -> remove swiper
|
||||
// Create swiper-instances.
|
||||
for (var s = 0; s < MAXBLOCK; s++) {
|
||||
swiper[s] = insertSwiper(s);
|
||||
}
|
||||
var homeButton = document.getElementById("home-icon");
|
||||
// for (var s = 0; s < MAXBLOCK; s++) {
|
||||
// swiper[s] = insertSwiper(s);
|
||||
// }
|
||||
|
||||
// var homeButton = document.getElementById("home-icon");
|
||||
|
||||
// TODO : uncomment this code with the right URL to navigate to when the way to select the instrument will be decided.
|
||||
// homeButton.onclick = function () {
|
||||
// window.location = "http://" + location.hostname + ":8800/";
|
||||
// };
|
||||
buildUpdateConnection();
|
||||
if (location.hash) {
|
||||
console.log("hash in url", location.hash);
|
||||
initSlides = location.hash.substring(1);
|
||||
} else {
|
||||
initSlides = "";
|
||||
}
|
||||
// Initialisation will be continued, when SSE-connection is established
|
||||
// and id-message is obtained.
|
||||
// (see also at SEAWebClientCommunication.js)
|
||||
addEventListener("popstate", function (e) {
|
||||
if (e.state) {
|
||||
if (loadingShown) {
|
||||
if (initSlides != e.state.funarg) {
|
||||
console.log("hash mismatch", initSlides, e.state.funarg);
|
||||
initSlides = e.state.funarg;
|
||||
}
|
||||
} else {
|
||||
console.log("popstate", e.state.func, e.state.funarg);
|
||||
window[e.state.func](e.state.funarg);
|
||||
}
|
||||
} else {
|
||||
document.title = "SEA "+ clientTitle;
|
||||
for (var s=0; s<MAXBLOCK; s++) {
|
||||
swiper[s].slideTo(defaultSlidePos(s));
|
||||
}
|
||||
}
|
||||
})
|
||||
// if (location.hash) {
|
||||
// console.log("hash in url", location.hash);
|
||||
// initSlides = location.hash.substring(1);
|
||||
// } else {
|
||||
// initSlides = "";
|
||||
// }
|
||||
// // Initialisation will be continued, when SSE-connection is established
|
||||
// // and id-message is obtained.
|
||||
// // (see also at SEAWebClientCommunication.js)
|
||||
// addEventListener("popstate", function (e) {
|
||||
// if (e.state) {
|
||||
// if (loadingShown) {
|
||||
// if (initSlides != e.state.funarg) {
|
||||
// console.log("hash mismatch", initSlides, e.state.funarg);
|
||||
// initSlides = e.state.funarg;
|
||||
// }
|
||||
// } else {
|
||||
// console.log("popstate", e.state.func, e.state.funarg);
|
||||
// window[e.state.func](e.state.funarg);
|
||||
// }
|
||||
// } else {
|
||||
// document.title = "SEA "+ clientTitle;
|
||||
// for (var s=0; s<MAXBLOCK; s++) {
|
||||
// swiper[s].slideTo(defaultSlidePos(s));
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
};
|
||||
|
||||
function toggleHeader() {
|
||||
if (debug_main_daniel) {
|
||||
console.log("%cfunction: toggleHeader", "color:white;background:limegreen");
|
||||
}
|
||||
|
||||
// Show and hide box showing name of the current device ('see also
|
||||
// SEAWebClient.html')
|
||||
|
||||
|
Reference in New Issue
Block a user