From f2a441061bb5b96d3b90faa580d2ea2b5fb1266f Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sun, 15 Jan 2017 17:23:19 +0800 Subject: [PATCH 1/9] Fix checkLoginStateChanged might fall into infinite loop while calling loginStateChangeEvent --- public/js/common.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/public/js/common.js b/public/js/common.js index f5bfc8e..7eee107 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -18,7 +18,8 @@ var checkAuth = false; var profile = null; var lastLoginState = getLoginState(); var lastUserId = getUserId(); -var loginStateChangeEvent = null; + +window.loginStateChangeEvent = null; function resetCheckAuth() { checkAuth = false; @@ -42,8 +43,7 @@ function setLoginState(bool, id) { function checkLoginStateChanged() { if (getLoginState() != lastLoginState || getUserId() != lastUserId) { - if(loginStateChangeEvent) - loginStateChangeEvent(); + if(loginStateChangeEvent) setTimeout(loginStateChangeEvent, 100); return true; } else { return false; @@ -65,8 +65,7 @@ function clearLoginState() { function checkIfAuth(yesCallback, noCallback) { var cookieLoginState = getLoginState(); - if (checkLoginStateChanged()) - checkAuth = false; + if (checkLoginStateChanged()) checkAuth = false; if (!checkAuth || typeof cookieLoginState == 'undefined') { $.get(serverurl + '/me') .done(function (data) { @@ -107,7 +106,6 @@ module.exports = { profile: profile, lastLoginState: lastLoginState, lastUserId: lastUserId, - loginStateChangeEvent: loginStateChangeEvent, /* export functions */ resetCheckAuth: resetCheckAuth, From 5751578275bd505ea613c77ab997a6ee29b1c1ee Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sun, 15 Jan 2017 17:23:33 +0800 Subject: [PATCH 2/9] Update to remove history pagination animation on refresh --- public/js/cover.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/js/cover.js b/public/js/cover.js index a8d8ecf..15f3e9c 100644 --- a/public/js/cover.js +++ b/public/js/cover.js @@ -355,7 +355,6 @@ $(".ui-refresh-history").click(function () { $('.search').val(''); historyList.search(); $('#history-list').slideUp('fast'); - $('.pagination').slideUp('fast'); resetCheckAuth(); historyList.clear(); @@ -367,7 +366,6 @@ $(".ui-refresh-history").click(function () { $('.search').val(lastKeyword); checkHistoryList(); $('#history-list').slideDown('fast'); - $('.pagination').slideDown('fast'); }); }); From f2ee8976997906f76fae39a5f5d7f70860f2c8dc Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 16 Jan 2017 12:04:11 +0800 Subject: [PATCH 3/9] Fix to prevent hash change on click nav item on index --- public/js/cover.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/cover.js b/public/js/cover.js index 15f3e9c..7c63e91 100644 --- a/public/js/cover.js +++ b/public/js/cover.js @@ -91,14 +91,18 @@ $(".masthead-nav li").click(function () { $(this).addClass("active"); }); -$(".ui-home").click(function () { +$(".ui-home").click(function (e) { + e.preventDefault(); + e.stopPropagation(); if (!$("#home").is(':visible')) { $(".section:visible").hide(); $("#home").fadeIn(); } }); -$(".ui-history").click(function () { +$(".ui-history").click(function (e) { + e.preventDefault(); + e.stopPropagation(); if (!$("#history").is(':visible')) { $(".section:visible").hide(); $("#history").fadeIn(); From 53223b5e2c9bb53737a4f812e61e0790833781db Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 16 Jan 2017 12:06:04 +0800 Subject: [PATCH 4/9] Update index layout to add profile on navbar --- public/css/cover.css | 22 ++++++++++++++++++--- public/views/index.ejs | 44 +++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/public/css/cover.css b/public/css/cover.css index dcf7321..a1527bf 100644 --- a/public/css/cover.css +++ b/public/css/cover.css @@ -78,6 +78,13 @@ body { margin-top: 10px; margin-bottom: 10px; } +.masthead-nav { + text-align: left; + max-width: 1000px; + margin: 0 auto; + padding-left: 10px; + padding-right: 10px; +} .masthead-nav > li { display: inline-block; } @@ -263,9 +270,14 @@ input { text-decoration: underline; } .ui-avatar { - border-radius: 15em; - height: auto; - width: 60px; + display: inline-block; + overflow: hidden; + line-height: 1; + vertical-align: middle; + border-radius: 3px; +} +.ui-avatar.circle { + border-radius: 50%; } .ui-history-close { position: absolute; @@ -338,6 +350,10 @@ input { display: inline-block !important; } +.btn-link, .btn-link:hover, .btn-link:focus, .btn-link:active { + color: white; +} + select { color: black; } diff --git a/public/views/index.ejs b/public/views/index.ejs index 55c13d2..2513990 100644 --- a/public/views/index.ejs +++ b/public/views/index.ejs @@ -40,6 +40,25 @@
  • <%= __('History') %>
  • + + @@ -60,19 +79,15 @@ <% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %> - <% }%> - <% if((facebook || twitter || github || gitlab || dropbox || google || email) && allowAnonymous) { %> <%= __('or') %> - <% }%> - <% if(allowAnonymous) { %> + <% } %> - <% }%>
    style="display:none;"<% } %>> - <% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %> -