-
Notifications
You must be signed in to change notification settings - Fork 5
/
move_extensions_to_panel-container.js
71 lines (67 loc) · 2.05 KB
/
move_extensions_to_panel-container.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
/*
Move Extensions to Panel
https://forum.vivaldi.net/topic/17879/moving-extension-icons-next-to-the-panel-toggles/16
Moves the extension action buttons to the panel.
*/
function csse() {
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
#switch .extensions-wrapper {
display: flex;
flex-flow: row wrap;
}
#switch .extensions-wrapper {
-webkit-app-region: no-drag;
}
#switch .button-toolbar.browserAction-button img {
height: auto;
width: 19px;
}
#switch .button-toolbar.toggle-extensions-group svg {
height: 16px;
width: 4px;
}
#switch .extensions-wrapper .dragging-cancelled, #switch .toggle-extensions-group {
background-color: transparent !important;
}
#switch .extensions-wrapper span:hover, #switch .toggle-extensions-group:hover {
background-color: var(--colorBgDarker) !important;
}
#switch {
contain: initial;
}
#switch .extension-popup.top::before, #switch .extension-popup.top::after {
display: none !important;
}
#panels-container.left #switch .extension-popup {
position: absolute !important;
top: 1px !important;
left: 35px !important;
}
#panels-container.right #switch .extensionaction {
position: absolute !important;
top: 1px !important;
left: unset !important;
right: 35px;
}
`;
document.getElementsByTagName('head')[0].appendChild(style);
};
function extPanel() {
csse();
const wrapper = document.querySelector('.UrlBar > .extensions-wrapper');
const pref = document.getElementById('overlay');
const panel = document.getElementById('switch');
panel.insertBefore(wrapper, pref);
};
// 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) {
extPanel();
}
else {
setTimeout(wait, 300);
}
}, 300);