-
Notifications
You must be signed in to change notification settings - Fork 13
/
modal lightbox observe changes.html
138 lines (73 loc) · 3.08 KB
/
modal lightbox observe changes.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
<!--
begin modal lightbox observe changes
License : < https://tinyurl.com/s872fb68 >
Version : 0.1.1
SS Versions : 7.1, 7.0
v7.1
Fluid
Engine
Compatible : Not Applicable
Note : this code is a base for other effects. on its own it
doesn't do anything. this code is not the end all be all
of mutation observers. it may not cover your needs
By : Thomas Creedon < http://www.tomsWeb.consulting/ >
-->
<script>
if ( window.twc == undefined ) window.twc = { };
twc.mloc = {
callbacks : [
/*
following is an example line. copy and paste it after the example
line. remove the double forward slash space of the new line. replace
the name with your callback
*/
// '[ enter your callback name here replacing square brackets ]',
]
};
</script>
<!-- do not change anything below, there be the borg here -->
<script>
document.addEventListener ( 'DOMContentLoaded', ( ) => {
const version = '0.1.1';
const s = `Modal Lightbox Observe Changes v${ version }, ` +
'License < https://tinyurl.com/s872fb68 >, ' +
'Tom\'s Web Consulting < http://www.tomsWeb.consulting >';
console.log ( s );
const callback = ( mutations ) => {
const callback = ( mutation ) => {
const callback = ( node ) => {
const b = ! node
.classList
.contains ( 'sqs-modal-lightbox' );
if ( b ) return; // bail if not element of interest
const callback = ( callback ) => {
try {
callback = window [ callback ];
callback ( node );
} catch ( error ) {
const s = `${ codeKey } callback error`;
console.error ( s, error );
}
};
twc
[ codeKeySuffix ]
.callbacks
.forEach ( callback );
};
mutation
.addedNodes
.forEach ( callback );
};
mutations.forEach ( callback );
};
const codeKeySuffix = 'mloc';
const codeKey = `twc-${ codeKeySuffix }`;
const config = {
childList : true
};
const observer = new MutationObserver ( callback );
// start listening for changes in body
observer.observe ( document.body, config );
} );
</script>
<!-- end modal lightbox observe changes -->