wolegca.github.io/js/view.js

34 lines
861 B
JavaScript
Raw Normal View History

2019-09-20 13:32:44 +08:00
(function () {
2019-10-19 22:13:48 +08:00
var index = window.parseInt(getQueryString('i'));
if (window.isNaN(index)) {
message.alert('发生错误', '缺少参数或参数类型不正确请检查URL是否正确', function () {
2019-10-19 22:03:32 +08:00
window.location.replace('/');
});
return;
}
2019-09-20 13:32:44 +08:00
$.ajax({
type: "GET",
2019-09-20 22:34:39 +08:00
url: "content.json?timestamp=" + (new Date()).valueOf(),
2019-09-20 13:32:44 +08:00
dataType: "json",
success: function (response) {
2019-10-19 21:56:07 +08:00
2019-09-21 16:07:59 +08:00
if (response.length <= index)
return;
2019-09-20 22:34:39 +08:00
listContent(response, index);
2019-09-20 13:32:44 +08:00
$.ajax({
type: "GET",
url: 'content/html/' + response[index]['date'] + '.html',
success: function (res) {
appendContent(res);
2019-09-21 16:17:12 +08:00
},
2019-10-19 21:56:07 +08:00
error: function () {
message.alert('出错了!', '网络连接出错了,请稍后再试');
2019-09-20 13:32:44 +08:00
}
});
2019-09-21 16:17:12 +08:00
},
2019-10-19 21:56:07 +08:00
error: function () {
message.alert('出错了!', '网络连接出错了,请稍后再试');
2019-09-20 13:32:44 +08:00
}
});
})();