Skip to content

Commit

Permalink
Removed Unsplash
Browse files Browse the repository at this point in the history
Removed Unsplash in order to keep everything simple. (Also the load times were too god damn high)
  • Loading branch information
Kukielka committed Apr 16, 2018
1 parent 05247c7 commit b9dfafa
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
config.json
favicon.ico
favicon.ico
21 changes: 4 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
# simple-dash

A simple, fully responsive Dashboard to forward to the services of your choice! Ideal for Desktop and mobile usage!
Based on: https://github.com/thetomester13/homepage

This project uses:
- jQuery
- Bootstrap CSS
- Font Awesome
- Unsplash
- Trianglify

## Screenshots
![Homepage Desktop Trianglify](example_img/homepage-desktop-trianglify.jpg?raw=true)
![Homepage Mobile Trianglify](example_img/homepage-mobile-trianglify.jpg?raw=true)
![Homepage Desktop Unsplash](example_img/homepage-desktop-unsplash.png?raw=true)
![Homepage Mobile Unsplash](example_img/homepage-mobile-unsplash.png?raw=true)
![Homepage Desktop](example_img/homepage-desktop.png?raw=true)
![Homepage Mobile](example_img/homepage-mobile.png?raw=true)

## To Use
Copy the config.sample.json file and rename to config.json. Be sure to update the fields as you see appropriate. You have the option to use the Unsplash API to fetch background images, or use a custom URL and JSON selector. If you choose to use Unsplash, will need to create a developer profile at [Unsplash](https://unsplash.com/) to use the background image functionality properly.
Copy the config.sample.json file and rename to config.json. Be sure to update the fields as you see appropriate.

## Configure Homepage
- 'items' => The menu will scale to the amount of items you want to display. Insert any link you'd like, or {{cur}} for the current URL of the page. Choose icons from [Font Awesome](http://fontawesome.io/icons/)

### Unsplash Background Images
- 'unsplash_client_id' => Get Unsplash client ID from [Unsplash](https://unsplash.com/developers). Leave this blank if you want to use Trianglify!
- 'credits' => Whether you want to give credits to the artists, or not.

### Custom Background Images
- 'custom_url' => Input a custom URL that will return proper JSON
- 'custom_url_headers' => Add any headers that may be needed to complete a cURL request to the aforementioned URL properly
- 'custom_url_selector' => Input a proper PHP array selector to be used on the JSON received above. For example, if I were to fetch from Github's user API with a 'custom_url' of 'https://api.github.com/users/octocat', the 'custom_url_selector' would simply be "['avatar_url']". [{random}] can be replaced for a random index in an array.
- 'items' => The menu will scale to the amount of items you want to display. Insert any link you'd like, or {{cur}} for the current URL of the page. Choose icons from [Font Awesome](http://fontawesome.io/icons/)
5 changes: 0 additions & 5 deletions config.sample.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"title" : "Your Homepage Title",
"credits" : true,
"custom_url" : "",
"custom_url_selector" : "",
"custom_url_headers" : [],
"unsplash_client_id" : "Make yourself an Unsplash Account here: https://unsplash.com/developers (Leave blank for Trianglify)",
"items" : [
{
"alt" : "Github",
Expand Down
Binary file removed example_img/homepage-desktop-unsplash.png
Binary file not shown.
File renamed without changes
Binary file removed example_img/homepage-mobile-unsplash.png
Binary file not shown.
File renamed without changes
73 changes: 37 additions & 36 deletions hp_assets/css/main.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
html {height: 100%; width: 100%;}
body {font-family: sans-serif; z-index: 1; height: 100%; width: 100%; background-position: center; background-attachment: fixed;}

.hidden {display: none;}
.menu-item {display: none; z-index: 3;}

#bg-overlay {
position:fixed;
padding:0;
margin:0;
top:0;
left:0;
width: 100%;
html {
height: 100%;
background-color: #fff;
opacity: 0;
z-index: 2;
transition: .3s all;
width: 100%;
}

body.menu-shown #bg-overlay {opacity: 0.3;}

#mobile-menu-wrap {z-index: 3; position: absolute; top: 15px; left: 15px;}
#mobile-menu-wrap a {font-size: 20px;}
body {
font-family: sans-serif;
z-index: 1;
height: 100%;
width: 100%;
background-position: center;
background-attachment: fixed;
}

.bg {
border-radius: 5px;
background-color: rgba(0, 0, 0, .5);
border-radius: 6px;
background-color: rgba(0, 0, 0, .4);
padding: 20px;
}

Expand All @@ -35,29 +24,41 @@ body.menu-shown #bg-overlay {opacity: 0.3;}

#links-wrap {
font-size: 80px;

position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);

padding-bottom: 3px;

width: fit-content;
height: auto;

max-width: 75%;
max-width: 80%;
max-height: 85%;

overflow: auto;
display: flex;
}

#links-wrap a {transition: .3s all;}
#links-wrap a:hover {color: #d3d3d3;}
#links-wrap .link {display: inline-block; width: 33%; float: left; text-align: center;}
#links-wrap::-webkit-scrollbar {width: 10px; background-color: transparent;}
#links-wrap::-webkit-scrollbar-thumb {border-radius: 10px; -webkit-box-shadow: inset 0 0 3px rgba(0,0,0,.4); background-color: rgba(255,255,255,.2);}
#links-wrap a {
transition: .3s all;
}

#links-wrap a:hover {
color: #c4c4c4;
}

#links-wrap .link {
display: inline-block;
width: 33%;
float: left;
text-align: center;
}

#links-wrap::-webkit-scrollbar {
width: 10px;
background-color: transparent;
}

#pic-info-wrap {color: #fff; font-size: 16px; position: absolute; bottom: 15px; left: 15px;}
#pic-info-wrap a:hover, #pic-info-wrap a:active {color: #fff; text-decoration: none;}
#links-wrap::-webkit-scrollbar-thumb {
border-radius: 6px;
-webkit-box-shadow: inset 0 0 3px rgba(0,0,0,.4);
background-color: rgba(255,255,255,.2);
}
53 changes: 0 additions & 53 deletions hp_assets/js/main.js

This file was deleted.

66 changes: 0 additions & 66 deletions hp_assets/lib/ajax_get_image.php

This file was deleted.

38 changes: 7 additions & 31 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function get_current_url() {
return $protocol . $domainName;
}
?>

<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand All @@ -24,45 +25,25 @@ function get_current_url() {
</head>

<body id="homepage">
<div id="bg-overlay">&nbsp;</div>
<!-- Line below is to preload the font when the page loads -->
<span class="fa fa-asterisk" style="opacity: 0;">&nbsp;</span>

<div id="links-wrap" class="menu-item bg">
<center><p>
<?php
echo '<center><p>';
foreach ($config['items'] as $i => $item) {
$icon = $item['icon'];
$link = str_replace("{{cur}}", get_current_url(), $item['link']);

echo '<a href="' . $link . '" title="' . $item['alt'] . '"><i class="fa ' . $icon . ' fa-fw"></i></a>';
}
echo '</p></center>';
?>
</p></center>
</div>
<?php
if ($config['credits'] == true) {
echo '<div id="pic-info-wrap" class="menu-item hidden bg">';
echo ' <span id="pic-info">Picture by <a href="#" id="pic-info-url"></a></span>';
echo '</div>';
}
?>


<script type="text/javascript" src="hp_assets/js/jquery.min.js"></script>
<script type="text/javascript" src="hp_assets/js/main.js"></script>

<script src="hp_assets/js/trianglify.min.js"></script>
<script>
function addTriangleTo(target) {
var dimensions = target.getClientRects()[0];
var pattern = Trianglify({
<?php
if ($config['unsplash_client_id'] != "") {
echo 'x_colors: \'Greys\',';
echo 'y_colors: \'match_x\',';
}
?>
width: dimensions.width,
height: dimensions.height
});
Expand All @@ -74,16 +55,11 @@ function addTriangleTo(target) {
}

var resizeTimer;

$(window).on('resize', function(e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
<?php
if ($config['unsplash_client_id'] == "") {
echo 'addTriangleTo(homepage)';
}
?>
}, 400);
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
<?php echo 'addTriangleTo(homepage)'; ?>
}, 400);
});

addTriangleTo(homepage);
Expand Down

0 comments on commit b9dfafa

Please sign in to comment.