Swiper removed

- Swiper removal work in progress
+ Fine debugging for every js-file
This commit is contained in:
Daniel
2025-03-17 11:07:50 +01:00
parent 680434e5e8
commit ca2945ac22
8 changed files with 419 additions and 156 deletions

View File

@ -1,37 +1,52 @@
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// % GROUP
// local debugging: print the name of every executed funtion to the console
var debug_group_daniel = 0;
var writePermissionTimeout; // Sets writePermission to 'false, restarts by
// user-interaction.
var prompt = false // True while a prompt is opened.
function getGroup(s, name) {
var found = false;
if (name == "") {
swiper[s].slideTo(defaultSlidePos(s));
return;
if (debug_group_daniel) {
console.log("%cfunction: getGroup", "color:white;background:salmon");
}
for (var i = 0; i < swiper[s].slides.length; i++) {
var slideType = swiper[s].slides[i].slideType;
if (slideType == name) {
found = true;
swiper[s].slideTo(i);
}
}
if (!found && name != "console" && name != "graphics") {
// var found = false;
// if (name == "") {
// swiper[s].slideTo(defaultSlidePos(s));
// return;
// }
// for (var i = 0; i < swiper[s].slides.length; i++) {
// var slideType = swiper[s].slides[i].slideType;
// if (slideType == name) {
// found = true;
// swiper[s].slideTo(i);
// }
// }
// if (!found && name != "console" && name != "graphics") {
// Server-request for group.
reqJSON(s, "http://" + hostPort + "/getblock?path=" + name
+ "&id=" + clientID, successHandler, errorHandler);
}
// }
}
function sendCommand(s, command) {
if (debug_group_daniel) {
console.log("%cfunction: sendCommand", "color:white;background:salmon");
}
reqJSON(s, "http://" + hostPort + "/sendcommand?command=" + encodeURIComponent(command)
+ "&id=" + clientID, successHandler, errorHandler);
}
function createContent(s, message) {
if (debug_group_daniel) {
console.log("%cfunction: createContent", "color:white;background:salmon");
}
// Depending on the message received from the server the content of the
// group is created dynamically. Handles draw-message.
@ -52,6 +67,10 @@ function createContent(s, message) {
}
function gotoGroups(slideNames) {
if (debug_group_daniel) {
console.log("%cfunction: gotoGroups", "color:white;background:salmon");
}
slideNames = slideNames.split("%20");
var l = Math.min(MAXBLOCK,slideNames.length);
document.title = "SEA "+ clientTitle + " " + slideNames.join(" ");
@ -61,7 +80,12 @@ function gotoGroups(slideNames) {
}
function create_group_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_group_row", "color:white;background:salmon");
}
// Creates row-element containing link.
var title = component.title;
var row = document.createElement('row');
@ -87,6 +111,10 @@ function create_group_row(s, component) {
}
function create_rdonly_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_rdonly_row", "color:white;background:salmon");
}
// Creates row-element containing link AND read-only-item.
var link = component.link;
@ -119,7 +147,12 @@ function create_rdonly_row(s, component) {
}
function create_rdlink_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_rdlink_row", "color:white;background:salmon");
}
// Creates row-element containing link AND read-only-item.
var name = component.name;
var left = createTitle(component);
@ -134,6 +167,10 @@ function create_rdlink_row(s, component) {
}
function create_pushbutton_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_pushbutton_row", "color:white;background:salmon");
}
// Creates row-element containing a push button
var name = component.name;
@ -181,6 +218,10 @@ function create_pushbutton_row(s, component) {
}
function create_input_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_input_row", "color:white;background:salmon");
}
// Creates row-element containing input-item.
var name = component.name;
@ -304,12 +345,20 @@ function create_input_row(s, component) {
}
function posTextfield(s, left) {
if (debug_group_daniel) {
console.log("%cfunction: posTextfield", "color:white;background:salmon");
}
var content = swiper[s].slides[swiper[s].activeIndex].childNodes[1];
var row = left.parentNode;
content.scrollTop = row.offsetTop - 30;
}
function resizeTextfield(input) {
if (debug_group_daniel) {
console.log("%cfunction: resizeTextfield", "color:white;background:salmon");
}
if (input.value.length > input.size * 12 / 20) {
var str0 = window.getComputedStyle(input).fontSize;
var str1 = str0.substring(0, str0.length - 2);
@ -322,7 +371,12 @@ function resizeTextfield(input) {
}
function create_checkbox_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_checkbox_row", "color:white;background:salmon");
}
// Creates row-element containing checkbox-item
var command = component.command;
var left = createTitle(component);
@ -392,7 +446,12 @@ function create_checkbox_row(s, component) {
}
function create_enum_row(s, component) {
if (debug_group_daniel) {
console.log("%cfunction: create_enum_row", "color:white;background:salmon");
}
// Creates row-element containing dropdown-selection.
var name = component.name;
var command = component.command;
var buttons = component.enum_names;
@ -449,6 +508,10 @@ function create_enum_row(s, component) {
}
function createTitle(component) {
if (debug_group_daniel) {
console.log("%cfunction: createTitle", "color:white;background:salmon");
}
// Creates left side of row-tag containing title. Title may hold additional
// information, which is shown, when title-tag is clicked.
@ -474,6 +537,10 @@ function createTitle(component) {
}
function createParElement(component, tag='span', cls='col-right') {
if (debug_group_daniel) {
console.log("%cfunction: createParElement", "color:white;background:salmon");
}
var right = document.createElement(tag);
if (cls)
right.classList.add(cls);
@ -484,6 +551,10 @@ function createParElement(component, tag='span', cls='col-right') {
}
function createInfo(component) {
if (debug_group_daniel) {
console.log("%cfunction: createInfo", "color:white;background:salmon");
}
// Creates info-box, which isn't visible by default but can be displayed.
var infoBox = document.createElement('div');
@ -498,6 +569,10 @@ function createInfo(component) {
}
function appendToContent(component, left, right) {
if (debug_group_daniel) {
console.log("%cfunction: appendToContent", "color:white;background:salmon");
}
// Creates row-tag containing infoBox (not visible by default), left side
// (span) and right side (span).