更新一下菜单逻辑

This commit is contained in:
HelloWorld 2020-04-13 10:22:48 +08:00
parent 56620d2565
commit df29e3e1d5
16 changed files with 149 additions and 242 deletions

View File

@ -116,11 +116,11 @@ source /home/lcq/schema.sql; // 执行schema.sql文件创建数据库表格。
8、在浏览器里面输入127.0.0.1:2000。
9、如果需要域名部署的话推荐使用nginx作为HTTP和反向代理服务器根目录有一份`nginx.conf`文件,你只需要更新`root`项即可使用。相关知识,请自行百度。
8 其他说明
7 其他说明
---------
1、我没有做浏览器兼容测试只在Google Chrome下面进行了测试开发。
9 开源许可证
8 开源许可证
-----------
[MIT License](http://www.opensource.org/licenses/MIT)
你可以随意使用此项目,无需通知我,因为我可能很忙没时间。注意,手机版当前没开源

View File

@ -4,44 +4,40 @@ app.controller('adviceCtr', ['$scope', '$state', '$timeout', 'pubSubService', 'd
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
$scope.comment = '';
$scope.advices = [];
$scope.user = {};
$scope.loading = false;
get('user').then(user => {
pubSubService.subscribe('Common.user', $scope, function (event, user) {
$scope.user = user;
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexAdvice
});
});
getAdvices();
$scope.ok = async function () {
if ($scope.comment == '') {
toastr.error('留言失败内容不能为空', "错误");
return;
}
if ($scope.user.username == 'test') {
} else if ($scope.user.username == 'test') {
toastr.error('test用户不允许留言!', "错误");
return;
} else {
await post('adviceAdd', { comment: $scope.comment });
await getAdvices();
}
await post('adviceAdd', {
comment: $scope.comment,
});
await getAdvices();
}
async function getAdvices() {
let data = await get("advices");
data.forEach(element => {
$scope.loading = true;
$scope.comment = "";
let advices = await get("advices");
advices.forEach(element => {
element.imgData = new Identicon(md5(element.userId)).toString();
});
$scope.comment = "";
$timeout(function () {
$scope.advices = data;
$scope.advices = advices;
});
$scope.loading = false;
}
}]);

View File

@ -4,4 +4,5 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
}]);

View File

@ -4,18 +4,9 @@ app.controller('homeCtr', ['$scope', '$stateParams', '$filter', '$state', '$wind
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
(async () => {
try {
await get('user');
pubSubService.publish('loginCtr.login', { 'login': true });
$state.go('tags');
} catch (error) {
pubSubService.publish('Common.menuActive', {
login: false,
index: dataService.NotLoginIndexHome
});
}
})();
pubSubService.subscribe('Common.user', $scope, function (event, user) {
user.id && $state.go('tags');
});
}]);

View File

@ -1,13 +1,13 @@
app.controller('loginCtr', ['$scope', '$filter', '$state', '$http', '$cookieStore', '$window', 'pubSubService', 'dataService', function ($scope, $filter, $state, $http, $cookieStore, $window, pubSubService, dataService) {
console.log("Hello loginCtr...", $cookieStore.get("username"));
console.log("Hello loginCtr...");
if (dataService.smallDevice()) {
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
pubSubService.publish('Common.menuActive', {
login: false,
index: dataService.NotLoginIndexLogin
pubSubService.subscribe('Common.user', $scope, function (event, user) {
user.id && $state.go('tags');
});
$scope.username = $cookieStore.get("username") || "";
@ -39,12 +39,12 @@ app.controller('loginCtr', ['$scope', '$filter', '$state', '$http', '$cookieStor
$cookieStore.put("username", $scope.username);
let data = await post('userLogin', params);
pubSubService.publish('Login', true);
// 更新token信息
localStorage.setItem("authorization", data.token);
pubSubService.publish('loginCtr.login', { login: true });
$state.go('tags')
$state.go('tags');
}
$scope.showRegister = async function () {

View File

@ -1,43 +1,48 @@
app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$timeout', '$document', 'pubSubService', 'dataService', function ($scope, $stateParams, $state, $window, $timeout, $document, pubSubService, dataService) {
console.log("Hello menuCtr")
$scope.login = false; /**< 是否登陆 */
$scope.selectLoginIndex = 0; /**< 默认登陆之后的选择的菜单索引,下表从 0 开始 */
$scope.selectNotLoginIndex = 0; /**< 默认未登陆之后的选择的菜单索引,下表从 0 开始 */
$scope.keyword = ''; /**< 搜索关键字 */
$scope.login = false;
$scope.selectLoginIndex = 0; // 默认登陆之后的选择的菜单索引,下表从 0 开始
$scope.selectNotLoginIndex = 0; // 默认未登陆之后的选择的菜单索引,下表从 0 开始
$scope.keyword = '';
$scope.searchHistory = [];
$scope.historyTypes = dataService.historyTypes;
$scope.quickUrl = {};
$scope.longPress = false;
$scope.user = {};
$scope.loaded = false; // 是否加载完毕
// 防止在登陆的情况下在浏览器里面直接输入url这时候要更新菜单选项
pubSubService.subscribe('Common.menuActive', $scope, function (event, params) {
console.log("subscribe Common.menuActive, login = " + params.login + ", index = " + params.index);
$scope.login = (params && params.login) || false;
var index = $scope.login ? ($scope.selectLoginIndex = (params && params.index) || 0) : ($scope.selectNotLoginIndex = (params && params.index) || 0);
updateMenuActive(index);
pubSubService.subscribe('Login', $scope, function (event, login) {
$scope.login = login;
});
pubSubService.subscribe('Settings.quickUrl', $scope, function (event, params) {
$scope.quickUrl = params.quickUrl;
function sleep(time) { return new Promise((resolve) => setTimeout(resolve, time)); }
pubSubService.subscribe('Menus.active', $scope, async function () {
while (!$scope.loaded) { await sleep(10); }
updateMenuActive();
});
$scope.loginMenus = dataService.loginMenus; // 登陆之后显示的菜单数据。uiSerf内部跳转链接。
$scope.notLoginMenus = dataService.notLoginMenus; // 未登陆显示的菜单数据
get('user', { full: true }).then(user => {
$timeout(() => {
$scope.user = user;
$scope.searchHistory = JSON.parse(user.searchHistory || '[]');
$scope.quickUrl = JSON.parse(user.quickUrl || '{}');
$scope.searchHistory.forEach((item, index) => {
$scope.searchIcon(item);
})
// if ($scope.user.username === 'lcq') {
// $scope.loginMenus[dataService.LoginIndexHot].show = false;
// }
(async () => {
$timeout(async () => {
try {
let user = await get('user', { full: true });
$scope.login = true;
$scope.user = user;
$scope.searchHistory = JSON.parse(user.searchHistory || '[]');
$scope.quickUrl = JSON.parse(user.quickUrl || '{}');
for (const item of $scope.searchHistory) {
$scope.searchIcon(item);
}
} catch (error) {
$scope.login = false;
}
pubSubService.publish('Common.user', $scope.user);
$scope.loaded = true;
})
});
})()
$scope.toggleReady = function (ready) {
if (ready) {
@ -84,7 +89,6 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
}, {
reload: true,
})
updateMenuActive($scope.selectLoginIndex = 0);
} else if (searchOption == 1) {
$window.open('https://www.google.com.hk/#newwindow=1&safe=strict&q=' + encodeURIComponent(keyword), '_blank');
} else if (searchOption == 2) {
@ -95,12 +99,7 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
$window.open('http://www.baidu.com/s?tn=mybookmark.cn&ch=3&ie=utf-8&wd=' + encodeURIComponent(keyword), '_blank');
} else if (searchOption == 5) {
console.log('search note, word = ', keyword);
$state.go('note', {
keyword: keyword,
}, {
reload: true,
})
updateMenuActive($scope.selectLoginIndex = dataService.LoginIndexNote);
$state.go('note', { keyword }, { reload: true })
}
if (!keyword) {
@ -186,29 +185,31 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
$window.open(url, '_blank');
}
$scope.showUpdate = function () {
$state.go('settings', {
formIndex: 5,
});
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexSettings
});
}
$scope.coffee = function () {
$state.go('settings', {
formIndex: 6,
});
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexSettings
});
}
function updateMenuActive(index) {
async function updateMenuActive() {
await sleep(10); // 阻塞 10ms 是因为 document.location.hash 还没切换过来等待切换
let mapIndex = {
"#/bookmarks": dataService.LoginIndexBookmarks,
"#/tags": dataService.LoginIndexTags,
"#/note": dataService.LoginIndexNote,
"#/weixin-article": $scope.login ? dataService.LoginIndexHot : dataService.NotLoginIndexHot,
"#/settings": dataService.LoginIndexSettings,
"#/advice": dataService.LoginIndexAdvice,
"#/": $scope.login ? dataService.LoginIndexBookmarks : dataService.NotLoginIndexHome,
"#/login": dataService.NotLoginIndexLogin,
}
console.log('updateMenuActive', $scope.login, document.location.hash, mapIndex[document.location.hash]);
$scope.selectLoginIndex = mapIndex[document.location.hash];
$scope.selectNotLoginIndex = mapIndex[document.location.hash];
$('.ui.menu a.item').removeClass('selected');
$('.ui.menu a.item:eq(' + index + ')').addClass('selected');
$('.ui.menu a.item:eq(' + mapIndex[document.location.hash] + ')').addClass('selected');
}
async function saveHistory() {
@ -249,7 +250,6 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
// 全局处理添加备忘录
if (key == 'A') {
if ($scope.selectLoginIndex !== dataService.LoginIndexNote) {
updateMenuActive($scope.selectLoginIndex = dataService.LoginIndexNote);
$state.go('note', { key: key }, { reload: true })
}
return;
@ -269,10 +269,6 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
}
if (key == ',' || key == '.' || key == '/') {
pubSubService.publish('Common.menuActive', {
login: $scope.login,
index: dataService.LoginIndexTags
});
var stateParams = {
tagId: -1,
orderIndex: (key == ',' ? 0 : (key == '.' ? 1 : 2)),
@ -283,11 +279,7 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
// 数字键用来切换菜单
if (!isNaN(key)) {
var num = parseInt(key);
if (num < 0 || num > 6) return;
pubSubService.publish('Common.menuActive', {
login: $scope.login,
index: num - 1
});
if (num < 0 || num > 6 || (!$scope.login)) return;
$state.go(dataService.loginMenus[num - 1].uiSref, {}, {
reload: true,
})

View File

@ -4,6 +4,7 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
var dialog = null;
$scope.hoverNote = null;
@ -25,11 +26,6 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
var timeagoInstance = timeago();
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexNote
});
getTags();
$scope.changeCurrentPage = function (currentPage) {

View File

@ -4,6 +4,7 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
$scope.hoverBookmark = null;
$scope.bookmarks = []; // 书签数据
@ -36,15 +37,11 @@ app.controller('searchCtr', ['$scope', '$state', '$stateParams', '$filter', '$wi
$scope.search();
}
}
pubSubService.subscribe('Common.user', $scope, function (event, user) {
$scope.user = user;
});
get('tags').then((tags) => $scope.tags = tags)
get('user').then((user) => $scope.user = user)
// 默认登陆
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexBookmarks
});
$scope.jumpToUrl = async function (url, id) {
if (!$scope.edit) {

View File

@ -4,6 +4,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
$scope.forbidQuickKey = dataService.forbidQuickKey
$scope.form = [false, false, false, false, false, false, false];
@ -50,10 +51,6 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
await post('userLogout');
localStorage.setItem("authorization", "");
pubSubService.publish('Common.menuActive', {
login: false,
index: dataService.NotLoginIndexLogin
});
$state.go('login', {})
} else {
toastr.error('新密码两次输入不一致', "错误");
@ -135,10 +132,6 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
console.log(files, response);
if (response.code == 0) {
setTimeout(function () {
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexBookmarks
});
$state.go('tags', {})
}, 3000);
toastr.success(response.msg, "提示");
@ -150,11 +143,6 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
$(".ui.pointing.menu .item").removeClass("selected");
}, 500);
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexSettings
});
async function saveQuickUrl() {
await post("userUpdate", { quickUrl: JSON.stringify($scope.quickUrl) });
toastr.success('全局快捷键更新成功', "提示");

View File

@ -4,6 +4,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
(async () => {
await getTags();
@ -30,11 +31,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
$scope.waitDelBookmark = {};
$scope.bookmarkNormalHover = false;
pubSubService.subscribe('MenuCtr.tags', $scope, function (event, data) {
console.log('subscribe MenuCtr.tags', data);
getTags();
});
$scope.getBookmarks = async function (tagId, page, showType) {
console.log(tagId, page, showType);
@ -86,11 +82,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
}, 10);
}
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexTags
});
$timeout(function () {
dataService.transition('#' + addBookmarkId, {
duration: 1000,
@ -365,7 +356,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
id: -1,
bookmarkCount: '...',
bookmarkClicked: false,
name: '个人定制',
name: '全部',
show: 1
})
@ -384,11 +375,6 @@ app.controller('tagsCtr', ['$scope', '$filter', '$state', '$window', '$statePara
tags[0].bookmarkClicked = true;
}
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexTags
});
$timeout(() => {
$scope.loading = false;
$scope.tags = tags;

View File

@ -4,6 +4,7 @@ app.controller('weixinArticleCtr', ['$scope', '$state', '$sce', '$filter', '$win
$window.location = "http://m.mybookmark.cn/#/tags";
return;
}
pubSubService.publish('Menus.active');
$scope.hoverBookmark = null;
$scope.bookmarks = []; // 书签数据
@ -24,13 +25,6 @@ app.controller('weixinArticleCtr', ['$scope', '$state', '$sce', '$filter', '$win
$scope.channels = JSON.parse(`[{"id":1,"name":"热门", "clicked": true},{"id":2,"name":"搞笑"},{"id":3,"name":"养生堂"},{"id":4,"name":"私房话"},{"id":5,"name":"八卦精"},{"id":6,"name":"科技咖"},{"id":7,"name":"财经迷"},{"id":8,"name":"汽车控"},{"id":9,"name":"生活家"},{"id":10,"name":"时尚圈"},{"id":11,"name":"育儿"},{"id":12,"name":"旅游"},{"id":13,"name":"职场"},{"id":14,"name":"美食"},{"id":15,"name":"历史"},{"id":16,"name":"教育"},{"id":17,"name":"星座"},{"id":18,"name":"体育"},{"id":19,"name":"军事"},{"id":20,"name":"游戏"},{"id":21,"name":"萌宠"}]`);
var timeagoInstance = timeago();
get('user').then((user) => {
pubSubService.publish('Common.menuActive', {
login: true,
index: dataService.LoginIndexHot
});
})
$scope.jumpToUrl = async function (url) {
$window.open(url, '_blank');
}
@ -116,12 +110,6 @@ app.controller('weixinArticleCtr', ['$scope', '$state', '$sce', '$filter', '$win
$scope.getWeixinArticles = async function (channelId, page) {
var menusScope = $('div[ng-controller="menuCtr"]').scope();
var login = (menusScope && menusScope.login) || false;
var index = login ? dataService.LoginIndexHot : dataService.NotLoginIndexHot;
pubSubService.publish('Common.menuActive', {
login: login,
index: index
});
$scope.bookmarks = []
$scope.bookmark = {}
$scope.loadBusy = true;

View File

@ -150,34 +150,9 @@ app.directive('jsMenuInit', function ($compile) {
link: function ($scope, $element, $attrs) {
if ($scope.$last === true) {
console.log('jsMenuInit......')
$('.js-bookmark-dropdown').dropdown({
action: 'hide',
on: 'hover',
});
$('.js-bookmark-dropdown .ui.checkbox').checkbox();
$('.ui.checkbox.js-radio-navigate').checkbox('check');
$('.ui.menu a.item').on('click', function () {
$(this).addClass('selected').siblings().removeClass('selected');
});
$(".ui.menu a.item:first").hover(
function () {
$('.js-bookmark-dropdown').dropdown('show');
},
function () {
setTimeout(() => {
if ($('.js-menu-option:hover').length === 0) {
$('.js-bookmark-dropdown').dropdown('hide');
}
}, 100)
}
);
$('.ui.menu a.item').on('click', function () {
$(this).addClass('selected').siblings().removeClass('selected');
});
$('.search-item').popup({
on: 'focus',
inline: true

View File

@ -7,13 +7,11 @@ app.factory('dataService', [function () {
LoginIndexHot: 3,
LoginIndexSettings: 4,
LoginIndexAdvice: 5,
LoginIndexPraise: 6,
// 非登陆索引
NotLoginIndexHome: 0,
NotLoginIndexLogin: 1,
NotLoginIndexHot: 2,
NotLoginIndexPraise: 3,
loginMenus: [{
uiSref: 'bookmarks',

View File

@ -11,7 +11,7 @@
</div>
</div>
<div class="ui divider"></div>
<div class="ui comments" style="max-width:100%;">
<div class="ui comments" style="max-width: 100%;">
<h3 class="ui header">最新100条留言</h3>
<div class="comment" ng-repeat="advice in advices">
<a class="avatar">
@ -27,4 +27,7 @@
</div>
</div>
</div>
<div class="ui huge text centered inline loader" style="margin-top: 10px;" ng-class="{active:loading, disabled: !loading}">
正在加载中...
</div>
</div>

View File

@ -1,56 +1,53 @@
<div class="js-menu" ng-controller="menuCtr">
<div class="ui huge menu js-login-in" ng-if="login">
<a class="item js-single-menu" ng-class="{selected:$index===selectLoginIndex}" style="cursor:default;" ui-sref-opts="{reload: true}" ng-repeat="menu in loginMenus" ui-sref="{{ menu.uiSref }}({searchWord:null})" ng-show="menu.show !== false" js-menu-init>
<a class="item js-single-menu" ng-class="{selected:$index===selectLoginIndex}" style="cursor: default;" ui-sref-opts="{reload: true}" ng-repeat="menu in loginMenus" ui-sref="{{ menu.uiSref }}({searchWord:null})" ng-show="menu.show !== false" js-menu-init>
<div>{{ menu.title }}</div>
</a>
<div id="js-search" style="width: 1500px;">
<div class="ui transparent fluid icon input" style="height: 100%;margin-left: 10px;">
<div class="ui transparent fluid icon input" style="height: 100%; margin-left: 10px;">
<input id="sInput" style="padding-left: 0px;" class="prompt search-item js-search-input" type="text" ng-model="searchWord" placeholder="search..." ng-keypress="($event.which === 13)?search(searchWord, 0):0" ng-focus="toggleReady(true)" ng-blur="toggleReady(false)" data-position="bottom left" data-variation="large" />
<div class="ui fluid popup top left transition hidden js-popup-search js-history-popup" ng-if="searchHistory.length > 0" style="margin-left: 2px; margin-top: -1px;">
<div class="ui internally grid">
<div class="row js-history-word" style="height: 20px;" ng-repeat="item in searchHistory">
<div class="sixteen wide column js-search-again" style="margin: -10px 0px 0px -8px;cursor:default;" ng-click="searchByHistory(item.t, item.d)">
<i class="{{ item.icon }}" style="cursor:default;"></i>
<span style="color: #7B77C5">{{ item.d}}</span>
<div class="sixteen wide column js-search-again" style="margin: -10px 0px 0px -8px; cursor: default;" ng-click="searchByHistory(item.t, item.d)">
<i class="{{ item.icon }}" style="cursor: default;"></i>
<span style="color: #7b77c5;">{{ item.d}}</span>
</div>
</div>
<div class="row" style="height: 20px;background: #f2f2f2" ng-click="delHistory()">
<div class="center aligned sixteen wide column" style="margin: -10px 0px 0px 0px;padding:0px;">
<div style="cursor:pointer;float: right;">清空全部</div>
<div class="row" style="height: 20px; background: #f2f2f2;" ng-click="delHistory()">
<div class="center aligned sixteen wide column" style="margin: -10px 0px 0px 0px; padding: 0px;">
<div style="cursor: pointer; float: right;">清空全部</div>
</div>
</div>
</div>
</div>
<div style="margin-top: 13px;">
<span style="display: none" class="searchIcon">
<span style="margin-left: -25px;"><i class="book link icon" title="书签搜索(输入关键字按回车键默认搜索引擎)" ng-click="search(searchWord, 0)" style="cursor:default;margin-right: 8px;"></i></span>
<span><i class="file alternate link icon" title="备忘录搜索" ng-click="search(searchWord, 5)" style="cursor:default;margin-right: 8px;"></i></span>
<span><i class="google link icon" title="谷歌搜索" ng-click="search(searchWord, 1)" style="cursor:default;margin-right: 8px;"></i></span>
<span><i class="bimobject link icon" title="百度搜索" ng-click="search(searchWord, 4)" style="cursor:default;margin-right: 8px;"></i></span>
<span><i class="github link icon" title="Github 搜索" ng-click="search(searchWord, 2)" style="cursor:default;margin-right: 8px;"></i></span>
<span><i class="stack overflow link icon" title="栈溢出搜索" ng-click="search(searchWord, 3)" style="cursor:default;margin-right: 8px;"></i></span>
<span style="margin: 0px 5px"></span>
<span style="display: none;" class="searchIcon">
<span style="margin-left: -25px;"><i class="book link icon" title="书签搜索(输入关键字按回车键默认搜索引擎)" ng-click="search(searchWord, 0)" style="cursor: default; margin-right: 8px;"></i></span>
<span><i class="file alternate link icon" title="备忘录搜索" ng-click="search(searchWord, 5)" style="cursor: default; margin-right: 8px;"></i></span>
<span><i class="google link icon" title="谷歌搜索" ng-click="search(searchWord, 1)" style="cursor: default; margin-right: 8px;"></i></span>
<span><i class="bimobject link icon" title="百度搜索" ng-click="search(searchWord, 4)" style="cursor: default; margin-right: 8px;"></i></span>
<span><i class="github link icon" title="Github 搜索" ng-click="search(searchWord, 2)" style="cursor: default; margin-right: 8px;"></i></span>
<span><i class="stack overflow link icon" title="栈溢出搜索" ng-click="search(searchWord, 3)" style="cursor: default; margin-right: 8px;"></i></span>
<span style="margin: 0px 5px;"></span>
</span>
<span data-tooltip="添加书签可按Insert快速打开添加页面" ng-click="showAddBookmarkMoadl()">
<i class="add square link icon" style="cursor:default;margin-right: 8px;margin-left: 1px;"></i>
<i class="add square link icon" style="cursor: default; margin-right: 8px; margin-left: 1px;"></i>
</span>
<span data-tooltip="如果你觉得我的系统对你有帮助,请点击跳转到 Github 为我 Star" ng-click="star()" ng-show="user.username !== 'lcq'">
<i class="star link icon" style="cursor:default;margin-right: 8px;"></i>
</span>
<span class="suggest" ng-click="showUpdate()" ng-show="user.username !== 'lcq'">
<i class="info circle link icon" style="cursor:default;margin-right: 8px;"></i>
<i class="star link icon" style="cursor: default; margin-right: 8px;"></i>
</span>
<span data-tooltip="请我喝杯咖啡" ng-click="coffee()" ng-show="user.username !== 'lcq'">
<i class="coffee link icon" style="cursor:default;margin-right: 8px;"></i>
<i class="coffee link icon" style="cursor: default; margin-right: 8px;"></i>
</span>
<span data-tooltip="退出登陆" ng-click="logout()">
<i class="sign out link icon" style="cursor:default;margin-right: 8px;"></i>
<i class="sign out link icon" style="cursor: default; margin-right: 8px;"></i>
</span>
</div>
</div>
</div>
</div>
<div class="ui huge menu js-not-login-in" ng-if="!login">
<a class="item" ng-class="{selected:$index==selectNotLoginIndex}" ui-sref="{{ menu.uiSref}}" ui-sref-opts="{reload: true}" ng-repeat="menu in notLoginMenus">{{ menu.title}}</a>
<a class="item" ng-class="{selected:$index==selectNotLoginIndex}" ui-sref="{{ menu.uiSref}}" ui-sref-opts="{reload: true}" ng-repeat="menu in notLoginMenus" js-menu-init>{{ menu.title}}</a>
</div>
</div>

View File

@ -1,50 +1,50 @@
<div class="ui segment js-tags" ng-show="!loading || tags.length > 0">
<div class="ui container" ng-show="!editMode" style="cursor:default">
<div class="ui label" style="margin:3px 15px 8px 0px;cursor:default;" ng-if="tag.bookmarkCount && tag.show" ng-repeat="tag in tags" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, (tag.id == -1 ? 0 : 1), null)">
<div class="ui container" ng-show="!editMode" style="cursor: default;">
<div class="ui label" style="margin: 3px 15px 8px 0px; cursor: default;" ng-if="tag.bookmarkCount && tag.show" ng-repeat="tag in tags" ng-class="{green:tag.bookmarkClicked}" ng-click="getBookmarks(tag.id, (tag.id == -1 ? 0 : 1), null)">
{{ tag.name }} ({{ tag.bookmarkCount || 0 }})
</div>
<div class="ui label js-tag-label" style="margin:3px 15px 8px 0px;cursor:default;">
<div class="ui label js-tag-label" style="margin: 3px 15px 8px 0px; cursor: default;">
<i class="plus icon" data-content="点击添加分类" data-position="top center" ng-click="showAddTag()"></i>
<i class="pencil alternate icon" data-content="点击进入分类编辑模式" data-position="top center" ng-click="toggleMode(true)"></i>
<i class="table icon" style="margin-right:0px;" data-content="点击以条目显示" data-position="top center" ng-show="showMode=='table'" ng-click="toggleShowMode('item')"></i>
<i class="list icon" style="margin-right:0px;" data-content="点击以表格显示" data-position="top center" ng-show="showMode=='item'" ng-click="toggleShowMode('table')"></i>
<i class="table icon" style="margin-right: 0px;" data-content="点击以条目显示" data-position="top center" ng-show="showMode=='table'" ng-click="toggleShowMode('item')"></i>
<i class="list icon" style="margin-right: 0px;" data-content="点击以表格显示" data-position="top center" ng-show="showMode=='item'" ng-click="toggleShowMode('table')"></i>
</div>
</div>
<div class="ui container" ng-show="editMode" ng-mousedown="storeTagIndex()" ng-mouseup="updateTagIndex()">
<p>提示:拖拽分类即可进行排序。如果添加新的分类,返回之后不会显示添加的分类,因为默认只显示有书签的分类。</p>
<div class="ui six stackable cards" sv-root sv-part="tags">
<div class="card" style="background-color:#F5F5F5;" ng-click="showAddTag()" data-tooltip="添加书签">
<div class="card" style="background-color: #f5f5f5;" ng-click="showAddTag()" data-tooltip="添加书签">
<div class="image">
<img src="./images/add-tag.png" />
</div>
</div>
<div class="card" style="background-color:#F5F5F5;" ng-click="toggleMode(false)" data-tooltip="退出编辑模式">
<div class="card" style="background-color: #f5f5f5;" ng-click="toggleMode(false)" data-tooltip="退出编辑模式">
<div class="image">
<img src="./images/back-tag.png" />
</div>
</div>
<div class="card" ng-repeat="tag in tags" id="tag{{tag.id}}" sv-element>
<div class="card" ng-repeat="tag in tags" id="tag{{tag.id}}" ng-if="tag.id > -1" sv-element>
<div class="content">
<div class="header" ng-if="!tag.edit">{{ tag.name }}</div>
<div class="ui large fluid transparent input" style="height:19px;" ng-if="tag.edit">
<input type="text" ng-model="tag.name" style="font-size:18px;" id="tagedit{{tag.id}}" />
<i class="checkmark icon" style="cursor:pointer;" ng-click="updateTag(tag)" title="更新分类"></i>
<i class="mail forward icon" style="cursor:pointer;" ng-click="backTag(tag)" title="放弃更新"></i>
<div class="ui large fluid transparent input" style="height: 19px;" ng-if="tag.edit">
<input type="text" ng-model="tag.name" style="font-size: 18px;" id="tagedit{{tag.id}}" />
<i class="checkmark icon" style="cursor: pointer;" ng-click="updateTag(tag)" title="更新分类"></i>
<i class="mail forward icon" style="cursor: pointer;" ng-click="backTag(tag)" title="放弃更新"></i>
</div>
</div>
<div class="content" style="cursor: move" sv-handle>
<div class="content" style="cursor: move;" sv-handle>
<div class="description">
<p>书签:{{ tag.bookmarkCount || 0 }}个</p>
<p>{{ tag.lastUse }}</p>
</div>
</div>
<div class="extra content">
<img class="ui mini spaced image right floated" style="width:16px;height:16px;margin:0 5px" ng-src="./images/delete.png" ng-click="delTag(tag)" title="删除分类" />
<img class="ui mini spaced image right floated" style="width: 16px; height: 16px; margin: 0 5px;" ng-src="./images/delete.png" ng-click="delTag(tag)" title="删除分类" />
<label for="tagedit{{tag.id}}" ng-show="!tag.edit">
<img class="ui mini spaced image right floated" style="width:16px;height:16px;margin:0 5px" ng-src="./images/edit-bookmark.png" ng-click="editTag(tag)" title="编辑分类" />
<img class="ui mini spaced image right floated" style="width: 16px; height: 16px; margin: 0 5px;" ng-src="./images/edit-bookmark.png" ng-click="editTag(tag)" title="编辑分类" />
</label>
<i class="eye black icon right floated" style="cursor:pointer;" ng-if="tag.show" ng-click="updateTagShow(tag, 0)" title="点击隐藏分类"></i>
<i class="eye black slash icon right floated" style="cursor:pointer;" ng-if="!tag.show" ng-click="updateTagShow(tag, 1)" title="点击显示分类"></i>
<i class="eye black icon right floated" style="cursor: pointer;" ng-if="tag.show" ng-click="updateTagShow(tag, 0)" title="点击隐藏分类"></i>
<i class="eye black slash icon right floated" style="cursor: pointer;" ng-if="!tag.show" ng-click="updateTagShow(tag, 1)" title="点击显示分类"></i>
</div>
</div>
</div>
@ -53,28 +53,28 @@
<div class="ui huge text centered inline loader" style="margin-top: 10px;" ng-class="{active:loading, disabled: !loading}">
正在加载中...
</div>
<table class="ui selectable sortable celled table js-tags-table" ng-if="showMode=='table'" style="margin-top:-15px;" ng-show="!loading && !editMode">
<table class="ui selectable sortable celled table js-tags-table" ng-if="showMode=='table'" style="margin-top: -15px;" ng-show="!loading && !editMode">
<thead>
<tr>
<th class="forbid_sorted">标题</th>
<th class="forbid_sorted">链接</th>
<th style="width:90px;" ng-class="{descending: showType == 'clickCount', sorted:showType == 'clickCount'}" ng-click="getBookmarks(null, 1, 'clickCount')" title="点击可对表格进行排序">点击次数</th>
<th style="width:100px;" ng-class="{descending: showType == 'createdAt', sorted:showType == 'createdAt'}" ng-click="getBookmarks(null, 1, 'createdAt')" title="点击可对表格进行排序">添加日期</th>
<th style="width:100px;" ng-class="{descending: showType == 'lastClick', sorted:showType == 'lastClick'}" ng-click="getBookmarks(null, 1, 'lastClick')" title="点击可对表格进行排序">最后点击</th>
<th style="width:150px;" class="forbid_sorted">分类</th>
<th style="width:88px;" class="forbid_sorted">操作</th>
<th style="width: 90px;" ng-class="{descending: showType == 'clickCount', sorted:showType == 'clickCount'}" ng-click="getBookmarks(null, 1, 'clickCount')" title="点击可对表格进行排序">点击次数</th>
<th style="width: 100px;" ng-class="{descending: showType == 'createdAt', sorted:showType == 'createdAt'}" ng-click="getBookmarks(null, 1, 'createdAt')" title="点击可对表格进行排序">添加日期</th>
<th style="width: 100px;" ng-class="{descending: showType == 'lastClick', sorted:showType == 'lastClick'}" ng-click="getBookmarks(null, 1, 'lastClick')" title="点击可对表格进行排序">最后点击</th>
<th style="width: 150px;" class="forbid_sorted">分类</th>
<th style="width: 88px;" class="forbid_sorted">操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="bookmark in bookmarks" id="{{ bookmark.id }}" ng-mouseover="setHoverBookmark(bookmark)" ng-mouseleave="setHoverBookmark(null)">
<td>
<img class="ui ui middle aligned tiny image" ng-src="http://favicon.luchenqun.com/?url={{bookmark.url}}" err-src="./images/default.ico" style="width:16px;height:16px;cursor:pointer;" ng-click="jumpToUrl(bookmark.url, bookmark.id)" />
<span ng-click="jumpToUrl(bookmark.url, bookmark.id)" title="{{bookmark.title}}" style="cursor:pointer;">
<img class="ui ui middle aligned tiny image" ng-src="http://favicon.luchenqun.com/?url={{bookmark.url}}" err-src="./images/default.ico" style="width: 16px; height: 16px; cursor: pointer;" ng-click="jumpToUrl(bookmark.url, bookmark.id)" />
<span ng-click="jumpToUrl(bookmark.url, bookmark.id)" title="{{bookmark.title}}" style="cursor: pointer;">
{{ bookmark.title }}
</span>
</td>
<td>
<span title="{{bookmark.url}} 点击复制链接" ng-click="copy(bookmark.url)" style="cursor:default;">{{ bookmark.url }}</span>
<span title="{{bookmark.url}} 点击复制链接" ng-click="copy(bookmark.url)" style="cursor: default;">{{ bookmark.url }}</span>
</td>
<td>{{ bookmark.clickCount }}</td>
<td>
@ -89,9 +89,9 @@
</div>
</td>
<td>
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/delete.png" ng-click="delBookmark(bookmark)" title="删除书签" />
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/edit-bookmark.png" ng-click="editBookmark(bookmark.id)" title="编辑书签" />
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/detail.png" ng-click="detailBookmark(bookmark)" title="书签详情" />
<img class="ui mini spaced image" style="width: 16px; height: 16px; margin: 0 1px;" ng-src="./images/delete.png" ng-click="delBookmark(bookmark)" title="删除书签" />
<img class="ui mini spaced image" style="width: 16px; height: 16px; margin: 0 1px;" ng-src="./images/edit-bookmark.png" ng-click="editBookmark(bookmark.id)" title="编辑书签" />
<img class="ui mini spaced image" style="width: 16px; height: 16px; margin: 0 1px;" ng-src="./images/detail.png" ng-click="detailBookmark(bookmark)" title="书签详情" />
</td>
</tr>
</tbody>
@ -103,33 +103,32 @@
</tr>
</tfoot>
</table>
<div class="ui segment js-tag-costomTag" ng-if="showMode=='item'" style="margin-top:-15px;" ng-show="!loading && !editMode">
<div class="ui segment js-tag-costomTag" ng-if="showMode=='item'" style="margin-top: -15px;" ng-show="!loading && !editMode">
<div class="ui five column grid">
<div ng-repeat="bookmark in bookmarks" class="column js-costomTag-item" ng-class="{bookmarkNormalHover:bookmarkNormalHover, bookmark:(!bookmarkNormalHover)}" ng-mouseover="bookmarkNormalHover=true; setHoverBookmark(bookmark)" ng-mouseleave="bookmarkNormalHover=false; setHoverBookmark(null)" ng-click="jumpToUrl(bookmark.url, bookmark.id)" title="{{ bookmark.title }}" id="{{bookmark.id}}">
<img class="ui ui middle aligned tiny image bookmarkInfo" ng-src="http://favicon.luchenqun.com/?url={{bookmark.url}}" err-src="./images/default.ico" style="width:16px;height:16px;" ng-click="detailBookmark(bookmark);$event.stopPropagation()" />
<img class="ui ui middle aligned tiny image bookmarkInfo" ng-src="http://favicon.luchenqun.com/?url={{bookmark.url}}" err-src="./images/default.ico" style="width: 16px; height: 16px;" ng-click="detailBookmark(bookmark);$event.stopPropagation()" />
<span>{{ bookmark.title}}</span>
</div>
</div>
<div class="ui divider"></div>
<div class="ui grid">
<div class="five wide column" style="margin-top:10px;" ng-show="currentPage>0">
<div class="five wide column" style="margin-top: 10px;" ng-show="currentPage>0">
<div class="ui three column grid" style="cursor: default;">
<div class="column" ng-click="getBookmarks(null, 1, 'createdAt')">
<i class="add to calendar large icon" ng-class="{green: showType == 'createdAt'}" style="margin-bottom:4px;"></i>
<span ng-class="{fontgreen: showType == 'createdAt'}" style="margin-left:-5px;">添加日期</span>
<i class="add to calendar large icon" ng-class="{green: showType == 'createdAt'}" style="margin-bottom: 4px;"></i>
<span ng-class="{fontgreen: showType == 'createdAt'}" style="margin-left: -5px;">添加日期</span>
</div>
<div class="column" ng-click="getBookmarks(null, 1, 'clickCount')">
<i class="sort numeric descending large icon" ng-class="{green: showType == 'clickCount'}" style="margin-bottom:4px;"></i>
<span ng-class="{fontgreen: showType == 'clickCount'}" style="margin-left:-5px;">点击次数</span>
<i class="sort numeric descending large icon" ng-class="{green: showType == 'clickCount'}" style="margin-bottom: 4px;"></i>
<span ng-class="{fontgreen: showType == 'clickCount'}" style="margin-left: -5px;">点击次数</span>
</div>
<div class="column" ng-click="getBookmarks(null, 1, 'lastClick')">
<i class="sort alphabet descending large icon" ng-class="{green: showType == 'lastClick'}" style="margin-bottom:4px;"></i>
<span ng-class="{fontgreen: showType == 'lastClick'}" style="margin-left:-5px;">最后点击</span>
<i class="sort alphabet descending large icon" ng-class="{green: showType == 'lastClick'}" style="margin-bottom: 4px;"></i>
<span ng-class="{fontgreen: showType == 'lastClick'}" style="margin-left: -5px;">最后点击</span>
</div>
</div>
</div>
<div class="five wide column" style="margin-top:10px;" ng-show="currentPage==0">
</div>
<div class="five wide column" style="margin-top: 10px;" ng-show="currentPage==0"></div>
<div class="eleven wide column">
<pagination></pagination>
</div>