Skip to content

Commit

Permalink
Updated jQuery, put application in /src, added option for show_menu_o…
Browse files Browse the repository at this point in the history
…n_page_load
  • Loading branch information
tomershvueli committed Jun 25, 2020
1 parent 7712041 commit 9b4d7e2
Show file tree
Hide file tree
Showing 24 changed files with 16 additions and 8 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions config.sample.json → src/config.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
7 changes: 4 additions & 3 deletions hp_assets/js/main.js → src/hp_assets/js/main.js
Original file line number Diff line number Diff line change
@@ -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/
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -159,6 +159,7 @@ $(function() {

updateClock();
setInterval('updateClock()', 1000);
setMenuVisibility(menuHidden); // Set menu visibility on page load

getCloudronApps();
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion index.php → src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b4d7e2

Please sign in to comment.