-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
256 lines (229 loc) · 7.35 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
<!DOCTYPE html>
<!--
| _
| /| / / |\
| / | / / | \
| / / / / \ \
| \ \ ___ / / / /
| \ | / \/ / | /
| \| | / |/
| \____/
|
-->
<!--don't prepend files with /
-->
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="icon" type="image/png" href="images/Chrome.png">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="manifest" href="manifest.json" />
<title>Chrome Tabs - Chrome-style Tabs in HTML/CSS/ES6</title>
<meta name="description" content="Chrome-style tabs in HTML/CSS/JS.">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="demo/css/demo.css" rel="stylesheet">
<link href="css/chrome-tabs.css" rel="stylesheet">
<link href="css/chrome-tabs-dark-theme.css" rel="stylesheet">
</head>
<body>
<div class="surface">
<div class="mock-browser">
<div class="chrome-tabs" style="--tab-content-margin: 9px">
<div class="new-tab-button">
</div>
<div class="chrome-tabs-content">
<div class="chrome-tab" active>
<div class="chrome-tab-dividers"></div>
<div class="chrome-tab-background">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="chrome-tab-geometry-left" viewBox="0 0 214 36">
<path d="M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" />
</symbol>
<symbol id="chrome-tab-geometry-right" viewBox="0 0 214 36">
<use xlink:href="#chrome-tab-geometry-left" />
</symbol>
<clipPath id="crop">
<rect class="mask" width="100%" height="100%" x="0" />
</clipPath>
</defs><svg width="52%" height="100%">
<use xlink:href="#chrome-tab-geometry-left" width="214" height="36" class="chrome-tab-geometry" />
</svg>
<g transform="scale(-1, 1)"><svg width="52%" height="100%" x="-100%" y="0">
<use xlink:href="#chrome-tab-geometry-right" width="214" height="36" class="chrome-tab-geometry" />
</svg></g>
</svg>
</div>
<div class="chrome-tab-content">
<div class="chrome-tab-favicon" style="background-image: url('demo/images/google-favicon.ico')"></div>
<div class="chrome-tab-title">New Tab</div>
<div class="chrome-tab-drag-handle"></div>
<div class="chrome-tab-close"></div>
</div>
</div>
</div>
<div class="chrome-tabs-bottom-bar"></div>
<!-- Styles to prevent flash after JS initialization -->
<style>
.chrome-tabs .chrome-tab {
width: 258px
}
.chrome-tabs .chrome-tab:nth-child(1) {
transform: translate3d(0px, 0, 0)
}
.chrome-tabs .chrome-tab:nth-child(2) {
transform: translate3d(239px, 0, 0)
}
new-tab-button {
transform: translate3d(250px, 0, 0);
}
</style>
</div>
<button class="btn-nt" data-add-tab>
<span class="material-icons">
add
</span>
</button>
<div class="chrome-tabs-optional-shadow-below-bottom-bar"></div>
<div class="mock-browser-content">
<img class="omnibar_img" src="images/Google.png" width="23px" height="23px" />
<table style="margin: 0px 10px 0px 0px; background-color: transparent;" class="nav">
<tr>
<td style="width: 30px; max-width: 30px; min-width: 30px;">
<button class="button_bk" data-page-back><span class="material-icons">
arrow_back
</span>
</button>
</td>
<td style="width: 30px; max-width: 30px; min-width: 30px;">
<button class="button_fw" data-page-forward>
<span class="material-icons">
arrow_forward
</span>
</button>
</td>
<td style="width: 30px; max-width: 30px; min-width: 30px;">
<button class="button_rld" data-page-reload>
<span class="material-icons">
refresh
</span>
</button>
</td>
<td style="width: 90%;">
<label for="omnibar"></label>
<input type="url" class="omnibar" id="omnibar" value="https://google.com"></input>
</td>
<td style="align-content: right;">
<button onclick="myFunction()" class="dropbtn"
style="font-size: 23px; align-content: center; color: #000000;"><span class="material-icons"
style="pointer-events: none;">
more_vert
</span>
</button>
</td>
</table>
</div>
</div>
<iframe style=" width: 100%; z-index: 1; border: box;" id="webview" src="https://google.com" frameBorder="0px"></iframe>
</div>
<div id="myDropdown" class="dropdown-content">
<a>
<table style="padding: 0px 0px 0px 0px;">
<tr>
<td><button>New tab</button data-add-tab></td>
<td style="color: grey;">Ctrl+T</td>
</tr>
</table>
</a>
<a href="https://chrome-tabs.glitch128.repl.co/" target="_blank" rel="noreferrer noopener">
<table>
<tr>
<td>New window</td>
<td style="color: grey;">Ctrl+N</td>
</tr>
</table>
</a>
<a>
<table>
<tr>
<td>New Incognito window</td>
<td style="color: grey;">Ctrl+Shift+N</td>
</tr>
</table>
</a>
<a style="padding: 16px 0px 0px 0px;">
</a>
<a>
<table>
<tr>
<td>History</td>
<td style="color: grey;">‣</td>
</tr>
</table>
</a>
<a>
<table style="padding: 1px 0px 3px 0px;">
<tr>
<td>Downloads</td>
<td style="color: grey;">Ctrl+J</td>
</tr>
</table>
</a>
<a>
<table style="padding: 2px 0px 4px 0px;">
<tr>
<td>Bookmarks</td>
<td style="color: grey;">‣</td>
</tr>
</table>
</a>
</div>
</div>
</body>
<script src="https://unpkg.com/draggabilly@2.2.0/dist/draggabilly.pkgd.min.js"></script>
<script src="js/chrome-tabs.js"></script>
<script>
var el = document.querySelector('.chrome-tabs')
var chromeTabs = new ChromeTabs()
chromeTabs.init(el)
el.addEventListener('activeTabChange', ({detail}) => console.log('Active tab changed', detail.tabEl))
el.addEventListener('tabAdd', ({detail}) => console.log('Tab added', detail.tabEl))
el.addEventListener('tabRemove', ({detail}) => console.log('Tab removed', detail.tabEl))
document.querySelector('button[data-add-tab]').addEventListener('click', _ => {
chromeTabs.addTab({
title: 'New Tab',
favicon: false
})
})
document.querySelector('button[data-add-background-tab]').addEventListener('click', _ => {
chromeTabs.addTab({
title: 'New Tab',
favicon: false
}, {
background: true
})
})
document.querySelector('button[data-remove-tab]').addEventListener('click', _ => {
chromeTabs.removeTab(chromeTabs.activeTabEl)
})
document.querySelector('button[data-theme-toggle]').addEventListener('click', _ => {
if (el.classList.contains('chrome-tabs-dark-theme')) {
document.documentElement.classList.remove('dark-theme')
el.classList.remove('chrome-tabs-dark-theme')
} else {
document.documentElement.classList.add('dark-theme')
el.classList.add('chrome-tabs-dark-theme')
}
})
window.addEventListener('keydown', (event) => {
event.preventDefault()
if (event.ctrlKey && event.key === 84) {
chromeTabs.addTab({
title: 'New Tab',
favicon: false
})
}
})
</script>
</html>