@@ -180,8 +180,8 @@ $(document).ready(function(){
180180 VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( 'form#vstobjects input.cancel' ) . attr ( 'onclick' ) . replace ( "location.href='" , "" ) . replace ( "'" , "" ) ) ;
181181 } else if ( $ ( 'form#vstobjects .button.cancel' ) [ 0 ] ) {
182182 location . href = $ ( 'form#vstobjects input.cancel' ) . attr ( 'onclick' ) . replace ( "location.href='" , "" ) . replace ( "'" , "" ) ;
183- } else if ( $ ( '#vstobjects a. button.cancel' ) [ 0 ] ) {
184- location . href = $ ( '#vstobjects a. button.cancel' ) . attr ( 'href' ) ;
183+ } else if ( $ ( 'a.ui- button.cancel' ) [ 0 ] ) {
184+ location . href = $ ( 'a.ui- button.cancel' ) . attr ( 'href' ) ;
185185 }
186186 } , {
187187 'type' : 'keydown' ,
@@ -225,10 +225,14 @@ $(document).ready(function(){
225225 } ) ;
226226
227227 shortcut . add ( "1" , function ( ) {
228+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(1) a' )
229+ if ( target . length != 1 ) {
230+ return ;
231+ }
228232 if ( VE . tmp . form_changed ) {
229- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(1) a' ) . attr ( 'href' ) ) ;
233+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
230234 } else {
231- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(1) a' ) . attr ( 'href' ) ;
235+ location . href = target . attr ( 'href' ) ;
232236 }
233237 } , {
234238 'type' : 'keydown' ,
@@ -239,10 +243,14 @@ $(document).ready(function(){
239243 ) ;
240244
241245 shortcut . add ( "2" , function ( ) {
246+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(2) a' )
247+ if ( target . length != 1 ) {
248+ return ;
249+ }
242250 if ( VE . tmp . form_changed ) {
243- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(2) a' ) . attr ( 'href' ) ) ;
251+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
244252 } else {
245- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(2) a' ) . attr ( 'href' ) ;
253+ location . href = target . attr ( 'href' ) ;
246254 }
247255 } , {
248256 'type' : 'keydown' ,
@@ -253,10 +261,14 @@ $(document).ready(function(){
253261 ) ;
254262
255263 shortcut . add ( "3" , function ( ) {
264+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(3) a' )
265+ if ( target . length != 1 ) {
266+ return ;
267+ }
256268 if ( VE . tmp . form_changed ) {
257- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(3) a' ) . attr ( 'href' ) ) ;
269+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
258270 } else {
259- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(3) a' ) . attr ( 'href' ) ;
271+ location . href = target . attr ( 'href' ) ;
260272 }
261273 } , {
262274 'type' : 'keydown' ,
@@ -267,10 +279,14 @@ $(document).ready(function(){
267279 ) ;
268280
269281 shortcut . add ( "4" , function ( ) {
282+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(4) a' )
283+ if ( target . length != 1 ) {
284+ return ;
285+ }
270286 if ( VE . tmp . form_changed ) {
271- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(4) a' ) . attr ( 'href' ) ) ;
287+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
272288 } else {
273- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(4) a' ) . attr ( 'href' ) ;
289+ location . href = target . attr ( 'href' ) ;
274290 }
275291 } , {
276292 'type' : 'keydown' ,
@@ -281,10 +297,14 @@ $(document).ready(function(){
281297 ) ;
282298
283299 shortcut . add ( "5" , function ( ) {
300+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(5) a' )
301+ if ( target . length != 1 ) {
302+ return ;
303+ }
284304 if ( VE . tmp . form_changed ) {
285- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(5) a' ) . attr ( 'href' ) ) ;
305+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
286306 } else {
287- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(5) a' ) . attr ( 'href' ) ;
307+ location . href = target . attr ( 'href' ) ;
288308 }
289309 } , {
290310 'type' : 'keydown' ,
@@ -295,10 +315,14 @@ $(document).ready(function(){
295315 ) ;
296316
297317 shortcut . add ( "6" , function ( ) {
318+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(6) a' )
319+ if ( target . length != 1 ) {
320+ return ;
321+ }
298322 if ( VE . tmp . form_changed ) {
299- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(6) a' ) . attr ( 'href' ) ) ;
323+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
300324 } else {
301- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(6) a' ) . attr ( 'href' ) ;
325+ location . href = target . attr ( 'href' ) ;
302326 }
303327 } , {
304328 'type' : 'keydown' ,
@@ -309,10 +333,14 @@ $(document).ready(function(){
309333 ) ;
310334
311335 shortcut . add ( "7" , function ( ) {
336+ var target = $ ( '.l-stat .l-stat__col:nth-of-type(7) a' )
337+ if ( target . length != 1 ) {
338+ return ;
339+ }
312340 if ( VE . tmp . form_changed ) {
313- VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , $ ( '.l-stat .l-stat__col:nth-of-type(7) a' ) . attr ( 'href' ) ) ;
341+ VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) , '' , target . attr ( 'href' ) ) ;
314342 } else {
315- location . href = $ ( '.l-stat .l-stat__col:nth-of-type(7) a' ) . attr ( 'href' ) ;
343+ location . href = target . attr ( 'href' ) ;
316344 }
317345 } , {
318346 'type' : 'keydown' ,
@@ -490,7 +518,12 @@ $(document).ready(function(){
490518 }
491519 ) ;
492520
493- shortcut . add ( "Enter" , function ( ) {
521+ shortcut . add ( "Enter" , function ( evt ) {
522+
523+ if ( evt . target . tagName == 'INPUT' && evt . target . form . id == 'vstobjects' ) {
524+ $ ( 'form#vstobjects' ) . submit ( ) ;
525+ }
526+
494527 if ( VE . tmp . form_changed ) {
495528 if ( ! $ ( '.ui-dialog' ) . is ( ':visible' ) ) {
496529 VE . helpers . createConfirmationDialog ( $ ( '.confirmation-text-redirect' ) [ 0 ] , '' , $ ( VE . navigation . state . menu_selector + '.focus a' ) . attr ( 'href' ) ) ;
@@ -511,8 +544,8 @@ $(document).ready(function(){
511544 }
512545 } , {
513546 'type' : 'keydown' ,
514- 'propagate' : false ,
515- 'disable_in_input' : true ,
547+ 'propagate' : true ,
548+ 'disable_in_input' : false ,
516549 'target' : document
517550 }
518551 ) ;
0 commit comments