forked from luetage/vivaldi_modding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
safari-style.js
82 lines (78 loc) · 2.37 KB
/
safari-style.js
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
/*
Safari Style
https://forum.vivaldi.net/topic/23138/solved-modding-the-adressbar-top-window-to-get-it-look-like-safari-browser/6
Safari (browser) like address bar. Requested mod.
*/
function cssm() {
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
#tabs-container.no-thumbs.bottom {
order: -1;
padding-top: 4px;
padding-bottom: 0px;
}
.toolbar.toolbar-addressbar {
display: flex;
order: -2;
}
.stacks-on.tabs-bottom .tab-strip .tab-group-indicator {
bottom: 28px;
}
.stacks-on.tabs-bottom .tab-strip .tab-group-indicator .tab-indicator.active {
padding-top: 3px;
}
#header {
min-height: 0 !important;
z-index: auto;
}
.container {
width: 100%;
display: flex;
justify-content: space-between;
-webkit-app-region: drag;
}
#browser.mac .window-buttongroup {
display: flex;
margin-top: 9px !important;
}
#browser.mac .window-buttongroup button {
margin-right: 8px;
}
#browser.mac .window-buttongroup button.window-minimze {
order: 1;
}
#browser.mac .window-buttongroup button.window-maximize {
order: 2;
}
.addressfield {
max-width: 600px;
}
`;
document.getElementsByTagName('head')[0].appendChild(style);
};
function safariStyle() {
cssm();
const adr = document.querySelector('.toolbar-addressbar.toolbar');
var windowbuttons = document.querySelector('.window-buttongroup');
var container = document.createElement('div');
var extwrapper = document.querySelector('.toolbar-addressbar.toolbar > .extensions-wrapper');
var tools = document.querySelector('.toolbar-addressbar.toolbar .toolbar');
var adfield = document.querySelector('.addressfield');
container.classList.add('container')
adr.insertBefore(windowbuttons,adr.firstChild);
adr.insertBefore(container,adr.lastChild);
container.appendChild(tools);
container.appendChild(adfield);
container.appendChild(extwrapper);
};
// Loop waiting for the browser to load the UI. You can call all functions from just one instance.
setTimeout(function wait() {
const browser = document.getElementById('browser');
if (browser) {
safariStyle();
}
else {
setTimeout(wait, 300);
}
}, 300);