-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.html
84 lines (76 loc) · 2.55 KB
/
build.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
<script type="text/javascript">
var DynamicListFuncs = DynamicListFuncs || {};
var dynamicLists = dynamicLists || {};
var closeIcon = {
black: {
url: '{{{ asset "img/cross.svg" }}}',
path: 'img/cross.svg'
},
white: {
url: '{{{ asset "img/cross_white.svg" }}}',
path: 'img/cross.svg'
}
};
</script>
{{#if layout}}
{{#if advancedSettings.cssEnabled}}
<style>
{{{advancedSettings.cssCode}}}
</style>
{{/if}}
<div data-dynamic-lists-id="{{ id }}" data-dynamic-lists-layout="{{ layout }}" data-dynamic-lists-uuid="{{uuid}}"></div>
{{#if advancedSettings.jsEnabled}}
<script type="text/javascript">
Fliplet().then(function () {
var id = {{ id }};
var data = Fliplet.Widget.getData(id);
data.closeIcon = closeIcon;
try {
{{{ advancedSettings.jsCode }}}
} catch (e) {
console.log('Error with custom JS code', e);
}
if (typeof DynamicList === 'function') {
DynamicListFuncs[id] = DynamicList;
DynamicList = null;
dynamicLists[id] = new DynamicListFuncs[id](id, data);
}
});
</script>
{{else}}
<script type="text/javascript">
var assetUrl = {
'small-card': '{{{ asset "js/layout-javascript/small-card-code.js" }}}',
'news-feed': '{{{ asset "js/layout-javascript/news-feed-code.js" }}}',
'agenda': '{{{ asset "js/layout-javascript/agenda-code.js" }}}',
'small-h-card': '{{{ asset "js/layout-javascript/small-h-card-code.js" }}}',
'simple-list': '{{{ asset "js/layout-javascript/simple-list-code.js" }}}'
};
</script>
<div data-script-insert="{{ id }}" class="hidden"></div>
<script type="text/javascript">
Fliplet().then(function () {
var script = document.createElement('script');
script.onload = function () {
if (typeof DynamicList !== 'function') {
console.warn('DynamicList() is not defined for widget for widget ID {{ id }}');
return;
}
var id = {{ id }};
DynamicListFuncs[id] = DynamicList;
DynamicList = null;
var data = Fliplet.Widget.getData(id);
data.closeIcon = closeIcon;
dynamicLists[id] = new DynamicListFuncs[id](id, data);
};
script.src = assetUrl['{{ layout }}'];
document.querySelector('[data-script-insert="{{ id }}"]').appendChild(script);
});
</script>
{{/if}}
{{else}}
<div class="dynamic-list-placeholder">
<h3>List (from data source)</h3>
<p>Click here to edit the settings.</p>
</div>
{{/if}}