summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/js/cover.js2
-rw-r--r--public/js/extra.js5
-rw-r--r--public/js/index.js10
-rw-r--r--public/js/locale.js2
-rw-r--r--public/js/public.js25
-rw-r--r--public/js/slide.js19
-rw-r--r--webpackBaseConfig.js14
7 files changed, 17 insertions, 60 deletions
diff --git a/public/js/cover.js b/public/js/cover.js
index 3dd4de09..c02f6c81 100644
--- a/public/js/cover.js
+++ b/public/js/cover.js
@@ -1,3 +1,5 @@
+require('./locale');
+
var common = require('./common');
var checkIfAuth = common.checkIfAuth;
var urlpath = common.urlpath;
diff --git a/public/js/extra.js b/public/js/extra.js
index 1eae80f6..499bdc4c 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -1,3 +1,8 @@
+require('prismjs/themes/prism.css');
+require('highlight.js/styles/github-gist.css');
+
+var Prism = require('prismjs');
+require('prismjs/components/prism-wiki');
var hljs = require('highlight.js');
var PDFObject = require('pdfobject');
var S = require('string');
diff --git a/public/js/index.js b/public/js/index.js
index 6625d2d1..d85a0902 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1,16 +1,11 @@
/* jquery and jquery plugins */
require('../vendor/showup/showup');
-require('prismjs/themes/prism.css');
-require('highlight.js/styles/github-gist.css');
-
-require('prismjs');
-require('prismjs/components/prism-wiki');
var toMarkdown = require('to-markdown');
var saveAs = require('file-saver').saveAs;
-require('js-url');
-require('randomcolor');
+var url = require('js-url');
+var randomColor = require('randomcolor');
var _ = require("lodash");
@@ -28,7 +23,6 @@ var noteurl = common.noteurl;
var checkLoginStateChanged = common.checkLoginStateChanged;
-require('./pretty');
var extra = require('./extra');
var md = extra.md;
var updateLastChange = extra.updateLastChange;
diff --git a/public/js/locale.js b/public/js/locale.js
index 484ce22f..702496e7 100644
--- a/public/js/locale.js
+++ b/public/js/locale.js
@@ -1,5 +1,3 @@
-require('./cover');
-
var lang = "en";
var userLang = navigator.language || navigator.userLanguage;
var userLangCode = userLang.split('-')[0];
diff --git a/public/js/public.js b/public/js/public.js
deleted file mode 100644
index f83ef41f..00000000
--- a/public/js/public.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* jquery and jquery plugins */
-require('../vendor/showup/showup');
-
-require('prismjs/themes/prism.css');
-require('highlight.js/styles/github-gist.css');
-
-/* other vendors plugin */
-require('string');
-require('prismjs');
-require('prismjs/components/prism-wiki');
-require('to-markdown');
-
-require('file-saver');
-require('store');
-require('js-url');
-require('visibilityjs');
-require('list.js');
-require('../vendor/md-toc');
-require('randomcolor');
-
-require('./extra');
-require('./syncscroll');
-require('./history');
-require('./pretty');
-require('./render');
diff --git a/public/js/slide.js b/public/js/slide.js
index 2536c602..c260de6d 100644
--- a/public/js/slide.js
+++ b/public/js/slide.js
@@ -1,30 +1,13 @@
-require('prismjs/themes/prism.css');
/* other vendors plugin */
var S = require('string');
-require('prismjs');
-require('prismjs/components/prism-wiki');
-require('to-markdown');
-
-require('../vendor/md-toc');
-require('randomcolor');
-
-var commonModule = require('./common');
-var urlpath = commonModule.urlpath;
-var noteid = commonModule.noteid;
-var debug = commonModule.debug;
-var version = commonModule.version;
-var GOOGLE_API_KEY = commonModule.GOOGLE_API_KEY;
-var GOOGLE_CLIENT_ID = commonModule.GOOGLE_CLIENT_ID;
-var DROPBOX_APP_KEY = commonModule.DROPBOX_APP_KEY;
-var noteurl = commonModule.noteurl;
var extraModule = require('./extra');
var md = extraModule.md;
var updateLastChange = extraModule.updateLastChange;
var finishView = extraModule.finishView;
-require('./render');
+var preventXSS = require('./render').preventXSS;
var body = $(".slides").html();
$(".slides").html(S(body).unescapeHTML().s);
diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js
index b9e61b67..60ece7be 100644
--- a/webpackBaseConfig.js
+++ b/webpackBaseConfig.js
@@ -17,7 +17,7 @@ module.exports = {
}),
new ExtractTextPlugin("[name].css"),
new webpack.optimize.CommonsChunkPlugin({
- names: ["vendor", "public", "slide", "locale"],
+ names: ["cover", "index", "pretty", "slide", "vendor"],
children: true,
async: true,
filename: '[name].js',
@@ -37,25 +37,25 @@ module.exports = {
}),
new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs',
- chunks: ['vendor', 'locale'],
+ chunks: ['vendor', 'cover'],
filename: path.join(__dirname, 'public/views/build/cover-header.ejs'),
inject: false
}),
new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs',
- chunks: ['vendor', 'locale'],
+ chunks: ['vendor', 'cover'],
filename: path.join(__dirname, 'public/views/build/cover-scripts.ejs'),
inject: false
}),
new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs',
- chunks: ['vendor', 'public'],
+ chunks: ['vendor', 'pretty'],
filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'),
inject: false
}),
new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs',
- chunks: ['vendor', 'public'],
+ chunks: ['vendor', 'pretty'],
filename: path.join(__dirname, 'public/views/build/pretty-scripts.ejs'),
inject: false
}),
@@ -74,10 +74,10 @@ module.exports = {
],
entry: {
+ cover: path.join(__dirname, 'public/js/cover.js'),
index: path.join(__dirname, 'public/js/index.js'),
- public: path.join(__dirname, 'public/js/public.js'),
+ pretty: path.join(__dirname, 'public/js/pretty.js'),
slide: path.join(__dirname, 'public/js/slide.js'),
- locale: path.join(__dirname, 'public/js/locale.js'),
vendor: [
"imports?$=jquery!jquery-mousewheel",
"expose?filterXSS!xss",