summaryrefslogtreecommitdiff
path: root/public/js/common.js
diff options
context:
space:
mode:
authorMax Wu2016-10-13 12:41:57 +0800
committerGitHub2016-10-13 12:41:57 +0800
commitaf461ac2d6171b6133701ce0817d14f18b4fd4b1 (patch)
tree58ae2135c69dacdac283538b6b5e54c8c816bd9f /public/js/common.js
parent53f88d82d1ea414dc95e8f6181c3cc6638573665 (diff)
parent773c0ce39e2da7ea155949b5a6dae986a747e89a (diff)
Merge pull request #195 from Yukaii/webpack-frontend
Use Webpack to bundle frontend code
Diffstat (limited to 'public/js/common.js')
-rw-r--r--public/js/common.js38
1 files changed, 37 insertions, 1 deletions
diff --git a/public/js/common.js b/public/js/common.js
index 047df8af..19455f3d 100644
--- a/public/js/common.js
+++ b/public/js/common.js
@@ -1,3 +1,11 @@
+var config = require('./config');
+var domain = config.domain; // domain name
+var urlpath = config.urlpath; // sub url path, like: www.example.com/<urlpath>
+var debug = config.debug;
+var GOOGLE_API_KEY = config.GOOGLE_API_KEY;
+var GOOGLE_CLIENT_ID = config.GOOGLE_CLIENT_ID;
+var DROPBOX_APP_KEY = config.DROPBOX_APP_KEY;
+
//common
var port = window.location.port;
var serverurl = window.location.protocol + '//' + (domain ? domain : window.location.hostname) + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : '');
@@ -82,4 +90,32 @@ function checkIfAuth(yesCallback, noCallback) {
} else {
noCallback();
}
-} \ No newline at end of file
+}
+
+module.exports = {
+ domain: domain,
+ urlpath: urlpath,
+ debug: debug,
+ GOOGLE_API_KEY: GOOGLE_API_KEY,
+ GOOGLE_CLIENT_ID: GOOGLE_CLIENT_ID,
+ DROPBOX_APP_KEY: DROPBOX_APP_KEY,
+ port: port,
+ serverurl: serverurl,
+ noteid: noteid,
+ noteurl: noteurl,
+ version: version,
+ checkAuth: checkAuth,
+ profile: profile,
+ lastLoginState: lastLoginState,
+ lastUserId: lastUserId,
+ loginStateChangeEvent: loginStateChangeEvent,
+
+ /* export functions */
+ resetCheckAuth: resetCheckAuth,
+ setLoginState: setLoginState,
+ checkLoginStateChanged: checkLoginStateChanged,
+ getLoginState: getLoginState,
+ getUserId: getUserId,
+ clearLoginState: clearLoginState,
+ checkIfAuth: checkIfAuth
+};