tide-command.page.js
1.21 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
require('home/tide-command.page.css');
let tip = require('plugin/tip');
let qs = require('yoho-qs');
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);
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_MYTREND_TREND_SET_C',
param: JSON.stringify({
TREND: trendWord
})
}, true);
}
}
});
});
(function() {
$('.world-number').html(15 - $('.command-textarea').val().length);
}());