Skip to content

Commit

Permalink
[rules editor] added file size info + warning if exceeding the max size
Browse files Browse the repository at this point in the history
  • Loading branch information
Grovkillen committed Jan 12, 2020
1 parent 70edadc commit 1cd3ce2
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function(grunt) {
'src/dash/gui_easy_dash_d*.js'
],
'build/temp/patreon.min.js': [
'src/dash/gui_easy_popper_extra.js'
'src/gui_easy_popper_extra.js'
]
}
}
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build/0.0.nightly.1/gui.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/0.0.nightly.1/info/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gui-easy",
"timestamp": 1578608108189,
"timestamp": 1578820861737,
"version": "0.0.1",
"author": "Jimmy 'Grovkillen' Westberg <jimmy@grovkillen.com> (https://grovkillen.com)",
"license": "GPL-3.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion build/0.0.nightly.1/info/source_files.json

Large diffs are not rendered by default.

Binary file modified build/0.0.nightly.1/main/index.htm.gz
Binary file not shown.
Binary file modified build/0.0.nightly.1/noDash/index.htm.gz
Binary file not shown.
Binary file modified build/0.0.nightly.1/src-0.0.nightly.1.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": 1578608108189,
"timestamp": 1578820861737,
"version": "0.0.1",
"author": "Jimmy 'Grovkillen' Westberg <jimmy@grovkillen.com> (https://grovkillen.com)",
"license": "GPL-3.0-or-later",
Expand Down
1 change: 1 addition & 0 deletions src/gui_easy_curly_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ guiEasy.curly.page.rules = function () {
tabindex="-1"
id="rules-editor-input"
>‌</div>
<div class="is-right text-tiny" id="rules-editor-file-size"></div>
</div>
</div>
`;
Expand Down
1 change: 1 addition & 0 deletions src/gui_easy_popper_extra.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* GUIEasy Copyright (C) 2019-2020 Jimmy "Grovkillen" Westberg */

guiEasy.popper.extra = "";

Expand Down
18 changes: 15 additions & 3 deletions src/gui_easy_popper_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ guiEasy.popper.rules = function(){
let input = document.getElementById("rules-editor-input");
let selection = document.getElementById("rules-editor-selection");
let background = document.getElementById("rules-editor-background");
let fileSize = document.getElementById("rules-editor-file-size");
guiEasy.popper.rules.syntax.editorElement = editor;
guiEasy.popper.rules.syntax.syntaxElement = syntax;
guiEasy.popper.rules.syntax.inputElement = input;
guiEasy.popper.rules.syntax.selectionElement = selection;
guiEasy.popper.rules.syntax.backgroundElement = background;
guiEasy.popper.rules.syntax.filesizeElement = fileSize;
editor.addEventListener("input", x.input, false);
editor.addEventListener("keyup", x.input.tab, false);
editor.addEventListener("keydown", x.input.tab, false);
Expand Down Expand Up @@ -391,9 +393,19 @@ guiEasy.popper.rules.input.tab = function (event) {
};

guiEasy.popper.rules.sizeOfFile = function () {
//max size/char's 2048
let editor = guiEasy.popper.rules.syntax.editorElement;
console.log(editor.value.length);
let x = guiEasy.popper.rules.syntax;
let maxSizeOfFile = 2048;
let currentSizeOfFile = x.editorElement.value.length;
x.filesizeElement.innerHTML = currentSizeOfFile + "/" + maxSizeOfFile;
if (currentSizeOfFile > maxSizeOfFile) {
x.backgroundElement.classList.add("main-warning");
x.filesizeElement.classList.remove("text-tiny");
x.filesizeElement.classList.add("text-huge");
} else {
x.backgroundElement.classList.remove("main-warning");
x.filesizeElement.classList.remove("text-huge");
x.filesizeElement.classList.add("text-tiny");
}
};

guiEasy.popper.rules.handleScroll = function () {
Expand Down

0 comments on commit 1cd3ce2

Please sign in to comment.