diff --git a/config.xml b/config.xml index 9a7df46..a5ec7af 100644 --- a/config.xml +++ b/config.xml @@ -16,9 +16,15 @@ + + + + + + @@ -52,10 +58,13 @@ + + + diff --git a/nbproject/plugins.properties b/nbproject/plugins.properties index 4f3b09f..d7af916 100644 --- a/nbproject/plugins.properties +++ b/nbproject/plugins.properties @@ -4,3 +4,5 @@ cordova-plugin-splashscreen=https://github.com/apache/cordova-plugin-splashscree cordova-plugin-console=https://github.com/apache/cordova-plugin-console.git cordova-plugin-whitelist=https://github.com/apache/cordova-plugin-whitelist.git phonegap-plugin-barcodescanner=https://github.com/phonegap/phonegap-plugin-barcodescanner.git +cordova-plugin-statusbar=https://github.com/apache/cordova-plugin-statusbar.git +cordova-plugin-headercolor=https://github.com/tomloprod/cordova-plugin-headercolor.git \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 82be726..f45c335 100644 --- a/package-lock.json +++ b/package-lock.json @@ -145,6 +145,337 @@ } } }, + "cordova-browser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cordova-browser/-/cordova-browser-4.1.0.tgz", + "integrity": "sha1-dQeQZeXNUKpnQ8vYUxdhcFP7IMY=", + "dependencies": { + "adm-zip": { + "version": "0.4.7", + "bundled": true + }, + "cordova-serve": { + "version": "1.0.0", + "bundled": true, + "dependencies": { + "chalk": { + "version": "1.1.1", + "bundled": true, + "dependencies": { + "ansi-styles": { + "version": "2.2.0", + "bundled": true, + "dependencies": { + "color-convert": { + "version": "1.0.0", + "bundled": true + } + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "bundled": true + }, + "has-ansi": { + "version": "2.0.0", + "bundled": true, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "bundled": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dependencies": { + "ansi-regex": { + "version": "2.0.0", + "bundled": true + } + } + }, + "supports-color": { + "version": "2.0.0", + "bundled": true + } + } + }, + "compression": { + "version": "1.6.1", + "bundled": true, + "dependencies": { + "accepts": { + "version": "1.3.1", + "bundled": true, + "dependencies": { + "mime-types": { + "version": "2.1.10", + "bundled": true, + "dependencies": { + "mime-db": { + "version": "1.22.0", + "bundled": true + } + } + }, + "negotiator": { + "version": "0.6.0", + "bundled": true + } + } + }, + "bytes": { + "version": "2.2.0", + "bundled": true + }, + "compressible": { + "version": "2.0.7", + "bundled": true, + "dependencies": { + "mime-db": { + "version": "1.22.0", + "bundled": true + } + } + }, + "debug": { + "version": "2.2.0", + "bundled": true, + "dependencies": { + "ms": { + "version": "0.7.1", + "bundled": true + } + } + }, + "on-headers": { + "version": "1.0.1", + "bundled": true + }, + "vary": { + "version": "1.1.0", + "bundled": true + } + } + }, + "express": { + "version": "4.13.4", + "bundled": true, + "dependencies": { + "accepts": { + "version": "1.2.13", + "bundled": true, + "dependencies": { + "mime-types": { + "version": "2.1.10", + "bundled": true, + "dependencies": { + "mime-db": { + "version": "1.22.0", + "bundled": true + } + } + }, + "negotiator": { + "version": "0.5.3", + "bundled": true + } + } + }, + "array-flatten": { + "version": "1.1.1", + "bundled": true + }, + "content-disposition": { + "version": "0.5.1", + "bundled": true + }, + "content-type": { + "version": "1.0.1", + "bundled": true + }, + "cookie": { + "version": "0.1.5", + "bundled": true + }, + "cookie-signature": { + "version": "1.0.6", + "bundled": true + }, + "debug": { + "version": "2.2.0", + "bundled": true, + "dependencies": { + "ms": { + "version": "0.7.1", + "bundled": true + } + } + }, + "depd": { + "version": "1.1.0", + "bundled": true + }, + "escape-html": { + "version": "1.0.3", + "bundled": true + }, + "etag": { + "version": "1.7.0", + "bundled": true + }, + "finalhandler": { + "version": "0.4.1", + "bundled": true, + "dependencies": { + "unpipe": { + "version": "1.0.0", + "bundled": true + } + } + }, + "fresh": { + "version": "0.3.0", + "bundled": true + }, + "merge-descriptors": { + "version": "1.0.1", + "bundled": true + }, + "methods": { + "version": "1.1.2", + "bundled": true + }, + "on-finished": { + "version": "2.3.0", + "bundled": true, + "dependencies": { + "ee-first": { + "version": "1.1.1", + "bundled": true + } + } + }, + "parseurl": { + "version": "1.3.1", + "bundled": true + }, + "path-to-regexp": { + "version": "0.1.7", + "bundled": true + }, + "proxy-addr": { + "version": "1.0.10", + "bundled": true, + "dependencies": { + "forwarded": { + "version": "0.1.0", + "bundled": true + }, + "ipaddr.js": { + "version": "1.0.5", + "bundled": true + } + } + }, + "qs": { + "version": "4.0.0", + "bundled": true + }, + "range-parser": { + "version": "1.0.3", + "bundled": true + }, + "send": { + "version": "0.13.1", + "bundled": true, + "dependencies": { + "destroy": { + "version": "1.0.4", + "bundled": true + }, + "http-errors": { + "version": "1.3.1", + "bundled": true, + "dependencies": { + "inherits": { + "version": "2.0.1", + "bundled": true + } + } + }, + "mime": { + "version": "1.3.4", + "bundled": true + }, + "ms": { + "version": "0.7.1", + "bundled": true + }, + "statuses": { + "version": "1.2.1", + "bundled": true + } + } + }, + "serve-static": { + "version": "1.10.2", + "bundled": true + }, + "type-is": { + "version": "1.6.12", + "bundled": true, + "dependencies": { + "media-typer": { + "version": "0.3.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.10", + "bundled": true, + "dependencies": { + "mime-db": { + "version": "1.22.0", + "bundled": true + } + } + } + } + }, + "utils-merge": { + "version": "1.0.0", + "bundled": true + }, + "vary": { + "version": "1.0.1", + "bundled": true + } + } + } + } + }, + "nopt": { + "version": "3.0.6", + "bundled": true, + "dependencies": { + "abbrev": { + "version": "1.0.7", + "bundled": true + } + } + }, + "q": { + "version": "1.4.1", + "bundled": true + }, + "shelljs": { + "version": "0.6.0", + "bundled": true + } + } + }, "cordova-plugin-compat": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/cordova-plugin-compat/-/cordova-plugin-compat-1.1.0.tgz", @@ -164,9 +495,19 @@ "cordova-plugin-dialogs": { "version": "git+https://github.com/apache/cordova-plugin-dialogs.git#a22b0eb7fd013e5b50486ebc54e6396780cad999" }, + "cordova-plugin-headercolor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-headercolor/-/cordova-plugin-headercolor-1.0.0.tgz", + "integrity": "sha1-AgrNlDeH7gOdZ/Z56NnqbTiSAxY=" + }, "cordova-plugin-splashscreen": { "version": "git+https://github.com/apache/cordova-plugin-splashscreen.git#98f83fea5ae58fb50962af2725310cc199b28f40" }, + "cordova-plugin-statusbar": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.2.3.tgz", + "integrity": "sha1-UcXgKtQzvr0LDcl3pEbrkd/uFQI=" + }, "cordova-plugin-whitelist": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.2.tgz", diff --git a/package.json b/package.json index c56e222..c4a56f6 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,15 @@ "license": "netsyms-business-license", "dependencies": { "cordova-android": "^6.2.3", + "cordova-browser": "^4.1.0", "cordova-plugin-compat": "^1.1.0", "cordova-plugin-console": "git+https://github.com/apache/cordova-plugin-console.git", "cordova-plugin-device": "git+https://github.com/apache/cordova-plugin-device.git", "cordova-plugin-dialog": "0.0.1", "cordova-plugin-dialogs": "git+https://github.com/apache/cordova-plugin-dialogs.git", + "cordova-plugin-headercolor": "^1.0.0", "cordova-plugin-splashscreen": "git+https://github.com/apache/cordova-plugin-splashscreen.git", + "cordova-plugin-statusbar": "^2.2.3", "cordova-plugin-whitelist": "^1.3.2", "phonegap-plugin-barcodescanner": "^6.0.6" }, @@ -24,10 +27,13 @@ "cordova-plugin-device": {}, "cordova-plugin-whitelist": {}, "cordova-plugin-dialogs": {}, - "cordova-plugin-splashscreen": {} + "cordova-plugin-splashscreen": {}, + "cordova-plugin-statusbar": {}, + "cordova-plugin-headercolor": {} }, "platforms": [ - "android" + "android", + "browser" ] } } \ No newline at end of file diff --git a/www/css/app.css b/www/css/app.css index ddd4fbd..ba16f8e 100644 --- a/www/css/app.css +++ b/www/css/app.css @@ -62,3 +62,7 @@ span.navbar-brand { height: 30px; margin-top: -4px; } + +#manual_setup { + margin-top: 15px; +} \ No newline at end of file diff --git a/www/css/inject_mini.css b/www/css/inject_mini.css new file mode 100644 index 0000000..70327f7 --- /dev/null +++ b/www/css/inject_mini.css @@ -0,0 +1,10 @@ +/* + A tiny bit of CSS to inject into apps even if injectcode = false. + + This hides items in the app with the class mobile-app-hide. +*/ + +.mobile-app-hide { + display: none; + visibility: hidden; +} \ No newline at end of file diff --git a/www/css/sidemenu.css b/www/css/sidemenu.css index e1a9048..9b71dae 100644 --- a/www/css/sidemenu.css +++ b/www/css/sidemenu.css @@ -8,6 +8,11 @@ visibility: hidden; } +.mobile-app-hide { + display: none; + visibility: hidden; +} + @media screen and (max-width: 767px) { #navbar-collapse { display: none; diff --git a/www/index.html b/www/index.html index 873ca69..5869a8f 100644 --- a/www/index.html +++ b/www/index.html @@ -14,6 +14,7 @@ + diff --git a/www/js/app.js b/www/js/app.js index 7251f9d..a763d84 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -14,6 +14,18 @@ $(document).ready(function () { } }); +document.addEventListener("deviceready", function () { + if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#1976d2"); + } +}, false); + +/** + * Fetch user info (name, email, etc) from the server and save to the global + * variable `userinfo`. + * @param function callback An optional function to run if/when the request + * succeeds. + */ function getuserinfo(callback) { $.post(localStorage.getItem("portalurl"), { username: localStorage.getItem("username"), @@ -23,7 +35,9 @@ function getuserinfo(callback) { }, function (data) { if (data.status === 'OK') { userinfo = data.info; - callback(); + if (typeof callback == 'function') { + callback(); + } } else { navigator.notification.alert(data.msg, null, "Error", 'Dismiss'); openscreen("homeloaderror"); @@ -57,7 +71,6 @@ function openscreen(screenname, effect) { $('#content-zone').load("views/" + screenname + ".html"); } currentscreen = screenname; - updateStatusBarColor(); } function openfragment(fragment, target, effect) { @@ -78,12 +91,26 @@ function openfragment(fragment, target, effect) { } } -function setnavbar(type) { +/** + * Set the navbar. + * @param String,boolean type false if no navbar, "home" for the home screen, + * "settings" for settings, "app" for a custom title, or anything else for + * a simple one. + * @param String title The title to show if type == "app" + * @returns {undefined} + */ +function setnavbar(type, title) { var navbar = $('#navbar-header'); if (type == false) { $('#navbar').css('display', 'none'); $('#content-zone').css('margin-top', '0px'); } else { + if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#1976d2"); + window.plugins.headerColor.tint("#2196f3"); + } else { + StatusBar.backgroundColorByHexString("#2196f3"); + } $('#navbar').css('display', 'initial'); $('#content-zone').css('margin-top', '75px'); switch (type) { @@ -93,12 +120,32 @@ function setnavbar(type) { case "settings": navbar.html('Settings'); break; + case "app": + navbar.html('' + title + ''); + break; default: navbar.html('Business'); } } } +/** + * Load the app.html view and open an app with native Android UI elements + * @param String id Application ID + * @param String api Path to the mobile API + * @param String url Base URL of the app + * @param String icon URL to the app icon + * @param String title Friendly app name + * @param boolean injectcode (optional, default true) Whether or not to inject UI modification code into the app + * @param boolean shownavbar (optional, default false) Whether or not to show the navbar at the top of the screen. + * @returns {undefined} + */ +function openapp(id, api, url, icon, title, injectcode, shownavbar) { + $('#content-zone').load("views/app.html", function () { + launchapp(id, api, url, icon, title, injectcode, shownavbar); + }); +} + /** * Opens a modal dialog over the top of everything else. * @param {String} filename screens/[filename].html diff --git a/www/js/material-palette.js b/www/js/material-palette.js new file mode 100644 index 0000000..41ee53b --- /dev/null +++ b/www/js/material-palette.js @@ -0,0 +1,320 @@ +/* + Based on the file + https://github.com/srekanui/google-material-color-palette-json/blob/master/lib/palette.json + + MIT License + + Copyright (c) 2016 Sravan Kumar Rekandar + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ +_PALETTE = { + "red": { + "shade_50": "#ffebee", + "shade_100": "#ffcdd2", + "shade_200": "#ef9a9a", + "shade_300": "#e57373", + "shade_400": "#ef5350", + "shade_500": "#f44336", + "shade_600": "#e53935", + "shade_700": "#d32f2f", + "shade_800": "#c62828", + "shade_900": "#b71c1c", + "shade_A100": "#ff8a80", + "shade_A200": "#ff5252", + "shade_A400": "#ff1744", + "shade_A700": "#d50000" + }, + "pink": { + "shade_50": "#fce4ec", + "shade_100": "#f8bbd0", + "shade_200": "#f48fb1", + "shade_300": "#f06292", + "shade_400": "#ec407a", + "shade_500": "#e91e63", + "shade_600": "#d81b60", + "shade_700": "#c2185b", + "shade_800": "#ad1457", + "shade_900": "#880e4f", + "shade_A100": "#ff80ab", + "shade_A200": "#ff4081", + "shade_A400": "#f50057", + "shade_A700": "#c51162" + }, + "purple": { + "shade_50": "#f3e5f5", + "shade_100": "#e1bee7", + "shade_200": "#ce93d8", + "shade_300": "#ba68c8", + "shade_400": "#ab47bc", + "shade_500": "#9c27b0", + "shade_600": "#8e24aa", + "shade_700": "#7b1fa2", + "shade_800": "#6a1b9a", + "shade_900": "#4a148c", + "shade_A100": "#ea80fc", + "shade_A200": "#e040fb", + "shade_A400": "#d500f9", + "shade_A700": "#aa00ff" + }, + "deepPurple": { + "shade_50": "#ede7f6", + "shade_100": "#d1c4e9", + "shade_200": "#b39ddb", + "shade_300": "#9575cd", + "shade_400": "#7e57c2", + "shade_500": "#673ab7", + "shade_600": "#5e35b1", + "shade_700": "#512da8", + "shade_800": "#4527a0", + "shade_900": "#311b92", + "shade_A100": "#b388ff", + "shade_A200": "#7c4dff", + "shade_A400": "#651fff", + "shade_A700": "#6200ea" + }, + "indigo": { + "shade_50": "#e8eaf6", + "shade_100": "#c5cae9", + "shade_200": "#9fa8da", + "shade_300": "#7986cb", + "shade_400": "#5c6bc0", + "shade_500": "#3f51b5", + "shade_600": "#3949ab", + "shade_700": "#303f9f", + "shade_800": "#283593", + "shade_900": "#1a237e", + "shade_A100": "#8c9eff", + "shade_A200": "#536dfe", + "shade_A400": "#3d5afe", + "shade_A700": "#304ffe" + }, + "blue": { + "shade_50": "#e3f2fd", + "shade_100": "#bbdefb", + "shade_200": "#90caf9", + "shade_300": "#64b5f6", + "shade_400": "#42a5f5", + "shade_500": "#2196f3", + "shade_600": "#1e88e5", + "shade_700": "#1976d2", + "shade_800": "#1565c0", + "shade_900": "#0d47a1", + "shade_A100": "#82b1ff", + "shade_A200": "#448aff", + "shade_A400": "#2979ff", + "shade_A700": "#2962ff" + }, + "lightBlue": { + "shade_50": "#e1f5fe", + "shade_100": "#b3e5fc", + "shade_200": "#81d4fa", + "shade_300": "#4fc3f7", + "shade_400": "#29b6f6", + "shade_500": "#03a9f4", + "shade_600": "#039be5", + "shade_700": "#0288d1", + "shade_800": "#0277bd", + "shade_900": "#01579b", + "shade_A100": "#80d8ff", + "shade_A200": "#40c4ff", + "shade_A400": "#00b0ff", + "shade_A700": "#0091ea" + }, + "cyan": { + "shade_50": "#e0f7fa", + "shade_100": "#b2ebf2", + "shade_200": "#80deea", + "shade_300": "#4dd0e1", + "shade_400": "#26c6da", + "shade_500": "#00bcd4", + "shade_600": "#00acc1", + "shade_700": "#0097a7", + "shade_800": "#00838f", + "shade_900": "#006064", + "shade_A100": "#84ffff", + "shade_A200": "#18ffff", + "shade_A400": "#00e5ff", + "shade_A700": "#00b8d4" + }, + "teal": { + "shade_50": "#e0f2f1", + "shade_100": "#b2dfdb", + "shade_200": "#80cbc4", + "shade_300": "#4db6ac", + "shade_400": "#26a69a", + "shade_500": "#009688", + "shade_600": "#00897b", + "shade_700": "#00796b", + "shade_800": "#00695c", + "shade_900": "#004d40", + "shade_A100": "#a7ffeb", + "shade_A200": "#64ffda", + "shade_A400": "#1de9b6", + "shade_A700": "#00bfa5" + }, + "green": { + "shade_50": "#e8f5e9", + "shade_100": "#c8e6c9", + "shade_200": "#a5d6a7", + "shade_300": "#81c784", + "shade_400": "#66bb6a", + "shade_500": "#4caf50", + "shade_600": "#43a047", + "shade_700": "#388e3c", + "shade_800": "#2e7d32", + "shade_900": "#1b5e20", + "shade_A100": "#b9f6ca", + "shade_A200": "#69f0ae", + "shade_A400": "#00e676", + "shade_A700": "#00c853" + }, + "lightGreen": { + "shade_50": "#f1f8e9", + "shade_100": "#dcedc8", + "shade_200": "#c5e1a5", + "shade_300": "#aed581", + "shade_400": "#9ccc65", + "shade_500": "#8bc34a", + "shade_600": "#7cb342", + "shade_700": "#689f38", + "shade_800": "#558b2f", + "shade_900": "#33691e", + "shade_A100": "#ccff90", + "shade_A200": "#b2ff59", + "shade_A400": "#76ff03", + "shade_A700": "#64dd17" + }, + "lime": { + "shade_50": "#f9fbe7", + "shade_100": "#f0f4c3", + "shade_200": "#e6ee9c", + "shade_300": "#dce775", + "shade_400": "#d4e157", + "shade_500": "#cddc39", + "shade_600": "#c0ca33", + "shade_700": "#afb42b", + "shade_800": "#9e9d24", + "shade_900": "#827717", + "shade_A100": "#f4ff81", + "shade_A200": "#eeff41", + "shade_A400": "#c6ff00", + "shade_A700": "#aeea00" + }, + "yellow": { + "shade_50": "#fffde7", + "shade_100": "#fff9c4", + "shade_200": "#fff59d", + "shade_300": "#fff176", + "shade_400": "#ffee58", + "shade_500": "#ffeb3b", + "shade_600": "#fdd835", + "shade_700": "#fbc02d", + "shade_800": "#f9a825", + "shade_900": "#f57f17", + "shade_A100": "#ffff8d", + "shade_A200": "#ffff00", + "shade_A400": "#ffea00", + "shade_A700": "#ffd600" + }, + "amber": { + "shade_50": "#fff8e1", + "shade_100": "#ffecb3", + "shade_200": "#ffe082", + "shade_300": "#ffd54f", + "shade_400": "#ffca28", + "shade_500": "#ffc107", + "shade_600": "#ffb300", + "shade_700": "#ffa000", + "shade_800": "#ff8f00", + "shade_900": "#ff6f00", + "shade_A100": "#ffe57f", + "shade_A200": "#ffd740", + "shade_A400": "#ffc400", + "shade_A700": "#ffab00" + }, + "orange": { + "shade_50": "#fff3e0", + "shade_100": "#ffe0b2", + "shade_200": "#ffcc80", + "shade_300": "#ffb74d", + "shade_400": "#ffa726", + "shade_500": "#ff9800", + "shade_600": "#fb8c00", + "shade_700": "#f57c00", + "shade_800": "#ef6c00", + "shade_900": "#e65100", + "shade_A100": "#ffd180", + "shade_A200": "#ffab40", + "shade_A400": "#ff9100", + "shade_A700": "#ff6d00" + }, + "deepOrange": { + "shade_50": "#fbe9e7", + "shade_100": "#ffccbc", + "shade_200": "#ffab91", + "shade_300": "#ff8a65", + "shade_400": "#ff7043", + "shade_500": "#ff5722", + "shade_600": "#f4511e", + "shade_700": "#e64a19", + "shade_800": "#d84315", + "shade_900": "#bf360c", + "shade_A100": "#ff9e80", + "shade_A200": "#ff6e40", + "shade_A400": "#ff3d00", + "shade_A700": "#dd2c00" + }, + "brown": { + "shade_50": "#efebe9", + "shade_100": "#d7ccc8", + "shade_200": "#bcaaa4", + "shade_300": "#a1887f", + "shade_400": "#8d6e63", + "shade_500": "#795548", + "shade_600": "#6d4c41", + "shade_700": "#5d4037", + "shade_800": "#4e342e", + "shade_900": "#3e2723" + }, + "grey": { + "shade_50": "#fafafa", + "shade_100": "#f5f5f5", + "shade_200": "#eeeeee", + "shade_300": "#e0e0e0", + "shade_400": "#bdbdbd", + "shade_500": "#9e9e9e", + "shade_600": "#757575", + "shade_700": "#616161", + "shade_800": "#424242", + "shade_900": "#212121" + }, + "blueGrey": { + "shade_50": "#eceff1", + "shade_100": "#cfd8dc", + "shade_200": "#b0bec5", + "shade_300": "#90a4ae", + "shade_400": "#78909c", + "shade_500": "#607d8b", + "shade_600": "#546e7a", + "shade_700": "#455a64", + "shade_800": "#37474f", + "shade_900": "#263238" + } +} \ No newline at end of file diff --git a/www/js/polyfills.js b/www/js/polyfills.js new file mode 100644 index 0000000..5f7c0a2 --- /dev/null +++ b/www/js/polyfills.js @@ -0,0 +1,7 @@ + +// https://stackoverflow.com/a/33106217 +if (typeof String.prototype.startsWith != 'function') { + String.prototype.startsWith = function (str) { + return this.indexOf(str) === 0; + }; +} \ No newline at end of file diff --git a/www/js/sidemenu.js b/www/js/sidemenu.js index 98975b5..d0d6771 100644 --- a/www/js/sidemenu.js +++ b/www/js/sidemenu.js @@ -17,6 +17,29 @@ /* * sidemenu.js */ + +// This code from +// https://stackoverflow.com/a/6177502 +$.cssHooks.backgroundColor = { + get: function(elem) { + if (elem.currentStyle) + var bg = elem.currentStyle["backgroundColor"]; + else if (window.getComputedStyle) + var bg = document.defaultView.getComputedStyle(elem, + null).getPropertyValue("background-color"); + if (bg.search("rgb") == -1) + return bg; + else { + bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); + function hex(x) { + return ("0" + parseInt(x).toString(16)).slice(-2); + } + return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]); + } + } +} + + function openmenu() { if ($('#swipe-nav').css('display') == 'none') { $('#swipe-shader').show("fade", {}, 300); @@ -44,12 +67,14 @@ $(document).ready(function () { var user = $('#navbar-collapse .navbar-right').html(); //$('body').append("
\n
    " + pages + "
\n
    " + user + "
"); var username = "%%USERNAME%%"; - var menucolor = $('.navbar').css('background-color'); + var menucolor = $('.navbar').css('backgroundColor'); var textcolor = $('.navbar .navbar-nav > li > a').css('color'); var logo = "%%LOGO%%"; $('body').append("
" + username + "
\n
    " + pages + "
"); $('body').append("
"); - + + parent.postMessage("setcolor " + menucolor, "*"); + $('button.navbar-toggle[data-toggle="collapse"]').click(togglemenu); $('#swipe-shader').click(togglemenu); diff --git a/www/views/app.html b/www/views/app.html index 7b60dab..7150f67 100644 --- a/www/views/app.html +++ b/www/views/app.html @@ -1,8 +1,25 @@ - + + \ No newline at end of file diff --git a/www/views/appspinner.html b/www/views/appspinner.html index fe84713..7efe86e 100644 --- a/www/views/appspinner.html +++ b/www/views/appspinner.html @@ -13,6 +13,7 @@ display: flex; align-items: center; justify-content: center; + flex-direction: column; } .spinner { @@ -89,5 +90,7 @@ + +

Logging in...

diff --git a/www/views/home.html b/www/views/home.html index 31c0760..5493064 100644 --- a/www/views/home.html +++ b/www/views/home.html @@ -9,12 +9,6 @@ \ No newline at end of file diff --git a/www/views/settings.html b/www/views/settings.html index 36fd08a..f2deae2 100644 --- a/www/views/settings.html +++ b/www/views/settings.html @@ -1,7 +1,14 @@ +
+
+ Open Portal +

Manage your account.

+
+
+
Log out and unpair -

Forget all stored user data. You will need to run the setup again.

+

Forget all stored user data and open the setup tool.

@@ -25,4 +32,8 @@ }, "App Reset", 'Continue'); }, "Are you sure?"); } + + function openportal() { + openapp("portal", "/mobile/index.php", localStorage.getItem("portalurl").replace("/mobile/index.php", ""), "/static/img/logo.svg", "Portal", false, true); + } diff --git a/www/views/setup1.html b/www/views/setup1.html index cf74fd7..5b5662d 100644 --- a/www/views/setup1.html +++ b/www/views/setup1.html @@ -8,11 +8,111 @@

Open Portal on another device and go to your account settings. Generate a mobile sync code, then press the button below to scan it.

-
Scan Code
+ + Scan Code + + + Manual Setup + + \ No newline at end of file