@@ -335,7 +335,7 @@ div.hint-scrollable {
335335 if ( ! behaviours . multipleHits ) {
336336 self . exit ( ) ;
337337 }
338- var tabbed = behaviours . tabbed , active = behaviours . active ;
338+ let tabbed = behaviours . tabbed , active = behaviours . active ;
339339 if ( behaviours . multipleHits ) {
340340 const href = element . getAttribute ( 'href' ) ;
341341 if ( href !== null && href !== "#" ) {
@@ -344,30 +344,20 @@ div.hint-scrollable {
344344 }
345345 }
346346
347+ const mouseEventModifiers = { shiftKey : shiftKey || active } ;
347348 if ( shiftKey && runtime . conf . hintShiftNonActive ) {
348349 tabbed = true ;
349- active = false ;
350- } else if ( shiftKey && getBrowserName ( ) === "Firefox" ) {
351- // mouseButton does not work for firefox in mouse event.
352- tabbed = true ;
353- active = true ;
350+ mouseEventModifiers . shiftKey = false ;
351+ }
352+ if ( tabbed ) {
353+ const modKey = ( navigator . platform . indexOf ( "Mac" ) !== - 1 ) ? "metaKey" : "ctrlKey" ;
354+ mouseEventModifiers [ modKey ] = true ;
354355 }
355-
356356 flashPressedLink ( element , ( ) => {
357- if ( tabbed ) {
358- RUNTIME ( "openLink" , {
359- tab : {
360- tabbed : tabbed ,
361- active : active
362- } ,
363- url : getHref ( element )
364- } ) ;
365- } else {
366- self . mouseoutLastElement ( ) ;
367- dispatchMouseEvent ( element , behaviours . mouseEvents , shiftKey ) ;
368- dispatchSKEvent ( "observer" , [ 'turnOn' ] ) ;
369- lastMouseTarget = element ;
370- }
357+ self . mouseoutLastElement ( ) ;
358+ dispatchMouseEvent ( element , behaviours . mouseEvents , mouseEventModifiers ) ;
359+ dispatchSKEvent ( "observer" , [ 'turnOn' ] ) ;
360+ lastMouseTarget = element ;
371361
372362 if ( behaviours . multipleHits ) {
373363 setTimeout ( resetHints , 300 ) ;
@@ -466,11 +456,7 @@ div.hint-scrollable {
466456 function hide ( ) {
467457 // To reset default behaviours here is necessary, as some hint my be hit without creation.
468458 behaviours = {
469- active : true ,
470- tabbed : false ,
471- regionalHints : false ,
472- mouseEvents : [ 'mouseover' , 'pointerdown' , 'mousedown' , 'pointerup' , 'mouseup' , 'click' , 'focus' , 'focusin' ] ,
473- multipleHits : false
459+ mouseEvents : MOUSE_EVENTS
474460 } ;
475461 setSanitizedContent ( holder , "" ) ;
476462 holder . remove ( ) ;
@@ -736,21 +722,13 @@ div.hint-scrollable {
736722 }
737723
738724 function createHintsForElements ( elements , attrs ) {
739- attrs = Object . assign ( {
740- active : true ,
741- tabbed : false ,
742- mouseEvents : MOUSE_EVENTS ,
743- multipleHits : false ,
744- filterInvisible : true
745- } , attrs || { } ) ;
725+ attrs = attrs || { } ;
746726 for ( var attr in attrs ) {
747727 behaviours [ attr ] = attrs [ attr ] ;
748728 }
749729 self . statusLine = ( attrs && attrs . statusLine ) || "Hints to click" ;
750730
751- if ( attrs . filterInvisible ) {
752- elements = filterInvisibleElements ( elements ) ;
753- }
731+ elements = filterInvisibleElements ( elements ) ;
754732 if ( elements . length > 0 ) {
755733 placeHints ( elements ) ;
756734 }
@@ -760,16 +738,11 @@ div.hint-scrollable {
760738 function createHintsForClick ( cssSelector , attrs ) {
761739 self . statusLine = "Hints to click" ;
762740
763- attrs = Object . assign ( {
764- active : true ,
765- tabbed : false ,
766- mouseEvents : MOUSE_EVENTS ,
767- multipleHits : false
768- } , attrs || { } ) ;
741+ attrs = attrs || { } ;
769742 for ( var attr in attrs ) {
770743 behaviours [ attr ] = attrs [ attr ] ;
771744 }
772- var elements ;
745+ let elements ;
773746 if ( cssSelector === "" ) {
774747 elements = getVisibleElements ( function ( e , v ) {
775748 if ( isElementClickable ( e ) ) {
@@ -991,7 +964,7 @@ div.hint-scrollable {
991964
992965 self . mouseoutLastElement = function ( ) {
993966 if ( lastMouseTarget ) {
994- dispatchMouseEvent ( lastMouseTarget , [ 'mouseout' ] , false ) ;
967+ dispatchMouseEvent ( lastMouseTarget , [ 'mouseout' ] , { } ) ;
995968 lastMouseTarget = null ;
996969 }
997970 } ;
0 commit comments