-
Notifications
You must be signed in to change notification settings - Fork 9
/
show.html
175 lines (161 loc) · 4.57 KB
/
show.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sungguh Besar Setia-Mu</title>
<link rel="stylesheet" href="css/vendor/reveal.min.css">
<link rel="stylesheet" href="css/vendor/theme/default.css" id="theme">
<link rel="stylesheet" href="css/vendor/jquery.maximage.min.css">
<link rel="stylesheet" href="css/show.css">
<script type="text/html" id="lirik-view-template">
<section>
<h3>
<%= lirik %>
</h3>
</section>
</script>
</head>
<body>
<div class="reveal" id="uploadBg">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides" id="slide-view">
</div>
</div>
<div id="videoWrap">
<video id="videoBg2" autoplay loop autobuffer muted>
</video>
<video id="videoBg" autoplay loop autobuffer muted>
</video>
</div>
<div id="imageWrap">
<div id="imageBg2">
</div>
<div id="imageBg">
</div>
</div>
<div id="blackSlide">
</div>
<script type="text/javascript" src="js/vendor/jquery.min.js"></script>
<script type="text/javascript" src="js/vendor/underscore-min.js"></script>
<script type="text/javascript" src="js/vendor/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="js/vendor/jquery.maximage.min.js"></script>
<script src="js/vendor/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
function reloadReveal() {
Reveal.initialize({
controls: false,
progress: false,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
});
}
function changeSlide(number) {
Reveal.slide(number, number, number);
}
function changeBg(file) {
var fileURL = URL.createObjectURL(file);
var doAmination = function(a, b, cb1, cb2) {
$(b).hide();
if (cb1) cb1(a, b);
$(b).delay(200);
$(b).fadeIn('slow', function() {
if (cb2) cb2(a, b);
$(a).fadeOut('slow');
});
};
var swapBg = function(a, b, cb1, cb2) {
if ($(b).hasClass('active')) {
$(b).removeClass('active');
doAmination(b, a, cb1, cb2);
} else {
$(b).addClass('active');
doAmination(a, b, cb1, cb2);
}
};
var swapType = function(a, b) {
$(a).hide().fadeIn('slow');
$(b).show().fadeOut('slow');
};
if (file.type.indexOf('video/') != -1) {
var cb1 = function(a, b) {
document.querySelector(b).src = fileURL;
$(b).maximage('maxcover');
};
var cb2 = function(a, b) {
document.querySelector(a).pause();
};
swapType('#videoWrap', '#imageWrap');
swapBg('#videoBg', '#videoBg2', cb1, cb2);
} else if (file.type.indexOf('image/') != -1) {
var cb1 = function(a, b) {
$(b).html('<img src="'+fileURL+'" />');
$(b).maximage();
};
swapType('#imageWrap', '#videoWrap');
swapBg('#imageBg', '#imageBg2', cb1, null);
}
}
function clearSlide(status) {
if (status) {
$('.slides').fadeOut('slow');
} else {
$('.slides').fadeIn('slow');
}
}
function blankSlide(status) {
if (status) {
$('#blackSlide').fadeIn('slow');
} else {
$('#blackSlide').fadeOut('slow');
}
}
var PresenterApp = {
lirikData: [],
init: function(options) {
_.bindAll(this, 'dragFile', 'dropFile');
this.lirikData = options.lirikData;
this.$lirikView = $('#slide-view');
this.show(this.lirikData);
$('video, object').maximage('maxcover');
// $('#imageBg').maximage();
reloadReveal();
$('#uploadBg').on('dragenter', this.dragFile);
$('#uploadBg').on('dragover', this.dragFile);
$('#uploadBg').on('drop', this.dropFile);
},
show: function(lirikData) {
var template = _.template($('#lirik-view-template').html());
var ctr = 0;
this.$lirikView.empty();
_.each(lirikData, function(baris) {
this.$lirikView.append(template(baris));
ctr++;
}, this);
},
dragFile: function(e) {
e.preventDefault();
e.stopPropagation();
},
dropFile: function(e) {
if(e.originalEvent.dataTransfer){
if(e.originalEvent.dataTransfer.files.length) {
e.preventDefault();
e.stopPropagation();
/*UPLOAD FILES HERE*/
var file = e.originalEvent.dataTransfer.files[0];
var type = file.type;
changeBg(file);
}
}
}
}
$(document).ready(function () {
PresenterApp.init({lirikData: window.opener.lirikData.toJSON()});
});
</script>
</body>
</html>