Update search
This commit is contained in:
parent
4e55f7f6e7
commit
94be84c33d
|
|
@ -107,4 +107,4 @@ console.log([
|
||||||
" 不见满街漂亮妹,哪个归得程序员?",
|
" 不见满街漂亮妹,哪个归得程序员?",
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
console.log = function(){}
|
// console.log = function(){}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
$scope.quickUrl = {};
|
$scope.quickUrl = {};
|
||||||
$scope.longPress = false;
|
$scope.longPress = false;
|
||||||
$scope.user = {};
|
$scope.user = {};
|
||||||
|
$scope.searching = true;
|
||||||
|
|
||||||
// 防止在登陆的情况下,在浏览器里面直接输入url,这时候要更新菜单选项
|
// 防止在登陆的情况下,在浏览器里面直接输入url,这时候要更新菜单选项
|
||||||
pubSubService.subscribe('Common.menuActive', $scope, function (event, params) {
|
pubSubService.subscribe('Common.menuActive', $scope, function (event, params) {
|
||||||
|
|
@ -42,11 +43,11 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
* @func
|
* @func
|
||||||
* @desc 点击搜索按钮搜索书签
|
* @desc 点击搜索按钮搜索书签
|
||||||
*/
|
*/
|
||||||
$scope.search = function (searchWord) {
|
$scope.search = function (searchWord, searchOption) {
|
||||||
console.log('search......', searchWord);
|
console.log('search......', searchWord);
|
||||||
|
|
||||||
$scope.login = true;
|
$scope.login = true;
|
||||||
var searchOption = $('.js-search-option').dropdown('get value') || 0;
|
// var searchOption = $('.js-search-option').dropdown('get value') || 0;
|
||||||
if (searchOption == 0) {
|
if (searchOption == 0) {
|
||||||
$state.go('search', {
|
$state.go('search', {
|
||||||
searchWord: searchWord,
|
searchWord: searchWord,
|
||||||
|
|
@ -97,6 +98,16 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.readySearch = function () {
|
||||||
|
$scope.searching = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.exitSearch = function () {
|
||||||
|
$scope.searching = false;
|
||||||
|
$scope.searchWord = "";
|
||||||
|
$(".search-item").val("");
|
||||||
|
}
|
||||||
|
|
||||||
$scope.searchByHistory = function (type, data) {
|
$scope.searchByHistory = function (type, data) {
|
||||||
$scope.searchWord = data;
|
$scope.searchWord = data;
|
||||||
$('.search-item').val($scope.searchWord);
|
$('.search-item').val($scope.searchWord);
|
||||||
|
|
@ -260,6 +271,21 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
updateMenuActive($scope.selectLoginIndex = dataService.LoginIndexNote);
|
updateMenuActive($scope.selectLoginIndex = dataService.LoginIndexNote);
|
||||||
$state.go('note', { key: key }, { reload: true })
|
$state.go('note', { key: key }, { reload: true })
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == 'S') {
|
||||||
|
$scope.searching = true;
|
||||||
|
$(".search-item").focus();
|
||||||
|
var count = 1;
|
||||||
|
var sId = setInterval(function() {
|
||||||
|
$(".search-item").val("");
|
||||||
|
count++;
|
||||||
|
if(count>=5) {
|
||||||
|
clearInterval(sId);
|
||||||
|
}
|
||||||
|
}, 3)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == ',' || key == '.' || key == '/') {
|
if (key == ',' || key == '.' || key == '/') {
|
||||||
|
|
@ -321,5 +347,4 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ app.factory('dataService', [function() {
|
||||||
'D': '在有关书签页面,用作删除书签',
|
'D': '在有关书签页面,用作删除书签',
|
||||||
'I': '在有关书签页面,用作查看书签详情',
|
'I': '在有关书签页面,用作查看书签详情',
|
||||||
'R': '在热门收藏界面,已用作随机查看热门收藏',
|
'R': '在热门收藏界面,已用作随机查看热门收藏',
|
||||||
|
'S': '在任意界面,已用做快速进入搜索页面',
|
||||||
'INSERT': '全局页面,已用做添加书签',
|
'INSERT': '全局页面,已用做添加书签',
|
||||||
'ESC': '全局页面,已用做退出弹窗',
|
'ESC': '全局页面,已用做退出弹窗',
|
||||||
',': '跳转到分类定制点击次数',
|
',': '跳转到分类定制点击次数',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="js-menu" ng-controller="menuCtr">
|
<div class="js-menu" ng-controller="menuCtr">
|
||||||
<div class="ui huge menu js-login-in" ng-if="login">
|
<div class="ui huge menu js-login-in" ng-if="login">
|
||||||
<a class="item" 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>
|
<div>{{ menu.title }}</div>
|
||||||
<div class="ui floating simple dropdown icon js-bookmark-dropdown" ng-if="$index==0" ng-click="$event.stopPropagation();">
|
<div class="ui floating simple dropdown icon js-bookmark-dropdown" ng-if="$index==0" ng-click="$event.stopPropagation();">
|
||||||
<i class="dropdown icon"></i>
|
<i class="dropdown icon"></i>
|
||||||
|
|
@ -29,34 +29,43 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="right menu">
|
<div id="js-search" style="width: 1500px;">
|
||||||
<div class="item">
|
<div class="ui transparent fluid icon input" style="height: 100%;margin-left: 10px;">
|
||||||
<div class="ui transparent icon input">
|
<label for="lcq">
|
||||||
<label for="lcq">
|
<div class="ui inline dropdown js-search-option" style="margin-top:3px;height: 100%;" js-search-option-init>
|
||||||
<div class="ui inline dropdown js-search-option" style="margin-top:3px;" js-search-option-init>
|
<!-- <div class="text " style="color:#C9C9C9;font-weight:normal;">书签</div> -->
|
||||||
<div class="text " style="color:#C9C9C9;font-weight:normal;">书签</div>
|
<!-- <i class="angle down icon"></i> -->
|
||||||
<i class="angle down icon"></i>
|
<div class="menu">
|
||||||
<div class="menu">
|
<div class="item" data-value="{{$index}}" ng-class="{active:$index==0}" ng-repeat="historyType in historyTypes">{{historyType}}</div>
|
||||||
<div class="item" data-value="{{$index}}" ng-class="{active:$index==0}" ng-repeat="historyType in historyTypes">{{historyType}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</div>
|
||||||
<input class="prompt search-item" type="text" ng-model="searchWord" placeholder="" ng-keypress="($event.which === 13)?search(searchWord):0" data-position="bottom left" data-variation="large" id="lcq">
|
</label>
|
||||||
<div class="ui fluid popup top left transition hidden" style="padding-left: 0px; padding-right: 0px;">
|
<input style="padding-left: 0px;" class="prompt search-item js-search-input" type="text" ng-focus="readySearch()" ng-model="searchWord" placeholder="search..." ng-keypress="($event.which === 13)?search(searchWord, 0):0" data-position="bottom left" data-variation="large" id="lcq">
|
||||||
<div class="ui selection list">
|
<div class="ui fluid popup top left transition hidden" style="padding-left: 0px; padding-right: -10px;">
|
||||||
<div class="item" ng-repeat="item in searchHistory" ng-click="searchByHistory(item.t, item.d)" style="height:30px;">
|
<div class="ui selection list">
|
||||||
<div class="right floated content">
|
<div class="item" ng-repeat="item in searchHistory" ng-click="searchByHistory(item.t, item.d)" style="height:30px;">
|
||||||
<span style="margin-right:10px;">{{ historyTypes[item.t] }}</span>
|
<div class="right floated content">
|
||||||
</div>
|
<span style="margin-right:10px;">{{ historyTypes[item.t] }}</span>
|
||||||
<div class="content">
|
</div>
|
||||||
<span style="margin-left:10px;">{{ item.d}}</span>
|
<div class="content">
|
||||||
</div>
|
<span style="margin-left:10px;">{{ item.d}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<i class="search link icon" ng-click="search(searchWord)" style="cursor:default;"></i>
|
</div>
|
||||||
|
<div ng-if="searching">
|
||||||
|
<span style="margin-left: -25px;"><i class="bookmark outline link icon" title="书签搜索" ng-click="search(searchWord, 0)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||||
|
<span><i class="google link icon" title="谷歌搜索" ng-click="search(searchWord, 1)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||||
|
<span><i class="bimobject link icon" title="百度搜索" ng-click="search(searchWord, 4)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||||
|
<span><i class="github link icon" title="Github 搜索" ng-click="search(searchWord, 2)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||||
|
<span><i class="stack overflow link icon" title="栈溢出搜索" ng-click="search(searchWord, 3)" style="cursor:default;margin-top:16px;margin-right: 8px;"></i></span>
|
||||||
|
<span>|</span>
|
||||||
|
<span><i class="add square link icon" title="添加书签" ng-click="showAddBookmarkMoadl()" style="cursor:default;margin-top:16px;margin-right: 8px;margin-left: 8px;"></i></span>
|
||||||
|
<span><i class="arrow right link icon" title="退出搜索" ng-click="exitSearch()" style="cursor:default;margin-top:16px;"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="right menu" ng-if="!searching">
|
||||||
<div class="item" style="padding:0 8px 0 13px;" title="添加书签" ng-click="showAddBookmarkMoadl()">
|
<div class="item" style="padding:0 8px 0 13px;" title="添加书签" ng-click="showAddBookmarkMoadl()">
|
||||||
<span data-tooltip="添加书签,可按Insert快速打开添加页面">
|
<span data-tooltip="添加书签,可按Insert快速打开添加页面">
|
||||||
<i class="add square icon"></i>
|
<i class="add square icon"></i>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue