-
Notifications
You must be signed in to change notification settings - Fork 1
/
function.js
91 lines (82 loc) · 2.8 KB
/
function.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
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
$(document).ready(function (e) {
var pttbtn = $('.record-right'),
recordTime = $('.time'),
spcon = $('.speech-container'),
btnEmoticon = $('.emoticon'),
sec = 0, min = 0, count = 0,
restartCount = function() {
if (count !== 0) {return;}
count = setInterval(function () {
if (sec <= 9 && min == 0) {
recordTime.text(min + ':0' + sec++);
return min;}
else if (sec > 9 && sec < 60 && min == 0) {
recordTime.text(min + ':' + sec++);
return min;}
else if (sec >= 60) {
sec = 0; min = min + 1;
recordTime.text(min + ':0' + sec++);
return min;}
else if (sec <= 9 && min >= 1) {
recordTime.text(min + ':0' + sec++);
return min;}
else if (sec > 9 && sec < 60 && min >= 1) {
recordTime.text(min + ':' + sec++);
return min;}
else if ( sec >= 60 && min >= 1) {
sec = 0; min = min + 1;
recordTime.text(min + ':' + sec++);
return min;}
}, 1000);};
// Initialize tutorial
$('.circle').on('mouseover', function() {
$('.start-here, .tutorial-dimmer').remove();
});
pttbtn.on('click', function(e) {
if ($('.swipe-to-cancel').length == 0) {
spcon.prepend('<div class="swipe-to-cancel"></div>');
}
btnEmoticon.addClass('hide');
$('.record-left').addClass('record-start');
spcon.css({'right' : "40px"});
$('.swipe-to-cancel').draggable({
axis: "x",
containment: ".speech-container",
drag: function() {
if ($('.swipe-to-cancel').offset().left - $('.wa-input-container').offset().left === 40) {
$(this).draggable('destroy');
$(this).remove();
spcon.attr("style", "");
recordTime.text('0:00');
clearInterval(count); count = 0; sec = 0; min = 0;
$('.record-left').removeClass('record-start').addClass('show small record-delete').delay(2000).queue(function() {
$(this).removeClass('show small record-delete').dequeue();
// btnEmoticon.removeClass('hide').dequeue();
});
$('.bin').delay(1000).queue(function() {
$(this).css({'bottom' : '5px'}).dequeue();
});
$('.bin').delay(1000).queue(function() {
$(this).css({'bottom' : '-40px'}).dequeue();
});
$('.bin-head').delay(1000).queue(function() {
$(this).addClass('anim').dequeue();
});
$('.bin-head').delay(1000).queue(function() {
$(this).removeClass('anim').dequeue();
$('.bin').removeClass('show').dequeue();
});
btnEmoticon.delay(2500).queue(function() {
$(this).removeClass('hide').dequeue();
});
}
},
stop: function() {
if ($('.swipe-to-cancel').offset().left - $('.wa-input-container').offset().left >= 40) {
$(this).css({'left' : '55px'});
}
}
});
restartCount();
});
});