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

Fixed #216

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