Support note list view and sorter
This commit is contained in:
@ -345,63 +345,74 @@ function log(o) {
|
||||
</div>
|
||||
<div id="noteList">
|
||||
<div class="clearfix" id="notesAndSort" style="position: relative">
|
||||
|
||||
<div class="pull-left">
|
||||
<!-- 我的笔记本 -->
|
||||
<div class="dropdown" id="myNotebookNavForListNav">
|
||||
<a class="ios7-a dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
|
||||
<a class="ios7-a">
|
||||
<span id="curNotebookForListNote">{{msg . "all"}}</span>
|
||||
<!--
|
||||
<i class="fa fa-angle-down"></i>
|
||||
-->
|
||||
</a>
|
||||
<!-- 如果notebook过多, 则会产生滚动 弃用
|
||||
<div class="dropdown-menu dropdown-list" style="left: 5px;">
|
||||
<ul role="menu" aria-labelledby="dropdownMenu1" id="notebookNavForListNote"></ul>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<!-- 共享的笔记本 -->
|
||||
<div class="dropdown" id="sharedNotebookNavForListNav" style="display: none">
|
||||
<a class="ios7-a dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">
|
||||
<a class="ios7-a">
|
||||
<span id="curSharedNotebookForListNote">{{msg . "all"}}</span>
|
||||
<!--
|
||||
<i class="fa fa-angle-down"></i>
|
||||
-->
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu"
|
||||
aria-labelledby="dropdownMenu2" style="left: 5px;" id="sharedNotebookNavForListNote">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pull-left" id="tagSearch" style="line-height: 38px">
|
||||
</div>
|
||||
<!-- tag search -->
|
||||
<div class="pull-left" id="tagSearch"></div>
|
||||
|
||||
<!-- sort type -->
|
||||
<div id="sortType">
|
||||
<div class="dropdown">
|
||||
<a class="ios7-a dropdown-toggle" id="dropdownMenu1"
|
||||
data-toggle="dropdown">
|
||||
<!--
|
||||
<i class="fa fa-sort-alpha-asc">
|
||||
</i>Sort <i class="fa fa-angle-down"></i>
|
||||
-->
|
||||
</i><i class="fa fa-th-list"></i>
|
||||
</a>
|
||||
<!--
|
||||
<ul class="dropdown-menu" role="menu"
|
||||
aria-labelledby="dropdownMenu1"
|
||||
style="right: 3px; ! important; left: -100px; min-width: 100px;">
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">创建日期</a></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">修改日期</a></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">标题</a></li>
|
||||
>
|
||||
|
||||
<li role="presentation"><a data-view="snippet" class="view-style view-snippet" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Snippet View"}}
|
||||
</a></li>
|
||||
<li role="presentation"><a data-view="list" class="view-style view-list" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "List View"}}
|
||||
</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">Separated </a></li>
|
||||
<li role="presentation"><a data-sorter="dateCreatedASC" class="sorter-style sorter-dateCreatedASC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Created"}} <i class="fa fa-sort-alpha-asc"></i>
|
||||
</a></li>
|
||||
<li role="presentation"><a data-sorter="dateCreatedDESC" class="sorter-style sorter-dateCreatedDESC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Created"}} <i class="fa fa-sort-alpha-desc"></i>
|
||||
</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation"><a data-sorter="dateUpdatedASC" class="sorter-style sorter-dateUpdatedASC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Updated"}} <i class="fa fa-sort-alpha-asc"></i>
|
||||
</a></li>
|
||||
<li role="presentation"><a data-sorter="dateUpdatedDESC" class="sorter-style sorter-dateUpdatedDESC checked" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Updated"}} <i class="fa fa-sort-alpha-desc"></i>
|
||||
</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation"><a data-sorter="titleASC" class="sorter-style sorter-titleASC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Title"}} <i class="fa fa-sort-alpha-asc"></i>
|
||||
|
||||
</a></li>
|
||||
<li role="presentation"><a data-sorter="titleDESC" class="sorter-style sorter-titleDESC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Title"}} <i class="fa fa-sort-alpha-desc"></i>
|
||||
</a></li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -856,7 +867,7 @@ function log(o) {
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var LEA = {};
|
||||
var LEA = {sPath: ''};
|
||||
LEA.locale = "{{.locale}}";
|
||||
var UrlPrefix = '{{.siteUrl}}';
|
||||
var UserInfo = {{.userInfo|jsonJs}};
|
||||
|
@ -333,58 +333,67 @@ function log(o) {
|
||||
<div class="pull-left">
|
||||
<!-- 我的笔记本 -->
|
||||
<div class="dropdown" id="myNotebookNavForListNav">
|
||||
<a class="ios7-a dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
|
||||
<a class="ios7-a">
|
||||
<span id="curNotebookForListNote">{{msg . "all"}}</span>
|
||||
<!--
|
||||
<i class="fa fa-angle-down"></i>
|
||||
-->
|
||||
</a>
|
||||
<!-- 如果notebook过多, 则会产生滚动 弃用
|
||||
<div class="dropdown-menu dropdown-list" style="left: 5px;">
|
||||
<ul role="menu" aria-labelledby="dropdownMenu1" id="notebookNavForListNote"></ul>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<!-- 共享的笔记本 -->
|
||||
<div class="dropdown" id="sharedNotebookNavForListNav" style="display: none">
|
||||
<a class="ios7-a dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">
|
||||
<a class="ios7-a">
|
||||
<span id="curSharedNotebookForListNote">{{msg . "all"}}</span>
|
||||
<!--
|
||||
<i class="fa fa-angle-down"></i>
|
||||
-->
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu"
|
||||
aria-labelledby="dropdownMenu2" style="left: 5px;" id="sharedNotebookNavForListNote">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pull-left" id="tagSearch" style="line-height: 38px">
|
||||
</div>
|
||||
<!-- tag search -->
|
||||
<div class="pull-left" id="tagSearch"></div>
|
||||
<!-- sort type -->
|
||||
<div id="sortType">
|
||||
<div class="dropdown">
|
||||
<a class="ios7-a dropdown-toggle" id="dropdownMenu1"
|
||||
data-toggle="dropdown">
|
||||
<!--
|
||||
<i class="fa fa-sort-alpha-asc">
|
||||
</i>Sort <i class="fa fa-angle-down"></i>
|
||||
-->
|
||||
</i><i class="fa fa-th-list"></i>
|
||||
</a>
|
||||
<!--
|
||||
<ul class="dropdown-menu" role="menu"
|
||||
aria-labelledby="dropdownMenu1"
|
||||
style="right: 3px; ! important; left: -100px; min-width: 100px;">
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">创建日期</a></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">修改日期</a></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">标题</a></li>
|
||||
>
|
||||
<li role="presentation"><a data-view="snippet" class="view-style view-snippet" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Snippet View"}}
|
||||
</a></li>
|
||||
<li role="presentation"><a data-view="list" class="view-style view-list" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "List View"}}
|
||||
</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1"
|
||||
href="#">Separated </a></li>
|
||||
<li role="presentation"><a data-sorter="dateCreatedASC" class="sorter-style sorter-dateCreatedASC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Created"}} <i class="fa fa-sort-alpha-asc"></i>
|
||||
</a></li>
|
||||
<li role="presentation"><a data-sorter="dateCreatedDESC" class="sorter-style sorter-dateCreatedDESC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Created"}} <i class="fa fa-sort-alpha-desc"></i>
|
||||
</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation"><a data-sorter="dateUpdatedASC" class="sorter-style sorter-dateUpdatedASC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Updated"}} <i class="fa fa-sort-alpha-asc"></i>
|
||||
</a></li>
|
||||
<li role="presentation"><a data-sorter="dateUpdatedDESC" class="sorter-style sorter-dateUpdatedDESC checked" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Date Updated"}} <i class="fa fa-sort-alpha-desc"></i>
|
||||
</a></li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation"><a data-sorter="titleASC" class="sorter-style sorter-titleASC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Title"}} <i class="fa fa-sort-alpha-asc"></i>
|
||||
|
||||
</a></li>
|
||||
<li role="presentation"><a data-sorter="titleDESC" class="sorter-style sorter-titleDESC" role="menuitem">
|
||||
<i class="fa fa-check"></i>
|
||||
{{leaMsg . "Title"}} <i class="fa fa-sort-alpha-desc"></i>
|
||||
</a></li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -828,7 +837,7 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var LEA = {};
|
||||
var LEA = {sPath: ''};
|
||||
LEA.locale = "{{.locale}}";
|
||||
var UrlPrefix = '{{.siteUrl}}';
|
||||
var UserInfo = {{.userInfo|jsonJs}};
|
||||
|
5
messages/zh-cn/note.conf
Normal file
5
messages/zh-cn/note.conf
Normal file
@ -0,0 +1,5 @@
|
||||
Snippet View=摘要视图
|
||||
List View=列表视图
|
||||
|
||||
Date Created=创建时间
|
||||
Date Updated=更新时间
|
5
messages/zh-hk/note.conf
Normal file
5
messages/zh-hk/note.conf
Normal file
@ -0,0 +1,5 @@
|
||||
Snippet View=摘要視圖
|
||||
List View=列表視圖
|
||||
|
||||
Date Created=創建時間
|
||||
Date Updated=更新時間
|
File diff suppressed because one or more lines are too long
@ -16,16 +16,16 @@
|
||||
@green: #65bd77;
|
||||
@gray: #ccc;
|
||||
|
||||
/* leanote */
|
||||
@font-face {
|
||||
font-family: 'leanote';
|
||||
src:url('../../fonts/leanote-font2/leanote.eot?-vcf23i');
|
||||
src:url('../../fonts/leanote-font2/leanote.eot?#iefix-vcf23i') format('embedded-opentype'),
|
||||
url('../../fonts/leanote-font2/leanote.ttf?-vcf23i') format('truetype'),
|
||||
url('../../fonts/leanote-font2/leanote.woff?-vcf23i') format('woff'),
|
||||
url('../../fonts/leanote-font2/leanote.svg?-vcf23i#leanote') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
@import "../theme/includes/icon.less";
|
||||
|
||||
#logo {
|
||||
font-size: 24px;
|
||||
&:before {
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
#subTitle {
|
||||
padding: 0 0 0 5px;
|
||||
}
|
||||
|
||||
@selectionBg: @aBlackColor;
|
||||
@ -65,22 +65,6 @@ a:hover {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
#logo {
|
||||
font-family: 'leanote';
|
||||
speak: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* Better Font Rendering =========== */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
font-size: 24px;
|
||||
}
|
||||
#logo:before {
|
||||
content: "\e601";
|
||||
}
|
||||
|
||||
#navbar {
|
||||
width: @pwidth;
|
||||
|
0
public/css/theme/css/font.css
Normal file
0
public/css/theme/css/font.css
Normal file
@ -808,10 +808,12 @@ a:hover {
|
||||
vertical-align: middle;
|
||||
visibility: hidden;
|
||||
}
|
||||
#inviteFriends {
|
||||
#inviteFriends,
|
||||
#upgradeAccount {
|
||||
position: relative;
|
||||
}
|
||||
#inviteFriends .dot {
|
||||
#inviteFriends .dot,
|
||||
#upgradeAccount .dot {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: -8px;
|
||||
@ -821,6 +823,12 @@ a:hover {
|
||||
border-radius: 50%;
|
||||
background: #FF9263;
|
||||
}
|
||||
#upgradeAccountModal .label {
|
||||
font-size: 12px;
|
||||
}
|
||||
#upgradeAccountModal .a {
|
||||
color: #428bca;
|
||||
}
|
||||
#inviteUrl {
|
||||
width: 400px;
|
||||
padding: 3px;
|
||||
@ -1884,6 +1892,37 @@ textarea#wmd-input {
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
#noteItemList.list .item {
|
||||
height: 30px !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ebeff2;
|
||||
margin: 0 -5px;
|
||||
}
|
||||
#noteItemList.list .item.item-b .item-blog {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item.item-b:hover .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList.list .item-thumb {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item-blog {
|
||||
display: none;
|
||||
top: auto;
|
||||
bottom: 5px;
|
||||
right: 25px;
|
||||
}
|
||||
#noteItemList.list .item-setting {
|
||||
bottom: 5px;
|
||||
}
|
||||
#noteItemList.list .item-title {
|
||||
border: none;
|
||||
}
|
||||
#noteItemList.list .item-desc {
|
||||
right: 0 !important;
|
||||
}
|
||||
#noteItemList .item:hover,
|
||||
#noteItemList .contextmenu-hover {
|
||||
background-color: #ddd !important;
|
||||
@ -1979,6 +2018,10 @@ textarea#wmd-input {
|
||||
}
|
||||
#noteItemList .item-blog {
|
||||
top: 1px;
|
||||
display: none;
|
||||
}
|
||||
#noteItemList .item-b .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList .item-setting {
|
||||
bottom: 0;
|
||||
@ -1987,6 +2030,20 @@ textarea#wmd-input {
|
||||
#noteItemList .item:hover .item-setting {
|
||||
display: block;
|
||||
}
|
||||
.sorter-style .fa-check:before,
|
||||
.view-style .fa-check:before {
|
||||
content: "";
|
||||
}
|
||||
.sorter-style.checked .fa-check:before,
|
||||
.view-style.checked .fa-check:before {
|
||||
content: "\f00c";
|
||||
}
|
||||
#sortType .dropdown-menu {
|
||||
right: -1px !important;
|
||||
}
|
||||
#tagSearch {
|
||||
line-height: 34px;
|
||||
}
|
||||
/**
|
||||
* 工具栏
|
||||
* 附件
|
||||
|
@ -268,7 +268,7 @@ a:hover {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#inviteFriends {
|
||||
#inviteFriends, #upgradeAccount {
|
||||
position: relative;
|
||||
.dot {
|
||||
display: inline-block;
|
||||
@ -281,6 +281,14 @@ a:hover {
|
||||
background: #FF9263;
|
||||
}
|
||||
}
|
||||
#upgradeAccountModal {
|
||||
.label {
|
||||
font-size: 12px;
|
||||
}
|
||||
.a {
|
||||
color:#428bca;
|
||||
}
|
||||
}
|
||||
|
||||
#inviteUrl {
|
||||
width: 400px;
|
||||
|
@ -75,15 +75,55 @@
|
||||
overflow-y: hidden;
|
||||
padding: 0 5px;
|
||||
}
|
||||
#noteItemList .item {
|
||||
position: relative;
|
||||
height: 110px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
#noteItemList {
|
||||
.item {
|
||||
position: relative;
|
||||
height: 110px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border: 1px solid @borderColor;
|
||||
border-radius: 3px;
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
// 列表模式
|
||||
&.list {
|
||||
.item {
|
||||
height: 30px !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ebeff2;
|
||||
margin: 0 -5px;
|
||||
&.item-b {
|
||||
.item-blog {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&.item-b:hover {
|
||||
.item-blog {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-thumb {
|
||||
display: none;
|
||||
}
|
||||
.item-blog {
|
||||
display: none;
|
||||
top: auto;
|
||||
bottom: 5px;
|
||||
right: 25px;
|
||||
}
|
||||
.item-setting {
|
||||
bottom: 5px;
|
||||
}
|
||||
.item-title {
|
||||
border: none;
|
||||
}
|
||||
.item-desc {
|
||||
right: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#noteItemList .item:hover,
|
||||
@ -189,6 +229,13 @@ top: 4px;
|
||||
|
||||
.item-blog {
|
||||
top: 1px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-b {
|
||||
.item-blog {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.item-setting {
|
||||
@ -202,3 +249,25 @@ top: 4px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// 视图
|
||||
.sorter-style, .view-style {
|
||||
.fa-check:before {
|
||||
content: "";
|
||||
}
|
||||
&.checked {
|
||||
.fa-check:before {
|
||||
content: "\f00c";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#sortType {
|
||||
.dropdown-menu {
|
||||
right: -1px !important;
|
||||
}
|
||||
}
|
||||
|
||||
#tagSearch {
|
||||
line-height: 34px
|
||||
}
|
||||
|
@ -170,4 +170,5 @@
|
||||
// 不要, 标题下拉有问题
|
||||
.mce-text {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,10 +808,12 @@ a:hover {
|
||||
vertical-align: middle;
|
||||
visibility: hidden;
|
||||
}
|
||||
#inviteFriends {
|
||||
#inviteFriends,
|
||||
#upgradeAccount {
|
||||
position: relative;
|
||||
}
|
||||
#inviteFriends .dot {
|
||||
#inviteFriends .dot,
|
||||
#upgradeAccount .dot {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: -8px;
|
||||
@ -821,6 +823,12 @@ a:hover {
|
||||
border-radius: 50%;
|
||||
background: #FF9263;
|
||||
}
|
||||
#upgradeAccountModal .label {
|
||||
font-size: 12px;
|
||||
}
|
||||
#upgradeAccountModal .a {
|
||||
color: #428bca;
|
||||
}
|
||||
#inviteUrl {
|
||||
width: 400px;
|
||||
padding: 3px;
|
||||
@ -1884,6 +1892,37 @@ textarea#wmd-input {
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
#noteItemList.list .item {
|
||||
height: 30px !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ebeff2;
|
||||
margin: 0 -5px;
|
||||
}
|
||||
#noteItemList.list .item.item-b .item-blog {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item.item-b:hover .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList.list .item-thumb {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item-blog {
|
||||
display: none;
|
||||
top: auto;
|
||||
bottom: 5px;
|
||||
right: 25px;
|
||||
}
|
||||
#noteItemList.list .item-setting {
|
||||
bottom: 5px;
|
||||
}
|
||||
#noteItemList.list .item-title {
|
||||
border: none;
|
||||
}
|
||||
#noteItemList.list .item-desc {
|
||||
right: 0 !important;
|
||||
}
|
||||
#noteItemList .item:hover,
|
||||
#noteItemList .contextmenu-hover {
|
||||
background-color: #ddd !important;
|
||||
@ -1979,6 +2018,10 @@ textarea#wmd-input {
|
||||
}
|
||||
#noteItemList .item-blog {
|
||||
top: 1px;
|
||||
display: none;
|
||||
}
|
||||
#noteItemList .item-b .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList .item-setting {
|
||||
bottom: 0;
|
||||
@ -1987,6 +2030,20 @@ textarea#wmd-input {
|
||||
#noteItemList .item:hover .item-setting {
|
||||
display: block;
|
||||
}
|
||||
.sorter-style .fa-check:before,
|
||||
.view-style .fa-check:before {
|
||||
content: "";
|
||||
}
|
||||
.sorter-style.checked .fa-check:before,
|
||||
.view-style.checked .fa-check:before {
|
||||
content: "\f00c";
|
||||
}
|
||||
#sortType .dropdown-menu {
|
||||
right: -1px !important;
|
||||
}
|
||||
#tagSearch {
|
||||
line-height: 34px;
|
||||
}
|
||||
/**
|
||||
* 工具栏
|
||||
* 附件
|
||||
|
@ -808,10 +808,12 @@ a:hover {
|
||||
vertical-align: middle;
|
||||
visibility: hidden;
|
||||
}
|
||||
#inviteFriends {
|
||||
#inviteFriends,
|
||||
#upgradeAccount {
|
||||
position: relative;
|
||||
}
|
||||
#inviteFriends .dot {
|
||||
#inviteFriends .dot,
|
||||
#upgradeAccount .dot {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: -8px;
|
||||
@ -821,6 +823,12 @@ a:hover {
|
||||
border-radius: 50%;
|
||||
background: #FF9263;
|
||||
}
|
||||
#upgradeAccountModal .label {
|
||||
font-size: 12px;
|
||||
}
|
||||
#upgradeAccountModal .a {
|
||||
color: #428bca;
|
||||
}
|
||||
#inviteUrl {
|
||||
width: 400px;
|
||||
padding: 3px;
|
||||
@ -1884,6 +1892,37 @@ textarea#wmd-input {
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
#noteItemList.list .item {
|
||||
height: 30px !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ebeff2;
|
||||
margin: 0 -5px;
|
||||
}
|
||||
#noteItemList.list .item.item-b .item-blog {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item.item-b:hover .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList.list .item-thumb {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item-blog {
|
||||
display: none;
|
||||
top: auto;
|
||||
bottom: 5px;
|
||||
right: 25px;
|
||||
}
|
||||
#noteItemList.list .item-setting {
|
||||
bottom: 5px;
|
||||
}
|
||||
#noteItemList.list .item-title {
|
||||
border: none;
|
||||
}
|
||||
#noteItemList.list .item-desc {
|
||||
right: 0 !important;
|
||||
}
|
||||
#noteItemList .item:hover,
|
||||
#noteItemList .contextmenu-hover {
|
||||
background-color: #ddd !important;
|
||||
@ -1979,6 +2018,10 @@ textarea#wmd-input {
|
||||
}
|
||||
#noteItemList .item-blog {
|
||||
top: 1px;
|
||||
display: none;
|
||||
}
|
||||
#noteItemList .item-b .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList .item-setting {
|
||||
bottom: 0;
|
||||
@ -1987,6 +2030,20 @@ textarea#wmd-input {
|
||||
#noteItemList .item:hover .item-setting {
|
||||
display: block;
|
||||
}
|
||||
.sorter-style .fa-check:before,
|
||||
.view-style .fa-check:before {
|
||||
content: "";
|
||||
}
|
||||
.sorter-style.checked .fa-check:before,
|
||||
.view-style.checked .fa-check:before {
|
||||
content: "\f00c";
|
||||
}
|
||||
#sortType .dropdown-menu {
|
||||
right: -1px !important;
|
||||
}
|
||||
#tagSearch {
|
||||
line-height: 34px;
|
||||
}
|
||||
/**
|
||||
* 工具栏
|
||||
* 附件
|
||||
|
@ -808,10 +808,12 @@ a:hover {
|
||||
vertical-align: middle;
|
||||
visibility: hidden;
|
||||
}
|
||||
#inviteFriends {
|
||||
#inviteFriends,
|
||||
#upgradeAccount {
|
||||
position: relative;
|
||||
}
|
||||
#inviteFriends .dot {
|
||||
#inviteFriends .dot,
|
||||
#upgradeAccount .dot {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: -8px;
|
||||
@ -821,6 +823,12 @@ a:hover {
|
||||
border-radius: 50%;
|
||||
background: #FF9263;
|
||||
}
|
||||
#upgradeAccountModal .label {
|
||||
font-size: 12px;
|
||||
}
|
||||
#upgradeAccountModal .a {
|
||||
color: #428bca;
|
||||
}
|
||||
#inviteUrl {
|
||||
width: 400px;
|
||||
padding: 3px;
|
||||
@ -1884,6 +1892,37 @@ textarea#wmd-input {
|
||||
margin-top: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
#noteItemList.list .item {
|
||||
height: 30px !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ebeff2;
|
||||
margin: 0 -5px;
|
||||
}
|
||||
#noteItemList.list .item.item-b .item-blog {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item.item-b:hover .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList.list .item-thumb {
|
||||
display: none;
|
||||
}
|
||||
#noteItemList.list .item-blog {
|
||||
display: none;
|
||||
top: auto;
|
||||
bottom: 5px;
|
||||
right: 25px;
|
||||
}
|
||||
#noteItemList.list .item-setting {
|
||||
bottom: 5px;
|
||||
}
|
||||
#noteItemList.list .item-title {
|
||||
border: none;
|
||||
}
|
||||
#noteItemList.list .item-desc {
|
||||
right: 0 !important;
|
||||
}
|
||||
#noteItemList .item:hover,
|
||||
#noteItemList .contextmenu-hover {
|
||||
background-color: #ddd !important;
|
||||
@ -1979,6 +2018,10 @@ textarea#wmd-input {
|
||||
}
|
||||
#noteItemList .item-blog {
|
||||
top: 1px;
|
||||
display: none;
|
||||
}
|
||||
#noteItemList .item-b .item-blog {
|
||||
display: block;
|
||||
}
|
||||
#noteItemList .item-setting {
|
||||
bottom: 0;
|
||||
@ -1987,6 +2030,20 @@ textarea#wmd-input {
|
||||
#noteItemList .item:hover .item-setting {
|
||||
display: block;
|
||||
}
|
||||
.sorter-style .fa-check:before,
|
||||
.view-style .fa-check:before {
|
||||
content: "";
|
||||
}
|
||||
.sorter-style.checked .fa-check:before,
|
||||
.view-style.checked .fa-check:before {
|
||||
content: "\f00c";
|
||||
}
|
||||
#sortType .dropdown-menu {
|
||||
right: -1px !important;
|
||||
}
|
||||
#tagSearch {
|
||||
line-height: 34px;
|
||||
}
|
||||
/**
|
||||
* 工具栏
|
||||
* 附件
|
||||
|
11
public/js/app.min.js
vendored
11
public/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
@ -74,7 +74,7 @@ Note.setNoteCache = function(content, clear) {
|
||||
if(clear) {
|
||||
Note.clearCacheByNotebookId(content.NotebookId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Note.setCurNoteId = function (noteId) {
|
||||
this.curNoteId = noteId;
|
||||
@ -90,7 +90,7 @@ Note.getCurNote = function() {
|
||||
return null;
|
||||
}
|
||||
return self.cache[self.curNoteId];
|
||||
}
|
||||
};
|
||||
Note.getNote = function(noteId) {
|
||||
var self = this;
|
||||
return self.cache[noteId];
|
||||
@ -114,35 +114,43 @@ Note.notebookHasNotes = function(notebookId) {
|
||||
};
|
||||
|
||||
// 得到notebook下的notes, 按什么排序 updatedTime?
|
||||
Note.getNotesByNotebookId = function(notebookId, sortBy, isAsc) {
|
||||
if(!sortBy) {
|
||||
sortBy = "UpdatedTime";
|
||||
}
|
||||
if(isAsc == "undefined") {
|
||||
isAsc = false; // 默认是降序
|
||||
}
|
||||
|
||||
if(!notebookId) {
|
||||
notebookId = "all";
|
||||
}
|
||||
|
||||
if(!Note.cacheByNotebookId[notebookId]) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if(Note.cacheByNotebookId[notebookId][sortBy]) {
|
||||
return Note.cacheByNotebookId[notebookId][sortBy];
|
||||
} else {
|
||||
}
|
||||
|
||||
// 从所有的notes中找到notebookId的, 并排序之
|
||||
var notes = [];
|
||||
var sortBys = [];
|
||||
for(var i in Note.cache) {
|
||||
if(!i) {
|
||||
continue;
|
||||
}
|
||||
var note = Note.cache[i];
|
||||
Note.getNotesByNotebookId = function(notebookId) {
|
||||
var sorterAndOrder = Note.getSorterAndOrder();
|
||||
var sortBy = sorterAndOrder.sortBy;
|
||||
var isAsc = sorterAndOrder.isAsc;
|
||||
|
||||
Note.listIsIn();
|
||||
|
||||
if (!notebookId) {
|
||||
notebookId = "all";
|
||||
}
|
||||
|
||||
if (!Note.cacheByNotebookId[notebookId]) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (Note.cacheByNotebookId[notebookId][sortBy]) {
|
||||
if (Note.cacheByNotebookId[notebookId][sortBy][isAsc]) {
|
||||
return Note.cacheByNotebookId[notebookId][sortBy][isAsc];
|
||||
}
|
||||
// 逆序
|
||||
Note.cacheByNotebookId[notebookId][sortBy][!isAsc].reverse();
|
||||
var notes = Note.cacheByNotebookId[notebookId][sortBy][!isAsc];
|
||||
Note.cacheByNotebookId[notebookId][sortBy][!isAsc] = null;
|
||||
Note.cacheByNotebookId[notebookId][sortBy][isAsc] = notes;
|
||||
return notes;
|
||||
}
|
||||
|
||||
// 从所有的notes中找到notebookId的, 并排序之
|
||||
var notes = [];
|
||||
for (var i in Note.cache) {
|
||||
if (!i) {
|
||||
continue;
|
||||
}
|
||||
var note = Note.cache[i];
|
||||
if (!note) {
|
||||
continue;
|
||||
}
|
||||
// 不要trash的not, 共享的也不要
|
||||
if(note.IsTrash || note.IsShared) {
|
||||
continue;
|
||||
@ -150,43 +158,27 @@ Note.getNotesByNotebookId = function(notebookId, sortBy, isAsc) {
|
||||
if(notebookId == "all" || note.NotebookId == notebookId) {
|
||||
notes.push(note);
|
||||
}
|
||||
}
|
||||
// 排序之
|
||||
notes.sort(function(a, b) {
|
||||
var t1 = a[sortBy];
|
||||
var t2 = b[sortBy];
|
||||
|
||||
if(isAsc) {
|
||||
if(t1 < t2) {
|
||||
return -1;
|
||||
} else if (t1 > t2) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if(t1 < t2) {
|
||||
return 1;
|
||||
} else if (t1 > t2) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
// 缓存之
|
||||
Note.cacheByNotebookId[notebookId][sortBy] = notes;
|
||||
return notes;
|
||||
}
|
||||
|
||||
Note.sortNotes(notes);
|
||||
|
||||
// 缓存之
|
||||
Note.cacheByNotebookId[notebookId][sortBy] = {};
|
||||
Note.cacheByNotebookId[notebookId][sortBy][isAsc] = notes;
|
||||
return notes;
|
||||
};
|
||||
|
||||
|
||||
// called by Notebook
|
||||
// render 所有notes, 和第一个note的content
|
||||
Note.renderNotesAndFirstOneContent = function(ret) {
|
||||
Note.renderNotesAndFirstOneContent = function(ret, hasSorted) {
|
||||
// 错误的ret是一个Object
|
||||
if(!isArray(ret)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// note 导航
|
||||
Note.renderNotes(ret);
|
||||
Note.renderNotes(ret, false, false, hasSorted);
|
||||
// 渲染第一个
|
||||
if(!isEmpty(ret[0])) {
|
||||
Note.changeNoteForPjax(ret[0].NoteId, true, false);
|
||||
@ -201,7 +193,7 @@ Note.renderNotesAndFirstOneContent = function(ret) {
|
||||
// 所以不用isDirty()
|
||||
// 只用Note.readOnly, 如果Note.readOnly, 那么不判断内容
|
||||
//
|
||||
Note.curHasChanged = function(force) {
|
||||
Note.curHasChanged = function(force, isRefreshOrCtrls) {
|
||||
var cacheNote = Note.getCurNote();
|
||||
if (!cacheNote) {
|
||||
return false;
|
||||
@ -222,6 +214,11 @@ Note.curHasChanged = function(force) {
|
||||
|
||||
if (cacheNote.IsNew) {
|
||||
hasChanged.hasChanged = true;
|
||||
hasChanged.title = title;
|
||||
// 来源
|
||||
if (LEA.topInfo) {
|
||||
hasChanged.Src = LEA.topInfo.src;
|
||||
}
|
||||
}
|
||||
|
||||
if(cacheNote.Title != title) {
|
||||
@ -270,6 +267,15 @@ Note.curHasChanged = function(force) {
|
||||
} else {
|
||||
content = contents;
|
||||
}
|
||||
|
||||
// 如果是插件, 且没有改动任何地方
|
||||
if ( hasChanged.Src && LEA.topInfo && title === LEA.topInfo.title && !hasChanged.Tags &&
|
||||
(!content || content == '<p><br></p>')) {
|
||||
// 如果不是手动ctrl+s, 则不保存
|
||||
if (!(isRefreshOrCtrls && isRefreshOrCtrls.ctrls)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 比较text, 因为note Nav会添加dom会导致content改变
|
||||
/*
|
||||
@ -369,7 +375,7 @@ Note.genAbstract = function(content, len) {
|
||||
var d = document.createElement("div");
|
||||
d.innerHTML = result
|
||||
return d.innerHTML;
|
||||
}
|
||||
};
|
||||
|
||||
Note.getImgSrc = function(content) {
|
||||
if(!content) {
|
||||
@ -383,7 +389,7 @@ Note.getImgSrc = function(content) {
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
// 如果当前的改变了, 就保存它
|
||||
// 以后要定时调用
|
||||
@ -391,7 +397,7 @@ Note.getImgSrc = function(content) {
|
||||
// 定时保存传false
|
||||
Note.saveInProcess = {}; // noteId => bool, true表示该note正在保存到服务器, 服务器未响应
|
||||
Note.savePool = {}; // 保存池, 以后的保存先放在pool中, id => note
|
||||
Note.curChangedSaveIt = function(force, callback) {
|
||||
Note.curChangedSaveIt = function(force, callback, isRefreshOrCtrls) {
|
||||
var me = this;
|
||||
// 如果当前没有笔记, 不保存
|
||||
// 或者是共享的只读笔记
|
||||
@ -401,7 +407,7 @@ Note.curChangedSaveIt = function(force, callback) {
|
||||
}
|
||||
var hasChanged;
|
||||
try {
|
||||
hasChanged = Note.curHasChanged(force);
|
||||
hasChanged = Note.curHasChanged(force, isRefreshOrCtrls);
|
||||
} catch(e) {
|
||||
// console.error('获取当前改变的笔记错误!');
|
||||
callback && callback(false);
|
||||
@ -450,7 +456,8 @@ Note.curChangedSaveIt = function(force, callback) {
|
||||
Note.setNoteCache(hasChanged, false);
|
||||
// 设置更新时间
|
||||
Note.setNoteCache({"NoteId": hasChanged.NoteId, "UpdatedTime": (new Date()).format("yyyy-MM-ddThh:mm:ss.S")}, false);
|
||||
|
||||
Note.clearCacheByNotebookId(hasChanged.NotebookId);
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
else {
|
||||
@ -493,13 +500,13 @@ Note.startUpdatePoolNoteInterval = function() {
|
||||
// 样式
|
||||
Note.clearSelect = function(target) {
|
||||
$(".item").removeClass("item-active");
|
||||
}
|
||||
};
|
||||
Note.selectTarget = function(target) {
|
||||
this.clearSelect();
|
||||
$(target).addClass("item-active");
|
||||
|
||||
// this.batch.reset();
|
||||
}
|
||||
};
|
||||
|
||||
// 改变note
|
||||
// 可能改变的是share note
|
||||
@ -516,7 +523,12 @@ Note.directToNote = function(noteId) {
|
||||
var $p = $("#noteItemList");
|
||||
var pHeight = $p.height();
|
||||
// 相对于父亲的位置
|
||||
var pTop = $("[noteId='" + noteId + "']").position().top;
|
||||
var position = $("[noteId='" + noteId + "']").position();
|
||||
if (!position) {
|
||||
console.error('no position: ' + noteId);
|
||||
return;
|
||||
}
|
||||
var pTop = position.top;
|
||||
var scrollTop = $p.scrollTop();
|
||||
pTop += scrollTop;
|
||||
/*
|
||||
@ -816,20 +828,168 @@ Note.hideEditorMask = function() {
|
||||
$("#editorMask").css("z-index", -10).hide();
|
||||
};
|
||||
|
||||
/**
|
||||
* 切换视图
|
||||
* @param {[type]} e [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
Note.toggleView = function (e) {
|
||||
var view;
|
||||
if (typeof e == 'object' && e) {
|
||||
view = $(e.target).data('view');
|
||||
}
|
||||
else {
|
||||
view = e;
|
||||
}
|
||||
if (!view) {
|
||||
view = 'snippet';
|
||||
}
|
||||
if (view == 'list') {
|
||||
$('#noteItemList').addClass('list');
|
||||
}
|
||||
else {
|
||||
$('#noteItemList').removeClass('list');
|
||||
}
|
||||
localStorage.setItem('viewStyle', view);
|
||||
$('.view-style').removeClass('checked');
|
||||
$('.view-' + view).addClass('checked');
|
||||
};
|
||||
|
||||
// 重新设置sorter, 此时要重新render
|
||||
// sortType = dateCreatedASC dateCreatedDESC
|
||||
Note.setNotesSorter = function (e) {
|
||||
var sorterType = $(e.currentTarget).data('sorter');
|
||||
if (!sorterType) {
|
||||
sorterType = 'dateUpdatedDESC';
|
||||
}
|
||||
localStorage.setItem("sorterType", sorterType);
|
||||
// alert(localStorage.getItem("sorterType"));
|
||||
Note.checkSorter(sorterType);
|
||||
|
||||
// 如果当前是tagSearch, search, star 怎么办?
|
||||
// 重新Render
|
||||
if (Note._isTag || Note._isSearch || Note._isShare) {
|
||||
Note.renderNotesAndFirstOneContent(Note._everNotes, false);
|
||||
} else {
|
||||
// 其实这里也可以用Note._everNotes, 主要是为了缓存数据
|
||||
Notebook.changeNotebook(Notebook.curNotebookId);
|
||||
}
|
||||
// Note.renderNotesAndTargetNote(Note._everNotes, false, false);
|
||||
// Api.writeConfig(Config);
|
||||
};
|
||||
|
||||
var $sorterStyles = $('.sorter-style');
|
||||
Note.checkSorter = function (sorterType) {
|
||||
// UC无痕浏览
|
||||
if (!sorterType) {
|
||||
sorterType = 'dateUpdatedDESC';
|
||||
}
|
||||
var $selected = $('.sorter-' + sorterType);
|
||||
if ($selected.is('.checked')) {
|
||||
return;
|
||||
}
|
||||
$sorterStyles.removeClass('checked');
|
||||
$selected.addClass('checked');
|
||||
};
|
||||
|
||||
// render前先排序
|
||||
Note.sortNotesToRender = function (notes) {
|
||||
Note.sortNotes(notes);
|
||||
};
|
||||
|
||||
Note.sortNotes = function (notes) {
|
||||
if (isEmpty(notes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var sorterAndOrder = Note.getSorterAndOrder();
|
||||
var sortBy = sorterAndOrder.sortBy;
|
||||
var isAsc = sorterAndOrder.isAsc;
|
||||
|
||||
// 排序之
|
||||
notes.sort(function(a, b) {
|
||||
var t1 = a[sortBy];
|
||||
var t2 = b[sortBy];
|
||||
|
||||
if (isAsc) {
|
||||
if (t1 < t2) {
|
||||
return -1;
|
||||
} else if (t1 > t2) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (t1 < t2) {
|
||||
return 1;
|
||||
} else if (t1 > t2) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
};
|
||||
|
||||
Note.getSorterAndOrder = function () {
|
||||
var sortBy = "UpdatedTime";
|
||||
var isAsc = false; // 默认是降序
|
||||
var sorterType = localStorage.getItem('sorterType');
|
||||
// console.log(sorterType);
|
||||
Note.checkSorter(sorterType);
|
||||
if (sorterType) {
|
||||
switch(sorterType) {
|
||||
case 'dateCreatedASC':
|
||||
sortBy = 'CreatedTime';
|
||||
isAsc = true;
|
||||
break;
|
||||
case 'dateCreatedDESC':
|
||||
sortBy = 'CreatedTime';
|
||||
isAsc = false;
|
||||
break;
|
||||
case 'dateUpdatedASC':
|
||||
sortBy = 'UpdatedTime';
|
||||
isAsc = true;
|
||||
break;
|
||||
case 'dateUpdatedDESC':
|
||||
sortBy = 'UpdatedTime';
|
||||
isAsc = false;
|
||||
break;
|
||||
case 'titleASC':
|
||||
sortBy = 'Title';
|
||||
isAsc = true;
|
||||
break;
|
||||
case 'titleDESC':
|
||||
sortBy = 'Title';
|
||||
isAsc = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log({sortBy: sortBy, isAsc: isAsc});
|
||||
return {sortBy: sortBy, isAsc: isAsc};
|
||||
};
|
||||
|
||||
// 列表是
|
||||
Note.listIsIn = function (isTag, isSearch, isShare) {
|
||||
this._isTag = isTag;
|
||||
this._isSearch = isSearch;
|
||||
this._isShare = isShare;
|
||||
};
|
||||
|
||||
// 这里如果notes过多>100个将会很慢!!, 使用setTimeout来分解
|
||||
Note.renderNotesC = 0;
|
||||
Note.renderNotes = function(notes, forNewNote, isShared) {
|
||||
Note.renderNotes = function(notes, forNewNote, isShared, hasSorted) {
|
||||
var renderNotesC = ++Note.renderNotesC;
|
||||
|
||||
this.clearSeqForNew();
|
||||
this.batch.reset();
|
||||
|
||||
// 为了切换排序方式用
|
||||
Note._everNotes = notes;
|
||||
|
||||
// 手机端不用
|
||||
// slimScroll使得手机端滚动不流畅
|
||||
if(!LEA.isMobile && !Mobile.isMobile()) {
|
||||
$("#noteItemList").slimScroll({ scrollTo: '0px', height: "100%", onlyScrollBar: true});
|
||||
}
|
||||
|
||||
|
||||
if(!notes || typeof notes != "object" || notes.length <= 0) {
|
||||
// 如果没有, 那么是不是应该hide editor?
|
||||
if(!forNewNote) {
|
||||
@ -849,6 +1009,11 @@ Note.renderNotes = function(notes, forNewNote, isShared) {
|
||||
// 20个一次
|
||||
var len = notes.length;
|
||||
var c = Math.ceil(len/20);
|
||||
|
||||
// 重新排序
|
||||
if (!hasSorted) {
|
||||
Note.sortNotes(notes);
|
||||
}
|
||||
|
||||
Note._renderNotes(notes, forNewNote, isShared, 1);
|
||||
|
||||
@ -900,9 +1065,11 @@ Note._renderNotes = function(notes, forNewNote, isShared, tang) { // 第几趟
|
||||
} else {
|
||||
tmp = tt(Note.itemTplNoImg, classes, i, note.NoteId, note.Title, Notebook.getNotebookTitle(note.NotebookId), goNowToDatetime(note.UpdatedTime), note.Desc);
|
||||
}
|
||||
tmp = $(tmp);
|
||||
if(!note.IsBlog) {
|
||||
tmp = $(tmp);
|
||||
tmp.find(".item-blog").hide();
|
||||
tmp.removeClass('item-b');
|
||||
} else {
|
||||
tmp.addClass('item-b');
|
||||
}
|
||||
Note.noteItemListO.append(tmp);
|
||||
|
||||
@ -937,22 +1104,36 @@ Note.newNoteSeq = function () {
|
||||
// isShare时fromUserId才有用
|
||||
// 3.8 add isMarkdown
|
||||
Note.newNote = function(notebookId, isShare, fromUserId, isMarkdown) {
|
||||
if (!notebookId) {
|
||||
notebookId = $("#curNotebookForNewNote").attr('notebookId');
|
||||
}
|
||||
|
||||
// 切换编辑器
|
||||
switchEditor(isMarkdown);
|
||||
Note.hideEditorMask();
|
||||
|
||||
|
||||
// 防止从共享read only跳到添加
|
||||
Note.hideReadOnly();
|
||||
|
||||
|
||||
Note.stopInterval();
|
||||
// 保存当前的笔记
|
||||
Note.curChangedSaveIt();
|
||||
|
||||
Note.batch.reset();
|
||||
|
||||
var note = {NoteId: getObjectId(), Title: "", Tags:[], Content:"", NotebookId: notebookId, IsNew: true, FromUserId: fromUserId, IsMarkdown: isMarkdown}; // 是新的
|
||||
|
||||
var note = {NoteId: getObjectId(),
|
||||
Title: "", Tags:[], Content:"",
|
||||
NotebookId: notebookId, IsNew: true, FromUserId: fromUserId,
|
||||
IsMarkdown: isMarkdown,
|
||||
UpdatedTime: new Date(),
|
||||
CreatedTime: new Date()}; // 是新的
|
||||
if (LEA.topInfo && LEA.topInfo.title) {
|
||||
note.Title = LEA.topInfo.title;
|
||||
}
|
||||
|
||||
// 添加到缓存中
|
||||
Note.addNoteCache(note);
|
||||
Note.clearCacheByNotebookId(notebookId);
|
||||
|
||||
// 清空附件数
|
||||
Attach.clearNoteAttachNum();
|
||||
@ -975,9 +1156,12 @@ Note.newNote = function(notebookId, isShare, fromUserId, isMarkdown) {
|
||||
}
|
||||
|
||||
// notebook是否是Blog
|
||||
newItem = $(newItem);
|
||||
if(!notebook.IsBlog) {
|
||||
newItem = $(newItem);
|
||||
newItem.find(".item-blog").hide();
|
||||
newItem.removeClass('item-b');
|
||||
}
|
||||
else {
|
||||
newItem.addClass('item-b');
|
||||
}
|
||||
|
||||
// 是否在当前notebook下, 不是则切换过去, 并得到该notebook下所有的notes, 追加到后面!
|
||||
@ -1261,6 +1445,10 @@ Note.searchNote = function() {
|
||||
// 先取消上一个
|
||||
showLoading();
|
||||
Notebook.showNoteAndEditorLoading();
|
||||
|
||||
Note.listIsIn(false, true);
|
||||
$("#tagSearch").hide();
|
||||
|
||||
Note.lastSearch = $.post("/note/searchNote", {key: val}, function(notes) {
|
||||
hideLoading();
|
||||
Notebook.hideNoteAndEditorLoading();
|
||||
@ -1317,9 +1505,9 @@ Note._setBlog = function(target, isBlog) {
|
||||
var noteId = noteIds[i];
|
||||
var $t = me.getTargetById(noteId);
|
||||
if(isBlog) {
|
||||
$t.find(".item-blog").show();
|
||||
$t.addClass('item-b');
|
||||
} else {
|
||||
$t.find(".item-blog").hide();
|
||||
$t.removeClass('item-b');
|
||||
}
|
||||
me.setNoteCache({NoteId: noteId, IsBlog: isBlog}, false); // 不清空NotesByNotebookId缓存
|
||||
}
|
||||
@ -1742,6 +1930,7 @@ Note.initContextmenu = function() {
|
||||
items.push("copy." + notebookTitle);
|
||||
}
|
||||
}
|
||||
// console.log(items);
|
||||
|
||||
// diable 这里
|
||||
menu.applyrule({
|
||||
@ -2450,7 +2639,6 @@ $(function() {
|
||||
Note.curChangedSaveIt(true);
|
||||
});
|
||||
|
||||
|
||||
// blog
|
||||
Note.$itemList.on("click", ".item-blog", function(e) {
|
||||
e.preventDefault();
|
||||
@ -2511,6 +2699,16 @@ $(function() {
|
||||
e.preventDefault();
|
||||
window.open(href);
|
||||
});
|
||||
|
||||
var view = localStorage.getItem('viewStyle');
|
||||
Note.toggleView(view);
|
||||
// view 切换
|
||||
$('.view-style').click(function (e) {
|
||||
Note.toggleView(e);
|
||||
});
|
||||
$('.sorter-style').click(function (e) {
|
||||
Note.setNotesSorter(e);
|
||||
});
|
||||
});
|
||||
|
||||
// 定时器启动
|
||||
|
@ -527,7 +527,7 @@ Notebook.changeNotebookNavForNewNote = function(notebookId, title) {
|
||||
Notebook.changeNotebookNavForNewNote(notebookId, title);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 改变导航, 两处
|
||||
// 单击左侧, 单击新建下拉时调用
|
||||
@ -544,7 +544,7 @@ Notebook.toggleToMyNav = function(userId, notebookId) {
|
||||
|
||||
// 搜索tag隐藏
|
||||
$("#tagSearch").hide();
|
||||
}
|
||||
};
|
||||
Notebook.changeNotebookNav = function(notebookId) {
|
||||
Notebook.curNotebookId = notebookId;
|
||||
Notebook.toggleToMyNav();
|
||||
@ -615,7 +615,7 @@ Notebook.changeNotebook = function(notebookId, callback) {
|
||||
if(callback) {
|
||||
callback(cacheNotes);
|
||||
} else {
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -628,7 +628,7 @@ Notebook.changeNotebook = function(notebookId, callback) {
|
||||
if(callback) {
|
||||
callback(cacheNotes);
|
||||
} else {
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes, true);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@ -653,7 +653,7 @@ Notebook.changeNotebook = function(notebookId, callback) {
|
||||
if(callback) {
|
||||
callback(cacheNotes);
|
||||
} else {
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes);
|
||||
Note.renderNotesAndFirstOneContent(cacheNotes, false);
|
||||
}
|
||||
me.hideNoteAndEditorLoading();
|
||||
});
|
||||
@ -728,19 +728,22 @@ Notebook.setNotebook2Blog = function(target) {
|
||||
// 那么, 如果当前是该notebook下, 重新渲染之
|
||||
if(Notebook.curNotebookId == notebookId) {
|
||||
if(isBlog) {
|
||||
$("#noteList .item-blog").show();
|
||||
$('.item').addClass('item-b');
|
||||
} else {
|
||||
$("#noteList .item-blog").hide();
|
||||
$('.item').removeClass('item-b');
|
||||
}
|
||||
|
||||
// 如果当前在所有笔记本下
|
||||
} else if(Notebook.curNotebookId == Notebook.allNotebookId){
|
||||
$("#noteItemList .item").each(function(){
|
||||
var noteId = $(this).attr("noteId");
|
||||
var note = Note.cache[noteId];
|
||||
if(note.NotebookId == notebookId) {
|
||||
if(isBlog) $(this).find(".item-blog").show();
|
||||
else $(this).find(".item-blog").hide();
|
||||
if (isBlog) {
|
||||
$(this).addClass('item-b');
|
||||
}
|
||||
else {
|
||||
$(this).removeClass('item-b');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -972,4 +975,4 @@ $(function() {
|
||||
var $p = $(this).parent();
|
||||
Notebook.contextmenuSearch.showMenu(e, $p);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,16 @@
|
||||
// 主页渲染
|
||||
//-------------
|
||||
|
||||
function sendLog (key, value) {
|
||||
if (!key) {
|
||||
return;
|
||||
}
|
||||
if (!value) {
|
||||
value = '';
|
||||
}
|
||||
ajaxGet('/index/log', {key: key, value: value});
|
||||
}
|
||||
|
||||
//----------------------
|
||||
// 编辑器模式
|
||||
function editorMode() {
|
||||
@ -88,7 +98,7 @@ editorMode.prototype.normalMode = function() {
|
||||
var $themeLink = $("#themeLink");
|
||||
// 如果之前不是normal才换
|
||||
if(this.$themeLink.attr('href').indexOf('writting-overwrite.css') != -1) {
|
||||
this.$themeLink.attr("href", "/css/theme/" + theme);
|
||||
this.$themeLink.attr("href", LEA.sPath + "/css/theme/" + theme);
|
||||
}
|
||||
|
||||
$("#noteList").width(UserInfo.NoteListWidth);
|
||||
@ -103,7 +113,7 @@ editorMode.prototype.writtingMode = function() {
|
||||
return;
|
||||
}
|
||||
if(this.$themeLink.attr('href').indexOf('writting-overwrite.css') == -1) {
|
||||
this.$themeLink.attr("href", "/css/theme/writting-overwrite.css");
|
||||
this.$themeLink.attr("href", LEA.sPath + "/css/theme/writting-overwrite.css");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -237,7 +247,7 @@ var Resize = {
|
||||
$('.preview-container').show();
|
||||
self.rightColumn.css('left', everLeftWidth).width('auto');
|
||||
|
||||
if(MD) {
|
||||
if(MD) {
|
||||
MD.resize();
|
||||
}
|
||||
}
|
||||
@ -582,7 +592,7 @@ function initEditor() {
|
||||
if (LEA.isLogout) {
|
||||
return;
|
||||
}
|
||||
Note.curChangedSaveIt(true);
|
||||
Note.curChangedSaveIt(true, null, {refresh: true});
|
||||
}
|
||||
|
||||
// 全局快捷键
|
||||
@ -594,7 +604,7 @@ function initEditor() {
|
||||
if(ctrlOrMetaKey) {
|
||||
// 保存
|
||||
if (num == 83 ) { // ctrl + s or command + s
|
||||
Note.curChangedSaveIt();
|
||||
Note.curChangedSaveIt(true, null, {ctrls: true});
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
@ -656,6 +666,11 @@ function scrollTo(self, tagName, text) {
|
||||
}
|
||||
}
|
||||
|
||||
function hideMask () {
|
||||
$("#mainMask").html("");
|
||||
$("#mainMask").hide(100);
|
||||
}
|
||||
|
||||
//--------------
|
||||
// 调用之
|
||||
// $(function() {
|
||||
@ -722,7 +737,7 @@ function scrollTo(self, tagName, text) {
|
||||
if (arr.length == 2) {
|
||||
id = arr[1];
|
||||
}
|
||||
$("#themeLink").attr("href", "/css/theme/" + val + ".css?id=" + id);
|
||||
$("#themeLink").attr("href", LEA.sPath + "/css/theme/" + val + ".css?id=" + id);
|
||||
ajaxPost("/user/updateTheme", {theme: val}, function(re) {
|
||||
if(reIsOk(re)) {
|
||||
UserInfo.Theme = val
|
||||
@ -812,8 +827,13 @@ function scrollTo(self, tagName, text) {
|
||||
Resize.set3ColumnsWidth(UserInfo.NotebookWidth, UserInfo.NoteListWidth);
|
||||
Resize.setMdColumnWidth(UserInfo.MdEditorWidth);
|
||||
|
||||
if (UserInfo.LeftIsMin) {
|
||||
minLeft(false);
|
||||
if (!Mobile.isMobile()) {
|
||||
if (UserInfo.LeftIsMin) {
|
||||
minLeft(false);
|
||||
}
|
||||
else {
|
||||
maxLeft(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
maxLeft(false);
|
||||
@ -822,8 +842,7 @@ function scrollTo(self, tagName, text) {
|
||||
// end
|
||||
// 开始时显示loading......
|
||||
// 隐藏mask
|
||||
$("#mainMask").html("");
|
||||
$("#mainMask").hide(100);
|
||||
// hideMask();
|
||||
|
||||
// 4/25 防止dropdown太高
|
||||
// dropdown
|
||||
@ -1438,45 +1457,174 @@ LeaAce = {
|
||||
}
|
||||
};
|
||||
|
||||
function initLeanoteIfrPlugin () {
|
||||
// 如果在iframe下, 很可能是嵌入了leanote
|
||||
if (self != window.parent) {
|
||||
LEA.topInfo = {};
|
||||
// 收到消息
|
||||
window.addEventListener('message', function(e) {
|
||||
console.log('child 收到消息: ')
|
||||
console.log(e.data);
|
||||
LEA.topInfo = e.data || {};
|
||||
LEA.topInfo.got = true;
|
||||
}, false);
|
||||
if (window.parent.postMessage) {
|
||||
window.parent.postMessage('leanote', '*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 通过src得到note
|
||||
function getNoteBySrc(src, callback) {
|
||||
ajaxGet('/note/getNoteAndContentBySrc', {src: src}, function (ret) {
|
||||
if (ret && ret.Ok) {
|
||||
var data = ret.Item;
|
||||
if (data) {
|
||||
var noteInfo = data.NoteInfo;
|
||||
var contentInfo = data.NoteContentInfo;
|
||||
for (var i in contentInfo) {
|
||||
noteInfo[i] = contentInfo[i];
|
||||
}
|
||||
callback(noteInfo);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 得到top的info's src
|
||||
var _topInfoStart = (new Date()).getTime();
|
||||
function getTopInfoSrc (callback) {
|
||||
if (LEA.topInfo.got) {
|
||||
return callback(LEA.topInfo.src);
|
||||
}
|
||||
else {
|
||||
// 超过1000ms, 不行
|
||||
if ((new Date()).getTime() - _topInfoStart > 2000) {
|
||||
return callback();
|
||||
}
|
||||
setTimeout(function () {
|
||||
getTopInfoSrc(callback);
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
// note.html调用
|
||||
// 实始化页面
|
||||
function initPage() {
|
||||
// 不要用$(function() {}) 因为要等到<script>都加载了才执行
|
||||
// $(function() {
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
Share.renderShareNotebooks(sharedUserInfos, shareNotebooks);
|
||||
|
||||
// 如果初始打开的是共享的笔记
|
||||
// 那么定位到我的笔记
|
||||
if(curSharedNoteNotebookId) {
|
||||
Share.firstRenderShareNote(curSharedUserId, curSharedNoteNotebookId, curNoteId);
|
||||
// 初始打开的是我的笔记
|
||||
} else {
|
||||
Note.setNoteCache(noteContentJson);
|
||||
Note.renderNotes(notes);
|
||||
if(curNoteId) {
|
||||
// 指定某个note时才target notebook, /note定位到最新
|
||||
// ie10&+要setTimeout
|
||||
setTimeout(function() {
|
||||
Note.changeNoteForPjax(curNoteId, true, curNotebookId);
|
||||
initLeanoteIfrPlugin();
|
||||
if (LEA.topInfo) {
|
||||
getTopInfoSrc(function (src) {
|
||||
if (src) {
|
||||
getNoteBySrc (src, function (srcNote) {
|
||||
_initPage(srcNote, true);
|
||||
});
|
||||
if(!curNotebookId) {
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', Notebook.allNotebookId)));
|
||||
} else {
|
||||
_initPage(false, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
_initPage();
|
||||
}
|
||||
}
|
||||
|
||||
function _initPage(srcNote, isTop) {
|
||||
if (srcNote) {
|
||||
curNoteId = srcNote.NoteId;
|
||||
curNotebookId = srcNote.NotebookId;
|
||||
noteContentJson = srcNote; // 当前笔记变成我的
|
||||
}
|
||||
else if(isTop) {
|
||||
curNoteId = null;
|
||||
}
|
||||
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
Share.renderShareNotebooks(sharedUserInfos, shareNotebooks);
|
||||
|
||||
// 如果初始打开的是共享的笔记
|
||||
// 那么定位到我的笔记
|
||||
if(curSharedNoteNotebookId) {
|
||||
Share.firstRenderShareNote(curSharedUserId, curSharedNoteNotebookId, curNoteId);
|
||||
// 初始打开的是我的笔记
|
||||
} else {
|
||||
Note.setNoteCache(noteContentJson);
|
||||
// 判断srcNote是否在notes中
|
||||
var isExists = false;
|
||||
if (isTop && srcNote && notes) {
|
||||
for (var i = 0; i < notes.length; ++i) {
|
||||
var note = notes[i];
|
||||
if (note.NoteId === srcNote.NoteId) {
|
||||
isExists = true;
|
||||
notes.splice(i, 1);
|
||||
notes.unshift(srcNote);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 指定笔记, 也要保存最新笔记
|
||||
if(latestNotes.length > 0) {
|
||||
for(var i = 0; i < latestNotes.length; ++i) {
|
||||
Note.addNoteCache(latestNotes[i]);
|
||||
if (!isExists) {
|
||||
notes.unshift(srcNote);
|
||||
}
|
||||
}
|
||||
|
||||
Tag.renderTagNav(tagsJson);
|
||||
// init notebook后才调用
|
||||
initSlimScroll();
|
||||
|
||||
LeaAce.handleEvent();
|
||||
// });
|
||||
}
|
||||
Note.renderNotes(notes);
|
||||
|
||||
if(curNoteId) {
|
||||
// 指定某个note时才target notebook, /note定位到最新
|
||||
// ie10&+要setTimeout
|
||||
setTimeout(function() {
|
||||
Note.changeNoteForPjax(curNoteId, true, curNotebookId);
|
||||
if (isTop) {
|
||||
Note.toggleWriteable();
|
||||
setTimeout(function () {
|
||||
Note.toggleWriteable();
|
||||
}, 100);
|
||||
// 如果是markdown
|
||||
setTimeout(function () {
|
||||
Note.toggleWriteable();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
if(!curNotebookId) {
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', Notebook.allNotebookId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 指定笔记, 也要保存最新笔记
|
||||
if(latestNotes.length > 0) {
|
||||
for(var i = 0; i < latestNotes.length; ++i) {
|
||||
Note.addNoteCache(latestNotes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Tag.renderTagNav(tagsJson);
|
||||
// init notebook后才调用
|
||||
initSlimScroll();
|
||||
|
||||
LeaAce.handleEvent();
|
||||
|
||||
// 如果是插件, 则切换到编辑页, 并切换到写作模式
|
||||
if (isTop) {
|
||||
Mobile.toEditor();
|
||||
|
||||
// 如果没有, 则新建之
|
||||
if (!srcNote) {
|
||||
Note.newNote();
|
||||
Note.toggleWriteable(true);
|
||||
setTimeout(function () {
|
||||
Note.toggleWriteable(true);
|
||||
}, 100);
|
||||
// 如果是markdown
|
||||
setTimeout(function () {
|
||||
Note.toggleWriteable(true);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
hideMask();
|
||||
}
|
@ -208,7 +208,7 @@ Share.toggleToSharedNav = function(userId, notebookId) {
|
||||
var self = this;
|
||||
// for list
|
||||
$("#curNotebookForListNote").html(Share.notebookCache[notebookId].Title + '(' + Share.sharedUserInfos[userId].Username + ")");
|
||||
|
||||
Note.listIsIn(false, false, true);
|
||||
// for new
|
||||
// 如果该用户下有新建的note, 那么列出, 如果没有, 则列出我的笔记
|
||||
var forNew = Share.userNavs[userId].forNew;
|
||||
|
@ -236,8 +236,10 @@ Tag.renderTagNav = function(tags) {
|
||||
var text = Tag.mapEn2Cn[tag] || text;
|
||||
}
|
||||
text = trimTitle(text);
|
||||
var classes = Tag.classes[tag] || "label label-default";
|
||||
$("#tagNav").append(tt('<li data-tag="?"><a> <span class="?">?</span> <span class="tag-delete">X</span></li>', tag, classes, text));
|
||||
if (text) {
|
||||
var classes = Tag.classes[tag] || "label label-default";
|
||||
$("#tagNav").append(tt('<li data-tag="?"><a> <span class="?">?</span> <span class="tag-delete">X</span></li>', tag, classes, text));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -367,6 +369,7 @@ $(function() {
|
||||
|
||||
$("#tagSearch").html($li.html()).show();
|
||||
$("#tagSearch .tag-delete").remove();
|
||||
Note.listIsIn(true, false);
|
||||
|
||||
showLoading();
|
||||
ajaxGet("/note/searchNoteByTags", {tags: [tag]}, function(notes) {
|
||||
@ -375,7 +378,7 @@ $(function() {
|
||||
// 和note搜索一样
|
||||
// 设空, 防止发生上述情况
|
||||
// Note.curNoteId = "";
|
||||
|
||||
|
||||
Note.renderNotes(notes);
|
||||
if(!isEmpty(notes)) {
|
||||
Note.changeNote(notes[0].NoteId);
|
||||
@ -387,4 +390,4 @@ $(function() {
|
||||
// $("#minTagNav").on("click", "li", searchTag);
|
||||
|
||||
$("#myTag .folderBody").on("click", "li .tag-delete", deleteTag);
|
||||
});
|
||||
});
|
6
public/js/markdown-v2.min.js
vendored
6
public/js/markdown-v2.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user