Skip to content

Commit

Permalink
Now allowing 40% keyboards in a separate list
Browse files Browse the repository at this point in the history
  • Loading branch information
YellowAfterlife committed Oct 17, 2024
1 parent be7d96d commit a42f1d8
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 32 deletions.
9 changes: 9 additions & 0 deletions docs/forties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
window.fortiesData = [

];
window.fortiesTODOs = `
`;
/* Other TODOs:
*/
33 changes: 23 additions & 10 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@
//
try {
var search = document.location.search;
if (/[?&]row\b/.test(search)) {
if (/[?&]40s\b/.test(search)) {
document.body.classList.add("forties");
} else if (/[?&]row\b/.test(search)) {
document.body.classList.add("rowstag");
} else document.body.classList.add("colstag");
} else {
document.body.classList.add("colstag");
}
} catch (_) {}
})();
</script>
Expand All @@ -90,18 +94,26 @@ <h1 style="transform: skewX(-5deg)">YellowAfterlife's ergonomic keyboard list</h
</p><p class="if-colstag">
It does not contain <i>every single keyboard</i>,
but it's a pretty big sample - especially as far medium/big/interesting keyboards go.
</p><p class="if-colstag">
See <a href="?row">the other list</a> for row-staggered/standard-layout keyboards.
</p>
<p class="if-rowstag">
This is a collection of row-staggered ergonomic keyboards!<br>
... and also other keyboards that are shaped liked row-staggered ones.
</p><p class="if-rowstag">
This one's a mostly-random sample of keyboards - there's not exactly a shortage of places
to look for row-staggered keyboards.
</p><p class="if-rowstag">
See <a href="?">the other list</a> for column-staggered and non-standard-layout keyboards.
</p>
<p class="if-forties">
This is a collection of little keyboards!
</p>
<p>
There are some lists of keyboards now:
</p><ul><li>
<a href="?">Column-staggered and non-standard-layout keyboards</a> <span class="if-colstag">(you're here)</span>
</li><li>
<a href="?row">Row-staggered and/or standard-layout keyboards</a> <span class="if-rowstag">(you're here)</span>
</li><li>
<a href="?40s">40% keyboards</a> <span class="if-forties">(you're here)</span>
</li></ul>
<details>
<summary>"The rules"</summary>
<ul>
Expand Down Expand Up @@ -287,11 +299,12 @@ <h2>Credits</h2>
<script src="lib/popper.min.js"></script>
<script src="lib/tippy-bundle.umd.js"></script>

<script src="keyboards.js?v=2024-06-24"></script>
<script src="rowstag.js?v=2024-05-20"></script>
<script src="keyboards.js?v=2024-10-18"></script>
<script src="rowstag.js?v=2024-10-18"></script>
<script src="forties.js?v=2024-10-18"></script>
<script src="mcus.csv.js?v=2024-05-20"></script>
<script src="origins.js?v=2024-05-20"></script>
<script src="script.js?v=2024-06-24"></script>
<script src="origins.js?v=2024-10-18"></script>
<script src="script.js?v=2024-10-18"></script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4R5QPPHC8M"></script>
Expand Down
37 changes: 25 additions & 12 deletions docs/script.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion docs/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ h2 {
.tag-options[column-count="3"] {
columns: 3;
}
body.rowstag .if-colstag {
display: none;
}
body.forties .if-colstag {
display: none;
}
body:not(.rowstag) .if-rowstag {
display: none;
}
body.rowstag .if-colstag {
body:not(.forties) .if-forties {
display: none;
}
input[invalid] {
Expand Down
17 changes: 11 additions & 6 deletions src/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@ class Main {

var kbTable:KeyboardTable<Keyboard>;
var row = document.body.classList.contains("rowstag");
if (row) {
kbTable = cast new RowStagTable();
var forties = document.body.classList.contains("forties");
if (row || forties) {
kbTable = cast new RowStagTable(forties);
} else kbTable = cast new ColStagTable();
KeyboardPage.main(kbTable);

ToDoList.element = document.querySelectorAuto("#todo");
ToDoList.set(row
? (cast window).rowStagTODOs
: (cast window).keyboardTODOs
);
var dynWindow = cast window;
if (forties) {
ToDoList.set(dynWindow.fortiesTODOs);
} else if (row) {
ToDoList.set(dynWindow.rowStagTODOs);
} else {
ToDoList.set(dynWindow.keyboardTODOs);
}
}

}
11 changes: 10 additions & 1 deletion src/RowStagTable.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ using tools.HtmlTools;
* @author YellowAfterlife
*/
class RowStagTable extends KeyboardTable<RowStagKeyboard> {
public var isForties:Bool;
public function new(isForties) {
this.isForties = isForties;
super();
}
override public function collectFilters():DynamicAccess<String> {
var result = super.collectFilters();
result["row"] = "";
Expand Down Expand Up @@ -237,7 +242,11 @@ class RowStagTable extends KeyboardTable<RowStagKeyboard> {
addColumn(mw);
}
override public function initKeyboards() {
var kbs:Array<RowStagKeyboard> = (cast window).rowStagData;
var dynWindow = (cast window);
var kbs:Array<RowStagKeyboard>;
if (isForties) {
kbs = dynWindow.fortiesData;
} else kbs = dynWindow.rowStagData;
for (kb in kbs) {
if (kb is String) {
document.querySelector("#version").innerText = cast kb;
Expand Down
9 changes: 7 additions & 2 deletions src/styles/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,16 @@ h2 {
columns: 3;
}

body.rowstag .if-colstag {
display: none;
}
body.forties .if-colstag {
display: none;
}
body:not(.rowstag) .if-rowstag {
display: none;
}

body.rowstag .if-colstag {
body:not(.forties) .if-forties {
display: none;
}

Expand Down

0 comments on commit a42f1d8

Please sign in to comment.