diff options
author | Cheng-Han, Wu | 2016-05-15 10:54:24 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-05-15 10:54:24 +0800 |
commit | a70ebf77620d6c5651e092cc4998c416161746cf (patch) | |
tree | 47deac42c840b770a17e79795b7a8ac5b8320784 /public/js/index.js | |
parent | a816420302b2c38893ab719e2a52c4c4b4ba7b50 (diff) |
Update to move dropbox app key setting to common.js and will auto load client-side related scripts
Diffstat (limited to 'public/js/index.js')
-rw-r--r-- | public/js/index.js | 29 |
1 files changed, 29 insertions, 0 deletions
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"); |