summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-03-16 12:46:29 +0800
committerCheng-Han, Wu2016-03-16 12:46:29 +0800
commit85078fd328d50edeeec188eefd41481d6eb824cb (patch)
treead95631dafc18a598ef52b218828560d9b89829f /public
parentb824fc8cf3d473a7966823e07945f1bf72db8f06 (diff)
Fixed minor bugs
Diffstat (limited to '')
-rw-r--r--public/js/extra.js1
-rw-r--r--public/js/index.js16
2 files changed, 13 insertions, 4 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 7b4eb0c0..41b984dc 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -366,6 +366,7 @@ function finishView(view) {
},
dataType: "jsonp",
success: function (data) {
+ if (!data.query || !data.query.results) return;
var json = data.query.results.json;
var html = json.html;
var ratio = json.height / json.width;
diff --git a/public/js/index.js b/public/js/index.js
index 79c2af0b..94ccc329 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -292,11 +292,19 @@ var statusLength = null;
var statusKeymap = null;
var statusIndent = null;
-$.get(serverurl + '/views/statusbar.html', function (template) {
- statusBarTemplate = template;
-});
+function getStatusBarTemplate(callback) {
+ $.get(serverurl + '/views/statusbar.html', function (template) {
+ statusBarTemplate = template;
+ if (callback) callback();
+ });
+}
+getStatusBarTemplate();
function addStatusBar() {
+ if (!statusBarTemplate) {
+ getStatusBarTemplate(addStatusBar);
+ return;
+ }
statusBar = $(statusBarTemplate);
statusCursor = statusBar.find('.status-cursor');
statusFile = statusBar.find('.status-file');
@@ -1469,7 +1477,7 @@ socket.on('info', function (data) {
});
socket.on('error', function (data) {
console.error(data);
- if (data.message.indexOf('AUTH failed') === 0)
+ if (data.message && data.message.indexOf('AUTH failed') === 0)
location.href = "./403";
});
socket.on('disconnect', function (data) {