From 8e11c19bed6b99b5476d9d7a6125dcfdd4119064 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Fri, 7 Oct 2016 23:06:10 +0800 Subject: Move out script tag and use js instead --- public/js/index.js | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 5 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 03729de4..9590a4e3 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1,3 +1,75 @@ +/* include jquery ui */ +require('jquery-ui/ui/widgets/resizable'); +require('jquery-ui/ui/widgets/tooltip'); +require('jquery-ui/ui/widgets/controlgroup'); +require('jquery-ui/ui/widgets/autocomplete'); + +/* jquery and jquery plugins */ +require('jquery'); +require('jquery-textcomplete'); +require('jquery-mousewheel'); +require('../vendor/jquery-scrollspy'); +require('../vendor/showup/showup'); + +/* bootstrap */ +require('bootstrap'); + +/* code mirror plugins */ +require('codemirror/keymap/vim'); +require('codemirror/keymap/emacs'); +require('codemirror/keymap/sublime'); + +require('../vendor/inlineAttachment/inline-attachment'); +require('../vendor/inlineAttachment/codemirror.inline-attachment'); +require('../vendor/codemirror-spell-checker/spell-checker.min'); + +/* operational transformation */ +require('../vendor/ot/ot.min'); + +/* other vendors plugin */ +require('markdown-it'); +require('markdown-it-abbr'); +require('markdown-it-footnote'); +require('markdown-it-deflist'); +require('markdown-it-mark'); +require('markdown-it-ins'); +require('markdown-it-sub'); +require('markdown-it-sup'); +require('markdown-it-container'); +require('markdown-it-mathjax'); +require('markdown-it-regexp'); +require('markdown-it-imsize'); + +require('gist-embed'); +require('lz-string'); +require('xss'); +require('string'); +require('highlight.js'); +require('prismjs'); +require('prismjs/components/prism-wiki'); +require('js-cookie'); +require('emojify.js'); +require('to-markdown'); + +require('raphael'); +require('js-sequence-diagrams'); + +require('flowchart.js'); +require('viz.js'); +require('pdfobject'); +require('file-saver'); +require('store'); +require('js-url'); +require('visibilityjs'); +require('list.js'); +require('../vendor/md-toc'); +require('randomcolor'); +require('keymaster'); + +var common = require('./common.js'); + +var serverurl = common.serverurl; + var defaultTextHeight = 20; var viewportMargin = 20; var mac = CodeMirror.keyMap["default"] == CodeMirror.keyMap.macDefault; @@ -126,7 +198,7 @@ function wrapTextWith(cm, symbol) { }; var postText = cm.getRange(postEndPos, from); var postIndex = wrapSymbols.indexOf(postText); - // check if surround symbol are list in array and matched + // check if surround symbol are list in array and matched if (preIndex > -1 && postIndex > -1 && preIndex === postIndex) { cm.replaceRange("", to, preEndPos, '+delete'); cm.replaceRange("", postEndPos, from, '+delete'); @@ -1035,7 +1107,7 @@ function checkEditorStyle() { }, stop: function (e) { lastEditorWidth = ui.area.edit.width(); - // workaround that scroll event bindings + // workaround that scroll event bindings preventSyncScrollToView = 2; preventSyncScrollToEdit = true; editor.setOption('viewportMargin', viewportMargin); @@ -1269,12 +1341,12 @@ function changeMode(type) { preventSyncScrollToView = 2; syncScrollToEdit(null, true); } - + if (lastMode == modeType.edit && currentMode == modeType.both) { preventSyncScrollToEdit = 2; syncScrollToView(null, true); } - + if (lastMode == modeType.both && currentMode != modeType.both) { preventSyncScrollToView = false; preventSyncScrollToEdit = false; @@ -1675,7 +1747,7 @@ function parseRevisions(_revisions) { } } function selectRevision(time) { - if (time == revisionTime) return; + if (time == revisionTime) return; $.get(noteurl + '/revision/' + time) .done(function(data) { revision = data; -- cgit v1.2.3 From ebee5a8d05a0282f5f584abc7d1eaa26d9d17ad8 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 19:56:38 +0800 Subject: Use xss in script tag --- public/js/index.js | 1 - 1 file changed, 1 deletion(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 9590a4e3..90a3daf4 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -42,7 +42,6 @@ require('markdown-it-imsize'); require('gist-embed'); require('lz-string'); -require('xss'); require('string'); require('highlight.js'); require('prismjs'); -- cgit v1.2.3 From 0be342c44d5b6287c67922758f076e7897f6c3a8 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 19:58:26 +0800 Subject: Fix mutiple socket.on handling --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 90a3daf4..dff278c9 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2250,7 +2250,7 @@ var socket = io.connect({ var on = socket.on; socket.on = function () { if (!checkLoginStateChanged() && !needRefresh) - on.apply(socket, arguments); + return on.apply(socket, arguments); }; var emit = socket.emit; socket.emit = function () { -- cgit v1.2.3 From 963a435ae1e9248b42b4665acf106dcffa549678 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 20:02:30 +0800 Subject: Resolve dependency module requiring * es5 style module exports * remove script tag require * webpack config ProvidePlugin Note that this commit only fix JavaScript module loading runtime error. --- public/js/index.js | 59 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 12 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index dff278c9..3801eea2 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -18,15 +18,14 @@ require('bootstrap'); require('codemirror/keymap/vim'); require('codemirror/keymap/emacs'); require('codemirror/keymap/sublime'); - -require('../vendor/inlineAttachment/inline-attachment'); -require('../vendor/inlineAttachment/codemirror.inline-attachment'); -require('../vendor/codemirror-spell-checker/spell-checker.min'); +require('codemirror/addon/display/panel'); /* operational transformation */ -require('../vendor/ot/ot.min'); +require('ot/lib/socketio-adapter'); +require('ot/lib/codemirror-adapter'); +require('ot/lib/undo-manager'); +require('../vendor/ot/editor-client'); -/* other vendors plugin */ require('markdown-it'); require('markdown-it-abbr'); require('markdown-it-footnote'); @@ -40,14 +39,13 @@ require('markdown-it-mathjax'); require('markdown-it-regexp'); require('markdown-it-imsize'); +/* other vendors plugin */ require('gist-embed'); -require('lz-string'); require('string'); require('highlight.js'); require('prismjs'); require('prismjs/components/prism-wiki'); require('js-cookie'); -require('emojify.js'); require('to-markdown'); require('raphael'); @@ -63,11 +61,48 @@ require('visibilityjs'); require('list.js'); require('../vendor/md-toc'); require('randomcolor'); -require('keymaster'); var common = require('./common.js'); - +var urlpath = common.urlpath; +var debug = common.debug; +var version = common.version; var serverurl = common.serverurl; +var GOOGLE_API_KEY = common.GOOGLE_API_KEY; +var GOOGLE_CLIENT_ID = common.GOOGLE_CLIENT_ID; +var DROPBOX_APP_KEY = common.DROPBOX_APP_KEY; +var noteurl = common.noteurl; + +var checkLoginStateChanged = common.checkLoginStateChanged; + +var syncScroll = require('./syncscroll'); +var setupSyncAreas = syncScroll.setupSyncAreas; +var clearMap = syncScroll.clearMap; +var syncScrollToEdit = syncScroll.syncScrollToEdit; + +var extra = require('./extra'); +var md = extra.md; +var createtime = extra.createtime; +var updateLastChange = extra.updateLastChange; +var postProcess = extra.postProcess; +var finishView = extra.finishView; +var lastchangetime = extra.lastchangetime; +var autoLinkify = extra.autoLinkify; +var generateToc = extra.generateToc; +var smoothHashScroll = extra.smoothHashScroll; +var lastchangeuser = extra.lastchangeuser; +var deduplicatedHeaderId = extra.deduplicatedHeaderId; +var renderTOC = extra.renderTOC; +var renderTitle = extra.renderTitle; +var renderFilename = extra.renderFilename; +var scrollToHash = extra.scrollToHash; + +var history = require('./history'); +var writeHistory = history.writeHistory; + +var pretty = require('./pretty'); + +var renderer = require('./render'); +var preventXSS = renderer.preventXSS; var defaultTextHeight = 20; var viewportMargin = 20; @@ -349,7 +384,7 @@ var supportExtraTags = [ } } ]; -var modeType = { +window.modeType = { edit: { name: "edit" }, @@ -389,7 +424,7 @@ var visibleSM = false; var visibleMD = false; var visibleLG = false; var isTouchDevice = 'ontouchstart' in document.documentElement; -var currentMode = defaultMode; +window.currentMode = defaultMode; var currentStatus = statusType.offline; var lastInfo = { needRestore: false, -- cgit v1.2.3 From 2b678c1f129abde7e20f471018c55626f57cae97 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 23:03:33 +0800 Subject: Make editor variable global --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 3801eea2..d84d0a8d 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -464,7 +464,7 @@ var fileTypes = { //editor settings var textit = document.getElementById("textit"); if (!textit) throw new Error("There was no textit area!"); -var editor = CodeMirror.fromTextArea(textit, { +window.editor = CodeMirror.fromTextArea(textit, { mode: 'gfm', backdrop: 'gfm', keyMap: "sublime", -- cgit v1.2.3 From 8e2b03cfd6d389df454d4baed68837c84e64ae66 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sat, 8 Oct 2016 23:04:19 +0800 Subject: Config bootstrap with webpack --- public/js/index.js | 1 + 1 file changed, 1 insertion(+) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index d84d0a8d..08f64d46 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -13,6 +13,7 @@ require('../vendor/showup/showup'); /* bootstrap */ require('bootstrap'); +require('bootstrap/dist/css/bootstrap.css'); /* code mirror plugins */ require('codemirror/keymap/vim'); -- cgit v1.2.3 From 845e9342c5b12638abcd6aa5cf96c9ce87762e9f Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 07:54:52 +0800 Subject: Add highlight.js and prism styles --- public/js/index.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 08f64d46..243761e6 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -15,6 +15,9 @@ require('../vendor/showup/showup'); require('bootstrap'); require('bootstrap/dist/css/bootstrap.css'); +require('prismjs/themes/prism.css'); +require('highlight.js/styles/github-gist.css'); + /* code mirror plugins */ require('codemirror/keymap/vim'); require('codemirror/keymap/emacs'); -- cgit v1.2.3 From 7e6b9f776ff18e77425bafaed76ede70fe712189 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 08:15:23 +0800 Subject: Revert customized ot library and fix dependency --- public/js/index.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 243761e6..0b64f667 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -24,12 +24,6 @@ require('codemirror/keymap/emacs'); require('codemirror/keymap/sublime'); require('codemirror/addon/display/panel'); -/* operational transformation */ -require('ot/lib/socketio-adapter'); -require('ot/lib/codemirror-adapter'); -require('ot/lib/undo-manager'); -require('../vendor/ot/editor-client'); - require('markdown-it'); require('markdown-it-abbr'); require('markdown-it-footnote'); -- cgit v1.2.3 From 67d118782de12f851ad38be13fa9f519ba100765 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 08:15:37 +0800 Subject: Fix function export --- public/js/index.js | 1 + 1 file changed, 1 insertion(+) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 0b64f667..376c8ddd 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -76,6 +76,7 @@ var syncScroll = require('./syncscroll'); var setupSyncAreas = syncScroll.setupSyncAreas; var clearMap = syncScroll.clearMap; var syncScrollToEdit = syncScroll.syncScrollToEdit; +var syncScrollToView = syncScroll.syncScrollToView; var extra = require('./extra'); var md = extra.md; -- cgit v1.2.3 From 196d546f7e8273b3fdc1bd60c3bf627b2fa1462b Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 10:51:39 +0800 Subject: Fix pdfobject require --- public/js/index.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 376c8ddd..0fba0b21 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -51,7 +51,6 @@ require('js-sequence-diagrams'); require('flowchart.js'); require('viz.js'); -require('pdfobject'); require('file-saver'); require('store'); require('js-url'); @@ -414,18 +413,18 @@ var statusType = { var defaultMode = modeType.view; //global vars -var loaded = false; -var needRefresh = false; -var isDirty = false; -var editShown = false; -var visibleXS = false; -var visibleSM = false; -var visibleMD = false; -var visibleLG = false; -var isTouchDevice = 'ontouchstart' in document.documentElement; +window.loaded = false; +window.needRefresh = false; +window.isDirty = false; +window.editShown = false; +window.visibleXS = false; +window.visibleSM = false; +window.visibleMD = false; +window.visibleLG = false; +window.isTouchDevice = 'ontouchstart' in document.documentElement; window.currentMode = defaultMode; -var currentStatus = statusType.offline; -var lastInfo = { +window.currentStatus = statusType.offline; +window.lastInfo = { needRestore: false, cursor: null, scroll: null, @@ -447,9 +446,9 @@ var lastInfo = { }, history: null }; -var personalInfo = {}; -var onlineUsers = []; -var fileTypes = { +window.personalInfo = {}; +window.onlineUsers = []; +window.fileTypes = { "pl": "perl", "cgi": "perl", "js": "javascript", @@ -2274,6 +2273,8 @@ function havePermission() { } return bool; } +// global module workaround +window.havePermission = havePermission; //socket.io actions var socket = io.connect({ -- cgit v1.2.3 From 3e2905be13551a0cceeb18e72242be891db10db7 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 17:54:51 +0800 Subject: Revert to customized codemirror --- public/js/index.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 0fba0b21..db76b745 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -18,12 +18,6 @@ require('bootstrap/dist/css/bootstrap.css'); require('prismjs/themes/prism.css'); require('highlight.js/styles/github-gist.css'); -/* code mirror plugins */ -require('codemirror/keymap/vim'); -require('codemirror/keymap/emacs'); -require('codemirror/keymap/sublime'); -require('codemirror/addon/display/panel'); - require('markdown-it'); require('markdown-it-abbr'); require('markdown-it-footnote'); -- cgit v1.2.3 From 8a254ea4f109db99bdc172ba2717997c4d5dd490 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 21:14:18 +0800 Subject: Fix scrollToTop/Buttom in preview workaround --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index db76b745..7be03086 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -71,6 +71,7 @@ var clearMap = syncScroll.clearMap; var syncScrollToEdit = syncScroll.syncScrollToEdit; var syncScrollToView = syncScroll.syncScrollToView; +require('./pretty'); var extra = require('./extra'); var md = extra.md; var createtime = extra.createtime; @@ -91,7 +92,6 @@ var scrollToHash = extra.scrollToHash; var history = require('./history'); var writeHistory = history.writeHistory; -var pretty = require('./pretty'); var renderer = require('./render'); var preventXSS = renderer.preventXSS; -- cgit v1.2.3 From 8f9afa42d57b26599de935e93b8b3a14d899566c Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 21:35:24 +0800 Subject: Fix history and edit mode change --- public/js/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 7be03086..8a55037b 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -55,6 +55,7 @@ require('randomcolor'); var common = require('./common.js'); var urlpath = common.urlpath; +var noteid = common.noteid; var debug = common.debug; var version = common.version; var serverurl = common.serverurl; @@ -89,9 +90,8 @@ var renderTitle = extra.renderTitle; var renderFilename = extra.renderFilename; var scrollToHash = extra.scrollToHash; -var history = require('./history'); -var writeHistory = history.writeHistory; - +var historyModule = require('./history'); +var writeHistory = historyModule.writeHistory; var renderer = require('./render'); var preventXSS = renderer.preventXSS; -- cgit v1.2.3 From a25889788443556703cf1f9b412b5d6dbf90febd Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 9 Oct 2016 21:35:56 +0800 Subject: Revert some bower assets --- public/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 8a55037b..bac2c9d0 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -8,7 +8,7 @@ require('jquery-ui/ui/widgets/autocomplete'); require('jquery'); require('jquery-textcomplete'); require('jquery-mousewheel'); -require('../vendor/jquery-scrollspy'); +require('jquery-scrollspy/jquery-scrollspy'); require('../vendor/showup/showup'); /* bootstrap */ -- cgit v1.2.3 From 9c8752d4521c7cffccf4313eca5cd6ff4f88c305 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 12:30:30 +0800 Subject: Split common vendor javascript into chunks --- public/js/index.js | 5 ----- 1 file changed, 5 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index bac2c9d0..0c6bb03a 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -5,14 +5,9 @@ require('jquery-ui/ui/widgets/controlgroup'); require('jquery-ui/ui/widgets/autocomplete'); /* jquery and jquery plugins */ -require('jquery'); -require('jquery-textcomplete'); -require('jquery-mousewheel'); -require('jquery-scrollspy/jquery-scrollspy'); require('../vendor/showup/showup'); /* bootstrap */ -require('bootstrap'); require('bootstrap/dist/css/bootstrap.css'); require('prismjs/themes/prism.css'); -- cgit v1.2.3 From 06437ccaa995afc48e30154c136c4e485ac04ae7 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 14:52:45 +0800 Subject: Manage more packages with npm and webpack --- public/js/index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 0c6bb03a..4bce2ff0 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -29,22 +29,19 @@ require('markdown-it-imsize'); /* other vendors plugin */ require('gist-embed'); require('string'); -require('highlight.js'); require('prismjs'); require('prismjs/components/prism-wiki'); -require('js-cookie'); require('to-markdown'); require('raphael'); require('js-sequence-diagrams'); require('flowchart.js'); -require('viz.js'); -require('file-saver'); +var saveAs = require('file-saver').saveAs; require('store'); require('js-url'); require('visibilityjs'); -require('list.js'); +var List = require('list.js'); require('../vendor/md-toc'); require('randomcolor'); -- cgit v1.2.3 From 56c5378939c6498d0440b3ed76a604523678073f Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 17:15:06 +0800 Subject: Optimize viz.js async rendering through webpack chunk --- public/js/index.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 4bce2ff0..2d3c2965 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1,9 +1,3 @@ -/* include jquery ui */ -require('jquery-ui/ui/widgets/resizable'); -require('jquery-ui/ui/widgets/tooltip'); -require('jquery-ui/ui/widgets/controlgroup'); -require('jquery-ui/ui/widgets/autocomplete'); - /* jquery and jquery plugins */ require('../vendor/showup/showup'); -- cgit v1.2.3 From 4a6903c91b3b8502585d6e17137ef076c489ebcf Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 17:53:46 +0800 Subject: Revert customized markdown-it-mathjax plugin --- public/js/index.js | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 2d3c2965..ae823c42 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -7,19 +7,6 @@ require('bootstrap/dist/css/bootstrap.css'); require('prismjs/themes/prism.css'); require('highlight.js/styles/github-gist.css'); -require('markdown-it'); -require('markdown-it-abbr'); -require('markdown-it-footnote'); -require('markdown-it-deflist'); -require('markdown-it-mark'); -require('markdown-it-ins'); -require('markdown-it-sub'); -require('markdown-it-sup'); -require('markdown-it-container'); -require('markdown-it-mathjax'); -require('markdown-it-regexp'); -require('markdown-it-imsize'); - /* other vendors plugin */ require('gist-embed'); require('string'); -- cgit v1.2.3 From 4a6a69e7bc8f6e2897394f3a1285ff7626bceb16 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 11 Oct 2016 20:17:44 +0800 Subject: Fix module export --- public/js/index.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 67499f86..f3bdf115 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -63,9 +63,12 @@ var renderTitle = extra.renderTitle; var renderFilename = extra.renderFilename; var scrollToHash = extra.scrollToHash; var owner = extra.owner; +var updateLastChangeUser = extra.updateLastChangeUser; +var updateOwner = extra.updateOwner; var historyModule = require('./history'); var writeHistory = historyModule.writeHistory; +var deleteServerHistory = historyModule.deleteServerHistory; var renderer = require('./render'); var preventXSS = renderer.preventXSS; @@ -1461,6 +1464,7 @@ function onGoogleAPILoaded() { .prop('defer', true) .appendTo('body'); } +window.onGoogleAPILoaded = onGoogleAPILoaded; //button actions //share -- cgit v1.2.3 From 43c9f68b9a67fa7f5b3e5a7f0dc6d5f8c9114d20 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Thu, 13 Oct 2016 08:56:56 +0800 Subject: Refactor webpack module --- public/js/index.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index f8f997d8..626799c4 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -7,25 +7,16 @@ require('bootstrap/dist/css/bootstrap.css'); require('prismjs/themes/prism.css'); require('highlight.js/styles/github-gist.css'); -/* other vendors plugin */ -require('gist-embed'); -require('string'); require('prismjs'); require('prismjs/components/prism-wiki'); -require('to-markdown'); +var toMarkdown = require('to-markdown'); -require('raphael'); -require('js-sequence-diagrams'); - -require('flowchart.js'); var saveAs = require('file-saver').saveAs; -require('store'); require('js-url'); -require('visibilityjs'); -var List = require('list.js'); -require('../vendor/md-toc'); require('randomcolor'); +var List = require('list.js'); + var common = require('./common.js'); var urlpath = common.urlpath; var noteid = common.noteid; @@ -2268,6 +2259,7 @@ function havePermission() { window.havePermission = havePermission; //socket.io actions +var io = require("socket.io-client"); var socket = io.connect({ path: urlpath ? '/' + urlpath + '/socket.io/' : '', timeout: 5000 //5 secs to timeout -- cgit v1.2.3 From 773c0ce39e2da7ea155949b5a6dae986a747e89a Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Thu, 13 Oct 2016 11:42:17 +0800 Subject: Optimize common assets with CDN * jquery * lodash * socket.io * boostrap --- public/js/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 626799c4..20a76ff1 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1,9 +1,6 @@ /* jquery and jquery plugins */ require('../vendor/showup/showup'); -/* bootstrap */ -require('bootstrap/dist/css/bootstrap.css'); - require('prismjs/themes/prism.css'); require('highlight.js/styles/github-gist.css'); @@ -15,6 +12,8 @@ var saveAs = require('file-saver').saveAs; require('js-url'); require('randomcolor'); +var _ = require("lodash"); + var List = require('list.js'); var common = require('./common.js'); -- cgit v1.2.3