Compare commits
No commits in common. "0c16b43ec78870ca66214cd6712dd55cf2dcf8da" and "610e22b3c9b1b6e9c71c3d52abcd9e0c55d847da" have entirely different histories.
0c16b43ec7
...
610e22b3c9
82 changed files with 66 additions and 122 deletions
15
.eleventy.js
15
.eleventy.js
|
|
@ -32,7 +32,7 @@ export default async function (eleventyConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Demo entfernen
|
// TODO: Demo entfernen
|
||||||
const permalinkPath = await hasFiles('source/view') ? '/demo/' : '/';
|
const permalinkPath = await hasFiles('source/screens') ? '/demo/' : '/';
|
||||||
|
|
||||||
eleventyConfig.addGlobalData('hippie', {
|
eleventyConfig.addGlobalData('hippie', {
|
||||||
brand: 'hippie',
|
brand: 'hippie',
|
||||||
|
|
@ -130,13 +130,14 @@ export default async function (eleventyConfig) {
|
||||||
eleventyConfig.addPassthroughCopy({'node_modules/hippie-script/index.js': 'vendor/hippie-script.js'});
|
eleventyConfig.addPassthroughCopy({'node_modules/hippie-script/index.js': 'vendor/hippie-script.js'});
|
||||||
|
|
||||||
eleventyConfig.addWatchTarget('./source/style/');
|
eleventyConfig.addWatchTarget('./source/style/');
|
||||||
}
|
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
return {
|
||||||
export const config = {
|
|
||||||
dir: {
|
dir: {
|
||||||
input: 'source/view',
|
input: 'source/screens',
|
||||||
output: 'build'
|
output: 'build',
|
||||||
|
includes: '../templates',
|
||||||
|
data: '../data'
|
||||||
},
|
},
|
||||||
templateFormats: ['html', 'liquid', 'md', 'njk']
|
templateFormats: ['html', 'liquid', 'md', 'njk']
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
16
.jshintrc
16
.jshintrc
|
|
@ -14,20 +14,20 @@
|
||||||
"unused": false,
|
"unused": false,
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"globals": {
|
"globals": {
|
||||||
"DateDisplay": true,
|
|
||||||
"HIPPIE": false,
|
"HIPPIE": false,
|
||||||
"HippieTaskBar": true,
|
"hippie": true,
|
||||||
"TimeDisplay": true,
|
"viewHover": true,
|
||||||
"basicEase": true,
|
"basicEase": true,
|
||||||
"centerElementUnderCursor": false,
|
|
||||||
"checkButtonAndTarget": false,
|
|
||||||
"debugOn": true,
|
"debugOn": true,
|
||||||
|
"TimeDisplay": true,
|
||||||
|
"DateDisplay": true,
|
||||||
|
"checkButtonAndTarget": false,
|
||||||
"getClosestEdgeToElement": false,
|
"getClosestEdgeToElement": false,
|
||||||
"getClosestEdgeToMouse": false,
|
"getClosestEdgeToMouse": false,
|
||||||
"hippie": true,
|
"centerElementUnderCursor": false,
|
||||||
|
"setAttributesAccordingToPosition": false,
|
||||||
"randomIntFrom": false,
|
"randomIntFrom": false,
|
||||||
"readJsonFile": false,
|
|
||||||
"replaceLineBreaks": false,
|
"replaceLineBreaks": false,
|
||||||
"viewHover": true
|
"HippieTaskBar": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
TODO.md
5
TODO.md
|
|
@ -1,5 +1,6 @@
|
||||||
# General
|
# General
|
||||||
|
|
||||||
|
- Remove gulp and legacy files
|
||||||
- Better README with more info for the content section
|
- Better README with more info for the content section
|
||||||
- Explain eleventy usage
|
- Explain eleventy usage
|
||||||
- Complete CHANGELOG
|
- Complete CHANGELOG
|
||||||
|
|
@ -7,10 +8,6 @@
|
||||||
- Add dynamic content to robots.txt during build process
|
- Add dynamic content to robots.txt during build process
|
||||||
- Add dynamic content to sitemap.xml
|
- Add dynamic content to sitemap.xml
|
||||||
|
|
||||||
# 11ty
|
|
||||||
|
|
||||||
- Look into teh difference of layouts and templates
|
|
||||||
|
|
||||||
# CSS
|
# CSS
|
||||||
|
|
||||||
- Check style for every basic element
|
- Check style for every basic element
|
||||||
|
|
|
||||||
|
|
@ -394,6 +394,20 @@ function centerElementUnderCursor(event, element) {
|
||||||
element.style.top = `${y}px`;
|
element.style.top = `${y}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setAttributesAccordingToPosition(element, position, attributes) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
element.classList.remove(...Object.values(attributes).map(pos => pos.className));
|
||||||
|
Object.keys(attributes[position].styles).forEach(key => {
|
||||||
|
element.style[key] = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
element.classList.add(attributes[position].className);
|
||||||
|
Object.entries(attributes[position].styles).forEach(([key, value]) => {
|
||||||
|
element.style[key] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt eine Zahl zwischen <min> und <max> aus.
|
* Gibt eine Zahl zwischen <min> und <max> aus.
|
||||||
* Die Werte <min> und <max> sind dabei mit eingeschlossen.
|
* Die Werte <min> und <max> sind dabei mit eingeschlossen.
|
||||||
|
|
@ -542,37 +556,9 @@ function zeroFill(number, width) {
|
||||||
// Retrieved 2026-03-08, License - CC BY-SA 4.0
|
// Retrieved 2026-03-08, License - CC BY-SA 4.0
|
||||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||||
|
|
||||||
async function readJsonFile(file) {
|
class RandomPixelCanvas {
|
||||||
return new Promise((resolve, reject) => {
|
constructor(containerElement, options = {}) {
|
||||||
const reader = new FileReader();
|
this.container = containerElement;
|
||||||
|
|
||||||
reader.readAsText(file);
|
|
||||||
reader.onload = function () {
|
|
||||||
try {
|
|
||||||
resolve(JSON.parse(reader.result));
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
reader.onerror = function () {
|
|
||||||
reject(reader.error);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadJson(filePath) {
|
|
||||||
try {
|
|
||||||
const response = await fetch(filePath);
|
|
||||||
|
|
||||||
if (!response.ok) throw new Error(`Failed to load file: ${response.status}`);
|
|
||||||
|
|
||||||
return await response.json();
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error loading file:', error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RandomPixelPlaceholder {
|
class RandomPixelPlaceholder {
|
||||||
constructor(parent, options = {}) {
|
constructor(parent, options = {}) {
|
||||||
this.container = parent;
|
this.container = parent;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@ class HippieTaskBar {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.placeholder = placeholder;
|
this.placeholder = placeholder;
|
||||||
this.date = null;
|
this.date = null;
|
||||||
this.time = null;
|
|
||||||
this.isDragging = false;
|
this.isDragging = false;
|
||||||
this.barSize = '';
|
this.barSize = '';
|
||||||
// TODO: Ergänzen und nicht ersetzen
|
// TODO: Erweitern auf allgemeine Möglichkeiten und dann aus JSON-Datei laden
|
||||||
this.options = options || {
|
this.options = options || {
|
||||||
direction: 0,
|
direction: 0,
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
|
|
@ -14,8 +13,7 @@ class HippieTaskBar {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: '2-digit',
|
month: '2-digit',
|
||||||
day: '2-digit'
|
day: '2-digit'
|
||||||
},
|
}
|
||||||
time: {hour: '2-digit', minute: '2-digit'}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
|
|
@ -27,20 +25,11 @@ class HippieTaskBar {
|
||||||
document.addEventListener('pointermove', this.onMove.bind(this));
|
document.addEventListener('pointermove', this.onMove.bind(this));
|
||||||
document.addEventListener('pointerup', this.onUp.bind(this));
|
document.addEventListener('pointerup', this.onUp.bind(this));
|
||||||
|
|
||||||
const clock = this.element.querySelector('.clock');
|
|
||||||
const dateElement = document.createElement('span');
|
const dateElement = document.createElement('span');
|
||||||
const timeElement = document.createElement('span');
|
|
||||||
const br = document.createElement('br');
|
|
||||||
|
|
||||||
dateElement.id = 'date';
|
dateElement.id = 'date';
|
||||||
timeElement.id = 'time';
|
this.element.querySelector('.clock').appendChild(dateElement);
|
||||||
this.date = new DateDisplay(dateElement, this.options.date);
|
this.date = new DateDisplay(dateElement, this.options.date);
|
||||||
this.time = new TimeDisplay(timeElement, this.options.time);
|
|
||||||
|
|
||||||
// TODO: Reihenfolge anpassbar machen
|
|
||||||
clock.appendChild(timeElement);
|
|
||||||
clock.appendChild(br);
|
|
||||||
clock.appendChild(dateElement);
|
|
||||||
|
|
||||||
this.setOptions(this.options.position);
|
this.setOptions(this.options.position);
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +111,7 @@ class HippieTaskBar {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setAttributesAccordingToPosition(this.placeholder, this.options.position, attributes);
|
setAttributesAccordingToPosition(this.placeholder, this.options.position, attributes);
|
||||||
centerElementUnderCursor(event, this.placeholder);
|
centerElementUnderCursor(event, this.placeholder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,18 +142,6 @@ class HippieTaskBar {
|
||||||
this.date.changeFormat(this.options.date, this.options.direction);
|
this.date.changeFormat(this.options.date, this.options.direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAttributesAccordingToPosition(element, position, attributes) {
|
|
||||||
element.classList.remove(...Object.values(attributes).map(pos => pos.className));
|
|
||||||
Object.keys(attributes[position].styles).forEach(key => {
|
|
||||||
element.style[key] = '';
|
|
||||||
});
|
|
||||||
|
|
||||||
element.classList.add(attributes[position].className);
|
|
||||||
Object.entries(attributes[position].styles).forEach(([key, value]) => {
|
|
||||||
element.style[key] = value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setOptions(position) {
|
setOptions(position) {
|
||||||
const attributes = {
|
const attributes = {
|
||||||
top: {
|
top: {
|
||||||
|
|
@ -205,7 +182,7 @@ class HippieTaskBar {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setAttributesAccordingToPosition(this.element, position, attributes);
|
setAttributesAccordingToPosition(this.element, position, attributes);
|
||||||
|
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 'right':
|
case 'right':
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"taskbar": {
|
|
||||||
"position": "top",
|
|
||||||
"color": "white",
|
|
||||||
"hover": {
|
|
||||||
"active": true,
|
|
||||||
"color": "#52bed1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"window": {
|
|
||||||
"name": "Custom"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -29,7 +29,10 @@ tags:
|
||||||
<button><i class="bi bi-mic"></i></button>
|
<button><i class="bi bi-mic"></i></button>
|
||||||
<button><i class="bi bi-volume-down"></i></button>
|
<button><i class="bi bi-volume-down"></i></button>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="clock"></div>
|
<div class="clock">
|
||||||
|
<span id="time">##:##</span>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
<nav>
|
<nav>
|
||||||
<button data-action="notification"><i class="bi bi-bell-fill"></i></button>
|
<button data-action="notification"><i class="bi bi-bell-fill"></i></button>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
@ -60,27 +63,20 @@ tags:
|
||||||
const start = document.querySelector('[data-action=start]');
|
const start = document.querySelector('[data-action=start]');
|
||||||
const draggableElement = document.getElementById('task-bar');
|
const draggableElement = document.getElementById('task-bar');
|
||||||
const placeholderElement = document.getElementById('placeholder');
|
const placeholderElement = document.getElementById('placeholder');
|
||||||
|
// TODO: TimeDisplay in HippieTaskbar aufnehmen
|
||||||
|
const timeElement = document.getElementById('time');
|
||||||
|
|
||||||
initializeApp();
|
const taskBar = new HippieTaskBar(draggableElement, placeholderElement);
|
||||||
|
const timeFormat = {hour: '2-digit', minute: '2-digit'};
|
||||||
|
const timeDisplay = new TimeDisplay(timeElement, timeFormat);
|
||||||
|
|
||||||
async function initializeApp() {
|
|
||||||
try {
|
|
||||||
const config = await loadJson('/json/windows.json');
|
|
||||||
// TODO: Elemente in der Klasse selbst erzeugen
|
|
||||||
const taskBar = new HippieTaskBar(draggableElement, placeholderElement, config.taskbar);
|
|
||||||
|
|
||||||
// TODO: In HippieTaskbar aufnehmen
|
|
||||||
document.getElementById('setPause').addEventListener('click', () => {
|
document.getElementById('setPause').addEventListener('click', () => {
|
||||||
taskBar.time.pause();
|
timeDisplay.pause();
|
||||||
console.info('Pause time');
|
console.info('Pause time');
|
||||||
});
|
});
|
||||||
document.getElementById('setPlay').addEventListener('click', () => {
|
document.getElementById('setPlay').addEventListener('click', () => {
|
||||||
taskBar.time.resume();
|
timeDisplay.resume();
|
||||||
console.info('Resume time');
|
console.info('Resume time');
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to initialize app:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
@ -12,17 +12,17 @@ title: Index
|
||||||
<h2>This is {{ hippie.brand | upcase }}</h2>
|
<h2>This is {{ hippie.brand | upcase }}</h2>
|
||||||
<p>You can start using it by replacing this file with your own index page.</p>
|
<p>You can start using it by replacing this file with your own index page.</p>
|
||||||
<p>To do this you need to create a file
|
<p>To do this you need to create a file
|
||||||
<code>index.liquid|njk</code>
|
<code>/index.njk</code>
|
||||||
inside the
|
inside the
|
||||||
<i>source/view</i>
|
<i>source/screens</i>
|
||||||
folder. You can also create a
|
folder. You can also create a
|
||||||
<code>data.json</code>
|
<code>data.json</code>
|
||||||
file inside the
|
file inside the
|
||||||
<i>source/view</i>
|
<i>source/templates</i>
|
||||||
folder as a global data source for your template files.</p>
|
folder as a data source for your nunjucks files.</p>
|
||||||
<p>For a very basic start you can make a copy of the demo page
|
<p>For a very basic start you can make a copy of the demo page
|
||||||
<code>blank.liquid|njk</code>. You can find it at
|
<code>blank.njk</code>. You can find it at
|
||||||
<i>/source/view/demo/pages</i>.</p>
|
<i>/source/screens/demo</i>.</p>
|
||||||
<p>The
|
<p>The
|
||||||
<i>source/demo</i>
|
<i>source/demo</i>
|
||||||
folder contains an overview of all HTML elements and also examples for CSS style combinations and even whole
|
folder contains an overview of all HTML elements and also examples for CSS style combinations and even whole
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block script %}
|
{% block script %}
|
||||||
<script>
|
<script>
|
||||||
// Setup global things
|
// Setup global things for all screens
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
// Create instances of objects made by constructor functions
|
// Create instances of objects made by constructor functions
|
||||||
Loading…
Add table
Add a link
Reference in a new issue