tide-command.page.js
907 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
require('home/tide-command.page.css');
let tip = require('plugin/tip');
let trendWord;
$('.tide-command-page').css('min-height', function() {
return $(window).height();
});
$('.close').click(function() {
$('.command-textarea').val('');
});
$('.command-textarea').bind('input propertychange', function() {
$('.world-number').html(15 - $('.command-textarea').val().length);
if ($('.command-textarea').val().length >= 15) {
$(this).val($(this).val().substring(0, 14));
}
});
$('.save').click(function() {
trendWord = $('.command-textarea').val();
$.ajax({
type: 'GET',
url: '/activity/set-trend-world',
data: {
trendWord: trendWord
},
success: function(result) {
tip.show(result.message);
}
});
});
(function() {
$('.world-number').html(15 - $('.command-textarea').val().length);
}());