Commit 8f13094d authored by Liang Ding's avatar Liang Ding

Fixed #216

parent 0bf0c7c0
...@@ -20,5 +20,5 @@ ...@@ -20,5 +20,5 @@
# Author: Liang Ding # Author: Liang Ding
# #
rhythm.servePath=http://rhythm.b3log.org:8081 rhythm.servePath=http://rhythm.b3log.org:80
symphony.servePath=http://symphony.b3log.org:8084 symphony.servePath=http://symphony.b3log.org:80
...@@ -27,4 +27,4 @@ contentLabel1=Content: ...@@ -27,4 +27,4 @@ contentLabel1=Content:
noEmptyLabel=No Empty noEmptyLabel=No Empty
submitLabel=Submit submitLabel=Submit
submitErrorLabel=Error submitErrorLabel=Error
chanceBroadcastLabel=Second Chance chanceBroadcastLabel=Time to post:
...@@ -27,4 +27,4 @@ contentLabel1=\u5185\u5bb9\uff1a ...@@ -27,4 +27,4 @@ contentLabel1=\u5185\u5bb9\uff1a
noEmptyLabel=\u4e0d\u80fd\u4e3a\u7a7a noEmptyLabel=\u4e0d\u80fd\u4e3a\u7a7a
submitLabel=\u63d0\u4ea4 submitLabel=\u63d0\u4ea4
submitErrorLabel=\u63d0\u4ea4\u5f02\u5e38 submitErrorLabel=\u63d0\u4ea4\u5f02\u5e38
chanceBroadcastLabel=\u79d2\u673a\u4f1a\u8fdb\u884c\u5e7f\u64ad chanceBroadcastLabel1=\u5e7f\u64ad\u5269\u4f59\u65f6\u95f4\uff1a
\ No newline at end of file \ No newline at end of file
...@@ -80,9 +80,9 @@ ...@@ -80,9 +80,9 @@
$("#b3logBroadcastContent").val(""); $("#b3logBroadcastContent").val("");
$("#b3logBroadcastDialog").dialog("close"); $("#b3logBroadcastDialog").dialog("close");
$("#b3logBroadcastDialog > button").next().hide(); $("#b3logBroadcastDialog > button").next().hide();
$("#b3logBroadcast .module-header > button").hide();
$("#b3logBroadcastTitle").prev().hide(); $("#b3logBroadcastTitle").prev().hide();
$("#b3logBroadcastContent").prev().hide(); $("#b3logBroadcastContent").prev().hide();
broadcastChange();
} else { } else {
$("#b3logBroadcastDialog > button").next().show(); $("#b3logBroadcastDialog > button").next().show();
} }
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
// 获取广播 // 获取广播
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "http://symphony.b3log.org:8084/apis/broadcasts", url: "http://symphony.b3log.org/apis/broadcasts",
dataType: "jsonp", dataType: "jsonp",
jsonp: "callback", jsonp: "callback",
beforeSend: function() { beforeSend: function() {
...@@ -128,33 +128,50 @@ ...@@ -128,33 +128,50 @@
} }
}); });
// 广播机会 // 广播机会
setInterval(function() { var interval;
var broadcastChange = function() {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: latkeConfig.servePath + "/console/plugins/b3log-broadcast/chance", url: latkeConfig.servePath + "/console/plugins/b3log-broadcast/chance",
cache: false,
success: function(result) { success: function(result) {
if (result.sc) { if (result.sc) {
var ShowCountDown = function() { var showCountDown = function() {
var now = new Date(); var now = new Date();
var leftTime = result.broadcastChanceExpirationTime - now.getTime(); var leftTime = result.broadcastChanceExpirationTime - now.getTime();
var leftsecond = parseInt(leftTime / 1000); var leftsecond = parseInt(leftTime / 1000);
if (leftsecond < 0) {
$("#b3logBroadcast .module-header > button").hide();
clearInterval(interval);
interval = undefined;
return;
} else {
var minute = Math.floor(leftsecond / 60), var minute = Math.floor(leftsecond / 60),
second = Math.floor(leftsecond - minute * 60); second = Math.floor(leftsecond - minute * 60);
$("#b3logBroadcast .module-header > button").text("${chanceBroadcastLabel}:" + minute + ":" + second).show(); $("#b3logBroadcast .module-header > button").text("${chanceBroadcastLabel1}" + minute + ":" + second).show();
}
}; };
window.setInterval(function() { if (!interval) {
ShowCountDown(); interval = window.setInterval(function() {
showCountDown();
}, 1000); }, 1000);
}
} else { } else {
$("#b3logBroadcast .module-header > button").hide(); $("#b3logBroadcast .module-header > button").hide();
clearInterval(interval);
interval = undefined;
} }
} }
}); });
};
setInterval(function() {
broadcastChange();
}, 10000); }, 10000);
broadcastChange();
} }
}; };
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment