summaryrefslogtreecommitdiff
path: root/public/js/common.js
diff options
context:
space:
mode:
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
+};