summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorYukai Huang2017-01-21 12:08:52 +0800
committerYukai Huang2017-01-21 12:08:52 +0800
commit4bbe035beb41ad2c9f43434d0d90209850a62f70 (patch)
tree53095b529b1220b6e2d23f0dbc255af2ca54d7d7 /public/js
parenta9a38c3d75b1cf467bb3b4484abfc09dcbcea107 (diff)
parent1de4242473b74afdb2d3e358e3b213ef156ca0de (diff)
Merge branch 'master' into frontend-next
Diffstat (limited to 'public/js')
-rw-r--r--public/js/cover.js10
-rw-r--r--public/js/index.js4
-rw-r--r--public/js/lib/common/login.js9
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 => {