Skip to content

Commit

Permalink
Moved homepage site and assets to /src, added show_menu_on_page_load …
Browse files Browse the repository at this point in the history
…option to config, updated jQuery to 3.5.1
  • Loading branch information
tomershvueli committed Jun 25, 2020
1 parent ca7008f commit 9b0034c
Show file tree
Hide file tree
Showing 21 changed files with 16 additions and 8 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ 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.
- `items` => Array of objects for links to be displayed. The menu will be in a grid of 3 icons per row on desktop. Object shape:
- `link` => Insert any link you'd like, or {{cur}} for the current URL of the page, i.e. `{{cur}}:32400/web/`.
Expand Down
2 changes: 0 additions & 2 deletions hp_assets/js/jquery.min.js

This file was deleted.

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,
"items" : [
{
"alt" : "Facebook",
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
2 changes: 2 additions & 0 deletions src/hp_assets/js/jquery.min.js

Large diffs are not rendered by default.

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 @@ -40,11 +40,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 @@ -136,4 +136,5 @@ $(function() {

updateClock();
setInterval('updateClock()', 1000);
setMenuVisibility(menuHidden); // Set menu visibility on page load
});
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 9b0034c

Please sign in to comment.