summaryrefslogtreecommitdiff
path: root/public
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
parenta9a38c3d75b1cf467bb3b4484abfc09dcbcea107 (diff)
parent1de4242473b74afdb2d3e358e3b213ef156ca0de (diff)
Merge branch 'master' into frontend-next
Diffstat (limited to '')
-rw-r--r--public/css/cover.css22
-rw-r--r--public/js/cover.js10
-rw-r--r--public/js/index.js4
-rw-r--r--public/js/lib/common/login.js9
-rw-r--r--public/views/index.ejs44
5 files changed, 57 insertions, 32 deletions
diff --git a/public/css/cover.css b/public/css/cover.css
index dcf7321c..a1527bfa 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/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 => {
diff --git a/public/views/index.ejs b/public/views/index.ejs
index b1a1feb4..d258857c 100644
--- a/public/views/index.ejs
+++ b/public/views/index.ejs
@@ -41,6 +41,25 @@
</li>
<li class="ui-history<% if(signin) { %> active<% } %>"><a href="#"><%= __('History') %></a>
</li>
+ <div class="ui-signin" style="float: right; margin-top: 8px;<% if(signin) { %> display: none;<% } %>">
+ <% if(allowAnonymous) { %>
+ <a type="button" href="<%- url %>/new" class="btn btn-sm btn-link"><i class="fa fa-plus"></i> <%= __('New guest note') %></a>
+ <% } %>
+ <% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %>
+ <button class="btn btn-sm btn-success ui-signin" data-toggle="modal" data-target=".signin-modal"><%= __('Sign In') %></button>
+ <% } %>
+ </div>
+ <div class="ui-signout" style="float: right; margin-top: 8px;<% if(!signin) { %> display: none;<% } %>">
+ <a type="button" href="<%- url %>/new" class="btn btn-sm btn-link"><i class="fa fa-plus"></i> <%= __('New note') %></a>
+ <span class="ui-profile dropdown pull-right">
+ <button id="profileLabel" class="btn btn-sm btn-link ui-profile-label" style="padding-right: 0;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ <img class="ui-avatar" width="20" height="20"><span class="hidden-xs hidden-sm">&ensp;<span class="ui-name"></span></span>&ensp;<i class="fa fa-caret-down"></i>
+ </button>
+ <ul class="dropdown-menu" aria-labelledby="profileLabel">
+ <li><a href="<%- url %>/logout"><i class="fa fa-sign-out fa-fw"></i> <%= __('Sign Out') %></a></li>
+ </ul>
+ </span>
+ </div>
</ul>
</nav>
</div>
@@ -61,19 +80,15 @@
<% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %>
<span class="ui-signin">
<br>
- <a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="min-width: 170px;"><%= __('Sign In') %></a>
+ <a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="min-width: 200px;"><%= __('Sign In') %></a>
</span>
- <% }%>
- <% if((facebook || twitter || github || gitlab || dropbox || google || email) && allowAnonymous) { %>
<span class="ui-or"><%= __('or') %></span>
- <% }%>
- <% if(allowAnonymous) { %>
+ <% } %>
<span class="ui-signin">
- <a href="<%- url %>/new" class="btn btn-lg btn-default" style="min-width: 170px;"><%= __('New guest note') %></a>
+ <a type="button" href="<%- url %>/features" class="btn btn-lg btn-primary" style="min-width: 200px;"><%= __('Explore all features') %></a>
<br>
<br>
</span>
- <% }%>
<div class="lead row" style="width: 90%; margin: 0 auto;">
<div class="col-md-4 inner">
<a href="<%- url %>/features#share-notes">
@@ -98,21 +113,10 @@
</div>
<div id="history" class="section"<% if(!signin) { %> style="display:none;"<% } %>>
- <% if(facebook || twitter || github || gitlab || dropbox || google || ldap || email) { %>
- <div class="ui-signin">
+ <div class="ui-signin"<% if(signin) { %> style="display:none;"<% } %>>
<p><%= __('Below is the history from browser') %></p>
</div>
- <div class="ui-signout" style="display:none;">
- <img class="ui-avatar">
- <h4 class="ui-welcome"><%= __('Welcome!') %> <span class="ui-name"></span></h4>
- <a href="<%- url %>/new" class="btn btn-md btn-default"><%= __('New note') %></a> <%= __('or') %>
- <a href="#" class="btn btn-danger ui-logout"><%= __('Sign Out') %></a>
- </div>
- <% }%>
- <h4>
- <a type="button" href="<%- url %>/features" class="btn btn-primary"><%= __('Explore all features') %></a>
- </h4>
- <hr>
+ <br>
<form class="form-inline">
<div class="form-group" style="vertical-align: bottom;">
<input class="form-control ui-use-tags" placeholder="<%= __('Select tags...') %>" />