diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/cover.js | 10 | ||||
-rw-r--r-- | public/js/index.js | 4 | ||||
-rw-r--r-- | public/js/lib/common/login.js | 9 |
3 files changed, 14 insertions, 9 deletions
diff --git a/public/js/cover.js b/public/js/cover.js index a3ed7784..79b168d9 100644 --- a/public/js/cover.js +++ b/public/js/cover.js @@ -102,7 +102,12 @@ $(".masthead-nav li").click(function () { $(this).addClass("active"); }); -$(".ui-home").click(() => { +// prevent empty link change hash +$('a[href="#"]').click(function (e) { + e.preventDefault(); +}); + +$(".ui-home").click(function (e) { if (!$("#home").is(':visible')) { $(".section:visible").hide(); $("#home").fadeIn(); @@ -366,7 +371,7 @@ $(".ui-refresh-history").click(() => { $('.search').val(''); historyList.search(); $('#history-list').slideUp('fast'); - $('.pagination').slideUp('fast'); + $('.pagination').hide(); resetCheckAuth(); historyList.clear(); @@ -378,7 +383,6 @@ $(".ui-refresh-history").click(() => { $('.search').val(lastKeyword); checkHistoryList(); $('#history-list').slideDown('fast'); - $('.pagination').slideDown('fast'); }); }); diff --git a/public/js/index.js b/public/js/index.js index a7e69e81..8e3bc561 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1761,6 +1761,10 @@ ui.toolbar.uploadImage.bind('change', function (e) { ui.toc.dropdown.click(function (e) { e.stopPropagation(); }); +// prevent empty link change hash +$('a[href="#"]').click(function (e) { + e.preventDefault(); +}); //modal actions var revisions = []; diff --git a/public/js/lib/common/login.js b/public/js/lib/common/login.js index f1a03c72..58fa55c6 100644 --- a/public/js/lib/common/login.js +++ b/public/js/lib/common/login.js @@ -4,7 +4,7 @@ let checkAuth = false; let profile = null; let lastLoginState = getLoginState(); let lastUserId = getUserId(); -let loginStateChangeEvent = null; +var loginStateChangeEvent = null; export function setloginStateChangeEvent(func) { loginStateChangeEvent = func; @@ -32,9 +32,7 @@ export function setLoginState(bool, id) { export function checkLoginStateChanged() { if (getLoginState() != lastLoginState || getUserId() != lastUserId) { - if (loginStateChangeEvent) { - loginStateChangeEvent(); - } + if (loginStateChangeEvent) setTimeout(loginStateChangeEvent, 100); return true; } else { return false; @@ -56,8 +54,7 @@ export function clearLoginState() { export function checkIfAuth(yesCallback, noCallback) { const cookieLoginState = getLoginState(); - if (checkLoginStateChanged()) - checkAuth = false; + if (checkLoginStateChanged()) checkAuth = false; if (!checkAuth || typeof cookieLoginState == 'undefined') { $.get(`${serverurl}/me`) .done(data => { |