Fixed minor bugs

This commit is contained in:
Cheng-Han, Wu 2016-03-16 12:46:29 +08:00
parent b824fc8cf3
commit 85078fd328
2 changed files with 13 additions and 4 deletions

View file

@ -366,6 +366,7 @@ function finishView(view) {
}, },
dataType: "jsonp", dataType: "jsonp",
success: function (data) { success: function (data) {
if (!data.query || !data.query.results) return;
var json = data.query.results.json; var json = data.query.results.json;
var html = json.html; var html = json.html;
var ratio = json.height / json.width; var ratio = json.height / json.width;

View file

@ -292,11 +292,19 @@ var statusLength = null;
var statusKeymap = null; var statusKeymap = null;
var statusIndent = null; var statusIndent = null;
$.get(serverurl + '/views/statusbar.html', function (template) { function getStatusBarTemplate(callback) {
statusBarTemplate = template; $.get(serverurl + '/views/statusbar.html', function (template) {
}); statusBarTemplate = template;
if (callback) callback();
});
}
getStatusBarTemplate();
function addStatusBar() { function addStatusBar() {
if (!statusBarTemplate) {
getStatusBarTemplate(addStatusBar);
return;
}
statusBar = $(statusBarTemplate); statusBar = $(statusBarTemplate);
statusCursor = statusBar.find('.status-cursor'); statusCursor = statusBar.find('.status-cursor');
statusFile = statusBar.find('.status-file'); statusFile = statusBar.find('.status-file');
@ -1469,7 +1477,7 @@ socket.on('info', function (data) {
}); });
socket.on('error', function (data) { socket.on('error', function (data) {
console.error(data); console.error(data);
if (data.message.indexOf('AUTH failed') === 0) if (data.message && data.message.indexOf('AUTH failed') === 0)
location.href = "./403"; location.href = "./403";
}); });
socket.on('disconnect', function (data) { socket.on('disconnect', function (data) {