-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentHandler.js
More file actions
43 lines (35 loc) · 900 Bytes
/
contentHandler.js
File metadata and controls
43 lines (35 loc) · 900 Bytes
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
'use strict'
var srcHandler = function( elt )
{
var
src = elt.href || elt.dataset.unboxSrc,
alt = elt.alt || elt.dataset.unboxTitle,
srcType,
srcData,
regex = {
image : /(^data:image\/)|(.+\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?))/i,
youtube : /^(?:(?:https?:)?\/\/)?(?:www\.)?(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w-]{11})/i,
}
if(!src)
return;
for( var sourceType in regex )
{
srcData = src.match( regex[ sourceType ] );
if( srcData !== null )
srcType = elt.dataset.unboxType || sourceType;
{
this.prepCoreLoad()
{
this.flip( 'on', this.loader );
core.addEventListener( 'load', function onLoad( e ){
core.removeEventListener( 'load', onLoad );
me.reflow( me.content );
me.flip( 'off', me.loader );
me.flip( 'on', me.content );
});
return core;
}
this.imageHandler = function()
{
}
}