Skip to content

Commit 8803684

Browse files
committed
- Enkele files naar andere folders verplaatst
- Een nieuwe class om helper tips af te beelden en een storage class zodat deze slechts 1x worden getoond - Nieuwe documentatie rond het situatieschema
1 parent 83fa81b commit 8803684

File tree

10 files changed

+471
-7
lines changed

10 files changed

+471
-7
lines changed

Documentation/sitplandoc.pdf

252 KB
Binary file not shown.

builddate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var CONF_builddate="20250125-140438"
1+
var CONF_builddate="20250125-215345"

eendraadschema.js

Lines changed: 214 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
5454
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
5555
}
5656
};
57+
var __assign = (this && this.__assign) || function () {
58+
__assign = Object.assign || function(t) {
59+
for (var s, i = 1, n = arguments.length; i < n; i++) {
60+
s = arguments[i];
61+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
62+
t[p] = s[p];
63+
}
64+
return t;
65+
};
66+
return __assign.apply(this, arguments);
67+
};
5768
var __extends = (this && this.__extends) || (function () {
5869
var extendStatics = function (d, b) {
5970
extendStatics = Object.setPrototypeOf ||
@@ -1735,16 +1746,117 @@ var TopMenu = /** @class */ (function () {
17351746
};
17361747
return TopMenu;
17371748
}());
1749+
var HelperTip = /** @class */ (function () {
1750+
function HelperTip(storage, storagePrefix) {
1751+
if (storagePrefix === void 0) { storagePrefix = 'helpertip'; }
1752+
this.storage = storage;
1753+
this.storagePrefix = storagePrefix;
1754+
}
1755+
// Show the helper tip if it hasn't been dismissed before
1756+
HelperTip.prototype.show = function (key, htmlContent) {
1757+
var _this = this;
1758+
var neverDisplayKey = "".concat(this.storagePrefix, ".").concat(key, ".neverDisplay");
1759+
var displayedInThisSessionKey = "".concat(this.storagePrefix, ".").concat(key, ".displayedInThisSession");
1760+
// Check if the tip was dismissed before
1761+
if ((this.storage.get(neverDisplayKey) === true) || (this.storage.get(displayedInThisSessionKey) === true)) {
1762+
return; // Do nothing if the tip was dismissed or already shown
1763+
}
1764+
// Create the popup
1765+
var popupOverlay = document.createElement('div');
1766+
popupOverlay.id = 'popupOverlay';
1767+
popupOverlay.style.position = 'fixed';
1768+
popupOverlay.style.top = '0';
1769+
popupOverlay.style.left = '0';
1770+
popupOverlay.style.width = '100%';
1771+
popupOverlay.style.height = '100%';
1772+
popupOverlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
1773+
popupOverlay.style.display = 'flex';
1774+
popupOverlay.style.justifyContent = 'center';
1775+
popupOverlay.style.alignItems = 'center';
1776+
popupOverlay.style.visibility = 'hidden';
1777+
popupOverlay.style.zIndex = '9999';
1778+
var popup = document.createElement('div');
1779+
popup.style.position = 'fixed';
1780+
popup.style.top = '50%';
1781+
popup.style.left = '50%';
1782+
popup.style.transform = 'translate(-50%, -50%)';
1783+
popup.style.backgroundColor = 'white';
1784+
popup.style.padding = '5px 20px 20px';
1785+
popup.style.border = '1px solid #ccc';
1786+
popup.style.borderRadius = '8px';
1787+
popup.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
1788+
popup.style.zIndex = '1000';
1789+
// Add the HTML content
1790+
popup.innerHTML = htmlContent;
1791+
// Style the title
1792+
var title = popup.querySelector('h3');
1793+
if (title) {
1794+
title.style.color = '#06F'; // Similar blue as the OK button
1795+
}
1796+
// Create the "Never display again" checkbox
1797+
var checkboxLabel = document.createElement('label');
1798+
checkboxLabel.style.display = 'block';
1799+
checkboxLabel.style.marginTop = '10px';
1800+
var checkbox = document.createElement('input');
1801+
checkbox.type = 'checkbox';
1802+
checkboxLabel.appendChild(checkbox);
1803+
var checkboxText = document.createTextNode(' Deze tekst niet meer weergeven');
1804+
var italicText = document.createElement('i');
1805+
italicText.appendChild(checkboxText);
1806+
checkboxLabel.appendChild(italicText);
1807+
popup.appendChild(checkboxLabel);
1808+
// Create the "OK" button
1809+
var okButton = document.createElement('button');
1810+
okButton.textContent = 'OK';
1811+
okButton.style.marginTop = '10px';
1812+
okButton.style.padding = '10px 20px';
1813+
okButton.style.cursor = 'pointer';
1814+
okButton.style.backgroundColor = '#3399FF'; // Lighter blue hue
1815+
okButton.style.color = 'white';
1816+
okButton.style.border = 'none';
1817+
okButton.style.borderRadius = '5px'; // Rounded corners
1818+
okButton.style.display = 'block';
1819+
okButton.style.marginLeft = 'auto';
1820+
okButton.style.marginRight = 'auto';
1821+
okButton.style.width = '100px'; // Wider button
1822+
// Add hover effect
1823+
okButton.addEventListener('mouseover', function () {
1824+
okButton.style.backgroundColor = '#06F'; // Darker blue on hover
1825+
});
1826+
okButton.addEventListener('mouseout', function () {
1827+
okButton.style.backgroundColor = '#3399FF'; // Lighter blue when not hovering
1828+
});
1829+
okButton.addEventListener('click', function () {
1830+
// Set the neverdisplay flag if the checkbox is checked
1831+
_this.storage.set(displayedInThisSessionKey, true, true);
1832+
if (checkbox.checked) {
1833+
_this.storage.set(neverDisplayKey, true);
1834+
}
1835+
// Remove the popup
1836+
document.body.removeChild(popupOverlay);
1837+
document.body.style.pointerEvents = 'auto';
1838+
});
1839+
popup.appendChild(okButton);
1840+
// Add the popup to the document body
1841+
popupOverlay.appendChild(popup);
1842+
document.body.appendChild(popupOverlay);
1843+
popupOverlay.style.visibility = 'visible';
1844+
document.body.style.pointerEvents = 'none'; // Disable interactions with the background
1845+
popupOverlay.style.pointerEvents = 'auto'; // Enable interactions with the popup
1846+
};
1847+
return HelperTip;
1848+
}());
17381849
/* FUNCTION showFilePage
17391850

17401851
Shows the Documentation-Page.
17411852

17421853
*/
17431854
function showDocumentationPage() {
1744-
var strleft = "\n <table border=\"1px\" style=\"border-collapse:collapse\" align=\"center\" width=\"100%\">\n <tr>\n <td width=\"100%\" align=\"center\" bgcolor=\"LightGrey\">\n <b>Handleiding</b>\n </td>\n </tr>\n <tr>\n <td width=\"100%\" align=\"left\">\n <table border=0>\n <tr>\n <td width=100 style=\"vertical-align:top;padding:5px\">\n <button style=\"font-size:14px\" id=\"Btn_downloadManual\">Download</button>\n </td>\n <td style=\"vertical-align:top;padding:7px\">\n Een volledige handleiding is beschikbaar in PDF formaat.\n Click link op \"Download\" om deze in een ander venster te openen.\n <br>\n Het programma is in volle ontwikkeling dus delen van de handleiding zijn\n mogelijk ietwat verouderd. \n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>";
1855+
var strleft = "\n <table border=\"1px\" style=\"border-collapse:collapse\" align=\"center\" width=\"100%\">\n <tr>\n <td width=\"100%\" align=\"center\" bgcolor=\"LightGrey\">\n <b>Handleiding</b>\n </td>\n </tr>\n <tr>\n <td width=\"100%\" align=\"left\">\n <table border=0>\n <tr>\n <td width=100 style=\"vertical-align:top;padding:5px\">\n <button style=\"font-size:14px\" id=\"Btn_downloadManual\">E\u00E9ndraadschema</button>\n </td>\n <td style=\"vertical-align:top;padding:7px\">\n Een volledige handleiding is beschikbaar in PDF formaat.\n Klik links om deze in een ander venster te openen.\n <br>\n Het programma is in volle ontwikkeling dus delen van de handleiding zijn\n mogelijk ietwat verouderd. \n </td>\n </tr>\n <tr>\n <td width=100 style=\"vertical-align:top;padding:5px\">\n <button style=\"font-size:14px\" id=\"Btn_downloadSitPlanManual\">Situatieschema</button>\n </td>\n <td style=\"vertical-align:top;padding:7px\">\n Specifiek voor het werken met het situatieschema werd een ander korter document opgesteld.\n Klik link om deze in een ander venster te openen.\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>";
17451856
document.getElementById("configsection").innerHTML = strleft;
17461857
toggleAppView('config');
17471858
document.getElementById('Btn_downloadManual').onclick = function () { window.open('Documentation/edsdoc.pdf', '_blank'); };
1859+
document.getElementById('Btn_downloadSitPlanManual').onclick = function () { window.open('Documentation/sitplandoc.pdf', '_blank'); };
17481860
}
17491861
/**
17501862
* Class gebruikt in SituationPlanView om te zoeken naar electroitems op basis van de kringnaam.
@@ -3257,6 +3369,9 @@ function showSituationPlanPage() {
32573369
}
32583370
;
32593371
structure.sitplanview.redraw();
3372+
// Initialize the HelperTip with the storage
3373+
var helperTip = new HelperTip(appDocStorage);
3374+
helperTip.show('sitplan.introductie', "<h3>Situatieschema</h3>\n <p>Op deze pagina kan u een situatieschema tekenen</p>\n <p>Laad een plattegrond met de knop \"Uit bestand\" en voeg symbolen toe met de knop \"Uit schema\".</p>\n <p>Klik <a href=\"Documentation/sitplandoc.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">hier</a> om in een nieuw venster de documentatie te bekijken.</p>\n <p>Het situatieschema werd recent toegevoegd aan het programma en zal nog verder ontwikkeld worden over de komende weken. Opmerkingen zijn welkom in het \"contact\"-formulier.</p>");
32603375
}
32613376
/**
32623377
* Een serie functies om een formulier te tonen met edit-functionaliteiten voor symbolen in het situatieplan
@@ -3617,6 +3732,103 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement, callbackOK) {
36173732
document.body.appendChild(div);
36183733
showPopup();
36193734
}
3735+
var MultiLevelStorage = /** @class */ (function () {
3736+
function MultiLevelStorage(storageKey, initialData) {
3737+
this.storageKey = storageKey;
3738+
// Load data from storage or initialize with default data
3739+
this.data = this.loadFromStorage() || deepClone(initialData);
3740+
this.memoryData = deepClone(initialData);
3741+
}
3742+
// Load data from localStorage
3743+
MultiLevelStorage.prototype.loadFromStorage = function () {
3744+
var storedData = localStorage.getItem(this.storageKey);
3745+
return storedData ? JSON.parse(storedData) : null;
3746+
};
3747+
// Save data to localStorage
3748+
MultiLevelStorage.prototype.saveToStorage = function () {
3749+
localStorage.setItem(this.storageKey, JSON.stringify(this.data));
3750+
};
3751+
// Get a value at a specific path (e.g., "user.profile.name")
3752+
MultiLevelStorage.prototype.get = function (path) {
3753+
var keys = path.split('.');
3754+
var current = this.memoryData;
3755+
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
3756+
var key = keys_1[_i];
3757+
if (current && typeof current === 'object' && key in current) {
3758+
current = current[key];
3759+
}
3760+
else {
3761+
current = undefined;
3762+
break;
3763+
}
3764+
}
3765+
if (current !== undefined) {
3766+
return current;
3767+
}
3768+
current = this.data;
3769+
for (var _a = 0, keys_2 = keys; _a < keys_2.length; _a++) {
3770+
var key = keys_2[_a];
3771+
if (current && typeof current === 'object' && key in current) {
3772+
current = current[key];
3773+
}
3774+
else {
3775+
return undefined; // Path not found
3776+
}
3777+
}
3778+
return current;
3779+
};
3780+
// Set a value at a specific path (e.g., "user.profile.name", "John Doe")
3781+
MultiLevelStorage.prototype.set = function (path, value, inMemory) {
3782+
if (inMemory === void 0) { inMemory = false; }
3783+
var keys = path.split('.');
3784+
var current = inMemory ? this.memoryData : this.data;
3785+
for (var i = 0; i < keys.length - 1; i++) {
3786+
var key = keys[i];
3787+
if (!current[key] || typeof current[key] !== 'object') {
3788+
current[key] = {}; // Create nested objects if they don't exist
3789+
}
3790+
current = current[key];
3791+
}
3792+
current[keys[keys.length - 1]] = value; // Set the value at the final key
3793+
if (!inMemory) {
3794+
this.saveToStorage(); // Save updated data to storage
3795+
}
3796+
};
3797+
// Delete a node at a specific path (e.g., "user.profile.name")
3798+
MultiLevelStorage.prototype.delete = function (path) {
3799+
var keys = path.split('.');
3800+
var current = this.memoryData;
3801+
for (var i = 0; i < keys.length - 1; i++) {
3802+
var key = keys[i];
3803+
if (!current[key] || typeof current[key] !== 'object') {
3804+
break; // Path not found, nothing to delete
3805+
}
3806+
current = current[key];
3807+
}
3808+
delete current[keys[keys.length - 1]]; // Delete the key
3809+
current = this.data;
3810+
for (var i = 0; i < keys.length - 1; i++) {
3811+
var key = keys[i];
3812+
if (!current[key] || typeof current[key] !== 'object') {
3813+
return; // Path not found, nothing to delete
3814+
}
3815+
current = current[key];
3816+
}
3817+
delete current[keys[keys.length - 1]]; // Delete the key
3818+
this.saveToStorage(); // Save updated data to storage
3819+
};
3820+
// Get the entire data object
3821+
MultiLevelStorage.prototype.getAll = function () {
3822+
return __assign(__assign({}, this.data), this.memoryData);
3823+
};
3824+
// Clear the entire data and storage
3825+
MultiLevelStorage.prototype.clear = function () {
3826+
this.data = {};
3827+
this.memoryData = {};
3828+
localStorage.removeItem(this.storageKey);
3829+
};
3830+
return MultiLevelStorage;
3831+
}());
36203832
var List_Item = /** @class */ (function () {
36213833
// -- Constructor --
36223834
function List_Item(mylist) {
@@ -9729,6 +9941,7 @@ var CONF_upload_OK = "ask"; //can be "ask", "yes", "no"; //before uploading, we
97299941
var session = new Session();
97309942
var structure;
97319943
var undostruct = new undoRedo(100);
9944+
var appDocStorage = new MultiLevelStorage('appDocStorage', {});
97329945
// Build the menu
97339946
var menuItems;
97349947
if (isDevMode()) {

src/documentation/HelperTip.ts

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
class HelperTip {
2+
private storage: MultiLevelStorage<any>;
3+
private storagePrefix: string;
4+
5+
constructor(storage: MultiLevelStorage<any>, storagePrefix: string = 'helpertip') {
6+
this.storage = storage;
7+
this.storagePrefix = storagePrefix;
8+
}
9+
10+
// Show the helper tip if it hasn't been dismissed before
11+
show(key: string, htmlContent: string): void {
12+
const neverDisplayKey = `${this.storagePrefix}.${key}.neverDisplay`;
13+
const displayedInThisSessionKey = `${this.storagePrefix}.${key}.displayedInThisSession`;
14+
15+
// Check if the tip was dismissed before
16+
if ( (this.storage.get(neverDisplayKey) === true) || (this.storage.get(displayedInThisSessionKey) === true) ) {
17+
return; // Do nothing if the tip was dismissed or already shown
18+
}
19+
20+
// Create the popup
21+
const popupOverlay = document.createElement('div');
22+
popupOverlay.id = 'popupOverlay';
23+
popupOverlay.style.position = 'fixed';
24+
popupOverlay.style.top = '0';
25+
popupOverlay.style.left = '0';
26+
popupOverlay.style.width = '100%';
27+
popupOverlay.style.height = '100%';
28+
popupOverlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
29+
popupOverlay.style.display = 'flex';
30+
popupOverlay.style.justifyContent = 'center';
31+
popupOverlay.style.alignItems = 'center';
32+
popupOverlay.style.visibility = 'hidden';
33+
popupOverlay.style.zIndex = '9999';
34+
35+
const popup = document.createElement('div');
36+
popup.style.position = 'fixed';
37+
popup.style.top = '50%';
38+
popup.style.left = '50%';
39+
popup.style.transform = 'translate(-50%, -50%)';
40+
popup.style.backgroundColor = 'white';
41+
popup.style.padding = '5px 20px 20px';
42+
popup.style.border = '1px solid #ccc';
43+
popup.style.borderRadius = '8px';
44+
popup.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
45+
popup.style.zIndex = '1000';
46+
47+
// Add the HTML content
48+
popup.innerHTML = htmlContent;
49+
50+
// Style the title
51+
const title = popup.querySelector('h3');
52+
if (title) {
53+
title.style.color = '#06F'; // Similar blue as the OK button
54+
}
55+
56+
// Create the "Never display again" checkbox
57+
const checkboxLabel = document.createElement('label');
58+
checkboxLabel.style.display = 'block';
59+
checkboxLabel.style.marginTop = '10px';
60+
61+
const checkbox = document.createElement('input');
62+
checkbox.type = 'checkbox';
63+
checkboxLabel.appendChild(checkbox);
64+
65+
const checkboxText = document.createTextNode(' Deze tekst niet meer weergeven');
66+
const italicText = document.createElement('i');
67+
italicText.appendChild(checkboxText);
68+
checkboxLabel.appendChild(italicText);
69+
70+
popup.appendChild(checkboxLabel);
71+
72+
// Create the "OK" button
73+
const okButton = document.createElement('button');
74+
okButton.textContent = 'OK';
75+
okButton.style.marginTop = '10px';
76+
okButton.style.padding = '10px 20px';
77+
okButton.style.cursor = 'pointer';
78+
okButton.style.backgroundColor = '#3399FF'; // Lighter blue hue
79+
okButton.style.color = 'white';
80+
okButton.style.border = 'none';
81+
okButton.style.borderRadius = '5px'; // Rounded corners
82+
okButton.style.display = 'block';
83+
okButton.style.marginLeft = 'auto';
84+
okButton.style.marginRight = 'auto';
85+
okButton.style.width = '100px'; // Wider button
86+
87+
// Add hover effect
88+
okButton.addEventListener('mouseover', () => {
89+
okButton.style.backgroundColor = '#06F'; // Darker blue on hover
90+
});
91+
okButton.addEventListener('mouseout', () => {
92+
okButton.style.backgroundColor = '#3399FF'; // Lighter blue when not hovering
93+
});
94+
95+
okButton.addEventListener('click', () => {
96+
// Set the neverdisplay flag if the checkbox is checked
97+
this.storage.set(displayedInThisSessionKey, true, true);
98+
if (checkbox.checked) {
99+
this.storage.set(neverDisplayKey, true);
100+
}
101+
// Remove the popup
102+
document.body.removeChild(popupOverlay);
103+
document.body.style.pointerEvents = 'auto';
104+
});
105+
106+
popup.appendChild(okButton);
107+
108+
// Add the popup to the document body
109+
popupOverlay.appendChild(popup);
110+
document.body.appendChild(popupOverlay);
111+
112+
popupOverlay.style.visibility = 'visible';
113+
document.body.style.pointerEvents = 'none'; // Disable interactions with the background
114+
popupOverlay.style.pointerEvents = 'auto'; // Enable interactions with the popup
115+
}
116+
}

0 commit comments

Comments
 (0)