-
Notifications
You must be signed in to change notification settings - Fork 13
/
header branding and navigation center actions left add.html
107 lines (56 loc) · 2.08 KB
/
header branding and navigation center actions left add.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
<script>
document.addEventListener ( 'DOMContentLoaded', ( ) => {
/*
header branding and navigation center actions left add
License : < https://tinyurl.com/s872fb68 >
Version : 0.1.0
SS Version : 7.1
Fluid
Engine
Compatible : Not Applicable
Dependencies : jQuery
Note : if the actions left element already exists this code does
nothing
By : Thomas Creedon < http://www.tomsWeb.consulting/ >
no user serviceable parts below
*/
let selector = '.header-layout-branding-center-nav-center';
let element = document
.querySelector ( selector );
if ( element == null ) return; // bail if branding navigation doesn't exist
selector = '.header-actions--left';
element = document
.querySelector ( selector );
if ( element != null ) return; // bail if actions left exist
selector = '.header-display-desktop';
const node = document
.querySelector ( selector );
const walker = document.createTreeWalker (
node,
NodeFilter.SHOW_COMMENT
);
while ( walker.nextNode ( ) ) {
const node = walker.currentNode;
const comment = node
.data
.trim ( );
// continue if not comment of interest
if ( comment != 'Title and nav wrapper' ) continue;
const html = `
<div class="header-actions header-actions--left">
</div>
`
.trim ( );
const template = document
.createElement ( 'template' );
template.innerHTML = html;
const element = template
.content
.firstChild;
node
.parentNode
.insertBefore ( element, node );
break;
}
} );
</script>