File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 9
9
< script src ="bower_components/angular-zeroclipboard/src/angular-zeroclipboard.js "> </ script >
10
10
< script src ="scripts/app.js "> </ script >
11
11
</ head >
12
- < body ng-app ="abstackVarLib " ng-controller ="mainCtrl ">
12
+ < body ng-app ="abstackVarLib " ng-controller ="mainCtrl " backspace-focus =" search " >
13
13
< header >
14
14
Abstack Tech Variables Library
15
- < input type ="text " class ="search-box " placeholder ="Type some keywords... " ng-model ="keywords ">
15
+ < input type ="text " id =" search " class ="search-box " placeholder ="Type some keywords... " ng-model ="keywords " ready-focus >
16
16
</ header >
17
17
< ul class ="word-list ng-hide " ng-show ="wordsList ">
18
18
< li ng-repeat ="word in wordsList | keywords: keywords ">
21
21
< a target ="_blank " ng-href ="{{ word.url?word.url: 'http://www.dict.cn/' + word.word }} " ng-bind ="word.word "> </ a >
22
22
</ h3 >
23
23
< span class ="tag-box ">
24
- < em ng-repeat ="tag in word.tags track by $index " ng-bind ="tag " ng-click ="setKeywords(tag) "> </ em >
24
+ < a href =" javascript:; " ng-repeat ="tag in word.tags track by $index " ng-bind ="tag " ng-click ="setKeywords(tag) "> </ a >
25
25
</ span >
26
26
</ li >
27
27
</ ul >
Original file line number Diff line number Diff line change @@ -10,6 +10,32 @@ angular.module('abstackVarLib', ['zeroclipboard'])
10
10
swfPath : '../bower_components/zeroclipboard/dist/ZeroClipboard.swf'
11
11
} ) ;
12
12
} ] )
13
+ . directive ( 'readyFocus' , [ '$document' , function ( $document ) {
14
+ return {
15
+ restrict : 'A' ,
16
+ link : function ( $scope , iElm , iAttrs , controller ) {
17
+ $document . ready ( function ( ) {
18
+ iElm [ 0 ] . focus ( ) ;
19
+ } ) ;
20
+ }
21
+ } ;
22
+ } ] )
23
+ . directive ( 'backspaceFocus' , function ( ) {
24
+ return {
25
+ restrict : 'A' ,
26
+ link : function ( $scope , iElm , iAttrs , controller ) {
27
+ var targetObj = document . getElementById ( iAttrs [ 'backspaceFocus' ] ) ;
28
+
29
+ iElm [ 0 ] . onkeydown = function ( ev ) {
30
+ var event = ev || event ,
31
+ keyCode = event . keyCode ;
32
+ if ( keyCode == 8 && targetObj ) {
33
+ targetObj . focus ( ) ;
34
+ }
35
+ } ;
36
+ }
37
+ } ;
38
+ } )
13
39
. filter ( 'keywords' , function ( ) {
14
40
return function ( input , type ) {
15
41
if ( ! type )
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ only screen and (min-device-pixel-ratio: 2){
128
128
font-size : 14px ;
129
129
margin-right : -2px ;
130
130
}
131
- em {
131
+ a {
132
132
@bgcolor : #eee ;
133
133
position : relative ;
134
134
display : inline-block ;
@@ -137,6 +137,7 @@ only screen and (min-device-pixel-ratio: 2){
137
137
padding : 3px 6px ;
138
138
font-size : 13px ;
139
139
font-style : normal ;
140
+ text-decoration : none ;
140
141
color : #333 ;
141
142
background-color : @bgcolor ;
142
143
border-top-right-radius : 3px ;
You can’t perform that action at this time.
0 commit comments