forked from quoid/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallView.svelte
More file actions
168 lines (151 loc) · 4.61 KB
/
Copy pathInstallView.svelte
File metadata and controls
168 lines (151 loc) · 4.61 KB
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
<script>
import iconWarn from "../../../shared/img/icon-warn.svg";
import iconError from "../../../shared/img/icon-error.svg";
export let userscript;
export let installError;
export let installCancelClick;
export let installConfirmClick;
</script>
<div class="view--install">
{#if installError}
<div class="install__error">
{@html iconError}
<div>The usercript can not be installed.</div>
<p>Error: OK GO</p>
</div>
{:else if userscript}
<ul>
<li class="userscript--name">{userscript.name}</li>
{#if userscript.description}
<li class="userscript--description">{userscript.description}</li>
{/if}
{#if userscript.match}
<li class="userscript--field">
<div>@match</div>
{#each userscript.match as match}
<div class="truncate">{match}</div>
{/each}
</li>
{/if}
{#if userscript.include}
<li class="userscript--field">
<div>@include</div>
{#each userscript.include as include}
<div class="truncate">{include}</div>
{/each}
</li>
{/if}
{#if userscript.require}
<li class="userscript--field">
<div>@require</div>
{#each userscript.require as require}
<div class="truncate">{require}</div>
{/each}
</li>
{/if}
{#if userscript.grant}
<li class="userscript--field">
<div>@grant</div>
{#each userscript.grant as grant}
<div>{grant}</div>
{/each}
</li>
{/if}
</ul>
<div class="badge">
<div class="badge--icon">{@html iconWarn}</div>
<div class="badge--text">Be sure you trust the author before installing. Nefarious code can exploit your security and privacy.</div>
</div>
<div class="buttons">
<button class="cancel" on:click={installCancelClick}>Cancel</button>
<button class="install" on:click={installConfirmClick}>Install</button>
</div>
{/if}
</div>
<style>
.view--install {
color: var(--text-color-secondary);
padding: 0 1rem;
}
.install__error {
color: var(--text-color-disabled);
font-weight: 600;
}
.install__error :global(svg) {
fill: var(--text-color-disabled);
height: 4rem;
margin: 2rem auto 0.5rem;
width: 4rem;
}
.install__error p {
color: var(--text-color-primary);
font: var(--text-small);
font-family: var(--editor-font);
letter-spacing: var(--letter-spacing-small);
margin-top: 1rem;
}
ul {
padding: 1rem 0;
text-align: left;
}
.userscript--name {
color: var(--text-color-primary);
font: var(--text-default);
font-weight: bold;
letter-spacing: var(--letter-spacing-default);
}
.userscript--description {
font: var(--text-small);
letter-spacing: var(--letter-spacing-small);
}
.userscript--field {
font: var(--text-small);
letter-spacing: var(--letter-spacing-small);
margin-top: 1rem;
}
.userscript--field > div:nth-child(1) {
color: var(--text-color-disabled);
}
.userscript--field > div:nth-child(n + 2) {
color: var(--text-color-secondary);
font-family: var(--editor-font);
}
.badge {
background-color: var(--color-black);
border-radius: var(--border-radius);
display: flex;
font: var(--text-small);
margin: 1rem 0;
padding: 0.5rem;
}
.badge--icon {
align-self: center;
flex-shrink: 0;
width: 32px;
}
.badge--icon :global(svg) {
fill: var(--color-blue);
}
.badge--text {
padding: 0 0.5rem;
text-align: left;
}
.buttons {
display: flex;
padding-bottom: 1rem;
}
button {
background-color: #ffffffa6; /* -text-color-secondary */
border-radius: var(--border-radius);
color: var(--color-bg-primary);
flex-grow: 1;
height: 2rem;
}
button:nth-child(1) {
margin-right: 0.5rem;
}
button:nth-child(2) {
background-color: var(--color-blue);
margin-left: 0.5rem;
}
</style>