diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/common.js | 6 | ||||
-rw-r--r-- | public/js/index.js | 29 |
2 files changed, 33 insertions, 2 deletions
diff --git a/public/js/common.js b/public/js/common.js index c623cd24..33b30689 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -4,8 +4,10 @@ var urlpath = ''; // sub url path, like: www.example.com/<urlpath> //settings var debug = false; -var GOOGLE_API_KEY = 'change this'; -var GOOGLE_CLIENT_ID = 'change this'; +var GOOGLE_API_KEY = ''; +var GOOGLE_CLIENT_ID = ''; + +var DROPBOX_APP_KEY = ''; var port = window.location.port; var serverurl = window.location.protocol + '//' + (domain ? domain : window.location.hostname) + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : ''); diff --git a/public/js/index.js b/public/js/index.js index 3f0ed593..6bb50c68 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1048,6 +1048,35 @@ function showMessageModal(title, header, href, text, success) { modal.modal('show'); } +// check if dropbox app key is set and load scripts +if (DROPBOX_APP_KEY) { + $('<script>') + .attr('type', 'text/javascript') + .attr('src', 'https://www.dropbox.com/static/api/2/dropins.js') + .attr('id', 'dropboxjs') + .attr('data-app-key', DROPBOX_APP_KEY) + .appendTo('body'); +} else { + ui.toolbar.import.dropbox.hide(); + ui.toolbar.export.dropbox.hide(); +} + +// check if google api key and client id are set and load scripts +if (GOOGLE_API_KEY && GOOGLE_CLIENT_ID) { + $('<script>') + .attr('type', 'text/javascript') + .attr('src', 'https://www.google.com/jsapi') + .appendTo('body'); + + $('<script>') + .attr('type', 'text/javascript') + .attr('src', 'https://apis.google.com/js/client:plusone.js?onload=onGoogleClientLoaded') + .appendTo('body'); +} else { + ui.toolbar.import.googleDrive.hide(); + ui.toolbar.export.googleDrive.hide(); +} + //button actions //share ui.toolbar.publish.attr("href", noteurl + "/publish"); |