diff options
author | Cheng-Han, Wu | 2016-02-16 20:08:44 -0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-02-16 20:08:44 -0800 |
commit | b2b1be3dda406312add39997ad8bd9494f20b7f8 (patch) | |
tree | 997403359ffc0f585fa52752c399ce87287222c3 /public/js/common.js | |
parent | 3f2f063e9b6c6d36169f6acefc27df87d0bd176b (diff) |
Support set url path and use relative url, move raphael to bower and fixed minor issue in history
Diffstat (limited to '')
-rw-r--r-- | public/js/common.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/public/js/common.js b/public/js/common.js index e6928e98..e84bc169 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -1,5 +1,12 @@ //common -var domain = 'change this'; +var domain = 'change this'; // domain name +var urlpath = ''; // sub url path, like: www.example.com/<urlpath> + +var port = window.location.port; +var serverurl = window.location.protocol + '//' + domain + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : ''); +var noteid = urlpath ? window.location.pathname.slice(urlpath.length + 1, window.location.pathname.length).split('/')[1] : window.location.pathname.split('/')[1]; +var noteurl = serverurl + '/' + noteid; + var checkAuth = false; var profile = null; var lastLoginState = getLoginState(); @@ -53,7 +60,7 @@ function checkIfAuth(yesCallback, noCallback) { if (checkLoginStateChanged()) checkAuth = false; if (!checkAuth || typeof cookieLoginState == 'undefined') { - $.get('/me') + $.get(serverurl + '/me') .done(function (data) { if (data && data.status == 'ok') { profile = data; |