diff --git a/.jshintrc b/.jshintrc index 134e601..24ef2fe 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,9 +1,9 @@ { "bitwise": true, - "curly": true, + "curly": false, "devel": true, "eqeqeq": true, - "esversion": 9, + "esversion": 11, "forin": true, "freeze": true, "jquery": true, diff --git a/README.md b/README.md index 7430cb6..83ea378 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,25 @@ Everything has its default style. CSS classes follow a naming scheme of `_`. -- *Object* usually is the name of the HTML element. If it is not a elemtn directly it is the thing which receives the styling +- *Object* usually is the name of the HTML element. If it is not a element directly it is the thing which receives the styling - *Description* is a name of the style e.g. what it does, how it looks +### JavaScript (JS) + +The codebase uses ECMAScript 2023 Language Specification (14th edition). +However, currently the JSHint configuration only allows 11 as highest version. + +ID values are written in *camelCase*. The scheme further uses parts for specific contexts. + +If the ID is for an interactive element the first part is an abbreviation of the action. + +- `add` - Add +- `qry` - Query +- `rmv` - Remove +- `set` - Set +- `slt` - Select +- `tgl` - Toggle + ## Versioning This project uses [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://quelltext.interaktionsweise.de/interaktionsweise/hippie/tags). diff --git a/TODO.md b/TODO.md index 1fea50d..6704e8e 100644 --- a/TODO.md +++ b/TODO.md @@ -11,120 +11,126 @@ - Add build process for normalize.css from github.com/necolas/normalize.css - Add build process for bourbon from https://github.com/thoughtbot/bourbon +# CSS + +- Check style for every basic element +- Uniform spelling of classes and identifiers + # Content -- Complete *Intro* with description for all basic elements, according to [HTML Standard - The elements of HTML](https://html.spec.whatwg.org/multipage/semantics.html#semantics) - - Sections - - [x] body - - [x] article - - [x] section - - [x] nav - - [x] aside - - [x] h1-h6 - - [x] hgroup - - [x] header - - [x] footer - - [x] address (put to grouping content) - - Grouping content - - [x] p - - [x] hr - - [x] pre - - [x] blockquote - - [x] ol - - [x] ul - - [ ] menu (new) - - [x] li - - [x] dl - - [x] dt - - [x] dd - - [x] figure - - [x] figcaption - - [x] main - - [ ] search (new) - - [x] div - - Text-level semantics - - [x] a - - [x] em - - [x] strong - - [x] small - - [x] s - - [x] cite - - [x] q - - [x] dfn - - [x] abbr - - [x] ruby - - [x] rb (deprecated) - - [x] rt - - [x] rtc (deprecated) - - [x] rp - - [x] data - - [x] time - - [x] code - - [x] var - - [x] samp - - [x] kbd - - [x] sub - - [x] sup - - [x] i - - [x] b - - [x] u - - [x] mark - - [x] bdi - - [x] bdo - - [x] span - - [x] br (mentioned in grouping content) - - [x] wbr - - Edits - - [x] ins - - [x] del - - Embedded content - - [x] picture - - [x] source - - [x] img - - [ ] iframe - - [ ] embed - - [ ] object - - [ ] param (deprecated) - - [ ] video - - [ ] audio - - [ ] track - - [ ] map - - [ ] area - - Tabular data - - [ ] table - - [ ] caption - - [ ] colgroup - - [ ] col - - [ ] tbody - - [ ] thead - - [ ] tfoot - - [ ] tr - - [ ] td - - [ ] th - - Forms - - [x] form - - [x] label - - [x] input - - [x] button - - [ ] select - - [ ] datalist - - [ ] optgroup - - [ ] option - - [ ] textarea - - [ ] output - - [ ] progress - - [ ] meter (new) - - [x] fieldset - - [x] legend - - Interactive elements - - [ ] details - - [ ] summary - - [ ] dialog - - Scripting - - [ ] script - - [ ] noscript - - [ ] template - - [ ] slot - - [ ] canvas -- Check style for every basic element -- Uniform spelling of classes and identifiers \ No newline at end of file +- *Intro* + - Complete with description for all basic elements, according to [HTML Standard - The elements of HTML](https://html.spec.whatwg.org/multipage/semantics.html#semantics) + - Sections + - [x] body + - [x] article + - [x] section + - [x] nav + - [x] aside + - [x] h1-h6 + - [x] hgroup + - [x] header + - [x] footer + - [x] address (put to grouping content) + - Grouping content + - [x] p + - [x] hr + - [x] pre + - [x] blockquote + - [x] ol + - [x] ul + - [ ] menu (new) + - [x] li + - [x] dl + - [x] dt + - [x] dd + - [x] figure + - [x] figcaption + - [x] main + - [ ] search (new) + - [x] div + - Text-level semantics + - [x] a + - [x] em + - [x] strong + - [x] small + - [x] s + - [x] cite + - [x] q + - [x] dfn + - [x] abbr + - [x] ruby + - [x] rb (deprecated) + - [x] rt + - [x] rtc (deprecated) + - [x] rp + - [x] data + - [x] time + - [x] code + - [x] var + - [x] samp + - [x] kbd + - [x] sub + - [x] sup + - [x] i + - [x] b + - [x] u + - [x] mark + - [x] bdi + - [x] bdo + - [x] span + - [x] br (mentioned in grouping content) + - [x] wbr + - Edits + - [x] ins + - [x] del + - Embedded content + - [x] picture + - [x] source + - [x] img + - [ ] iframe + - [ ] embed + - [ ] object + - [ ] param (deprecated) + - [ ] video + - [ ] audio + - [ ] track + - [ ] map + - [ ] area + - Tabular data + - [ ] table + - [ ] caption + - [ ] colgroup + - [ ] col + - [ ] tbody + - [ ] thead + - [ ] tfoot + - [ ] tr + - [ ] td + - [ ] th + - Forms + - [x] form + - [x] label + - [x] input + - [x] button + - [ ] select + - [ ] datalist + - [ ] optgroup + - [ ] option + - [ ] textarea + - [ ] output + - [ ] progress + - [ ] meter (new) + - [x] fieldset + - [x] legend + - Interactive elements + - [ ] details + - [ ] summary + - [ ] dialog + - Scripting + - [ ] script + - [ ] noscript + - [ ] template + - [ ] slot + - [ ] canvas +- *Clock* + - Add overlays to better distinguish day, week and year \ No newline at end of file diff --git a/source/code/hippie/app.js b/source/code/hippie/app.js index f00f364..81d2494 100644 --- a/source/code/hippie/app.js +++ b/source/code/hippie/app.js @@ -351,12 +351,12 @@ function checkButtonAndTarget(event, element, button = 0) { function getClosestEdgeToElement(element) { 'use strict'; - const rect = element.getBoundingClientRect(); + const bounding = element.getBoundingClientRect(); const distances = { - top: rect.top, - right: window.innerWidth - rect.right, - bottom: window.innerHeight - rect.bottom, - left: rect.left + top: bounding.top, + right: window.innerWidth - bounding.right, + bottom: window.innerHeight - bounding.bottom, + left: bounding.left }; return Object.keys(distances).reduce((a, b) => distances[a] < distances[b] ? a : b); @@ -459,6 +459,70 @@ function getRandomColor() { return color; } +function getRandomFormattedString(chars = 2, digits = 6, separator = '-') { + const getRandomUppercase = () => String.fromCharCode(Math.floor(Math.random() * 26) + 65); + const getRandomDigit = () => Math.floor(Math.random() * 10); + let string = ''; + + for (let i = 0; i < chars; i++) { + string += getRandomUppercase(); + } + + string += separator; + + for (let i = 0; i < digits; i++) { + string += getRandomDigit(); + } + + return string; +} + +function toggleColumn(table, index) { + const rows = table.rows; + const isHidden = rows[0].cells[index].classList.contains('di_none'); + + for (let i = 0; i < rows.length; i++) { + const cell = rows[i].cells[index]; + + if (isHidden) { + cell.classList.remove('di_none'); + } else { + cell.classList.add('di_none'); + } + } +} + +function convertToRomanNumeral(num) { + const romanNumeralMap = [ + {value: 1000, numeral: 'M'}, + {value: 900, numeral: 'CM'}, + {value: 500, numeral: 'D'}, + {value: 400, numeral: 'CD'}, + {value: 100, numeral: 'C'}, + {value: 90, numeral: 'XC'}, + {value: 50, numeral: 'L'}, + {value: 40, numeral: 'XL'}, + {value: 10, numeral: 'X'}, + {value: 9, numeral: 'IX'}, + {value: 5, numeral: 'V'}, + {value: 4, numeral: 'IV'}, + {value: 1, numeral: 'I'} + ]; + + let result = ''; + for (let i = 0; i < romanNumeralMap.length; i++) { + while (num >= romanNumeralMap[i].value) { + result += romanNumeralMap[i].numeral; + num -= romanNumeralMap[i].value; + } + } + return result; +} + +function capitalizeFirstLetter(text) { + return text.charAt(0).toUpperCase() + text.slice(1); +} + // CONCEPTS // NOTE: Benutzt private Zuweisungen diff --git a/source/screens/demo/examples/clock.liquid b/source/screens/demo/examples/clock.liquid index da8f5a4..34fb1d5 100644 --- a/source/screens/demo/examples/clock.liquid +++ b/source/screens/demo/examples/clock.liquid @@ -11,7 +11,7 @@ tags:

- +

{% endblock %} @@ -27,9 +27,9 @@ tags: const colorDayOfMonth = getComputedStyle(document.documentElement).getPropertyValue('--clock-color-orange').trim(); const colorMonth = getComputedStyle(document.documentElement).getPropertyValue('--clock-color-pink').trim(); - document.getElementById('toggleFormat').addEventListener('click', () => { + document.getElementById('tglFormat').addEventListener('click', () => { is24HourFormat = !is24HourFormat; - document.getElementById('toggleFormat').textContent = is24HourFormat ? '12-Stunden-Format' : '24-Stunden-Format'; + document.getElementById('tglFormat').textContent = is24HourFormat ? '12-Stunden-Format' : '24-Stunden-Format'; }); function drawRings(seconds, minutes, hours, dayOfWeek, dayOfMonth, month, daysInCurrentMonth) { diff --git a/source/screens/demo/examples/start.liquid b/source/screens/demo/examples/start.liquid index b4b1d98..3155921 100644 --- a/source/screens/demo/examples/start.liquid +++ b/source/screens/demo/examples/start.liquid @@ -11,7 +11,7 @@ tags: {% block body %}
@@ -69,7 +69,7 @@ tags: document.getElementById('www-search').addEventListener('submit', function (e) { e.preventDefault(); - const query = document.getElementById('query').value.trim(); + const query = document.getElementById('qrySearch').value.trim(); if (!query) return; diff --git a/source/screens/demo/examples/ui/cli.liquid b/source/screens/demo/examples/ui/cli.liquid new file mode 100644 index 0000000..18f4cd4 --- /dev/null +++ b/source/screens/demo/examples/ui/cli.liquid @@ -0,0 +1,60 @@ +--- +title: CLI +tags: +- ui +--- +{% assign bodyClass = "body_cli" -%} +{% layout "hippie/app.liquid" %} + +{% block body %} +
+
+
Previous prompt
+
+
+ + +
+
+{% endblock %} + +{%- block script %} +{{ block.super -}} + +{% endblock %} \ No newline at end of file diff --git a/source/screens/demo/examples/ui/cli.njk b/source/screens/demo/examples/ui/cli.njk deleted file mode 100755 index dc0800f..0000000 --- a/source/screens/demo/examples/ui/cli.njk +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: CLI -tags: - - ui ---- -{% set pageId = page.fileSlug %} -{% set bodyClass = "body_cli" %} - -{% extends "hippie/_app_frame.njk" %} - -{% block body %} -
-
-
Previous prompt
-
-
- - -
-
-{% endblock %} - -{%- block script %} - {{ super() }} - -{% endblock %} \ No newline at end of file diff --git a/source/screens/demo/examples/ui/explorer.liquid b/source/screens/demo/examples/ui/explorer.liquid new file mode 100644 index 0000000..f8e66fa --- /dev/null +++ b/source/screens/demo/examples/ui/explorer.liquid @@ -0,0 +1,145 @@ +--- +title: Explorer +tags: +- ui +--- +{% assign bodyClass = "body_frame" -%} +{% layout "hippie/app.liquid" %} + +{% block body %} +{% render 'hippie/partials/frame-header.liquid' %} +
+ +
+
+ + +
+
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
namedatetypesize
folderYYYY-MM-DDfolder4KB
fileYYYY-MM-DDfolder1B
+
+ {% render 'hippie/partials/frame-status.liquid' %} +
+
+{% render 'hippie/partials/frame-mode.liquid' %} +{% endblock %} \ No newline at end of file diff --git a/source/screens/demo/examples/ui/explorer.njk b/source/screens/demo/examples/ui/explorer.njk deleted file mode 100755 index c54ea0a..0000000 --- a/source/screens/demo/examples/ui/explorer.njk +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: GUI explorer -tags: - - ui ---- -{% set pageId = page.fileSlug %} - -{% extends "hippie/_app_frame.njk" %} - -{% block body %} - {{ io.frameHeader('title-bar') }} -
- -
-
- - -
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - -
namedatetypesize
folderYYYY-MM-DDfolder4KB
fileYYYY-MM-DDfolder1B
-
- {{ io.statusBar() }} -
-
- {{ io.frameFooter('mode-bar') }} -{% endblock %} \ No newline at end of file diff --git a/source/screens/demo/examples/ui/gallery.liquid b/source/screens/demo/examples/ui/gallery.liquid index c548374..8128023 100755 --- a/source/screens/demo/examples/ui/gallery.liquid +++ b/source/screens/demo/examples/ui/gallery.liquid @@ -12,9 +12,9 @@ tags: