@@ -32,13 +32,13 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
32
32
} ) ;
33
33
34
34
var Assistive = MathJax . Extension . explorer = {
35
- version : '1.2.3 ' ,
35
+ version : '1.4.0 ' ,
36
36
dependents : [ ] , // the extensions that depend on this one
37
37
//
38
38
// Default configurations.
39
39
//
40
40
defaults : {
41
- walker : 'syntactic ' ,
41
+ walker : 'table ' ,
42
42
highlight : 'none' ,
43
43
background : 'blue' ,
44
44
foreground : 'black' ,
@@ -50,6 +50,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
50
50
eagerComplexity : 80 ,
51
51
prefix : 'Assistive-' ,
52
52
hook : null ,
53
+ locHook : null ,
53
54
oldrules : null ,
54
55
addMenuOption : function ( key , value ) {
55
56
SETTINGS [ Assistive . prefix + key ] = value ;
@@ -87,6 +88,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
87
88
var ruleset = SETTINGS [ Assistive . prefix + 'ruleset' ] ;
88
89
var cstr = ruleset . split ( '-' ) ;
89
90
sre . System . getInstance ( ) . setupEngine ( {
91
+ locale : MathJax . Localization . locale ,
90
92
domain : Assistive . Domain ( cstr [ 0 ] ) ,
91
93
style : cstr [ 1 ] ,
92
94
rules : Assistive . RuleSet ( cstr [ 0 ] )
@@ -110,11 +112,13 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
110
112
return [ 'AbstractionRules' , 'SemanticTreeRules' ] ;
111
113
case 'mathspeak' :
112
114
default :
113
- return [ 'AbstractionRules' , 'MathspeakRules' ] ;
115
+ return [ 'AbstractionRules' , 'AbstractionSpanish' ,
116
+ 'MathspeakRules' , 'MathspeakSpanish' ] ;
114
117
}
115
118
} ,
116
119
117
120
hook : null ,
121
+ locHook : null ,
118
122
Enable : function ( update , menu ) {
119
123
SETTINGS . explorer = true ;
120
124
if ( menu ) COOKIE . explorer = true ;
@@ -129,6 +133,10 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
129
133
this . hook = MathJax . Hub . Register . MessageHook (
130
134
'New Math' , [ 'Register' , this . Explorer ] ) ;
131
135
}
136
+ if ( ! this . locHook ) {
137
+ this . locHook = MathJax . Hub . Register . MessageHook (
138
+ 'Locale Reset' , [ 'RemoveSpeech' , this . Explorer ] ) ;
139
+ }
132
140
if ( update ) MathJax . Hub . Queue ( [ 'Reprocess' , MathJax . Hub ] ) ;
133
141
} ,
134
142
Disable : function ( update , menu ) {
@@ -155,7 +163,6 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
155
163
for ( var i = 2 , item ; item = items [ i ] ; i ++ ) item . disabled = state ;
156
164
if ( ! state && menu . FindId ( 'SpeechOutput' ) && ! SETTINGS [ Assistive . prefix + 'speech' ] ) {
157
165
menu . FindId ( 'Subtitles' ) . disabled = true ;
158
- menu . FindId ( 'Generation' ) . disabled = true ;
159
166
}
160
167
}
161
168
}
@@ -412,7 +419,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
412
419
Explorer . AddMathLabel ( mathml , id ) ;
413
420
}
414
421
if ( math . getAttribute ( 'hasspeech' ) ) return ;
415
- switch ( Assistive . getOption ( ' generation' ) ) {
422
+ switch ( MathJax . Hub . config . explorer . generation ) {
416
423
case 'eager' :
417
424
Explorer . AddSpeechEager ( mathml , id ) ;
418
425
break ;
@@ -483,6 +490,9 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
483
490
}
484
491
// If walker is active we redirect there.
485
492
if ( Explorer . walker && Explorer . walker . isActive ( ) ) {
493
+ if ( typeof ( Explorer . walker . modifier ) !== 'undefined' ) {
494
+ Explorer . walker . modifier = event . shiftKey ;
495
+ }
486
496
var move = Explorer . walker . move ( event . keyCode ) ;
487
497
if ( move === null ) return ;
488
498
if ( move ) {
@@ -586,13 +596,15 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
586
596
//
587
597
Walkers : {
588
598
'syntactic' : sre . SyntaxWalker ,
599
+ 'table' : sre . TableWalker ,
589
600
'semantic' : sre . SemanticWalker ,
590
601
'none' : sre . DummyWalker
591
602
} ,
592
603
ActivateWalker : function ( math , jax ) {
593
604
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' ] ;
596
608
var speechGenerator = speechOn ? new sre . DirectSpeechGenerator ( ) :
597
609
new sre . DummySpeechGenerator ( ) ;
598
610
Explorer . GetHighlighter ( .2 ) ;
@@ -653,7 +665,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
653
665
//
654
666
SpeechOutput : function ( ) {
655
667
Explorer . Reset ( ) ;
656
- var speechItems = [ 'Subtitles' , 'Generation' ] ;
668
+ var speechItems = [ 'Subtitles' ] ;
657
669
speechItems . forEach (
658
670
function ( x ) {
659
671
var item = MathJax . Menu . menu . FindId ( 'Accessibility' , 'Explorer' , x ) ;
@@ -663,13 +675,26 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
663
675
Explorer . Regenerate ( ) ;
664
676
} ,
665
677
//
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
+ //
666
691
// Regenerates speech.
667
692
//
668
693
Regenerate : function ( ) {
669
694
for ( var i = 0 , all = MathJax . Hub . getAllJax ( ) , jax ; jax = all [ i ] ; i ++ ) {
670
695
var math = document . getElementById ( jax . inputID + '-Frame' ) ;
671
696
if ( math ) {
672
- math . removeAttribute ( 'hasSpeech ' ) ;
697
+ math . removeAttribute ( 'hasspeech ' ) ;
673
698
Explorer . AddSpeech ( math ) ;
674
699
}
675
700
}
@@ -698,11 +723,7 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
698
723
ITEM . SUBMENU ( [ 'Explorer' , 'Explorer' ] ,
699
724
ITEM . CHECKBOX ( [ 'Active' , 'Active' ] , 'explorer' , { action : Switch } ) ,
700
725
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' ) ,
706
727
ITEM . SUBMENU ( [ 'Highlight' , 'Highlight' ] ,
707
728
ITEM . RADIO ( [ 'none' , 'None' ] , 'Assistive-highlight' , reset ) ,
708
729
ITEM . RADIO ( [ 'hover' , 'Hover' ] , 'Assistive-highlight' , reset ) ,
@@ -733,15 +754,6 @@ MathJax.Hub.Register.StartupHook('Sre Ready', function() {
733
754
'Assistive-speech' , { action : Explorer . SpeechOutput } ) ,
734
755
ITEM . CHECKBOX ( [ 'Subtitles' , 'Subtitles' ] , 'Assistive-subtitle' ,
735
756
{ 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
- ) ,
745
757
ITEM . RULE ( ) ,
746
758
ITEM . SUBMENU ( [ 'Mathspeak' , 'Mathspeak Rules' ] ,
747
759
ITEM . RADIO ( [ 'mathspeak-default' , 'Verbose' ] ,
0 commit comments