tide-command.page.js
1.75 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require('home/tide-command.page.css');
let yoho = require('yoho-app');
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);
if (result.code && result.code === 200) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_MYTREND_TREND_SET_C',
param: JSON.stringify({
TREND: trendWord
})
}, true);
}
if (yoho && yoho.isApp) {
yoho.invokeMethod('go.refreshUserInfomation');
setTimeout(function() {
yoho.invokeMethod('go.back');
}, 1000);
}
}
}
});
});
(function() {
$('.world-number').html(15 - $('.command-textarea').val().length);
if (yoho && yoho.isApp) {
if (yoho.isMarsApp) {
yoho.ready(() => {
yoho.invokeMethod('set.removeTopRightButton');
});
}
}
}());