Nice little directory browser :D
1@*
2 This file is part of Utatane.
3
4 Utatane is free software: you can redistribute it and/or modify it under
5 the terms of the GNU Affero General Public License as published by the Free
6 Software Foundation, either version 3 of the License, or (at your option)
7 any later version.
8
9 Utatane is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
12 more details.
13
14 You should have received a copy of the GNU Affero General Public License
15 along with Utatane. If not, see <http://www.gnu.org/licenses/>.
16*@
17
18@inherits LayoutComponentBase
19@inject IHttpContextAccessor context
20
21<!DOCTYPE html>
22<html lang="en">
23<head>
24 <meta charset="utf-8" />
25 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
26
27 <link rel="stylesheet" type="text/css" href="/.nhnd/style.css" />
28
29 <script src="/.nhnd/htmx.js"></script>
30 <script src="/.nhnd/jquery.js"></script>
31 <script src="/.nhnd/jquery.marquee.js"></script>
32 <script type="text/javascript">
33 // custom jq extensions, see net.helpimnotdrowning."MB Convenience Buttons"
34 HTMLElement.prototype.toJQuery = function() { return $(this); }
35
36 jQuery.fn.exists = function() { return this.length > 0; }
37 jQuery.fn.toDOM = function() { return this[0]; }
38 jQuery.fn.appendAll = function(elArray) {
39 /*
40 * Append an entire array of elements to an element
41 *
42 * @@param elArray Array of elements.
43 * @@returns Itself, *not* any member of the array.
44 */
45 elArray.forEach( (el) => this.append(el) );
46 return this;
47 }
48 jQuery.fn.dispatchEvent = function(event) {
49 /*
50 * I think I made this because the default jQuery event sender didn't work
51 * correctly/the way I expected. Internally calls the DOM dispatchEvent.
52 *
53 * @@param event Event to send.
54 */
55 $(this).toDOM().dispatchEvent(event);
56 return this;
57 }
58 jQuery.fn.setInput = function(value) {
59 /*
60 * Set the value of an input, supporting React inputs
61 *
62 * @@param value Value
63 * @@returns Itself
64 */
65 // :heart: https://github.com/jesus2099/konami-command/blob/1db343dc1fef317ab28b79b3386847d9af5771f6/lib/SUPER.js#L163C1-L171C2
66 if (!this.exists()) {
67 throw "input doesn't exist!";
68 }
69
70 // Tested OK with input of types: <input> <select> <textarea>
71 // Force react state change by bubbling up the input event : https://nattaylor.com/blog/2022/userscripts-and-reactjs-forms/
72 this.dispatchEvent(newEvent('input'));
73 // Use native input value setter to bypass React (simple value setter is overridden by react)
74 (Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.toDOM()), "value").set).call(this.toDOM(), value);
75 // Without change it was not working, either, in MBS edit artist page, at least
76 this.dispatchEvent(newEvent('change'));
77
78 return this;
79 }
80 jQuery.fn.second = function() { return this.eq(1); }
81 jQuery.fn.check = function() {
82 /*
83 * Set a checkbox to checked.
84 *
85 * @@returns Itself
86 */
87 this.toDOM().checked = true;
88 return this;
89 }
90 jQuery.fn.uncheck = function() {
91 /*
92 * Set a checkbox to unchecked.
93 *
94 * @@returns Itself
95 */
96 this.toDOM().checked = false;
97 return this;
98 }
99 function sleep(ms) {
100 return new Promise(resolve => setTimeout(resolve, ms));
101 }
102
103 function newEvent(name) {
104 return new Event(name, { bubbles: true });
105 }
106 </script>
107 <meta name="htmx-config" content='{"scrollIntoViewOnBoost":false}' />
108
109 <meta name="darkreader-lock" />
110
111 <HeadOutlet />
112 @* blank placeholder title, overriden (usually) in @Body *@
113 <AppTitle></AppTitle>
114</head>
115<body class="@(context.HttpContext.Response.StatusCode >= 400 ? "from-red-400! to-red-500!" : null)">
116@Body
117</body>
118</html>