From 9b4d7e283d8a19c8916162d69c3f4c3adba26b3b Mon Sep 17 00:00:00 2001 From: Tomer Shvueli Date: Wed, 24 Jun 2020 22:43:47 -0400 Subject: [PATCH] Updated jQuery, put application in /src, added option for show_menu_on_page_load --- README.md | 9 +++++---- .gitignore => src/.gitignore | 0 .htaccess => src/.htaccess | 0 config.sample.json => src/config.sample.json | 1 + favicon.ico => src/favicon.ico | Bin {hp_assets => src/hp_assets}/css/bootstrap.min.css | 0 .../hp_assets}/css/font-awesome.min.css | 0 {hp_assets => src/hp_assets}/css/main.css | 0 {hp_assets => src/hp_assets}/fonts/FontAwesome.otf | Bin .../hp_assets}/fonts/fontawesome-webfont.eot | Bin .../hp_assets}/fonts/fontawesome-webfont.svg | 0 .../hp_assets}/fonts/fontawesome-webfont.ttf | Bin .../hp_assets}/fonts/fontawesome-webfont.woff | Bin .../hp_assets}/fonts/fontawesome-webfont.woff2 | Bin {hp_assets => src/hp_assets}/img/cache/README.md | 0 {hp_assets => src/hp_assets}/img/sayagata-400px.png | Bin {hp_assets => src/hp_assets}/js/jquery.min.js | 0 {hp_assets => src/hp_assets}/js/main.js | 7 ++++--- {hp_assets => src/hp_assets}/js/mousetrap.min.js | 0 {hp_assets => src/hp_assets}/lib/_request.php | 0 {hp_assets => src/hp_assets}/lib/ajax_get_apps.php | 0 {hp_assets => src/hp_assets}/lib/ajax_get_image.php | 0 .../hp_assets}/lib/render_cloudron_app_icon.php | 0 index.php => src/index.php | 7 ++++++- 24 files changed, 16 insertions(+), 8 deletions(-) rename .gitignore => src/.gitignore (100%) rename .htaccess => src/.htaccess (100%) rename config.sample.json => src/config.sample.json (91%) rename favicon.ico => src/favicon.ico (100%) rename {hp_assets => src/hp_assets}/css/bootstrap.min.css (100%) rename {hp_assets => src/hp_assets}/css/font-awesome.min.css (100%) rename {hp_assets => src/hp_assets}/css/main.css (100%) rename {hp_assets => src/hp_assets}/fonts/FontAwesome.otf (100%) rename {hp_assets => src/hp_assets}/fonts/fontawesome-webfont.eot (100%) rename {hp_assets => src/hp_assets}/fonts/fontawesome-webfont.svg (100%) rename {hp_assets => src/hp_assets}/fonts/fontawesome-webfont.ttf (100%) rename {hp_assets => src/hp_assets}/fonts/fontawesome-webfont.woff (100%) rename {hp_assets => src/hp_assets}/fonts/fontawesome-webfont.woff2 (100%) rename {hp_assets => src/hp_assets}/img/cache/README.md (100%) rename {hp_assets => src/hp_assets}/img/sayagata-400px.png (100%) rename {hp_assets => src/hp_assets}/js/jquery.min.js (100%) rename {hp_assets => src/hp_assets}/js/main.js (97%) rename {hp_assets => src/hp_assets}/js/mousetrap.min.js (100%) rename {hp_assets => src/hp_assets}/lib/_request.php (100%) rename {hp_assets => src/hp_assets}/lib/ajax_get_apps.php (100%) rename {hp_assets => src/hp_assets}/lib/ajax_get_image.php (100%) rename {hp_assets => src/hp_assets}/lib/render_cloudron_app_icon.php (100%) rename index.php => src/index.php (92%) diff --git a/README.md b/README.md index 006273b..df0f650 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,12 @@ Copy the config.sample.json file and rename to config.json. Be sure to update th ## Configure Homepage - `unlock_pattern` => Choose unlock pattern from [Mousetrap](https://craig.is/killing/mice) - `clock_format` => Choose pattern format from [PHP's date function](http://php.net/manual/en/function.date.php) -- `hover_color` => The CSS color for menu items when hovered over -- `time_to_refresh_bg` => Time, in milliseconds, until it will fetch the next background image +- `hover_color` => The CSS color for menu items when hovered over. Defaults to `#999`. +- `time_to_refresh_bg` => Time, in milliseconds, until it will fetch the next background image. Defaults to `20000`. +- `show_menu_on_page_load` => Boolean as to whether the menu should be shown when you first load the page. Defaults to `false`. - `idle_timer` => Set a number of milliseconds here if you'd like to automatically hide the menu after a certain time of inactivity. Leave this attribute out entirely if you don't want an idle timer. -- `cloudron_api_url` => The url of your Cloudron dashboard, i.e. my.example.com. -- `cloudron_api_access_token` => An API access token so that we can query the apps installed in the Cloudron instance. You can get an API access token by visiting your Cloudron dashboard and adding an `/tokens` to the end of the url instead of `/apps`, i.e. my.example.com/#/tokens. +- `cloudron_api_url` => The url of your Cloudron dashboard, i.e. `https://my.example.com`. +- `cloudron_api_access_token` => An API access token so that we can query the apps installed in the Cloudron instance. You can get an API access token by visiting your Cloudron dashboard and adding an `/profile` to the end of the url instead of `/apps`, i.e. `https://my.example.com/#/profile`. __NOTE__: PHP cURL is required for fetching external images. diff --git a/.gitignore b/src/.gitignore similarity index 100% rename from .gitignore rename to src/.gitignore diff --git a/.htaccess b/src/.htaccess similarity index 100% rename from .htaccess rename to src/.htaccess diff --git a/config.sample.json b/src/config.sample.json similarity index 91% rename from config.sample.json rename to src/config.sample.json index 3965fc1..954a3b8 100644 --- a/config.sample.json +++ b/src/config.sample.json @@ -5,6 +5,7 @@ "hover_color" : "#999", "time_to_refresh_bg" : 20000, "idle_timer" : 60000, + "show_menu_on_page_load": false, "cloudron_api_url": "", "protected": { "cloudron_api_access_token": "", diff --git a/favicon.ico b/src/favicon.ico similarity index 100% rename from favicon.ico rename to src/favicon.ico diff --git a/hp_assets/css/bootstrap.min.css b/src/hp_assets/css/bootstrap.min.css similarity index 100% rename from hp_assets/css/bootstrap.min.css rename to src/hp_assets/css/bootstrap.min.css diff --git a/hp_assets/css/font-awesome.min.css b/src/hp_assets/css/font-awesome.min.css similarity index 100% rename from hp_assets/css/font-awesome.min.css rename to src/hp_assets/css/font-awesome.min.css diff --git a/hp_assets/css/main.css b/src/hp_assets/css/main.css similarity index 100% rename from hp_assets/css/main.css rename to src/hp_assets/css/main.css diff --git a/hp_assets/fonts/FontAwesome.otf b/src/hp_assets/fonts/FontAwesome.otf similarity index 100% rename from hp_assets/fonts/FontAwesome.otf rename to src/hp_assets/fonts/FontAwesome.otf diff --git a/hp_assets/fonts/fontawesome-webfont.eot b/src/hp_assets/fonts/fontawesome-webfont.eot similarity index 100% rename from hp_assets/fonts/fontawesome-webfont.eot rename to src/hp_assets/fonts/fontawesome-webfont.eot diff --git a/hp_assets/fonts/fontawesome-webfont.svg b/src/hp_assets/fonts/fontawesome-webfont.svg similarity index 100% rename from hp_assets/fonts/fontawesome-webfont.svg rename to src/hp_assets/fonts/fontawesome-webfont.svg diff --git a/hp_assets/fonts/fontawesome-webfont.ttf b/src/hp_assets/fonts/fontawesome-webfont.ttf similarity index 100% rename from hp_assets/fonts/fontawesome-webfont.ttf rename to src/hp_assets/fonts/fontawesome-webfont.ttf diff --git a/hp_assets/fonts/fontawesome-webfont.woff b/src/hp_assets/fonts/fontawesome-webfont.woff similarity index 100% rename from hp_assets/fonts/fontawesome-webfont.woff rename to src/hp_assets/fonts/fontawesome-webfont.woff diff --git a/hp_assets/fonts/fontawesome-webfont.woff2 b/src/hp_assets/fonts/fontawesome-webfont.woff2 similarity index 100% rename from hp_assets/fonts/fontawesome-webfont.woff2 rename to src/hp_assets/fonts/fontawesome-webfont.woff2 diff --git a/hp_assets/img/cache/README.md b/src/hp_assets/img/cache/README.md similarity index 100% rename from hp_assets/img/cache/README.md rename to src/hp_assets/img/cache/README.md diff --git a/hp_assets/img/sayagata-400px.png b/src/hp_assets/img/sayagata-400px.png similarity index 100% rename from hp_assets/img/sayagata-400px.png rename to src/hp_assets/img/sayagata-400px.png diff --git a/hp_assets/js/jquery.min.js b/src/hp_assets/js/jquery.min.js similarity index 100% rename from hp_assets/js/jquery.min.js rename to src/hp_assets/js/jquery.min.js diff --git a/hp_assets/js/main.js b/src/hp_assets/js/main.js similarity index 97% rename from hp_assets/js/main.js rename to src/hp_assets/js/main.js index d95d4bd..e51d52c 100644 --- a/hp_assets/js/main.js +++ b/src/hp_assets/js/main.js @@ -1,4 +1,4 @@ -let menuHidden = true; +let menuHidden = $.config.show_menu_on_page_load; let randBgTimer = null; // Simulates PHP's date function - http://jacwright.com/projects/javascript/date_format/ @@ -28,11 +28,11 @@ function toggleMenu() { function setMenuVisibility(visible) { if (visible) { - $(".menu-item").fadeIn(); + $(".menu-item").fadeIn(250); $("body").addClass("menu-shown"); menuHidden = false; } else { - $(".menu-item").fadeOut(); + $(".menu-item").fadeOut(250); $("body").removeClass("menu-shown"); menuHidden = true; } @@ -159,6 +159,7 @@ $(function() { updateClock(); setInterval('updateClock()', 1000); + setMenuVisibility(menuHidden); // Set menu visibility on page load getCloudronApps(); }); diff --git a/hp_assets/js/mousetrap.min.js b/src/hp_assets/js/mousetrap.min.js similarity index 100% rename from hp_assets/js/mousetrap.min.js rename to src/hp_assets/js/mousetrap.min.js diff --git a/hp_assets/lib/_request.php b/src/hp_assets/lib/_request.php similarity index 100% rename from hp_assets/lib/_request.php rename to src/hp_assets/lib/_request.php diff --git a/hp_assets/lib/ajax_get_apps.php b/src/hp_assets/lib/ajax_get_apps.php similarity index 100% rename from hp_assets/lib/ajax_get_apps.php rename to src/hp_assets/lib/ajax_get_apps.php diff --git a/hp_assets/lib/ajax_get_image.php b/src/hp_assets/lib/ajax_get_image.php similarity index 100% rename from hp_assets/lib/ajax_get_image.php rename to src/hp_assets/lib/ajax_get_image.php diff --git a/hp_assets/lib/render_cloudron_app_icon.php b/src/hp_assets/lib/render_cloudron_app_icon.php similarity index 100% rename from hp_assets/lib/render_cloudron_app_icon.php rename to src/hp_assets/lib/render_cloudron_app_icon.php diff --git a/index.php b/src/index.php similarity index 92% rename from index.php rename to src/index.php index 65b1466..c9b8c7a 100755 --- a/index.php +++ b/src/index.php @@ -3,7 +3,12 @@ * homepage */ - $default_config = array("time_to_refresh_bg" => 20000, "hover_color" => "#999"); // Make sure that we at least always have a value for these + // Make sure that we at least always have a value for these config values + $default_config = array( + "show_menu_on_page_load" => false, + "time_to_refresh_bg" => 20000, + "hover_color" => "#999" + ); $config_file = json_decode(file_get_contents("config.json"), true); $config = array_merge($default_config, $config_file); unset($config['protected']); // Make sure we don't expose any protected fields to the front end