From fd321284f55d9c1c828636cb553391aa50efb5b6 Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 11 Aug 2014 00:47:04 +0100 Subject: [PATCH] Fixes and improvements --- public/res/constants.js | 149 +++++++++++----------- public/res/extensions/documentManager.js | 4 +- public/res/extensions/scrollSync.js | 6 +- public/res/html/bodyIndex.html | 16 +-- public/res/html/dialogAbout.html | 21 +-- public/res/html/dialogAutoSyncGdrive.html | 2 +- public/res/html/dialogExportGdrive.html | 2 +- public/res/layout.js | 2 + public/res/libs/Markdown.Editor.js | 10 +- public/res/libs/prism-markdown.js | 6 +- 10 files changed, 104 insertions(+), 114 deletions(-) diff --git a/public/res/constants.js b/public/res/constants.js index ebeabae4..e081e790 100644 --- a/public/res/constants.js +++ b/public/res/constants.js @@ -1,81 +1,82 @@ define([], function() { - var constants = {}; - constants.VERSION = "3.99.15"; - constants.MAIN_URL = "https://stackedit.io/"; - constants.GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1"; - constants.GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw"; - constants.GOOGLE_DRIVE_APP_ID = "241271498917"; - constants.DROPBOX_APP_KEY = "lq6mwopab8wskas"; - constants.DROPBOX_APP_SECRET = "851fgnucpezy84t"; - constants.DROPBOX_RESTRICTED_APP_KEY = "sw0hlixhr8q1xk0"; - constants.DROPBOX_RESTRICTED_APP_SECRET = "1r808p2xygs6lbg"; - constants.BITLY_ACCESS_TOKEN = "317e033bfd48cf31155a68a536b1860013b09c4c"; - constants.DEFAULT_FILE_TITLE = "Title"; - constants.DEFAULT_FOLDER_NAME = "New folder"; - constants.GDRIVE_DEFAULT_FILE_TITLE = "New Markdown document"; - constants.EDITOR_DEFAULT_PADDING = 35; - constants.CHECK_ONLINE_PERIOD = 120000; - constants.AJAX_TIMEOUT = 30000; - constants.ASYNC_TASK_DEFAULT_TIMEOUT = 60000; - constants.ASYNC_TASK_LONG_TIMEOUT = 180000; - constants.USER_IDLE_THRESHOLD = 300000; - constants.IMPORT_FILE_MAX_CONTENT_SIZE = 100000; - constants.IMPORT_IMG_MAX_CONTENT_SIZE = 10000000; - constants.TEMPORARY_FILE_INDEX = "file.tempIndex"; - constants.WELCOME_DOCUMENT_TITLE = "Welcome document"; - constants.DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/"; - constants.PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/"; - constants.SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/"; - constants.HTMLTOPDF_URL = "https://stackedit-htmltopdf.herokuapp.com/"; + var constants = {}; + constants.VERSION = "3.99.15"; + constants.MAIN_URL = "https://stackedit.io/"; + constants.GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1"; + constants.GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw"; + constants.GOOGLE_DRIVE_APP_ID = "241271498917"; + constants.DROPBOX_APP_KEY = "lq6mwopab8wskas"; + constants.DROPBOX_APP_SECRET = "851fgnucpezy84t"; + constants.DROPBOX_RESTRICTED_APP_KEY = "sw0hlixhr8q1xk0"; + constants.DROPBOX_RESTRICTED_APP_SECRET = "1r808p2xygs6lbg"; + constants.BITLY_ACCESS_TOKEN = "317e033bfd48cf31155a68a536b1860013b09c4c"; + constants.DEFAULT_FILE_TITLE = "Title"; + constants.DEFAULT_FOLDER_NAME = "New folder"; + constants.GDRIVE_DEFAULT_FILE_TITLE = "New Markdown document"; + constants.EDITOR_DEFAULT_PADDING = 35; + constants.CHECK_ONLINE_PERIOD = 120000; + constants.AJAX_TIMEOUT = 30000; + constants.ASYNC_TASK_DEFAULT_TIMEOUT = 60000; + constants.ASYNC_TASK_LONG_TIMEOUT = 180000; + constants.USER_IDLE_THRESHOLD = 300000; + constants.IMPORT_FILE_MAX_CONTENT_SIZE = 100000; + constants.IMPORT_IMG_MAX_CONTENT_SIZE = 10000000; + constants.TEMPORARY_FILE_INDEX = "file.tempIndex"; + constants.WELCOME_DOCUMENT_TITLE = "Welcome document"; + constants.DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/"; + constants.PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/"; + constants.SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/"; + constants.HTMLTOPDF_URL = "https://stackedit-htmltopdf.herokuapp.com/"; // Site dependent - constants.BASE_URL = "http://localhost/"; - constants.GOOGLE_CLIENT_ID = '241271498917-lev37kef013q85avc91am1gccg5g8lrb.apps.googleusercontent.com'; - constants.GITHUB_CLIENT_ID = 'e47fef6055344579799d'; - constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-localhost.herokuapp.com/"; - constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-local.herokuapp.com/"; - constants.WORDPRESS_CLIENT_ID = '23361'; - constants.WORDPRESS_PROXY_URL = "https://stackedit-io-wordpress-proxy.herokuapp.com/"; + constants.BASE_URL = "http://localhost/"; + constants.GOOGLE_CLIENT_ID = '241271498917-lev37kef013q85avc91am1gccg5g8lrb.apps.googleusercontent.com'; + constants.GITHUB_CLIENT_ID = 'e47fef6055344579799d'; + constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-localhost.herokuapp.com/"; + constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-local.herokuapp.com/"; + constants.WORDPRESS_CLIENT_ID = '23361'; + constants.WORDPRESS_PROXY_URL = "https://stackedit-io-wordpress-proxy.herokuapp.com/"; - if(location.hostname.indexOf("stackedit.io") === 0) { - constants.BASE_URL = constants.MAIN_URL; - constants.GOOGLE_CLIENT_ID = '241271498917-t4t7d07qis7oc0ahaskbif3ft6tk63cd.apps.googleusercontent.com'; - constants.GITHUB_CLIENT_ID = '710fc67886ab1ae8fee6'; - constants.GATEKEEPER_URL = "https://stackedit-io-gatekeeper.herokuapp.com/"; - constants.TUMBLR_PROXY_URL = "https://stackedit-io-tumblr-proxy.herokuapp.com/"; - } - else if(location.hostname.indexOf("benweet.github.io") === 0) { - constants.BASE_URL = 'http://benweet.github.io/stackedit/'; - constants.GOOGLE_CLIENT_ID = '241271498917-jpto9lls9fqnem1e4h6ppds9uob8rpvu.apps.googleusercontent.com'; - constants.GITHUB_CLIENT_ID = 'fa0d09514da8377ee32e'; - constants.GATEKEEPER_URL = "https://stackedit-gatekeeper.herokuapp.com/"; - constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy.herokuapp.com/"; - constants.WORDPRESS_CLIENT_ID = '3185'; - constants.WORDPRESS_PROXY_URL = "https://stackedit-wordpress-proxy.herokuapp.com/"; - } - else if(location.hostname.indexOf("stackedit-beta.herokuapp.com") === 0) { - constants.BASE_URL = 'https://stackedit-beta.herokuapp.com/'; - constants.GOOGLE_CLIENT_ID = '241271498917-9bbplknkt0ljv5gaudhoiogp13hd18be.apps.googleusercontent.com'; - constants.GITHUB_CLIENT_ID = 'e9034ae191c3a8a1c5ed'; - constants.GATEKEEPER_URL = "https://stackedit-beta-gatekeeper.herokuapp.com/"; - constants.TUMBLR_PROXY_URL = "https://stackedit-beta-tumblr-proxy.herokuapp.com/"; - constants.WORDPRESS_CLIENT_ID = '34786'; - constants.WORDPRESS_PROXY_URL = "https://stackedit-beta-wordpress-proxy.herokuapp.com/"; - } - else if(location.hostname.indexOf("benweet.insomnia247.nl") === 0) { - constants.BASE_URL = "http://benweet.insomnia247.nl/stackedit/"; - constants.GOOGLE_CLIENT_ID = '241271498917-52hae7a08hv7ltenv7km8h7lghno9sk3.apps.googleusercontent.com'; - constants.GITHUB_CLIENT_ID = 'd2943d6074b2d9c4a830'; - constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-insomnia.herokuapp.com/"; - constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-beta.herokuapp.com/"; - } + if(location.hostname.indexOf("stackedit.io") === 0) { + constants.BASE_URL = constants.MAIN_URL; + constants.GOOGLE_CLIENT_ID = '241271498917-t4t7d07qis7oc0ahaskbif3ft6tk63cd.apps.googleusercontent.com'; + constants.GITHUB_CLIENT_ID = '710fc67886ab1ae8fee6'; + constants.GATEKEEPER_URL = "https://stackedit-io-gatekeeper.herokuapp.com/"; + constants.TUMBLR_PROXY_URL = "https://stackedit-io-tumblr-proxy.herokuapp.com/"; + } + else if(location.hostname.indexOf("benweet.github.io") === 0) { + constants.BASE_URL = 'http://benweet.github.io/stackedit/'; + constants.GOOGLE_CLIENT_ID = '241271498917-jpto9lls9fqnem1e4h6ppds9uob8rpvu.apps.googleusercontent.com'; + constants.GITHUB_CLIENT_ID = 'fa0d09514da8377ee32e'; + constants.GATEKEEPER_URL = "https://stackedit-gatekeeper.herokuapp.com/"; + constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy.herokuapp.com/"; + constants.WORDPRESS_CLIENT_ID = '3185'; + constants.WORDPRESS_PROXY_URL = "https://stackedit-wordpress-proxy.herokuapp.com/"; + } + else if(location.hostname.indexOf("stackedit-beta.herokuapp.com") === 0) { + constants.BASE_URL = 'https://stackedit-beta.herokuapp.com/'; + constants.GOOGLE_CLIENT_ID = '241271498917-9bbplknkt0ljv5gaudhoiogp13hd18be.apps.googleusercontent.com'; + constants.GITHUB_CLIENT_ID = 'e9034ae191c3a8a1c5ed'; + constants.GATEKEEPER_URL = "https://stackedit-beta-gatekeeper.herokuapp.com/"; + constants.TUMBLR_PROXY_URL = "https://stackedit-beta-tumblr-proxy.herokuapp.com/"; + constants.WORDPRESS_CLIENT_ID = '34786'; + constants.WORDPRESS_PROXY_URL = "https://stackedit-beta-wordpress-proxy.herokuapp.com/"; + } + else if(location.hostname.indexOf("benweet.insomnia247.nl") === 0) { + constants.BASE_URL = "http://benweet.insomnia247.nl/stackedit/"; + constants.GOOGLE_CLIENT_ID = '241271498917-52hae7a08hv7ltenv7km8h7lghno9sk3.apps.googleusercontent.com'; + constants.GITHUB_CLIENT_ID = 'd2943d6074b2d9c4a830'; + constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-insomnia.herokuapp.com/"; + constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-beta.herokuapp.com/"; + } - constants.THEME_LIST = { - "default": "Default", - "gray": "Gray", - "night": "Night", - "school": "School", - }; + constants.THEME_LIST = { + "blue": "Blue", + "default": "Default", + "gray": "Gray", + "night": "Night", + "school": "School" + }; - return constants; + return constants; }); diff --git a/public/res/extensions/documentManager.js b/public/res/extensions/documentManager.js index 0ae904e6..b4bb83ff 100644 --- a/public/res/extensions/documentManager.js +++ b/public/res/extensions/documentManager.js @@ -246,10 +246,10 @@ define([ // Selection dropdown menu actions $(modalElt.querySelectorAll('.action-select-all')).click(function() { - $(documentListElt.querySelectorAll('input[type="checkbox"]')).prop('checked', true).change(); + $(documentListElt.querySelectorAll('.folder input[type="checkbox"]')).prop('checked', true).change(); }); $(modalElt.querySelectorAll('.action-unselect-all')).click(function() { - $(documentListElt.querySelectorAll('input[type="checkbox"]')).prop('checked', false).change(); + $(documentListElt.querySelectorAll('.folder input[type="checkbox"]')).prop('checked', false).change(); }); // Delete selection actions diff --git a/public/res/extensions/scrollSync.js b/public/res/extensions/scrollSync.js index e267b3f9..d9bfdd51 100644 --- a/public/res/extensions/scrollSync.js +++ b/public/res/extensions/scrollSync.js @@ -231,11 +231,11 @@ define([ $('.extension-preview-buttons .table-of-contents').on('click', 'a', function(evt) { evt.preventDefault(); var id = this.hash; - var anchorElt = previewElt.querySelector(id); - if(!anchorElt) { + var anchorElt = $(id); + if(!anchorElt.length) { return; } - var previewScrollTop = anchorElt.getBoundingClientRect().top - previewElt.getBoundingClientRect().top + previewElt.scrollTop; + var previewScrollTop = anchorElt[0].getBoundingClientRect().top - previewElt.getBoundingClientRect().top + previewElt.scrollTop; previewElt.scrollTop = previewScrollTop; var editorScrollTop = getDestScrollTop(previewScrollTop, htmlSectionList, mdSectionList); editorElt.scrollTop = editorScrollTop; diff --git a/public/res/html/bodyIndex.html b/public/res/html/bodyIndex.html index d78974f1..77fffb3b 100644 --- a/public/res/html/bodyIndex.html +++ b/public/res/html/bodyIndex.html @@ -862,7 +862,7 @@ "" can be shared using the following link(s):

-

No sharing link yet! +

No sharing link yet!

To collaborate on this document, use Google Drive or Dropbox synchronization from the menu. @@ -1157,30 +1157,30 @@

diff --git a/public/res/html/dialogAbout.html b/public/res/html/dialogAbout.html index 87b475d5..3c99b565 100644 --- a/public/res/html/dialogAbout.html +++ b/public/res/html/dialogAbout.html @@ -2,8 +2,7 @@