mirror of
https://github.com/wled/WLED.git
synced 2025-07-09 20:06:33 +00:00
Remove old simplifiedUI code and update cdata.js
This commit is contained in:
parent
a3dd6ce891
commit
3ee3b97255
@ -219,36 +219,10 @@ function writeChunks(srcDir, specs, resultFile) {
|
||||
}
|
||||
|
||||
writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h", 'index');
|
||||
writeHtmlGzipped("wled00/data/simple.htm", "wled00/html_simple.h", 'simple');
|
||||
writeHtmlGzipped("wled00/data/pixart/pixart.htm", "wled00/html_pixart.h", 'pixart');
|
||||
writeHtmlGzipped("wled00/data/cpal/cpal.htm", "wled00/html_cpal.h", 'cpal');
|
||||
writeHtmlGzipped("wled00/data/pxmagic/pxmagic.htm", "wled00/html_pxmagic.h", 'pxmagic');
|
||||
/*
|
||||
writeChunks(
|
||||
"wled00/data",
|
||||
[
|
||||
{
|
||||
file: "simple.css",
|
||||
name: "PAGE_simpleCss",
|
||||
method: "gzip",
|
||||
filter: "css-minify",
|
||||
},
|
||||
{
|
||||
file: "simple.js",
|
||||
name: "PAGE_simpleJs",
|
||||
method: "gzip",
|
||||
filter: "js-minify",
|
||||
},
|
||||
{
|
||||
file: "simple.htm",
|
||||
name: "PAGE_simple",
|
||||
method: "gzip",
|
||||
filter: "html-minify-ui",
|
||||
}
|
||||
],
|
||||
"wled00/html_simplex.h"
|
||||
);
|
||||
*/
|
||||
|
||||
writeChunks(
|
||||
"wled00/data",
|
||||
[
|
||||
|
@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<script src="simple.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,104 +0,0 @@
|
||||
/*
|
||||
This file creates the simple UI by fetching the default UI and modifying it.
|
||||
*/
|
||||
|
||||
var loc = false, locip, locproto = "http:";
|
||||
if (window.location.protocol == "file:") {
|
||||
loc = true;
|
||||
locip = localStorage.getItem('locIp');
|
||||
if (!locip) {
|
||||
locip = prompt("File Mode. Please enter WLED IP!");
|
||||
localStorage.setItem('locIp', locip);
|
||||
}
|
||||
} else {
|
||||
// detect reverse proxy
|
||||
let paths = window.location.pathname.slice(1, window.location.pathname.endsWith('/') ? -1 : undefined).split("/");
|
||||
if (paths.length > 2) {
|
||||
locproto = window.location.protocol;
|
||||
loc = true;
|
||||
locip = window.location.hostname + (window.location.port ? ":" + window.location.port : "") + "/" + paths[0];
|
||||
}
|
||||
}
|
||||
|
||||
function getURL(path) {
|
||||
return (loc ? locproto + "//" + locip : "") + path;
|
||||
}
|
||||
|
||||
// fetch default UI and modify it
|
||||
fetch(getURL("/index.htm"))
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
let parser = new DOMParser();
|
||||
let doc = parser.parseFromString(data, 'text/html');
|
||||
// patch simple ui
|
||||
simplifyUI(doc);
|
||||
|
||||
// copy page to current page
|
||||
document.documentElement.innerHTML = doc.documentElement.innerHTML;
|
||||
|
||||
// execute scripts in page
|
||||
let scripts = document.querySelectorAll('script');
|
||||
scripts.forEach(script => {
|
||||
// create new script element
|
||||
let newScript = document.createElement('script');
|
||||
// copy attributes
|
||||
for (let i = 0; i < script.attributes.length; i++) {
|
||||
newScript.setAttribute(script.attributes[i].name, script.attributes[i].value);
|
||||
}
|
||||
// copy content
|
||||
newScript.innerHTML = script.innerHTML;
|
||||
// replace script
|
||||
script.parentNode.replaceChild(newScript, script);
|
||||
});
|
||||
finalizeSimpleUI();
|
||||
})
|
||||
.catch(error => console.error('Error:', error));
|
||||
|
||||
// Transforms the default UI into the simple UI
|
||||
function simplifyUI(doc) {
|
||||
function gId(id) {
|
||||
return doc.getElementById(id);
|
||||
}
|
||||
|
||||
// Disable PC Mode as it does not exist in simple UI
|
||||
localStorage.setItem("pcm", "false");
|
||||
|
||||
// Put effects below palett list
|
||||
gId("Colors").innerHTML += gId("Effects").innerHTML;
|
||||
// Put preset quick load before palette list
|
||||
gId("Colors").insertBefore(gId("pql"), gId("pall"));
|
||||
|
||||
// Hide buttons in top bar
|
||||
gId("buttonNl").style.display = "none";
|
||||
gId("buttonSync").style.display = "none";
|
||||
gId("buttonSr").style.display = "none";
|
||||
gId("buttonPcm").style.display = "none";
|
||||
|
||||
// Hide bottom bar
|
||||
gId("bot").style.display = "none";
|
||||
doc.documentElement.style.setProperty('--bh', '0px');
|
||||
|
||||
// Hide other tabs
|
||||
gId("Effects").style.display = "none";
|
||||
gId("Segments").style.display = "none";
|
||||
gId("Presets").style.display = "none";
|
||||
|
||||
// Chage height of palette list
|
||||
gId("pallist").style.height = "300px";
|
||||
gId("pallist").style.overflow = "scroll";
|
||||
// fix shadow
|
||||
gId("pallist").style.margin = "0px -16px";
|
||||
gId("pallist").style.padding = "0px 16px";
|
||||
|
||||
// Hide filter options
|
||||
gId("filters").style.display = "none";
|
||||
}
|
||||
|
||||
// Called when simple UI is ready
|
||||
function finalizeSimpleUI() {
|
||||
// disable horizontal scrolling
|
||||
simpleUI = true;
|
||||
// set correct position of selected and sticky palette
|
||||
Array.from(document.styleSheets[0].cssRules).find(rule => rule.selectorText == "#pallist .lstI.sticky").style.top = "0px";
|
||||
Array.from(document.styleSheets[0].cssRules).find(rule => rule.selectorText == "#pallist .lstI.selected").style.top = "42px";
|
||||
}
|
1141
wled00/html_simple.h
1141
wled00/html_simple.h
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user