Skip to content

Commit 0558141

Browse files
imjuniperjaapmarcusScIT-Raphael
authored
Remove most unused JavaScript, modernized it and add Alpinejs (hestiacp#3096)
* Start removing jQuery * Cleanup app.js a bit * Start shortcuts refactor * Fix tableHeader sticky * Wrap shortcuts in IIFE * Rename randomString2 to randomString Reorg templates Reorg events * Remove floating_layer Fix some shortcuts Move helper function * Turn App into a class, simpler notification toggle * Better notification removal * Fix status icon and no notif message * Fix empty message * Consolidate js into one file, and defer loading * fix typo * Remove i18n.js.php, move to GLOBAL obj * Fix typos * Add alpine.js * Only add event listener if more than 2 notifs * Experiment with alpinejs * create getToken helperfunction * Add main.js * Load main.js first * Fix reducer * Rename items to notifications and use x-html * Toggle status icon * Better initial listing * Remove shorthands, reorder templates * Only fetch notifications once * Fix delete and little cleanup * Remove useless doSearch (form submitting works) * Make form_changed an Alpine store * Delete GLOBAL object * Start removing elementHideShow, move stuff into main.js * remove jquery.cookie and .finder * Reorganize * Replace shortcut and to-top code with alpine * Fix cookie reading * fix undefined stuff * fix form id * Fix icons and notifications * move init lower to prevent flash * Use store for shortcut toggle, link for to-top * Actually make shortcuts work * Move shortcuts to alpine store maybe in the future we'll generate the list dynamically * move App to js.php * Remove elementHideShow, * Make alpine local * Replace javascript with form attr for save buttons Replace menu opening with Alpine Replace custom js with Alpine for bulk actions * Fix typos * Fix other typos * Use x-show * Fix menu * Compile CSS * Reorganize x-* properties, add x-cloak, scroll-behavior * Use x-model for less repetition Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com> Co-authored-by: Raphael <rs@scit.ch>
1 parent f332636 commit 0558141

File tree

106 files changed

+1792
-4386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1792
-4386
lines changed

.eslintrc.cjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ module.exports = {
2424
},
2525
rules: {
2626
// Set those as warnings instead. They should be fixed at some point
27-
'@typescript-eslint/no-unused-vars': 'warn',
27+
'@typescript-eslint/no-unused-vars': [
28+
'warn',
29+
{
30+
argsIgnorePattern: '^_',
31+
varsIgnorePattern: '^_',
32+
caughtErrorsIgnorePattern: '^_',
33+
},
34+
],
2835
'@typescript-eslint/no-empty-function': 'warn',
2936
'@typescript-eslint/no-this-alias': 'warn',
3037
'no-redeclare': 'off',

.lintstagedrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
// Run markdownlint on MD files
33
'*.md': 'markdownlint-cli2-fix',
44
// Run Stylelint on CSS files
5-
'*.css': 'stylelint --fix',
5+
'*.css': 'stylelint --fix --allow-empty-input',
66
// Run ESLint on TS, TSX, JS, JSX files
77
'*.{ts,js}?(x)': 'eslint --fix',
88
// Run Prettier everywhere

web/css/src/base.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ html {
55
height: 100%;
66
box-sizing: border-box;
77
font-family: sans-serif;
8+
scroll-behavior: smooth;
9+
}
10+
11+
[x-cloak] {
12+
display: none !important;
813
}
914

1015
*,

web/css/src/themes/default.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
}
284284

285285
.top-bar-menu-list {
286-
display: none;
286+
display: block;
287287
background-color: #4673b6;
288288
box-shadow: 0 3px 20px 0 rgb(0 0 0 / 40%);
289289
position: absolute;
@@ -422,7 +422,7 @@
422422
}
423423

424424
.main-menu-list {
425-
display: none;
425+
display: block;
426426
border-top: 1px solid #ddd;
427427

428428
@media (--viewport-small) {

web/css/themes/default.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/hotkeys.php

Lines changed: 0 additions & 116 deletions
This file was deleted.

web/inc/main.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ function render_page($user, $TAB, $page) {
178178
// Header
179179
include $__template_dir . "header.php";
180180

181+
// Including page specific js file
182+
if (file_exists($__pages_js_dir . $page . ".js")) {
183+
echo '<script defer src="/js/pages/' . $page . ".js?" . JS_LATEST_UPDATE . '"></script>';
184+
}
185+
181186
// Panel
182187
$panel = top_panel(empty($_SESSION["look"]) ? $_SESSION["user"] : $_SESSION["look"], $TAB);
183188
// Extract global variables
@@ -186,16 +191,10 @@ function render_page($user, $TAB, $page) {
186191

187192
// Policies controller
188193
@include_once dirname(__DIR__) . "/inc/policies.php";
194+
189195
// Body
190196
include $__template_dir . "pages/" . $page . ".php";
191197

192-
// Including common js files
193-
@include_once dirname(__DIR__) . "/templates/includes/end_js.php";
194-
// Including page specific js file
195-
if (file_exists($__pages_js_dir . $page . ".js")) {
196-
echo '<script src="/js/pages/' . $page . ".js?" . JS_LATEST_UPDATE . '"></script>';
197-
}
198-
199198
// Footer
200199
include $__template_dir . "footer.php";
201200
}

0 commit comments

Comments
 (0)