Merge branch 'master' into frontend-next

This commit is contained in:
Yukai Huang 2017-01-21 12:08:52 +08:00
commit 4bbe035beb
8 changed files with 95 additions and 59 deletions

View file

@ -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');
});
});

View file

@ -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 = [];

View file

@ -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 => {