-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
159 lines (150 loc) · 3.87 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>dtinth’s toolbox</title>
<!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag -->
<meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline' 'unsafe-eval';"
/>
<style>
@import url(./vendor/tailwind-1.4.6.css);
body {
background: transparent;
color: #fff;
font: 10px system-ui, Arimo, sans-serif;
}
.windows body {
background: #353433;
}
#appLayout {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
flex-direction: column;
}
#topBar {
padding: 4px;
display: flex;
align-items: top;
flex-wrap: wrap;
}
#appNav {
flex: auto;
}
#appNav a {
color: inherit;
text-decoration: none;
}
#appNav a.router-link-exact-active {
font-weight: bold;
color: #d7fc70;
}
#settingsForm {
flex: none;
}
#mainArea {
position: relative;
flex: 1;
}
</style>
</head>
<body>
<script src="vendor/vue-3.0.0-beta.20.js"></script>
<script src="vendor/vue-router-4.0.0-beta.2.js"></script>
<div id="app"></div>
<script>
if (process.platform === 'win32') {
document.documentElement.classList.add('windows')
}
</script>
<script>
const html = String.raw
const css = String.raw
var App = {
routes: [],
features: [],
registerFeature(key, { css, ...component }) {
App.features.push(key)
App.routes.push({
name: key,
path: `/${key}`,
component,
})
if (css) App.injectCSS(css)
},
injectCSS(css) {
const style = document.createElement('style')
style.textContent = css
document.querySelector('head').appendChild(style)
},
}
App.routes.push({
name: 'home',
path: '/',
component: {
template: html`<div class="p-1">Hello there!</div>`,
},
})
</script>
<script>
require('./features/iframe')
require('./features/keynote')
require('./features/screen')
require('./features/head')
</script>
<script>
const { Buffer } = require('buffer')
const { ipcRenderer } = require('electron')
const { getCurrentWindow } = require('@electron/remote')
App.history = VueRouter.createWebHashHistory()
App.router = VueRouter.createRouter({
history: App.history,
routes: App.routes,
})
App.instance = Vue.createApp({
template: html`
<div id="appLayout">
<div id="topBar">
<div id="appNav" class="space-x-2">
<router-link to="/">home</router-link>
<router-link
:key="feature"
:to="'/' + feature"
v-for="feature of features"
>
{{feature}}
</router-link>
</div>
<form id="settingsForm">
<label>
<input type="checkbox" v-model="alwaysOnTop" /> Always on top
</label>
</form>
</div>
<div id="mainArea">
<router-view></router-view>
</div>
</div>
`,
data() {
return {
features: App.features,
alwaysOnTop: getCurrentWindow().isAlwaysOnTop(),
}
},
watch: {
alwaysOnTop(value) {
getCurrentWindow().setAlwaysOnTop(value)
},
},
})
App.instance.use(App.router)
App.instance.mount('#app')
</script>
</body>
</html>