Skip to content

Commit

Permalink
[mini] copied the favicon function = cut the size by 1kB+
Browse files Browse the repository at this point in the history
  • Loading branch information
Grovkillen committed Mar 7, 2020
1 parent 727057f commit c0c0582
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 181 deletions.
9 changes: 3 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//TODO: add git commit functionality for auto-release tag (https://github.com/rubenv/grunt-git)
/* GUIEasy Copyright (C) 2019-2020 Jimmy "Grovkillen" Westberg */

module.exports = function(grunt) {
// Project configuration.
Expand All @@ -22,14 +22,14 @@ module.exports = function(grunt) {
'src/gui_easy_curly_unit.js',
'src/gui_easy_curly_page.js',
'src/gui_easy_curly_icons.js',
'src/gui_easy_curly_forms.js',
'src/gui_easy_scrubber.js',
'src/gui_easy_popper.js',
'src/gui_easy_popper_rules.js',
'src/gui_easy_popper_extra.js',
'src/gui_easy_pitcher.js',
'src/gui_easy_butler.js',
'src/gui_easy_tender.js',
'src/gui_easy_ini.js'
'src/gui_easy_ini.js',
],
'build/temp/forms.min.js': [
'src/forms/gui_easy_forms.js',
Expand All @@ -41,9 +41,6 @@ module.exports = function(grunt) {
'src/dash/gui_easy_dash.js',
'src/dash/gui_easy_dash_d*.js'
],
'build/temp/patreon.min.js': [
'src/gui_easy_popper_extra.js'
],
'build/temp/mini.min.js': [
'src/index-minimal.js'
]
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ you may use the **noDash** version.
If you plan on contributing to the project you need to be able to compile stuff yourself in
order to bug test as close as release conditions as possible. What you need to do:

1. Install [Node.js](https://nodejs.org/en/download/), this will include [npm](https://www.npmjs.com/get-npm) which is what we use
to compile the project.
2. Install [Grunt.js](https://gruntjs.com/) + dependencies ([package.json](/package.json), run ``npm install`` from the project root level)
1. Install [Node.js](https://nodejs.org/en/download/), this will include [npm](https://www.npmjs.com/get-npm)
which is what we use to compile the project.
2. Install [Grunt.js](https://gruntjs.com/) + dependencies ([package.json](/package.json), run ``npm install``
from the project root level)
3. Install Grunt Command Line Interface using your terminal/cmd, and thanks to npm it's this easy:

```
Expand Down
1 change: 0 additions & 1 deletion build/0.1.nightly.5/gui.min.css

This file was deleted.

44 changes: 0 additions & 44 deletions build/0.1.nightly.5/info/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions build/0.1.nightly.5/info/release.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/0.1.nightly.5/info/source_files.json

This file was deleted.

Binary file removed build/0.1.nightly.5/main/index.htm.gz
Binary file not shown.
1 change: 0 additions & 1 deletion build/0.1.nightly.5/mini.min.css

This file was deleted.

Binary file removed build/0.1.nightly.5/mini/index.htm.gz
Binary file not shown.
Binary file removed build/0.1.nightly.5/noDash/index.htm.gz
Binary file not shown.
Binary file removed build/0.1.nightly.5/src-0.1.nightly.5.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gui-easy",
"timestamp": 1583578088039,
"timestamp": 1583609496335,
"version": "0.1.5",
"versionName": "0.1.nightly.5",
"author": "Jimmy 'Grovkillen' Westberg <jimmy@grovkillen.com> (https://grovkillen.com)",
Expand Down
6 changes: 6 additions & 0 deletions release.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
timestamp:1583609496335
major:0
minor:1
revision:5
rc:0
dev:true
77 changes: 1 addition & 76 deletions src/forms/gui_easy_forms_p002.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,80 +9,5 @@ guiEasy.forms.plugin.P002.category = "analog input";
guiEasy.forms.plugin.P002.state = "normal"; //normal, testing, development
//------------------------------- HTML or CURLY -------------------------------//
guiEasy.forms.plugin.P002.html = `
{{TOGGLE--configs-0--P002-1--oversampling is active|oversampling is disabled}}
<hr>
<div hidden id="task-_tasknumber_-y=kx+m">
<svg
id="task-_tasknumber_-y=kx+m-svg"
viewbox="0 0 500 100"
class="chart"
>
<g class="grid x-grid">
<line
x1="90"
x2="90"
y1="5"
y2="371"
></line>
</g>
<g class="grid y-grid">
<line
x1="90"
x2="705"
y1="370"
y2="370"
></line>
</g>
<g class="labels x-labels">
<text x="100" y="400">2008</text>
<text x="246" y="400">2009</text>
<text x="392" y="400">2010</text>
<text x="538" y="400">2011</text>
<text x="684" y="400">2012</text>
<text x="400" y="440" class="label-title">Year</text>
</g>
<g class="labels y-labels">
<text x="80" y="15">15</text>
<text x="80" y="131">10</text>
<text x="80" y="248">5</text>
<text x="80" y="373">0</text>
<text x="50" y="200" class="label-title">Price</text>
</g>
<polyline
id="task-_tasknumber_-y=kx+m-line"
fill="none"
stroke="#0074d9"
stroke-width="3"
points="
0,120
20,60
40,80
60,20
"
/>
<g class="data">
<circle cx="90" cy="192" r="4"></circle>
<circle cx="240" cy="141" r="4"></circle>
</g>
</svg>
</div>
<script defer>
let task_tasknumber_toggle = document.getElementById("task-_tasknumber_-P002-2");
let task_tasknumber_input1 = document.getElementById("task-_tasknumber_-P002-3");
let task_tasknumber_input2 = document.getElementById("task-_tasknumber_-P002-4");
let task_tasknumber_input3 = document.getElementById("task-_tasknumber_-P002-5");
let task_tasknumber_input4 = document.getElementById("task-_tasknumber_-P002-6");
let task_tasknumber_graph = document.getElementById("task-_tasknumber_-y=kx+m");
task_tasknumber_toggle.addEventListener("change", function() {
task_tasknumber_graph.hidden = task_tasknumber_toggle.checked;
})
function task_tasknumber_updateGraph() {
task_tasknumber_graph = "..";
}
</script>
{{TOGGLE--configs-3--P002-2--calibration is active|calibration is disabled}}
{{NUMBER--configs_long-0--P002-3--point 1 (x)--0--0--1023--1}}
{{NUMBER--configs_float-0--P002-4--point 1 (y)--0}}
{{NUMBER--configs_long-1--P002-5--point 2 (x)--0--0--1023--1}}
{{NUMBER--configs_float-1--P002-6--point 2 (y)--0}}
Add html or curly syntax here...
`; //--------------------------- HTML or CURLY -------------------------------//
2 changes: 2 additions & 0 deletions src/gui_easy_curly.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,14 @@ guiEasy.curly.drawer = function (arg) {
}
html += guiEasy.curly.drawer.theme(x[i]);
}
// the space between "main-info" button and the "main-bg" button is needed for the grunt to minify correctly
html += `
<hr>
<div class="row">
<button class="main-success" data-click="theme-save">Save</button>
<button class="main-sunny" data-click="theme-copy">Copy</button>
<button class="main-info" data-click="theme-default">Default</button>
<button class="main-bg" data-click="modal-theme-import">Import</button>
</div>
</div>
Expand Down
63 changes: 32 additions & 31 deletions src/gui_easy_popper_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,26 +369,28 @@ guiEasy.popper.rules.input = function (event) {
};

guiEasy.popper.rules.syntaxHighlightTemporary = function (what, start, end) {
let x = guiEasy.popper.rules.syntax.selectionElement;
//default is to insert a character
let innerText = guiEasy.popper.rules.syntaxHighlightTemporary.checkTypeOfInput(what, start, end);
if (innerText !== false) {
x.position.col++;
let z = guiEasy.popper.rules.syntaxHighlightTemporary;
z.addCharacter(innerText, x.position.row, x.position.col);
}
// this one is special since the "selection" function deals with clicks and inputs, this part deals with the temporary selection
x.innerHTML = (x.innerHTML).replace(/editor-caret/g, "");
x.innerHTML = (x.innerHTML).replace(/end-of-line-caret/g, "");
let children = document.getElementById("row-" + x.position.row).children;
if (children[x.position.col] !== null) {
children[x.position.col].classList.add("editor-caret");
}
if (children[x.position.col] !== null && children[x.position.col].dataset.endOfLine !== undefined) {
children[x.position.col].classList.add("end-of-line-caret");
}
let x = guiEasy.popper.rules.syntax.selectionElement;
//default is to insert a character
let innerText = guiEasy.popper.rules.syntaxHighlightTemporary.checkTypeOfInput(what, start, end);
if (innerText !== false) {
x.position.col++;
let z = guiEasy.popper.rules.syntaxHighlightTemporary;
z.addCharacter(innerText, x.position.row, x.position.col);
}
// this one is special since the "selection" function deals with clicks and inputs, this part deals with the temporary selection
x.innerHTML = (x.innerHTML).replace(/editor-caret/g, "");
x.innerHTML = (x.innerHTML).replace(/end-of-line-caret/g, "");
let children = document.getElementById("row-" + x.position.row).children;
if (children[x.position.col] !== null) {
children[x.position.col].classList.add("editor-caret");
}
if (children[x.position.col] !== null && children[x.position.col].dataset.endOfLine !== undefined) {
children[x.position.col].classList.add("end-of-line-caret");
}
};

// TODO: this part is making grunt compile go locco... BELOW could it be the number of levels???

guiEasy.popper.rules.syntaxHighlightTemporary.checkTypeOfInput = function (what, start, end) {
if (
what === "up" ||
Expand All @@ -409,24 +411,22 @@ guiEasy.popper.rules.syntaxHighlightTemporary.checkTypeOfInput = function (what,
let colsInRow;
let x = guiEasy.popper.rules.syntax.selectionElement;
let y = guiEasy.popper.rules.syntax.editorElement;
if (
document.getElementById("rules-editor-selection").childElementCount === null ||
document.getElementById("row-" + x.position.row).childElementCount === null
) {
let e = document.getElementById("rules-editor-selection").childElementCount;
let r = document.getElementById("row-" + x.position.row).childElementCount;

if (e === null || r === null) {
let p = setInterval(function () {
if (
document.getElementById("rules-editor-selection").childElementCount !== null ||
document.getElementById("row-" + x.position.row).childElementCount !== null
) {
if (e !== null || r !== null) {
clearInterval(p);
rows = document.getElementById("rules-editor-selection").childElementCount - 1;
colsInRow = document.getElementById("row-" + x.position.row).childElementCount - 1;
rows = e - 1;
colsInRow = r - 1;
}
}, 10)
} else {
rows = document.getElementById("rules-editor-selection").childElementCount - 1;
colsInRow = document.getElementById("row-" + x.position.row).childElementCount - 1;
rows = e - 1;
colsInRow = r- 1;
}

let colsInRowAbove = document.getElementById("row-" + (x.position.row - 1));
if (colsInRowAbove !== null) {
colsInRowAbove = colsInRowAbove.childElementCount - 1;
Expand All @@ -439,6 +439,7 @@ guiEasy.popper.rules.syntaxHighlightTemporary.checkTypeOfInput = function (what,
} else {
colsInRowBelow = -1;
}

if (what === "down") {
if (rows > x.position.row) {
x.position.row++;
Expand Down Expand Up @@ -532,7 +533,7 @@ guiEasy.popper.rules.syntaxHighlightTemporary.addCharacter = function(char, row,
rowInputElement = document.getElementById("input-row-" + row);
rowSyntaxElement = document.getElementById("syntax-row-" + row);
}
}, 10)
}, 10);
}
let pos = col - 1 + i;
let siblingSelect = rowSelectElement.children[pos];
Expand Down
4 changes: 2 additions & 2 deletions src/index-minimal.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ select option:checked {
}
#upload {
display: none;
min-height: 230px;
max-height: 230px;
min-height: 260px;
max-height: 260px;
margin-top: unset;
}
.drag-drop {
Expand Down
16 changes: 8 additions & 8 deletions src/index-minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ obj.frontend = {
"uploadEndpoint": "/upload",
"uploadSpeed": 35,
"t": "Click the button below to upgrade this unit.",
"v": "" //FRONTEND <--- don't change this row, used for Grunt
"v": "0.1.nightly.5" //FRONTEND <--- don't change this row, used for Grunt
};
obj.backend = {
"b": "Update Firmware",
Expand Down Expand Up @@ -444,16 +444,16 @@ favicon = function () {
ctx.moveTo(0,iconRadius);
ctx.lineTo(0,iconSide-iconRadius);
ctx.arc(iconRadius,iconSide-iconRadius, iconRadius, Math.PI, 0.5 * Math.PI, true);
ctx.lineTo(iconRadius,iconSide);
ctx.lineTo(iconSide-iconRadius,iconSide);
ctx.lineTo(iconRadius,iconSide);
ctx.lineTo(iconSide-iconRadius,iconSide);
ctx.arc(iconSide-iconRadius,iconSide-iconRadius, iconRadius, Math.PI, 1.5 * Math.PI, true);
ctx.lineTo(iconSide,iconSide-iconRadius);
ctx.lineTo(iconSide,iconRadius);
ctx.lineTo(iconSide,iconSide-iconRadius);
ctx.lineTo(iconSide,iconRadius);
ctx.arc(iconSide-iconRadius,iconRadius, iconRadius, 0, 1.5 * Math.PI, true);
ctx.lineTo(iconSide-iconRadius,0);
ctx.lineTo(iconRadius,0);
ctx.lineTo(iconSide-iconRadius,0);
ctx.lineTo(iconRadius,0);
ctx.arc(iconRadius,iconRadius, iconRadius, 0, 0.5 * Math.PI, true);
ctx.lineTo(0,iconRadius);
ctx.lineTo(0,iconRadius);
ctx.closePath();
ctx.fill();
//The dot
Expand Down

0 comments on commit c0c0582

Please sign in to comment.