Prepare repo

This commit is contained in:
Dryusdan 2017-06-09 22:20:53 +02:00
parent bc023fd932
commit 600651a74e
4 changed files with 502 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/nbproject/

331
assets/css/sass/app.scss Normal file
View File

@ -0,0 +1,331 @@
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400);
@import url(//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css);
// Z-INDEXs:
// 100 - main
// 200 - windows
// 300 - header, menu
// 400 - screensaver
// THEMING VARIABLES
$desktopBackground: linear-gradient(to right top, #8e44ad, #3498db);
$screensaverBackground: linear-gradient(#24C6DC 10%, #514A9D 90%) whitesmoke;
$headerBackground: rgba(255, 255, 255, 0.3);
$menuBackground: rgba(255, 255, 255, 0.3);
$menuFooterBackground: rgba(255, 255, 255, 0.3);
$windowBackground: rgba(255, 255, 255, 0.3);
$windowTextColor: whitesmoke;
// STYLES
*, *:after, *:before {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
background: #333;
overflow: hidden;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: auto;
-moz-text-size-adjust: 100%;
text-rendering: optimizelegibility;
color: whitesmoke;
font: 400 normal 16px/20px 'Raleway', 'Quicksand', 'Open Sans', 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', 'Helvetica', 'Arial', 'Lucida Grande', sans-serif;
}
// HEADER
header {
position: fixed;
top: 0;
left: 0;
z-index: 300;
width: 100%;
height: 30px;
line-height: 30px;
box-shadow: 0 0 15px 2px rgba(0, 0, 0, 0.1);
color: whitesmoke;
background: $headerBackground;
//background: #333;
//border-bottom: 2px solid #709AD1;
> * {
margin: 0 0.5rem;
}
> span {
display: inline-block;
cursor: pointer;
&:hover {
color: gold;
}
}
}
// MENU
#menu {
display: block;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
min-width: 280px;
width: 70%;
min-height: 300px;
height: 70%;
background: $menuBackground;
overflow: hidden;
z-index: 300;
.menu-item {
display: inline-block;
width: 64px;
height: 64px;
color: black;
text-align: center;
cursor: pointer;
margin: 1rem;
outline: 1px dotted red;
i {
}
p {
}
}
.menu-content {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: calc(100% - 100px);
overflow: auto;
padding: 1rem;
}
.menu-footer {
display: block;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
background: $menuFooterBackground;
overflow: hidden;
padding: 1rem;
text-align: center;
.menu-item {
margin: 0 1rem;
}
}
}
// MAIN
main {
position: fixed;
top: 0;
left: 0;
z-index: 100;
width: 100%;
height: 100%;
padding: 30px 0 0 0;
background: $desktopBackground;
}
.screensaver {
position: fixed;
top: 0;
left: 0;
z-index: 400;
width: 100%;
height: 100%;
background: $screensaverBackground;
text-align: center;
color: whitesmoke;
font-weight: 300;
> .content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
time {
display: block;
font-size: 1.5rem;
line-height: 1.25 * 1.5rem;
&:first-of-type {
font-size: 5rem;
line-height: 1.25 * 5rem;
}
}
}
> .unlock {
position: absolute;
top: 75%;
left: 50%;
transform: translateX(-50%);
text-shadow: 0 0 5px whitesmoke;
color: rgba(255, 255, 255, 0.5);
animation: flash 1500ms ease infinite alternate;
}
}
@keyframes flash {
0% { opacity: 0; }
75% { opacity: 1; }
}
// MISCELLANEOUS
button {
color: inherit;
font: inherit;
padding: 0.5rem;
margin: 1rem 0 0 0;
background: none;
border: 1px solid rgba(255, 255, 255, 0.2);
cursor: pointer;
&:hover {
background: rgba(255, 255, 255, 0.1);
}
&:active {
background: rgba(0, 0, 0, 0.1);
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2) inset;
}
}
a {
text-decoration: none;
color: #666;
&:hover {}
&:active {}
}
// WINDOW
.window {
position: absolute;
z-index: 200;
min-width: 200px;
max-width: 100%;
max-height: 100%;
background: $windowBackground;
box-shadow: 0 0 15px 2px rgba(0, 0, 0, 0.1);
color: $windowTextColor;
font-size: 14px;
resize: both;
overflow: auto;
.header {
position: absolute;
width: 100%;
padding: 0.5rem;
cursor: move;
background: rgba(255, 255, 255, 0.1);
//background: #333;
//border-bottom: 2px solid #709AD1;
//color: gold;
h1 {
text-align: center;
font-size: 1.2rem;
font-weight: 400;
//text-shadow: rgba(0, 0, 0, 0.3) -1px -2px, rgba(255, 255, 255, 0.7) 0px 1px 2px;
}
> .close {
position: absolute;
right: 1rem;
top: 0.5rem;
cursor: pointer;
}
}
.sub-header {
background: rgba(255, 255, 255, 0.1);
padding: 0.5rem;
}
.content {
padding: 2.5rem 0 0 0;
overflow: auto;
.file-item {
display: inline-block;
position: relative;
width: 100px;
margin: 1rem;
text-align: center;
cursor: pointer;
resize: none;
> .icon {
display: block;
position: relative;
width: 100px;
height: 100px;
text-align: center;
&:hover {
background: rgba(255, 255, 255, 0.1);
}
&:active {
background: rgba(255, 255, 255, 0.2);
}
&.folder {
background: linear-gradient(rgba(34, 201, 232, 0.5), rgba(20, 85, 219, 0.5));
//background: linear-gradient(#22c9e8, #1455db);
border-radius: 0 0 4px 4px;
&:before {
content: '';
display: block;
position: absolute;
top: -3px;
left: 3px;
background: rgba(255, 255, 255, 0.5);
width: 94px;
height: 3px;
}
> * {
color: rgba(0, 0, 0, 0.1);
//text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.2);
}
}
> * {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
> .label {
display: inline-block;
color: whitesmoke;
padding: 0.2rem 0.5rem;
min-width: 5rem;
background: rgba(0, 0, 0, 0.1);
border-radius: 50px;
text-align: center;
font-size: 0.63rem;
margin: 0.3rem 0 0 0;
overflow: hidden;
}
}
}
}

116
assets/js/app.js Normal file
View File

@ -0,0 +1,116 @@
function setTime(ts) {
var date = new Date(ts);
$('.time').text(date.toLocaleString(navigator.language, {
hour: '2-digit',
minute: '2-digit'
})).attr('datetime', date.getHours() + ':' + date.getMinutes());
$('.date').text(date.toLocaleString(navigator.language, {
year: 'numeric',
month: 'long',
day: 'numeric'
})).attr('datetime', date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate());
setTimeout(function () {
setTime(Date.now());
}, 1000);
}
setTime(Date.now());
$('.screensaver').on('click', function () {
$(this).fadeOut(500);
});
$('#menu').hide();
$('#header-menu').on('click', function () {
$('#menu').fadeIn(500);
});
$('.menu-item').on('click', function () {
$('#menu').fadeOut(500);
});
function Window(settings) {
// ATTRIBUTES
this.id = Date.now();
this.top = settings.top || 50;
this.left = settings.left || 20;
this.title = settings.title || 'New Window';
this.close = settings.close !== undefined ? settings.close : true;
this.draggable = settings.draggable !== undefined ? settings.draggable : true;
this.content = settings.content || null;
// METHODS
this.setContent = function (content) {
this.content = content || null;
var $content = $('#' + this.id).find('.content');
if (this.content) {
this.content.forEach(function (item, index, array) {
var fileitem = '' +
'<div class="file-item">' +
'<div class="icon ' + (item.type || '') + '"><i class="fa fa-4x fa-' + (item.icon || 'question') + '"></i></div>' +
'<div class="label">' + (item.text || 'unknown') + '</div>' +
'</div>';
$content.append(fileitem);
});
}
};
// CONSTRUCTOR
var html = '' +
'<div id="' + this.id + '" class="window" style="top: ' + this.top + 'px; left: ' + this.left + 'px">' +
'<div class="header">' +
'<h1>' + this.title + '</h1>' +
(this.close ? '<div class="close"><i class="fa fa-times"></i></div>' : '') +
'</div>' +
'<div class="content"></div>' +
'</div>';
$('main').append(html);
this.setContent(this.content);
var windowID = this.id;
$('#' + this.id).find('.close').on('click', function () {
$('#' + windowID).fadeOut(200, function () {
$('#' + windowID).remove();
});
});
if (this.draggable) {
$('#' + this.id).draggable({
handle: '.header'
});
}
}
var w = new Window({
top: 50,
left: 20,
title: 'Home',
close: true,
draggable: true,
content: [
{ type: 'folder', icon: 'file', text: 'Documents' },
{ type: 'folder', icon: 'music', text: 'Music' },
{ type: 'folder', icon: 'camera', text: 'Pictures' },
{ type: 'folder', icon: 'video-camera', text: 'Videos' }
]
});
var w = new Window({
top: 300,
left: 250,
title: 'Project Pillow',
close: true,
draggable: true,
content: [
{ type: 'file', icon: 'file-pdf-o', text: 'specs.pdf' },
{ type: 'file', icon: 'file-excel-o', text: 'plan.xls' },
{ type: 'file', icon: 'file-archive-o', text: 'stuff.zip' },
{ type: 'file', icon: 'file-code-o', text: 'project.js' }
]
});

54
index.html Normal file
View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="assets/css/app.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<header><span id="header-menu">Menu</span><span id="header-settings">Settings</span>
<time class="time" style="float: right">time</time>
<time class="date" style="float: right">date</time>
</header>
<div id="menu">
<div class="menu-content">
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
</div>
<div class="menu-footer">
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
<div class="menu-item"><i class="fa fa-cube"></i>
<p>Item</p>
</div>
</div>
</div>
<main></main>
<div class="screensaver">
<div class="content">
<time class="time">time</time>
<time class="date">date</time>
</div>
<div class="unlock">click to unlock</div>
</div>
<script src="assets/js/app.js"></script>
</body>
</html>