From cbef4f9e7f6b39469d9e6ac77b5a7237f69022ee Mon Sep 17 00:00:00 2001 From: rstular Date: Wed, 20 May 2020 19:37:34 +0200 Subject: Night theme --- assets/js/lang/bundle.js | 2 + assets/js/lib/themes.js | 32 +- assets/js/messaging.js | 1020 ++++++++++++++++++++-------------------- assets/pages-src/messaging.bvr | 144 +++--- assets/pages-src/settings.bvr | 165 +++---- 5 files changed, 697 insertions(+), 666 deletions(-) (limited to 'assets') diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js index 7e269b0..6c53d94 100644 --- a/assets/js/lang/bundle.js +++ b/assets/js/lang/bundle.js @@ -290,6 +290,7 @@ var langstrings = { theme: "theme", themeLight: "light theme (default)", themeDark: "dark theme", + themeNight: "night theme", selectTheme: "select a theme", themeSet: "theme set, open another page for the changes to take effect", errorReportingSet: "error reporting preference set", @@ -485,6 +486,7 @@ var langstrings = { theme: "izgled", themeLight: "svetel izgled (privzeto)", themeDark: "temen izgled", + themeNight: "nočni izgled", themeSet: "izgled nastavljen, odprite neko drugo stran da se spremembe uveljavijo", selectTheme: "izberite željen izgled", errorReportingSet: "nastavitev pošiljanja napak izbrana", diff --git a/assets/js/lib/themes.js b/assets/js/lib/themes.js index 14ef436..75dedfd 100644 --- a/assets/js/lib/themes.js +++ b/assets/js/lib/themes.js @@ -25,7 +25,7 @@ const THEME_COLOR_SCHEMES = { "color-divider": "rgba(224, 224, 224, 1)", "color-btn-flat": "rgba(52, 52, 52, 1)", - "color-btn-flat-disabled": "rgba(178, 178, 178, 1)", + "color-btn-flat-disabled": "rgba(178, 178, 178, 1)" }, dark: { @@ -54,7 +54,35 @@ const THEME_COLOR_SCHEMES = { "color-divider": "rgba(80, 80, 80, 1)", "color-btn-flat": "rgba(178, 178, 178, 1)", - "color-btn-flat-disabled": "rgba(52, 52, 52, 1)", + "color-btn-flat-disabled": "rgba(52, 52, 52, 1)" + }, + black: { + "color-primary": "rgba(0, 79, 51, 1)", + "color-secondary": "rgba(0, 94, 61, 1)", + "color-accent": "rgba(28, 107, 79, 1)", + "color-primary-light": "rgba(0, 77, 2, 1)", // it's not really light anymore, is it? + "color-invalid": "rgba(138, 0, 0, 1)", + "color-primary-transparent": "rgba(0, 79, 51, 0.3)", + + "background-color": "rgba(0, 0, 0, 1)", + "background-accent": "rgba(0, 38, 18, 0.2)", + "background-accent-1": "rgb(20, 33, 25, 1)", + + "color-header-bold": "rgba(255, 255, 255, 1)", + "color-header-span": "rgba(255, 255, 255, 1)", + + "color-text": "rgba(189, 189, 189, 1)", + "color-text-light": "rgba(160, 160, 160, 1)", + "color-label-text": "rgba(158, 158, 158, 1)", + "color-table-hover": "rgba(43, 43, 43, 0.5)", + + "color-sidenav-background": "rgba(0, 0, 0, 1)", + "color-sidenav-text": "rgba(189, 189, 189, 1)", + "color-sidenav-header": "rgba(189, 189, 189, 0.54)", + "color-divider": "rgba(50, 50, 50, 1)", + + "color-btn-flat": "rgba(178, 178, 178, 1)", + "color-btn-flat-disabled": "rgba(52, 52, 52, 1)" } } diff --git a/assets/js/messaging.js b/assets/js/messaging.js index dba57ef..305b355 100644 --- a/assets/js/messaging.js +++ b/assets/js/messaging.js @@ -6,34 +6,34 @@ const ENCRYPTED_MESSAGE_REGEX = /(\S+?)${encrypted_message} - - ` - } - - console.log(msgcontent); - console.log(encrypted_message); - - sendMessage(value[$("#full-name").val()], msgsubject, htmlEncode(msgcontent)); - $("#msg-body").val(""); - $("#full-name").val(""); - $("#msg-subject").val(""); - // $("#msg-send").prop("disabled", true); - $("#msg-send").attr("disabled", "disabled"); - additionalstufftoaddtomessage = ""; - - $("#msg-added-image").html(""); - $("#msg-e2ee-pass").hide(); - - }).catch(function (err) { - UIAlert( `${D("unableToReadDirectory")} ${D("messageCouldNotBeSend")}`, "45245" ); - console.log(err); - }); - }); + // Button to add a photo + $("#msg-add-photo").click(() => { + let input = document.createElement("input"); + input.type = "file"; + input.onchange = (e) => { + // getting a hold of the file reference + let file = e.target.files[0]; + // setting up the reader + let reader = new FileReader(); + reader.readAsDataURL(file); // this is reading as data url + + // here we tell the reader what to do when it's done reading... + reader.onload = readerEvent => { + additionalstufftoaddtomessage += `
`; // this is the content! + if ($("#msg-added-image").html().length > 1) { + $("#msg-added-image").append(``); + } else { + $("#msg-added-image").html(` + +
+ ${D("largeImagesNote")} +
+ ${S("attachedImages")}: +
+ + `); + // ravno obratni narekovaji + } + UIAlert(D("imageAddedAsAnAttachment")); + } + } + input.click(); + }); + + // Verify recipient when input loses focus + $("#full-name").on("blur", validateName); + + // Setup refresh icon + $("#refresh-icon").click(() => { + loadMessages(true, current_tab); + }); + + // Setup checkbox handler + $("#encrypt-checkbox").change(function() { + if (this.checked) { + $("#encryption-key-input").prop("hidden", false); + } else { + $("#encryption-key-input").prop("hidden", true); + } + }); + + // Button to send message + $("#msg-send").click(() => { + localforage.getItem("directory").then(function (value) { + var msgcontent = $("#msg-body").val() + additionalstufftoaddtomessage; + var msgsubject = $("#msg-subject").val(); + if ($("#encryption-key-input").prop("hidden") !== true) { + var randomencdivid = Math.floor(Math.random() * 9999).toString().padStart(4, "0"); + var addrparts = window.location.href.split("/"); // engleski + + var encrypted_message = sjcl.encrypt($("#msg-e2ee-pass-input").val(), msgcontent); + msgcontent = ` + +
+ This message was encrypted by BežiApp. + + +
+ + ` + } + + console.log(msgcontent); + console.log(encrypted_message); + + sendMessage(value[$("#full-name").val()], msgsubject, htmlEncode(msgcontent)); + $("#msg-body").val(""); + $("#full-name").val(""); + $("#msg-subject").val(""); + // $("#msg-send").prop("disabled", true); + $("#msg-send").attr("disabled", "disabled"); + additionalstufftoaddtomessage = ""; + + $("#msg-added-image").html(""); + $("#msg-e2ee-pass").hide(); + + }).catch(function (err) { + UIAlert( `${D("unableToReadDirectory")} ${D("messageCouldNotBeSend")}`, "45245" ); + console.log(err); + }); + }); } function getUrlParameter(sParam) { - const url_params = new URLSearchParams(window.location.search); - const found_param = url_params.get(sParam); - return found_param + const url_params = new URLSearchParams(window.location.search); + const found_param = url_params.get(sParam); + return found_param } var additionalstufftoaddtomessage = ""; document.addEventListener("DOMContentLoaded", () => { - checkLogin(); - - // Setup modals - const modal_elems = document.querySelectorAll('.modal'); - const modal_options = { - onOpenStart: () => { $("#fab-new").hide() }, - onCloseEnd: () => { $("#fab-new").show() }, - dismissible: false - }; - M.Modal.init(modal_elems, modal_options); - - loadDirectory(); - setupEventListeners(); - - // Setup tabs - const tabs = document.querySelectorAll(".tabs"); - const tab_options = { - // swipeable: true, // TODO: figure out how to fix height when it's enabled (it's good for UX to have it enabled) - onShow: (tab) => { - if ($(tab).hasClass("active")) { - switch (tab.id) { - case "beziapp-received": - current_tab = 0; - loadMessages(false, 0); - break; - case "beziapp-sent": - current_tab = 1; - loadMessages(false, 1); - break; - case "beziapp-deleted": - current_tab = 2; - loadMessages(false, 2); - break; - } - } - } - }; - M.Tabs.init(tabs, tab_options); - - // Setup floating action button - const fab_options = { - hoverEnabled: false, - toolbarEnabled: false - } - const fab_elem = document.querySelectorAll(".fixed-action-btn"); - M.FloatingActionButton.init(fab_elem, fab_options); - - var receivedmessages = null; - loadMessages(true, 0); - M.updateTextFields(); - - // Setup side menu - const menus = document.querySelectorAll(".side-menu"); - M.Sidenav.init(menus, { edge: "right", draggable: true }); + checkLogin(); + + // Setup modals + const modal_elems = document.querySelectorAll('.modal'); + const modal_options = { + onOpenStart: () => { $("#fab-new").hide() }, + onCloseEnd: () => { $("#fab-new").show() }, + dismissible: false + }; + M.Modal.init(modal_elems, modal_options); + + loadDirectory(); + setupEventListeners(); + + // Setup tabs + const tabs = document.querySelectorAll(".tabs"); + const tab_options = { + // swipeable: true, // TODO: figure out how to fix height when it's enabled (it's good for UX to have it enabled) + onShow: (tab) => { + if ($(tab).hasClass("active")) { + switch (tab.id) { + case "beziapp-received": + current_tab = 0; + loadMessages(false, 0); + break; + case "beziapp-sent": + current_tab = 1; + loadMessages(false, 1); + break; + case "beziapp-deleted": + current_tab = 2; + loadMessages(false, 2); + break; + } + } + } + }; + M.Tabs.init(tabs, tab_options); + + // Setup floating action button + const fab_options = { + hoverEnabled: false, + toolbarEnabled: false + } + const fab_elem = document.querySelectorAll(".fixed-action-btn"); + M.FloatingActionButton.init(fab_elem, fab_options); + + var receivedmessages = null; + loadMessages(true, 0); + M.updateTextFields(); + + // Setup side menu + const menus = document.querySelectorAll(".side-menu"); + M.Sidenav.init(menus, { edge: "right", draggable: true }); }); diff --git a/assets/pages-src/messaging.bvr b/assets/pages-src/messaging.bvr index abc7e79..80bb80d 100644 --- a/assets/pages-src/messaging.bvr +++ b/assets/pages-src/messaging.bvr @@ -2,91 +2,91 @@ - - - - - Messaging « BežiApp + + + + + Messaging « BežiApp - - - - + + + + - - + + - + - - - - - - - - - + + + + + + + + + - - - - + + + + - + <@?i navigation@> -
-
+
+
-
-
-
- messageStorageUsed: 0/120 messages -
-
-
-
-
+
+
+
+ messageStorageUsed: 0/120 messages +
+
+
+
+
-
- maxMessagesNote -
+
+ maxMessagesNote +
-
- -
-
-

loadingMessages

-

loadingMessages

-

loadingMessages

-
-
+
+ +
+
+

loadingMessages

+

loadingMessages

+

loadingMessages

+
+
- -
- - mode_edit - -
+ +
+ + mode_edit + +
<@?i msg-compose-modal@> diff --git a/assets/pages-src/settings.bvr b/assets/pages-src/settings.bvr index 4c55da6..960adb5 100644 --- a/assets/pages-src/settings.bvr +++ b/assets/pages-src/settings.bvr @@ -2,102 +2,103 @@ - - - - - Settings « BežiApp + + + + + Settings « BežiApp - - - - - + + + + + - - + + - + - - - - - - + + + + + + - - - - + + + + - + <@?i navigation@> -
-
-
-

BežiApp -

-

settings

-
-
-
-
-
language
-
-
- translate - - -
-
+
+
+
+

BežiApp +

+

settings

+
+
+
+
+
language
+
+
+ translate + + +
+
-
-
-
theme
-
-
- palette - - -
-
+
+
+
theme
+
+
+ palette + + +
+
-
-
-
errorReporting
-
-
- report_problem - - -
-
+
+
+
errorReporting
+
+
+ report_problem + + +
+
-
+
-- cgit v1.2.3