-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathdefaultFilters.js
More file actions
64 lines (62 loc) · 1.75 KB
/
defaultFilters.js
File metadata and controls
64 lines (62 loc) · 1.75 KB
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
module.exports = {
'script': function() {
return this.attribs.src;
},
'link[rel="stylesheet"]': function() {
return this.attribs['href'];
},
'meta[property]': function() {
return this.attribs.content;
},
'div': function() {
if(this.attribs['class']&&(this.attribs['class'].indexOf(' lazy') >= 0 )){
return this.attribs['data-original'];
}else{
return false;
}
},
'img': [
function() {
if(this.attribs['class']&&(this.attribs['class'].indexOf(' lazy') >= 0 )){
return this.attribs['data-original'];
}else{
return this.attribs.src;
}
},
function() {
var srcset = this.attribs.srcset;
if (!srcset) {
return false;
}
return srcset.split(',').map(function(src) {
return src.trim().split(' ')[0];
});
}
],
'video': function() {
return this.attribs['src'];
},
// Video source tag e.g. <video><source src="video.mp4" type="video/mp4" /></video>
'source' : function() {
if (this.attribs.type && this.attribs.type.indexOf("video") === 0 ){
return this.attribs.src;
}
return undefined;
},
'link[rel*="icon"]': function() {
return this.attribs.href;
},
'script[type="text/template"]': function() {},
'square70x70logo': function() {
return this.attribs.src;
},
'square150x150logo': function() {
return this.attribs.src;
},
'square310x310logo': function() {
return this.attribs.src;
},
'wide310x150logo': function() {
return this.attribs.src;
}
};