diff --git a/public/js/cover.js b/public/js/cover.js index f353382..d3d3c10 100644 --- a/public/js/cover.js +++ b/public/js/cover.js @@ -1,3 +1,17 @@ +var common = require('./common'); +var checkIfAuth = common.checkIfAuth; +var urlpath = common.urlpath; +var serverurl = common.serverurl; +var resetCheckAuth = common.resetCheckAuth; + +var historyModule = require('./history'); +var parseStorageToHistory = historyModule.parseStorageToHistory; +var parseHistory = historyModule.parseHistory; +var getStorageHistory = historyModule.getStorageHistory; +var getHistory = historyModule.getHistory; +var saveHistory = historyModule.saveHistory; +var removeHistory = historyModule.removeHistory; + var options = { valueNames: ['id', 'text', 'timestamp', 'fromNow', 'time', 'tags', 'pinned'], item: '
  • \ @@ -265,16 +279,16 @@ $(".ui-clear-history").click(function () { }); $(".ui-refresh-history").click(function () { - var lastTags = $(".ui-use-tags").select2('val'); + var lastTags = $(".ui-use-tags").select2('val'); $(".ui-use-tags").select2('val', ''); historyList.filter(); var lastKeyword = $('.search').val(); $('.search').val(''); historyList.search(); - + resetCheckAuth(); historyList.clear(); - parseHistory(historyList, function (list, notehistory) { + parseHistory(historyList, function (list, notehistory) { parseHistoryCallback(list, notehistory); $(".ui-use-tags").select2('val', lastTags); $(".ui-use-tags").trigger('change'); @@ -336,4 +350,4 @@ $(".ui-use-tags").on('change', function () { $('.search').keyup(function () { checkHistoryList(); -}); \ No newline at end of file +}); diff --git a/public/js/history.js b/public/js/history.js index 23c7beb..192a40b 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -3,6 +3,7 @@ var store = require('store'); var common = require('./common'); var checkIfAuth = common.checkIfAuth; var urlpath = common.urlpath; +var serverurl = common.serverurl; var extra = require('./extra'); var renderFilename = extra.renderFilename; @@ -378,5 +379,11 @@ function parseToHistory(list, notehistory, callback) { } module.exports = { - writeHistory: writeHistory + writeHistory: writeHistory, + parseHistory: parseHistory, + getStorageHistory: getStorageHistory, + getHistory: getHistory, + saveHistory: saveHistory, + removeHistory: removeHistory, + parseStorageToHistory: parseStorageToHistory } diff --git a/public/js/locale.js b/public/js/locale.js index 6fe7fdb..484ce22 100644 --- a/public/js/locale.js +++ b/public/js/locale.js @@ -1,3 +1,5 @@ +require('./cover'); + var lang = "en"; var userLang = navigator.language || navigator.userLanguage; var userLangCode = userLang.split('-')[0]; @@ -21,4 +23,4 @@ locale.change(function() { expires: 365 }); window.location.reload(); -}); \ No newline at end of file +}); diff --git a/public/views/index.ejs b/public/views/index.ejs index f5f848e..04a401a 100644 --- a/public/views/index.ejs +++ b/public/views/index.ejs @@ -205,10 +205,7 @@ - - - - + diff --git a/webpack.config.js b/webpack.config.js index a4fabde..5a7d671 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -23,7 +23,8 @@ module.exports = { entry: { index: path.join(__dirname, 'public/js/index.js'), public: path.join(__dirname, 'public/js/public.js'), - slide: path.join(__dirname, 'public/js/slide.js') + slide: path.join(__dirname, 'public/js/slide.js'), + locale: path.join(__dirname, 'public/js/locale.js') }, output: {