-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
322 lines (275 loc) Β· 10.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!doctype html><html lang=en-QS><meta charset=utf-8>
<title>SmileBASIC Source 2</title>
<meta name=viewport content="width=device-width, height=device-height, initial-scale=1" id=$meta_viewport>
<link rel=preconnect href=https://qcs.shsbs.xyz/api crossorigin>
<link rel=icon sizes=16x16 href=resource/icon16.ico> <!-- compatibility -->
<link rel=icon sizes=16x16 href=resource/icon16.png> <!-- firefox -->
<link rel=icon sizes=32x32 href=resource/icon32.png> <!-- chrome -->
<link rel=icon sizes=192x192 href=resource/iconbig.png> <!-- large -->
<link rel=apple-touch-icon href=resource/iconbig.png> <!-- large 2 -->
<link rel=image_src href=resource/iconbig.png> <!-- large 3 -->
<noscript>
<style>
* { word-break: break-word; }
.shadow {
box-shadow: 0 1px 3px inset gray;
}
plaintext {
white-space: pre-wrap;
-moz-tab-size:3; tab-size:3;
padding: 123px 10px 10px;
text-shadow: 1px 1px 1px darkgray;
/* we need the white bg so cleartype is enabled */
background-color: white;
position: relative;
z-index: -2;
}
</style>
<marquee behavior=slide scrollamount=1 height=100% direction=down>
This web-site requires JavaScript
</marquee>
<hr>
<marquee class='shadow' scrollamount=3 scrolldelay=60 direction=up>
<plaintext><!doctype html><html lang=en-QS><meta charset=utf-8>
<title>SmileBASIC Source 2</title>
<noscript>This web-site requires JavaScript</noscript>
<meta name=application-name content="sbs2">
<meta name=description content="oww..">
<link rel=author href=data:,12>
<link rel=vcs-git href=https://github.com/12Me21/sbs2>
<meta name=theme-color content="#888">
<meta name=color-scheme content="light dark">
<script>'use strict'
if (window.location.search=="?logout") {
window.localStorage.removeItem("token-qcs.shsbs.xyz/api")
window.location.search = ""
}
window.print = window.alert
let m
function RELOAD() {
var l=window.location.href
window.history.replaceState(null, "", "?β")
window.location.replace(l)
RELOAD = ()=>{}
}
let OPTS = new URL(window.location).searchParams
let BASE_URL = new URL("./", window.location).href
let run_on_load = []
let do_when_ready = func => run_on_load.push(func)
// todo: get rid of global vars here
/*function check_markup() {
return "yeah"===window.getComputedStyle(document.documentElement).getPropertyValue('--Markup-loaded')
}*/
function alert_error(msg, message, source, line, col) {
source = source.replace(BASE_URL, "πβ")
col = String(col).replace(/\d/g, c=>"ββββββ
ββββ"[c])
if (confirm(msg+"\n"+line+"."+col+" in "+source+"\n\n"+message+"\n\n[Cancel] = reload page, [Ok] = continue"))
window.onerror = null
else
RELOAD()
}
window.onerror = (message, source, line, col, error)=>{
if (/^\w+-extension:/.test(source)) // browser extensions love to inject scripts that fail
return
(window.queueMicrotask || window.setTimeout)(()=>{
alert_error("π ERROR DURING PAGE LOAD!", message, source, line, col)
})
}
// not perfect but should protect against f*ceb*ok's shit for now
Object.defineProperty(HTMLScriptElement.prototype, 'src', {
set(url) {
alert("Hijacking detected! π¬ποΈπ₯\nAttempt to inject script with src:\n"+url)
}
})
//let store_prefix = OPTS.has('dev') ? "dev-" : ""
// load settings very early
let Settings = {
values: {__proto__:null},
}
if (window.location.search=="?nosettings") {
Settings = {
get values() { return {__proto__:null} },
get fields() { return {__proto__:null} },
set fields(v) { },
}
} else {
for (let i=0; i<localStorage.length; i++) {
let key = localStorage.key(i)
if (key.startsWith("setting-"))
try {
let value = JSON.parse(localStorage.getItem(key))
Settings.values[key.substring(8)] = value
} catch {}
}
}
// dark theme
let theme_query = window.matchMedia("(prefers-color-scheme: dark)")
theme_query.onchange = query=>{
let theme = Settings.values.theme
if (!theme || theme==='auto')
document.documentElement.dataset.theme = query.matches ? 'dark' : 'light'
}
theme_query.onchange(theme_query)
let IOS_SAFARI = CSS.supports('-webkit-touch-callout', 'none')
// disable the automatic zoom when focusing text inputs in safari
if (IOS_SAFARI)
$meta_viewport.content += ", user-scalable=no"
console.log("π
early init done")
</script>
<!--START-->
<!-- this part will be replaced by the build script -->
<link rel=stylesheet href=resource/fonts.css>
<link rel=stylesheet href=src/layout.css>
<link rel=stylesheet href=markup2/markup.css>
<link rel=stylesheet href=src/style.css>
<link rel=stylesheet href=src/theme.css>
<style id=$customCSS></style>
<script src=markup2/langs.js></script>
<script src=markup2/parse.js></script>
<script src=markup2/legacy.js></script>
<script src=markup2/render.js></script>
<script src=markup2/runtime.js></script>
<script src=markup2/helpers.js></script>
<script src=src/fill.js></script>
<script src=src/event.js></script>
<script src=src/settings.js></script>
<script src=src/ABOUT.js></script>
<script src=src/entity.js></script>
<script src=src/view.js></script>
<script src=src/activity.js></script>
<script src=src/request.js></script>
<script src=src/socket.js></script>
<script src=src/keyboard.js></script>
<script src=src/draw.js></script>
<script src=src/apx.js></script>
<script src=src/messages.js></script>
<script src=src/input.js></script>
<script src=src/scroller.js></script>
<script src=src/debug.js></script>
<script src=src/upload.js></script>
<script src=src/sidebar.js></script>
<script src=src/Views/page.js></script>
<script src=src/Views/user.js></script>
<script src=src/Views/comments.js></script>
<script src=src/Views/editpage.js></script>
<script src=src/Views/images.js></script>
<script src=src/Views/category.js></script>
<script src=src/Views/account.js></script>
<!-- <script src=src/Views/template.js></script> -->
<script src=src/navigate.js></script>
<script src=src/main.js></script>
<!--END-->
<body class='resize-box ROW'>
<!--=====\
|| MAIN ||
\======-->
<not-sidebar class='FILL ROW' id=$main_slides>
<button id=$openSidebar class='toggle-sidebar'>| | |</button>
</not-sidebar>
<!--========\
|| SIDEBAR ||
\=========-->
<resize-handle id=$horizontalResize class='sidebar-element'></resize-handle>
<sidebar-container id=$sidebar class='sized resize-box sidebar-element COL'>
<button class='toggle-sidebar' id=$closeSidebar>Close Sidebar</button>
<div class='userlist' style='--bar-height:1.625rem' id=$sidebarUserList></div>
<tab-list id=$sidebar_tabs aria-label="sidebar tabs"></tab-list>
<!-- sidebar panels -->
<div id=$sidebarTop class='sized SLIDES'>
<div id=$sidebarActivityPanel>
<scroll-outer id=$sidebarActivity class='activity-scroller' tabindex=-1 style='padding-top:3px;'></scroll-outer>
</div>
<div id=$sidebarWatchPanel>
<scroll-outer id=$sidebarWatch class='activity-scroller' tabindex=-1></scroll-outer>
</div>
<div id=$sidebarNavPanel tabindex=-1 style='overflow-y:scroll;'>
<div class='rem1-5 ROW'>
<input class='FILL item' id=$searchInput>
<button id=$searchButton class='item'>Search</button>
</div>
<div id=$searchResults role='list'></div>
<div class='ROW' style='justify-content:space-around;'><span>ποΈ</span><span>ποΈ</span><span>ποΈ</span><span>ποΈ</span><span>ποΈ</span></div>
<div id=$sidebarCategories role='list'></div>
</div>
<div id=$sidebarFilePanel class='COL'>
<div class='rem1-5 ROW' style='justify-content:space-between;'>
<div class='FILL COL' id=$file_inputs>
<input type=file accept="image/png,image/jpeg,image/gif,image/bmp,image/webp,.png,.jpg,.jpeg,.gif,.bmp" id=$file_browse class='item'>
<form class='ROW' id=$file_url_form method=dialog>
<input type=text id=$file_url_input class='FILL item' placeholder='url (CORS only)'>
<button class='item'>GET</button>
</form>
</div>
<button id=$file_cancel class='item'>Cancel</button>
<button id=$file_upload class='item'>Upload Image</button>
<button id=$file_url_insert class='item'>Insert</button>
<input readonly class='FILL item' id=$file_url>
<a id=$file_upload_page>[Page]</a>
<button id=$file_done class='item'>Done</button>
</div>
<br id=$file_upload_form>
<div class='FILL image-box' style="min-height:3rem"><img id=$file_image></div>
<!-- todo: this should probably be better -->
<!--
fixme: apparently we want to display images in the panel instead?
the images view is a temporary solution then in that case
-->
<a href=#images>View Images</a>
</div>
<div id=$sidebarUserPanel class='COL'>
<!--<tab-list id=$settings_tabs aria-label="settings tabs"></tab-list>-->
<div class='registerBox'>
<button onclick='RELOAD()'>Reload</button>
<button onclick='Lp.start_websocket(true)'>Reset Socket</button>
<button id=$logOut style="float:right">Log out</button>
</div>
<div class='loggedOut registerBox'>
<h2>Log In</h2>
<form id=$loginForm method=dialog>
<input placeholder=Username name=username><br>
<br id=$login_password><br>
<div class='ROW' style=align-items:center>
<button>Log In</button>
<label style='display:contents'> — forever: <input type=checkbox name=long></label>
</div>
</form>
<div id=$loginError></div>
</div>
<div class='local-settings' id=$localSettings></div>
<div class='loggedOut registerBox'>
js eval:
<textarea id=$debugInput class='code-textarea'></textarea>
</div>
<div class='registerBox'>
<button onclick="window.setTimeout(x=>document.addEventListener('click',ev=>{print(ev.target.outerHTML||ev.target),{once:true}))}">Inspect (click element)</button><!-- todo: maybe display an outline on this element? -->
</div>
</div>
<div id=$sidebarPopupPanel class='COL'>
</div>
<div id=$sidebarEditorPanel class='COL'></div>
</div>
<!-- sidebar bottom -->
<resize-handle id=$sidebarResize></resize-handle>
<div class='FILL' id=$sidebarBottom>
<auto-scroller>
<scroll-inner id=$sidebarScroller></scroll-inner>
</auto-scroller>
</div>
</sidebar-container>
<script hidden>'use strict'
if (Settings.values.sitecss)
$customCSS.textContent = Settings.values.sitecss
document.currentScript.remove() // π
// whitespace between nodes in html (due to line breaks, indentation, etc.) creates text nodes which need to be stripped:
{
let n = 0
document.createNodeIterator(
document.body, NodeFilter.SHOW_TEXT,
{acceptNode(node){
if (!node.data.trim())
node.remove(), n++
}},
).nextNode()
console.log("π
removed "+n+" blank textnodes")
}
</script>