From 9e7d40d70795cb7bcb8b235cf8d6b742f339d417 Mon Sep 17 00:00:00 2001 From: Guus van Meerveld <57101832+Guusvanmeerveld@users.noreply.github.com> Date: Sun, 31 Jan 2021 19:55:59 +0100 Subject: [PATCH] Commit to not lose files --- index.js | 6 +- json/app.json | 4 + json/functions.json | 50 +++++--- src/icon/icon.ico | Bin 0 -> 13359 bytes src/javascripts/keybinds.js | 159 -------------------------- src/javascripts/keybinds/detection.js | 59 ++++++++++ src/javascripts/keybinds/menu.js | 75 ++++++++++++ src/javascripts/settings.js | 4 +- src/pages/keybinds.html | 11 +- 9 files changed, 188 insertions(+), 180 deletions(-) create mode 100644 json/app.json create mode 100644 src/icon/icon.ico delete mode 100644 src/javascripts/keybinds.js create mode 100644 src/javascripts/keybinds/detection.js create mode 100644 src/javascripts/keybinds/menu.js diff --git a/index.js b/index.js index d335fee..1be83af 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,10 @@ const { autoUpdater, } = require("electron"); +const path = app.getAppPath(); + +const info = require(path + "/json/app.json"); + const electronLocalshortcut = require("electron-localshortcut"); const Store = require("electron-store"); const store = new Store(); @@ -100,7 +104,7 @@ app.on("ready", () => { } let autoLaunch = new AutoLaunch({ - name: "Keyzo", + name: info.name, path: app.getPath("exe"), }); diff --git a/json/app.json b/json/app.json new file mode 100644 index 0000000..b5ee8c3 --- /dev/null +++ b/json/app.json @@ -0,0 +1,4 @@ +{ + "name": "Keyzo", + "version": "0.1" +} diff --git a/json/functions.json b/json/functions.json index f74abe2..25b9b34 100644 --- a/json/functions.json +++ b/json/functions.json @@ -1,20 +1,42 @@ -{ - "Applications": { +[ + { + "title": "applications", "description": "Open/Close/Modify your applications", - "open app": { - "description": "Open an application" - }, - "close app": { - "description": "Close an application" - } + "children": [ + { + "title": "open app", + "description": "Open an application", + "children": [ + { + "title": "test" + }, + { + "title": "lksfjslkd" + } + ] + } + ] }, - "System": { + { + "title": "system", + "description": "Open/Close/Modify your applications", + "children": [ + { + "title": "yeetapp", + "children": [ + { + "title": "lksfjslkd" + } + ] + } + ] + }, + { + "title": "system functions", "description": "Interact with your system" }, - "Keys": { + { + "title": "keys", "description": "Output keyboard inputs" - }, - "System Functions": { - "description": "Some predefined functions" } -} \ No newline at end of file +] \ No newline at end of file diff --git a/src/icon/icon.ico b/src/icon/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..2dc299114e6573c748ea023726bb599801dcce65 GIT binary patch literal 13359 zcmc&*1y>Z#*WO*a8y1j8;751ElF}iKAgP3O2}*ajND3lSQX6%wasMgZ`im&G|L(2CrA$Ul{ zg|^m~4;>x;kR;}@g-g~%lQS|g@q!U)!A9k=JyiHbRM3_QJv2Wkh@&9G883W2kfyoQ^|5#Y4=#-B?y=EsBi``Jd;7JX~eQCSY@~mJ_!qpSQCiYh3TTp!KdL#v8%>t0 z5AM)LFKPaL60*g&jD|!0RZ$k*nzx{$LdtYUm=}IxwbmWYUe$izWHof}m!F^Cp%BE! z2B|VM^*uEm9UY~V^YGQy*H4?PU`3aYL&A%NNB^5xvkc4xD`m@{2TO#h{s+N~g3Q}n z@S+RQ!}gXS^8aOsxa7JIP55=0J(3^I-!Ib2;FT34C%oy(;Iqzv@WPSh#x)Um?CZ9? zaO|PaDyc?~hAnUnzJLE7G5V8#z=9VZXjE;5MnZ}n+F=oeQD;4gk?|>N>$FHKZ^%qk zo)j!L>QB4@eBN=toM#5cB+ogJDG)jL;&VmCU}f(`I#2tp`%WCCKn5$45H~A*we9*( znI%2TPacS%nnpaeNCFl_p3tsn0X^}x>tfjC$cRO87Ca7dyS?=5-G931c~U{m0+-^0 z7LpM=*xqdXHMYYx#^G@6(4wNP755uT+@3%Sj5#KcF)f=j#4Tvj#ocdVj?2YsU?0w1`D#{Iyx?o*GqHzZZ6s%DsEYC;kZ4APjz*z zFAU&u9Z^L^EE3s_B^_GW8l`#B;^Et)YHQFp)brN`S{D*pEwiHTaS9v&XkT8O*uD{}`2hxGJxL&kw`6N(TkpI3}Q>5)Ym*+uUdA>8{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?_uS>T778hiy_Jge`%QVHS0{=Fgw|M{a1tuzUX@;b$f$iQ88+e7P_Z$fgWS zYAHyz5iL^4_;PY_-Ssal+;-XCX8>K<99)`F^|$@SwY6jp*-r1qC9KZ=J%s^S#hZYV zM#m&rRStsOr#lFLEb-u3@+U+^McI`je~~$^02_}MT*5hU!wJ$(eXS(X!81Ds1{{5C zY;16UPgz_P=5PGde6I%y27nU+AD9W?^&lx708O|F85(tTdTQOn!>bN?hXdj@h6Hrd zrt;5Td0zKM_wD6Ha(4aIO z@IJaGosZ4IJz@{LkG;MZ`uB$uyl~wAmoMlT4|GJ>?N<&BSWMv0dmt)`nhKS279sx! D!v1KC literal 0 HcmV?d00001 diff --git a/src/javascripts/keybinds.js b/src/javascripts/keybinds.js deleted file mode 100644 index 24a678a..0000000 --- a/src/javascripts/keybinds.js +++ /dev/null @@ -1,159 +0,0 @@ -const app = require("electron").remote.app; -const path = app.getAppPath(); - -const q = document.querySelector.bind(document); -const c = document.createElement.bind(document); - -const $ = require(path + "/src/javascripts/jquery.min.js"); -const functions = require(path + "/json/functions.json"); - -// Predefine some vars -var keys = {}, - showsFunctions = {}, - keybind; - -// Detect keybinds -$(".keybind-input").on("keyup", (e) => { - keys[e.key.toUpperCase()] = false; - setInput(); -}); - -$(".keybind-input").on("keydown", (e) => { - e.preventDefault(); - - Object.keys(keys).forEach((g) => { - if (!keys[g]) delete keys[g]; - }); - - keys[e.key.toUpperCase()] = true; - setInput(); -}); - -function setInput() { - keybind = Object.keys(keys).join(" + "); - - if (Object.values(keys).filter((k) => k).length == 0) { - $(".keybind-input").hide(); - $(".customize").show(); - } - - $(".show-keybind").html(keybind); - $(".keybind-input").val(keybind); -} - -// Configure buttons -$(".add-keybind").click(() => { - $(".dark-overlay").show().addClass("d-flex"); - $(".keybind-input").show().focus(); -}); - -$(".cancel-btn").click(resetKeyAdder); -$(".done-btn").click(resetKeyAdder); - -$(".change-btn").click(() => { - $(".keybind-input").show().focus().val(""); - $(".customize").hide(); -}); - -function resetKeyAdder() { - $(".dark-overlay").hide().removeClass("d-flex"); - - $(".keybind-input").val(""); - $(".customize").hide(); - $(".done-btn").hide(); - - keybind = null; -} - -// Load functions from json -Object.keys(functions).forEach((cat) => { - let catNoSpace = cat.replace(/ /g, ""); - // Select category - let catagoryItem = createCatagoryItem(cat, catNoSpace), - catagoryFunctions = c("div"), - functionItems = createFunctionItem(functions[cat]); - - q(".select-category").appendChild(catagoryItem); - - catagoryFunctions.classList.add(catNoSpace); - catagoryFunctions.style.display = "none"; - - functionItems.forEach((item) => { - catagoryFunctions.appendChild(item); - }); - - q(".select-function").appendChild(catagoryFunctions); -}); - -function createCatagoryItem(f, noSpace) { - let title = c("div"), - trailing = c("i"), - subtitle = c("div"); - - title.classList.add("category-item"); - title.classList.add("bold"); - title.innerHTML = f.toUpperCase(); - - title.addEventListener("click", () => { - showsFunctions[f] = !showsFunctions[f] ?? true; - - Object.keys(showsFunctions).forEach((i) => { - if (f !== i) { - showsFunctions[i] = false; - $("." + i.replace(/ /g, "")).hide(); - } - }); - - if (showsFunctions[f]) { - $(".select-function").show(); - $("." + noSpace).show(); - } else { - $(".select-function").hide(); - $("." + noSpace).hide(); - } - }); - - trailing.classList.add("category-arrow"); - trailing.classList.add("material-icons"); - trailing.innerHTML = "arrow_forward_ios"; - - subtitle.classList.add("text-muted"); - subtitle.innerHTML = functions[f].description; - - title.appendChild(subtitle); - title.appendChild(trailing); - - return title; -} - -function createFunctionItem(f) { - delete f.description; - var result = []; - - Object.keys(f).forEach((func) => { - result.push(createFunctionItem(func, f[func].description)); - }); - - return result; -} - -function createListItem(title, subtitle) { - let titleEl = c("div"), - trailing = c("i"), - subtitleEl = c("div"); - - titleEl.classList.add("category-item"); - titleEl.classList.add("bold"); - titleEl.innerHTML = title.toUpperCase(); - - trailing.classList.add("category-arrow"); - trailing.classList.add("material-icons"); - trailing.innerHTML = "arrow_forward_ios"; - - subtitleEl.classList.add("text-muted"); - subtitleEl.innerHTML = subtitle; - - titleEl.appendChild(trailing); - titleEl.appendChild(subtitleEl); - return titleEl; -} diff --git a/src/javascripts/keybinds/detection.js b/src/javascripts/keybinds/detection.js new file mode 100644 index 0000000..977dbc4 --- /dev/null +++ b/src/javascripts/keybinds/detection.js @@ -0,0 +1,59 @@ +const path = require("electron").remote.app.getAppPath(); +const $ = require(path + "/src/javascripts/jquery.min.js"); + +// Predefine some vars +var keys = {}, + keybind; + +// Detect keybinds +$(".keybind-input").on("keyup", (e) => { + keys[e.key.toUpperCase()] = false; + setInput(); +}); + +$(".keybind-input").on("keydown", (e) => { + e.preventDefault(); + + Object.keys(keys).forEach((g) => { + if (!keys[g]) delete keys[g]; + }); + + keys[e.key.toUpperCase()] = true; + setInput(); +}); + +function setInput() { + keybind = Object.keys(keys).join(" + "); + + if (Object.values(keys).filter((k) => k).length == 0) { + $(".keybind-input").hide(); + $(".customize").show(); + } + + $(".show-keybind").html(keybind); + $(".keybind-input").val(keybind); +} + +// Configure buttons +$(".add-keybind").click(() => { + $(".dark-overlay").show().addClass("d-flex"); + $(".keybind-input").show().focus(); +}); + +$(".cancel-btn").click(resetKeyAdder); +$(".done-btn").click(resetKeyAdder); + +$(".change-btn").click(() => { + $(".keybind-input").show().focus().val(""); + $(".customize").hide(); +}); + +function resetKeyAdder() { + $(".dark-overlay").hide().removeClass("d-flex"); + + $(".keybind-input").val(""); + $(".customize").hide(); + $(".done-btn").hide(); + + keybind = null; +} diff --git a/src/javascripts/keybinds/menu.js b/src/javascripts/keybinds/menu.js new file mode 100644 index 0000000..437ee6c --- /dev/null +++ b/src/javascripts/keybinds/menu.js @@ -0,0 +1,75 @@ +const c = document.createElement.bind(document); +const q = document.querySelector.bind(document); + +const functions = require(path + "/json/functions.json"); +var showsFunctions = []; + +// Load functions from json +function init() { + cycleList(functions, "", 0); +} + +function cycleList(list, title, i) { + let div = c("div"); + + showsFunctions[i] = {}; + list.forEach((item) => { + showsFunctions[i][item.title] = false; + div.appendChild(createListItem(i, item.title, item.description)); + if (item.children) { + cycleList(item.children, item.title.replace(/ /g, ""), i + 1); + } + }); + + if (title) div.classList.add(title); + q(".select-function-" + i).appendChild(div); +} + +function createListItem(which, t, s) { + let showsFunctionsLocal = showsFunctions[which], + title = c("div"), + trailing = c("i"), + subtitle = c("div"), + noSpace = t.replace(/ /g, ""); + + title.classList.add("category-item"); + title.classList.add("bold"); + title.innerHTML = t.toUpperCase(); + + trailing.classList.add("category-arrow"); + trailing.classList.add("material-icons"); + trailing.innerHTML = "arrow_forward_ios"; + + title.addEventListener("click", () => { + showsFunctionsLocal[t] = !showsFunctionsLocal[t]; + + Object.keys(showsFunctionsLocal).forEach((i) => { + if (t !== i) { + showsFunctionsLocal[i] = false; + // console.log("Clicked: " + t, "Did not click: " + i); + $("." + i.replace(/ /g, "")).hide(); + } + }); + + // console.log(showsFunctions, which, t); + + if (showsFunctionsLocal[t]) { + $(".select-function-" + (which + 1)).show(); + $("." + noSpace).show(); + } else { + $(".select-function-" + (which + 1)).hide(); + $("." + noSpace).hide(); + } + }); + + subtitle.classList.add("text-muted"); + subtitle.innerHTML = s; + + title.appendChild(trailing); + + if (s) title.appendChild(subtitle); + + return title; +} + +init(); diff --git a/src/javascripts/settings.js b/src/javascripts/settings.js index 35f32be..b021c18 100644 --- a/src/javascripts/settings.js +++ b/src/javascripts/settings.js @@ -1,7 +1,9 @@ const Store = require("electron-store"); const store = new Store(); -const $ = require("./jquery.min.js"); +const path = require("electron").remote.app.getAppPath(); + +const $ = require(path + "/src/javascripts/jquery.min.js"); const settings = ["minimize", "startup", "startup-min"]; diff --git a/src/pages/keybinds.html b/src/pages/keybinds.html index 5b681b5..2bd9577 100644 --- a/src/pages/keybinds.html +++ b/src/pages/keybinds.html @@ -25,15 +25,15 @@
-
+

CATEGORIES

- @@ -45,6 +45,7 @@
- + + \ No newline at end of file