From 034687163faf44686eda4a54c108be509deb49cd Mon Sep 17 00:00:00 2001 From: Ruslan Gainutdinov Date: Sun, 17 May 2020 21:59:00 +0300 Subject: [PATCH] Fix dynamic replacements for other pages --- tools/cdata.js | 29 +++++++++++++++-- wled00/data/dmxmap.htm | 2 +- wled00/data/msg.htm | 60 ++++++++++++------------------------ wled00/data/settings.htm | 27 +++++----------- wled00/data/settings_dmx.htm | 1 + wled00/data/style.css | 2 +- wled00/data/update.htm | 45 +++++++++++++++++++++++++-- wled00/html_other.h | 37 ++++++---------------- wled00/html_settings.h | 32 +++++++++---------- 9 files changed, 124 insertions(+), 111 deletions(-) diff --git a/tools/cdata.js b/tools/cdata.js index 849415c0..afcebcf9 100644 --- a/tools/cdata.js +++ b/tools/cdata.js @@ -175,6 +175,10 @@ writeChunks( str .replace(/\/gms, "") .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace( + /function GetV().*\<\/script\>/gms, + "function GetV() {var d=document;\n" + ) }, { file: "settings_leds.htm", @@ -187,6 +191,10 @@ writeChunks( str .replace(/\/gms, "") .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace( + /function GetV().*\<\/script\>/gms, + "function GetV() {var d=document;\n" + ) }, { file: "settings_dmx.htm", @@ -198,7 +206,11 @@ writeChunks( mangle: str => { const nocss = str .replace(/\/gms, "") - .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%"); + .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace( + /function GetV().*\<\/script\>/gms, + "function GetV() {var d=document;\n" + ); return ` #ifdef WLED_ENABLE_DMX ${nocss} @@ -219,6 +231,10 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; str .replace(/\/gms, "") .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace( + /function GetV().*\<\/script\>/gms, + "function GetV() {var d=document;\n" + ) }, { file: "settings_sync.htm", @@ -231,6 +247,7 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; str .replace(/\/gms, "") .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace(/function GetV().*\<\/script\>/gms, "function GetV() {\n") }, { file: "settings_time.htm", @@ -243,6 +260,7 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; str .replace(/\/gms, "") .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace(/function GetV().*\<\/script\>/gms, "function GetV() {\n") }, { file: "settings_sec.htm", @@ -255,6 +273,10 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; str .replace(/\/gms, "") .replace(/\.*\<\/style\>/gms, "%CSS%%SCSS%") + .replace( + /function GetV().*\<\/script\>/gms, + "function GetV() {var d=document;\n" + ) } ], "wled00/html_settings.h" @@ -277,7 +299,8 @@ writeChunks( prepend: "=====(", append: ")=====", method: "plaintext", - filter: "html-minify" + filter: "html-minify", + mangle: str => str.replace(/\.*\<\/body\>/gms, "

%MSG%") }, { file: "dmxmap.htm", @@ -288,7 +311,7 @@ writeChunks( filter: "html-minify", mangle: str => ` #ifdef WLED_ENABLE_DMX -${str} +${str.replace(/function FM\(\)[ ]?\{/gms, "function FM() {%DMXVARS%\n")} #else const char PAGE_dmxmap[] PROGMEM = R"=====()====="; #endif diff --git a/wled00/data/dmxmap.htm b/wled00/data/dmxmap.htm index 816c5da1..23e056cb 100644 --- a/wled00/data/dmxmap.htm +++ b/wled00/data/dmxmap.htm @@ -1,7 +1,7 @@ DMX Map - + + -

Sample message.

-Sample detail. +

Sample Message.

+ Sample Detail. - - \ No newline at end of file + + \ No newline at end of file diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index b4f981e5..425c3295 100644 --- a/wled00/data/settings.htm +++ b/wled00/data/settings.htm @@ -3,34 +3,23 @@ WLED Settings -

WLED Software Update

Installed version: 0.8.5-dev
Download the latest binary:

\ No newline at end of file + + + + + WLED Update + + + + + +

WLED Software Update

Installed version: 0.10.0
Download the latest binary:
+

+ + + \ No newline at end of file diff --git a/wled00/html_other.h b/wled00/html_other.h index 97b11a32..6f094c32 100644 --- a/wled00/html_other.h +++ b/wled00/html_other.h @@ -8,8 +8,8 @@ const char PAGE_msg[] PROGMEM = R"=====(WLED Message

Sample message.

Sample detail.)====="; +.bt{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;display:inline-block;font-size:20px;margin:8px;margin-top:12px}body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%%;margin:0} +

%MSG%)====="; #ifdef WLED_ENABLE_DMX @@ -17,28 +17,9 @@ function B(){window.history.back()}function RS(){window.location="/settings"}fun // Autogenerated from wled00/data/dmxmap.htm, do not edit!! const char PAGE_dmxmap[] PROGMEM = R"=====( DMX Map
...
)====="; @@ -49,11 +30,11 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()====="; // Autogenerated from wled00/data/update.htm, do not edit!! const char PAGE_update[] PROGMEM = R"=====( -WLED Message +WLED Update

WLED Software Update

Installed version: 0.8.5-dev -
Download the latest binary:

WLED Software Update

Installed version: 0.10.0
+Download the latest binary:

diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 9d6542c3..6e6a408e 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -1,12 +1,12 @@ // Autogenerated from wled00/data/style.css, do not edit!! -const char PAGE_settingsCss[] PROGMEM = R"=====()====="; +const char PAGE_settingsCss[] PROGMEM = R"=====()====="; // Autogenerated from wled00/data/settings.htm, do not edit!! const char PAGE_settings[] PROGMEM = R"=====(WLED Settings
WiFi Settings%CSS%%SCSS% +function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#wifi-settings")}function B(){window.open("/settings","_self")}function GetV() {var d=document; +%CSS%%SCSS%

WiFi setup

Connect to existing network

@@ -58,8 +58,8 @@ type="button" onclick="B()">Back

LED setup

LED count: Back
// Autogenerated from wled00/data/settings_dmx.htm, do not edit!! const char PAGE_settings_dmx[] PROGMEM = R"=====(DMX Settings
+function GCH(n){for(d=document,d.getElementById("dmxchannels").innerHTML+="",i=0;iChannel "+(i+1)+":
\n'}function mMap(){for(d=document,numCh=document.Sf.CN.value,numGap=document.Sf.CG.value,parseInt(numCh)>parseInt(numGap)?d.getElementById("gapwarning").style.display="block":d.getElementById("gapwarning").style.display="none",i=0;i<15;i++)i>=numCh?(d.getElementById("CH"+(i+1)+"s").style.opacity="0.5",d.getElementById("CH"+(i+1)).disabled=!0):(d.getElementById("CH"+(i+1)+"s").style.opacity="1",d.getElementById("CH"+(i+1)).disabled=!1)}function S(){GCH(15),GetV(),mMap()}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/DMX")}function B(){window.history.back()}function GetV() {var d=document; +

Imma firin ma lazer (if it has DMX support)

@@ -154,8 +154,8 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; // Autogenerated from wled00/data/settings_ui.htm, do not edit!! const char PAGE_settings_ui[] PROGMEM = R"=====( UI Settings%CSS%%SCSS%

Web Setup

Server description:
@@ -167,8 +167,8 @@ Save)====="; // Autogenerated from wled00/data/settings_sync.htm, do not edit!! const char PAGE_settings_sync[] PROGMEM = R"=====(Sync Settings%CSS%%SCSS%

Sync setup

Button setup

On/Off button enabled: Save)====="; // Autogenerated from wled00/data/settings_time.htm, do not edit!! const char PAGE_settings_time[] PROGMEM = R"=====( Time Settings%CSS%%SCSS%
',j=1;j<8;j++)t+='';gId("TMT").innerHTML=t}function FC(){for(j=0;j<8;j++)for(i=0;i<8;i++)gId("W"+i+j).checked=gId("W"+i).value>>j&1}function Wd(){for(a=[0,0,0,0,0,0,0,0],i=0;i<8;i++){for(m=1,j=0;j<8;j++)a[i]+=gId("W"+i+j).checked*m,m*=2;gId("W"+i).value=a[i]}}function GetV() { +%CSS%%SCSS%

Time setup

Get time from NTP server: @@ -303,8 +303,8 @@ required>
Time-Controlled Macros:
Misc Settings%CSS%%SCSS% +function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#security-settings")}function B(){window.open("/settings","_self")}function U(){window.open("/update","_self")}function GetV() {var d=document; +%CSS%%SCSS%

Security & Update setup