增加数字键切换菜单
This commit is contained in:
parent
31b9d41126
commit
a930cb11b1
|
|
@ -31,6 +31,7 @@
|
||||||
- [x] 在热门标签里面,有在网上找的热门书签。可以转存收藏到自己书签里面,快捷键R随机查看热门书签。
|
- [x] 在热门标签里面,有在网上找的热门书签。可以转存收藏到自己书签里面,快捷键R随机查看热门书签。
|
||||||
- [x] 新增备忘录功能,有时候随手要做点纪录,就方便了。任意界面按快捷键A增加备忘录。双击备忘录可查看详情!
|
- [x] 新增备忘录功能,有时候随手要做点纪录,就方便了。任意界面按快捷键A增加备忘录。双击备忘录可查看详情!
|
||||||
- [x] 在设置的全局链接,可设置快捷键,用来在任何页面,快速打开设置的链接。
|
- [x] 在设置的全局链接,可设置快捷键,用来在任何页面,快速打开设置的链接。
|
||||||
|
- [ ] 适配手机平板。
|
||||||
|
|
||||||
4 主要用到的模块说明
|
4 主要用到的模块说明
|
||||||
------------------
|
------------------
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
$scope.showStyle = null;
|
$scope.showStyle = null;
|
||||||
$scope.searchHistory = [];
|
$scope.searchHistory = [];
|
||||||
$scope.historyTypes = dataService.historyTypes;
|
$scope.historyTypes = dataService.historyTypes;
|
||||||
$scope.quickUrl = { };
|
$scope.quickUrl = {};
|
||||||
$scope.longPress = false;
|
$scope.longPress = false;
|
||||||
|
|
||||||
// 防止在登陆的情况下,在浏览器里面直接输入url,这时候要更新菜单选项
|
// 防止在登陆的情况下,在浏览器里面直接输入url,这时候要更新菜单选项
|
||||||
|
|
@ -213,9 +213,21 @@ app.controller('menuCtr', ['$scope', '$stateParams', '$state', '$window', '$time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = $scope.quickUrl[key];
|
// 数字键用来切换菜单
|
||||||
if (url) {
|
if (!isNaN(key)) {
|
||||||
$window.open(url, '_blank');
|
var num = parseInt(key);
|
||||||
|
pubSubService.publish('Common.menuActive', {
|
||||||
|
login: $scope.login,
|
||||||
|
index: num - 1
|
||||||
|
});
|
||||||
|
$state.go(dataService.loginMenus[num - 1].uiSref, {}, {
|
||||||
|
reload: true,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
var url = $scope.quickUrl[key];
|
||||||
|
if (url) {
|
||||||
|
$window.open(url, '_blank');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -116,16 +116,16 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
|
||||||
$scope.quickKey = function(key) {
|
$scope.quickKey = function(key) {
|
||||||
key = key.toUpperCase();
|
key = key.toUpperCase();
|
||||||
console.log('key = ', key);
|
console.log('key = ', key);
|
||||||
if (!((key >= 'A' && key <= 'Z') || (key >= '1' && key <= '9'))) {
|
if (!(key >= 'A' && key <= 'Z')) {
|
||||||
key = '';
|
key = '';
|
||||||
toastr.warning('快捷键只能是数字1 ~ 9或者字母a ~ z,字母不区分大小写。', "警告");
|
toastr.warning('快捷键只能是字母a ~ z,字母不区分大小写。', "警告");
|
||||||
}
|
}
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.key = key;
|
$scope.key = key;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.addQuickUrl = function(){
|
$scope.addQuickUrl = function() {
|
||||||
if ($scope.url == '' || $scope.key == '') {
|
if ($scope.url == '' || $scope.key == '') {
|
||||||
toastr.warning('快捷键或者网站地址为空!', "警告");
|
toastr.warning('快捷键或者网站地址为空!', "警告");
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +136,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(($scope.key >= 'A' && $scope.key <= 'Z') || ($scope.key >= 'a' && $scope.key <= 'z') || ($scope.key >= '1' && $scope.key <= '9'))) {
|
if (!(($scope.key >= 'A' && $scope.key <= 'Z') || ($scope.key >= 'a' && $scope.key <= 'z') || ($scope.key >= '1' && $scope.key <= '9'))) {
|
||||||
toastr.warning('快捷键只能是数字1 ~ 9或者字母a ~ z,字母不区分大小写。', "警告");
|
toastr.warning('快捷键只能是字母a ~ z,字母不区分大小写。', "警告");
|
||||||
$scope.key = '';
|
$scope.key = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -227,6 +227,7 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
|
||||||
}
|
}
|
||||||
|
|
||||||
transition();
|
transition();
|
||||||
|
|
||||||
function transition() {
|
function transition() {
|
||||||
var className = 'js-segment-settings';
|
var className = 'js-segment-settings';
|
||||||
$('.' + className).transition('hide');
|
$('.' + className).transition('hide');
|
||||||
|
|
|
||||||
|
|
@ -46,15 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<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">
|
||||||
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">
|
|
||||||
<div class="ui fluid popup top left transition hidden" style="padding-left: 0px; padding-right: 0px;">
|
<div class="ui fluid popup top left transition hidden" style="padding-left: 0px; padding-right: 0px;">
|
||||||
<div class="ui selection list">
|
<div class="ui selection list">
|
||||||
<div class="item" ng-repeat="item in searchHistory" ng-click="searchByHistory(item.t, item.d)" style="height:30px;">
|
<div class="item" ng-repeat="item in searchHistory" ng-click="searchByHistory(item.t, item.d)" style="height:30px;">
|
||||||
|
|
@ -81,7 +73,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" style="padding:0 8px 0 13px;">
|
<div class="item" style="padding:0 8px 0 13px;">
|
||||||
<span data-tooltip="1、在备忘录页面,按A键添加备忘录。2、在热门收藏页面,按R键随机查看热门收藏。">
|
<span data-tooltip="1、在任意页面,按A键添加备忘录。2、在热门收藏页面,按R键随机查看热门收藏。3、在任意页面,按数字键切换菜单栏。">
|
||||||
<i class="info circle icon"></i>
|
<i class="info circle icon"></i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -158,43 +158,43 @@
|
||||||
<p>1、该代码我托管在Github上<a href="https://github.com/luchenqun/my-bookmark" target="_blank">my-bookmark</a>。该地址有文件夹详细说明以及部署步骤。git地址:git@github.com:luchenqun/my-bookmark.git。如果你需要源码,你尽可随意使用此项目无需通知我。</p>
|
<p>1、该代码我托管在Github上<a href="https://github.com/luchenqun/my-bookmark" target="_blank">my-bookmark</a>。该地址有文件夹详细说明以及部署步骤。git地址:git@github.com:luchenqun/my-bookmark.git。如果你需要源码,你尽可随意使用此项目无需通知我。</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui container js-p-info" ng-show="form[4]">
|
<div class="ui container js-p-info" ng-show="form[4]">
|
||||||
<p>功能说明:可在该页面,设置全局快速打开的链接。快捷键只能是数字1 ~ 9或者字母a ~ z,字母不区分大小写。</p>
|
<p>功能说明:可在该页面,设置全局快速打开的链接。快捷键只能是字母a ~ z,字母不区分大小写。</p>
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
<table class="ui selectable sortable celled table js-quick-url-table">
|
<table class="ui selectable sortable celled table js-quick-url-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:80px;">快捷键</th>
|
<th style="width:80px;">快捷键</th>
|
||||||
<th>网站地址</th>
|
<th>网站地址</th>
|
||||||
<th style="width:45px;">操作</th>
|
<th style="width:45px;">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="(key, value) in quickUrl">
|
<tr ng-repeat="(key, value) in quickUrl">
|
||||||
<td>{{key}}</td>
|
<td>{{key}}</td>
|
||||||
<td>{{value}}</td>
|
<td>{{value}}</td>
|
||||||
<td>
|
<td>
|
||||||
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/delete.png" ng-click="delUrl(key)" title="删除书签">
|
<img class="ui mini spaced image" style="width:16px;height:16px;margin:0 1px" ng-src="./images/delete.png" ng-click="delUrl(key)" title="删除书签">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
<div class="ui form">
|
<div class="ui form">
|
||||||
<div class="inline fields">
|
<div class="inline fields">
|
||||||
<div class="five wide field">
|
<div class="five wide field">
|
||||||
<label style="min-width:55px;">快捷键:</label>
|
<label style="min-width:55px;">快捷键:</label>
|
||||||
<input type="text" placeholder="请按相应的快捷键" ng-model="key" ng-keypress="quickKey($event.key)">
|
<input type="text" placeholder="请按相应的快捷键" ng-model="key" ng-keypress="quickKey($event.key)">
|
||||||
</div>
|
</div>
|
||||||
<div class="nine wide field">
|
<div class="nine wide field">
|
||||||
<label style="min-width:66px;">网站地址:</label>
|
<label style="min-width:66px;">网站地址:</label>
|
||||||
<input type="text" placeholder="请输入你需要快捷打开的网站地址" ng-model="url">
|
<input type="text" placeholder="请输入你需要快捷打开的网站地址" ng-model="url">
|
||||||
</div>
|
</div>
|
||||||
<div class="two wide field">
|
<div class="two wide field">
|
||||||
<div class="ui green button" ng-click="addQuickUrl()">确定</div>
|
<div class="ui green button" ng-click="addQuickUrl()">确定</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue