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
|
// Copyright Epic Games, Inc. All Rights Reserved.
"use strict";
import { WidgetHost } from "../util/widgets.js"
////////////////////////////////////////////////////////////////////////////////
export class PageBase extends WidgetHost
{
constructor(parent, params)
{
super(parent)
this._params = params;
}
set_title(name)
{
var value = document.title;
if (name.length && value.length)
name = value + " - " + name;
document.title = name;
}
get_param(name, fallback=undefined)
{
var ret = this._params.get(name);
if (ret != undefined)
return ret;
if (fallback != undefined)
this.set_param(name, fallback);
return fallback;
}
set_param(name, value, update=true)
{
this._params.set(name, value);
if (!update)
return value;
const url = new URL(window.location);
for (var [key, xfer] of this._params)
url.searchParams.set(key, xfer);
history.replaceState(null, "", url);
return value;
}
reload()
{
window.location.reload();
}
}
////////////////////////////////////////////////////////////////////////////////
export class ZenPage extends PageBase
{
constructor(parent, ...args)
{
super(parent, ...args);
super.set_title("zen");
this.add_branding(parent);
this.generate_crumbs();
}
add_branding(parent)
{
var root = parent.tag().id("branding");
const zen_store = root.tag("pre").id("logo").text(
"_________ _______ __\n" +
"\\____ /___ ___ / ___// |__ ___ ______ ____\n" +
" / __/ __ \\ / \\ \\___ \\\\_ __// \\\\_ \\/ __ \\\n" +
" / \\ __// | \\/ \\| | ( - )| |\\/\\ __/\n" +
"/______/\\___/\\__|__/\\______/|__| \\___/ |__| \\___|"
);
zen_store.tag().id("go_home").on_click(() => window.location.search = "");
root.tag("img").attr("src", "favicon.ico").id("ue_logo");
/*
_________ _______ __
\____ /___ ___ / ___// |__ ___ ______ ____
/ __/ __ \ / \ \___ \\_ __// \\_ \/ __ \
/ \ __// | \/ \| | ( - )| |\/\ __/
/______/\___/\__|__/\______/|__| \___/ |__| \___|
*/
}
set_title(...args)
{
super.set_title(...args);
}
generate_crumbs()
{
const auto_name = this.get_param("page") || "start";
if (auto_name == "start")
return;
const crumbs = this.tag().id("crumbs");
const new_crumb = function(name, search=undefined) {
crumbs.tag();
var crumb = crumbs.tag().text(name);
if (search != undefined)
crumb.on_click((x) => window.location.search = x, search);
};
new_crumb("home", "");
var project = this.get_param("project");
if (project != undefined)
{
var oplog = this.get_param("oplog");
if (oplog != undefined)
{
new_crumb("project", `?page=project&project=${project}`);
if (this.get_param("opkey"))
new_crumb("oplog", `?page=oplog&project=${project}&oplog=${oplog}`);
}
}
new_crumb(auto_name.toLowerCase());
}
}
|