-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
55 lines (43 loc) · 1.56 KB
/
main.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
/*
*/
// =============
// = Polyfills =
// =============
var polyfills = [],
lang = ( document.documentElement.lang ) ? document.documentElement.lang : "en";
// =========================
// CONFIGURATION
// =========================
require.config({
config: {
i18n: {
locale: lang
}
}
});
require([ "/assets/wet-boew/lib/dom/stylesheet.js" ], function( Stylesheet ) {
// Lets bind the dictionary to the window-object
//window.i18n = i8n;
let insertListener = function( event ) {
if (
event.animationName === "nodeInserted" &&
event.target.tagName.startsWith("WB-")
) {
let node = Object.assign( event.target, {} ),
tagName = node.tagName.toLowerCase();
path = ( node.getAttribute('srcid') ) ? node.getAttribute('srcid') + "/logic.js" : "core/" + tagName + "/logic.js" ;
require( [ path ], function( element ) {
if ( element && element.init ) {
element.init( node );
}
});
}
}
document.addEventListener( "animationstart", insertListener, false ) ; // standard+ firefox
document.addEventListener( "MSAnimationStart", insertListener, false ) ; // IE
document.addEventListener( "webkitAnimationStart", insertListener, false ) ; // Chrome + Safari
// Add the observer event binding
document.head.appendChild(
Stylesheet.css("@keyframes nodeInserted {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n\n[v] {animation-duration: 0.001s;animation-name: nodeInserted;}" )
);
});