-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.html
118 lines (118 loc) · 3.13 KB
/
ui.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="ui.css">
<link rel="icon" type="image/png" href="icon/icon-16.png">
<title>ContainerScript Editor</title>
<style>
body {
margin: 0;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background-color: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 15px;
}
.header img {
width: 70px;
height: 70px;
}
.header h1 {
color: #2c3e50;
margin: 0 0 10px 0;
}
.header p {
color: #7f8c8d;
margin: 0;
}
#root {
width: 100%;
height: 700px;
border: 1px solid #e0e0e0;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
background-color: #fff;
margin-bottom: 30px;
}
.instructions {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.instructions summary {
padding: 20px 25px;
cursor: pointer;
user-select: none;
color: #2c3e50;
font-weight: 600;
font-size: 1.2em;
}
.instructions summary:hover {
background-color: #f8f9fa;
}
.instructions summary:focus {
outline: none;
}
.instructions-content {
padding: 0 25px 25px 25px;
border-top: 1px solid #eee;
}
.instructions h3 {
color: #2c3e50;
margin-top: 20px;
margin-bottom: 15px;
}
.instructions p {
color: #34495e;
line-height: 1.6;
margin-bottom: 15px;
}
.instructions code {
background-color: #f8f9fa;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 0.9em;
color: #e83e8c;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<img src="icon/icon-512.png" alt="ContainerScript Logo">
<div>
<h1>Container Script</h1>
<p>Programmatically assign URLs to containers.</p>
</div>
</div>
<div id="root"></div>
<details class="instructions">
<summary>How to Use ContainerScript</summary>
<div class="instructions-content">
<p>
Write JavaScript code to define container rules.
The code runs each time you open a URL, with the <code>url</code> variable (an instance of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a> class) available in scope.
The code is executed using <a href="https://github.com/Siubaak/sval">Sval</a> due to <a href="https://www.w3.org/TR/CSP/">CSP</a> restrictions.
</p>
<h3>Basic Usage</h3>
<p>Return a string to open the URL in that container:</p>
<p><code>if (url.hostname === "www.amazon.com") return "shopping";</code></p>
<h3>Advanced Configuration</h3>
<p>Return an object for more control over the container:</p>
<p><code>if (url.toString().includes("bank.com")) return { name: "finance", icon: "fingerprint", color: "blue" }; </code></p>
</div>
</details>
</div>
<script src="ui.js"></script>
</body>
</html>