@@ -32,13 +32,13 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
3232 } ) ;
3333
3434 var Assistive = MathJax . Extension . explorer = {
35- version : '1.2.3 ' ,
35+ version : '1.4.0 ' ,
3636 dependents : [ ] , // the extensions that depend on this one
3737 //
3838 // Default configurations.
3939 //
4040 defaults : {
41- walker : 'syntactic ' ,
41+ walker : 'table ' ,
4242 highlight : 'none' ,
4343 background : 'blue' ,
4444 foreground : 'black' ,
@@ -50,6 +50,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
5050 eagerComplexity : 80 ,
5151 prefix : 'Assistive-' ,
5252 hook : null ,
53+ locHook : null ,
5354 oldrules : null ,
5455 addMenuOption : function ( key , value ) {
5556 SETTINGS [ Assistive . prefix + key ] = value ;
@@ -87,6 +88,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
8788 var ruleset = SETTINGS [ Assistive . prefix + 'ruleset' ] ;
8889 var cstr = ruleset . split ( '-' ) ;
8990 sre . System . getInstance ( ) . setupEngine ( {
91+ locale : MathJax . Localization . locale ,
9092 domain : Assistive . Domain ( cstr [ 0 ] ) ,
9193 style : cstr [ 1 ] ,
9294 rules : Assistive . RuleSet ( cstr [ 0 ] )
@@ -110,11 +112,13 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
110112 return [ 'AbstractionRules' , 'SemanticTreeRules' ] ;
111113 case 'mathspeak' :
112114 default :
113- return [ 'AbstractionRules' , 'MathspeakRules' ] ;
115+ return [ 'AbstractionRules' , 'AbstractionSpanish' ,
116+ 'MathspeakRules' , 'MathspeakSpanish' ] ;
114117 }
115118 } ,
116119
117120 hook : null ,
121+ locHook : null ,
118122 Enable : function ( update , menu ) {
119123 SETTINGS . explorer = true ;
120124 if ( menu ) COOKIE . explorer = true ;
@@ -129,6 +133,10 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
129133 this . hook = MathJax . Hub . Register . MessageHook (
130134 'New Math' , [ 'Register' , this . Explorer ] ) ;
131135 }
136+ if ( ! this . locHook ) {
137+ this . locHook = MathJax . Hub . Register . MessageHook (
138+ 'Locale Reset' , [ 'RemoveSpeech' , this . Explorer ] ) ;
139+ }
132140 if ( update ) MathJax . Hub . Queue ( [ 'Reprocess' , MathJax . Hub ] ) ;
133141 } ,
134142 Disable : function ( update , menu ) {
@@ -155,7 +163,6 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
155163 for ( var i = 2 , item ; item = items [ i ] ; i ++ ) item . disabled = state ;
156164 if ( ! state && menu . FindId ( 'SpeechOutput' ) && ! SETTINGS [ Assistive . prefix + 'speech' ] ) {
157165 menu . FindId ( 'Subtitles' ) . disabled = true ;
158- menu . FindId ( 'Generation' ) . disabled = true ;
159166 }
160167 }
161168 }
@@ -412,7 +419,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
412419 Explorer . AddMathLabel ( mathml , id ) ;
413420 }
414421 if ( math . getAttribute ( 'hasspeech' ) ) return ;
415- switch ( Assistive . getOption ( ' generation' ) ) {
422+ switch ( MathJax . Hub . config . explorer . generation ) {
416423 case 'eager' :
417424 Explorer . AddSpeechEager ( mathml , id ) ;
418425 break ;
@@ -483,6 +490,9 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
483490 }
484491 // If walker is active we redirect there.
485492 if ( Explorer . walker && Explorer . walker . isActive ( ) ) {
493+ if ( typeof ( Explorer . walker . modifier ) !== 'undefined' ) {
494+ Explorer . walker . modifier = event . shiftKey ;
495+ }
486496 var move = Explorer . walker . move ( event . keyCode ) ;
487497 if ( move === null ) return ;
488498 if ( move ) {
@@ -586,13 +596,15 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
586596 //
587597 Walkers : {
588598 'syntactic' : sre . SyntaxWalker ,
599+ 'table' : sre . TableWalker ,
589600 'semantic' : sre . SemanticWalker ,
590601 'none' : sre . DummyWalker
591602 } ,
592603 ActivateWalker : function ( math , jax ) {
593604 var speechOn = Assistive . getOption ( 'speech' ) ;
594- var constructor = Explorer . Walkers [ Assistive . getOption ( 'walker' ) ] ||
595- Explorer . Walkers [ 'none' ] ;
605+ var constructor = Assistive . getOption ( 'walker' ) ?
606+ Explorer . Walkers [ MathJax . Hub . config . explorer . walker ] :
607+ Explorer . Walkers [ 'none' ] ;
596608 var speechGenerator = speechOn ? new sre . DirectSpeechGenerator ( ) :
597609 new sre . DummySpeechGenerator ( ) ;
598610 Explorer . GetHighlighter ( .2 ) ;
@@ -653,7 +665,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
653665 //
654666 SpeechOutput : function ( ) {
655667 Explorer . Reset ( ) ;
656- var speechItems = [ 'Subtitles' , 'Generation' ] ;
668+ var speechItems = [ 'Subtitles' ] ;
657669 speechItems . forEach (
658670 function ( x ) {
659671 var item = MathJax . Menu . menu . FindId ( 'Accessibility' , 'Explorer' , x ) ;
@@ -663,13 +675,26 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
663675 Explorer . Regenerate ( ) ;
664676 } ,
665677 //
678+ // Remove speech and resets SRE options.
679+ //
680+ RemoveSpeech : function ( ) {
681+ Assistive . setSpeechOption ( ) ;
682+ for ( var i = 0 , all = MathJax . Hub . getAllJax ( ) , jax ; jax = all [ i ] ; i ++ ) {
683+ var math = document . getElementById ( jax . inputID + '-Frame' ) ;
684+ if ( math ) {
685+ math . removeAttribute ( 'hasspeech' ) ;
686+ math . removeAttribute ( 'haslabel' ) ;
687+ }
688+ }
689+ } ,
690+ //
666691 // Regenerates speech.
667692 //
668693 Regenerate : function ( ) {
669694 for ( var i = 0 , all = MathJax . Hub . getAllJax ( ) , jax ; jax = all [ i ] ; i ++ ) {
670695 var math = document . getElementById ( jax . inputID + '-Frame' ) ;
671696 if ( math ) {
672- math . removeAttribute ( 'hasSpeech ' ) ;
697+ math . removeAttribute ( 'hasspeech ' ) ;
673698 Explorer . AddSpeech ( math ) ;
674699 }
675700 }
@@ -698,11 +723,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
698723 ITEM . SUBMENU ( [ 'Explorer' , 'Explorer' ] ,
699724 ITEM . CHECKBOX ( [ 'Active' , 'Active' ] , 'explorer' , { action : Switch } ) ,
700725 ITEM . RULE ( ) ,
701- ITEM . SUBMENU ( [ 'Walker' , 'Walker' ] ,
702- ITEM . RADIO ( [ 'nowalker' , 'No walker' ] , 'Assistive-walker' , { value :"none" } ) ,
703- ITEM . RADIO ( [ 'syntactic' , 'Syntax walker' ] , 'Assistive-walker' ) ,
704- ITEM . RADIO ( [ 'semantic' , 'Semantic walker' ] , 'Assistive-walker' )
705- ) ,
726+ ITEM . CHECKBOX ( [ 'Walker' , 'Walker' ] , 'Assistive-walker' ) ,
706727 ITEM . SUBMENU ( [ 'Highlight' , 'Highlight' ] ,
707728 ITEM . RADIO ( [ 'none' , 'None' ] , 'Assistive-highlight' , reset ) ,
708729 ITEM . RADIO ( [ 'hover' , 'Hover' ] , 'Assistive-highlight' , reset ) ,
@@ -733,15 +754,6 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
733754 'Assistive-speech' , { action : Explorer . SpeechOutput } ) ,
734755 ITEM . CHECKBOX ( [ 'Subtitles' , 'Subtitles' ] , 'Assistive-subtitle' ,
735756 { disabled : ! SETTINGS [ 'Assistive-speech' ] } ) ,
736- ITEM . SUBMENU ( [ 'Generation' , 'Generation' ] ,
737- { disabled : ! SETTINGS [ 'Assistive-speech' ] } ,
738- ITEM . RADIO ( [ 'eager' , 'Eager' ] , 'Assistive-generation' ,
739- { action : Explorer . Regenerate } ) ,
740- ITEM . RADIO ( [ 'mixed' , 'Mixed' ] , 'Assistive-generation' ,
741- { action : Explorer . Regenerate } ) ,
742- ITEM . RADIO ( [ 'lazy' , 'Lazy' ] , 'Assistive-generation' ,
743- { action : Explorer . Regenerate } )
744- ) ,
745757 ITEM . RULE ( ) ,
746758 ITEM . SUBMENU ( [ 'Mathspeak' , 'Mathspeak Rules' ] ,
747759 ITEM . RADIO ( [ 'mathspeak-default' , 'Verbose' ] ,
0 commit comments