1
+ var myTheme = {
2
+ collapseActivities : true , // Minimize interactive activities
3
+ // Activities (to minify if collapseActivities is true)
4
+ // Activities using any of these icons will be minified too: icon_udl_exp_tarea, icon_udl_exp_interactivo
5
+ activities : [
6
+ "Lista" ,
7
+ "QuizTest" ,
8
+ "ScrambledList" ,
9
+ "Multichoice" ,
10
+ "MultiSelect" ,
11
+ "TrueFalse" ,
12
+ "Cloze" ,
13
+ "interactive-video" ,
14
+ "GeoGebra" ,
15
+ "Eleccionmultiplefpd" ,
16
+ "Clozefpd" ,
17
+ "Clozelangfpd" ,
18
+ "Seleccionmultiplefpd" ,
19
+ "Verdaderofalsofpd" ,
20
+ "Ejercicioresueltofpd"
21
+ ] ,
22
+ init : function ( ) {
23
+ var ie_v = $exe . isIE ( ) ;
24
+ if ( ie_v && ie_v < 8 ) return false ;
25
+ setTimeout ( function ( ) {
26
+ $ ( window ) . resize ( function ( ) {
27
+ myTheme . reset ( ) ;
28
+ } ) ;
29
+ } , 1000 ) ;
30
+ var tit = $exe_i18n . menu + " (" + $exe_i18n . hide . toLowerCase ( ) + ")" ;
31
+ var navToggler = '<p id="header-options">' ;
32
+ navToggler += '<a href="#" class="hide-nav" id="toggle-nav" title="' + tit + '">' ;
33
+ navToggler += '<span>' + $exe_i18n . menu + '</span>' ;
34
+ navToggler += '</a>' ;
35
+ navToggler += '</p>' ;
36
+ var l = $ ( navToggler ) ;
37
+ var nav = $ ( "#siteNav" ) ;
38
+ nav . before ( l ) ;
39
+ $ ( "#toggle-nav" ) . click ( function ( ) {
40
+ myTheme . toggleMenu ( this ) ;
41
+ return false ;
42
+ } ) ;
43
+ $ ( "#print-page" ) . click ( function ( ) {
44
+ window . print ( ) ;
45
+ return false ;
46
+ } ) ;
47
+ if ( $ ( "A" , nav ) . attr ( "class" ) . indexOf ( "active" ) == 0 ) $ ( "BODY" ) . addClass ( "home-page" ) ;
48
+ var url = window . location . href ;
49
+ url = url . split ( "?" ) ;
50
+ if ( url . length > 1 ) {
51
+ if ( url [ 1 ] . indexOf ( "nav=false" ) != - 1 ) {
52
+ myTheme . hideMenu ( ) ;
53
+ }
54
+ }
55
+ // Set the min-height for the content wrapper
56
+ $ ( "#main-wrapper" ) . css ( "min-height" , ( nav . height ( ) + 25 ) + "px" ) ;
57
+ } ,
58
+ init2 : function ( ) {
59
+ var ie_v = $exe . isIE ( ) ;
60
+ if ( ie_v && ie_v < 8 ) return false ;
61
+ setTimeout ( function ( ) {
62
+ $ ( window ) . resize ( function ( ) {
63
+ myTheme . reset ( ) ;
64
+ } ) ;
65
+ } , 1000 ) ;
66
+ var tit = $exe_i18n . menu + " (" + $exe_i18n . hide . toLowerCase ( ) + ")" ;
67
+ var navToggler = '<p id="header-options">' ;
68
+ navToggler += '<a href="#" class="hide-nav" id="toggle-nav" title="' + tit + '">' ;
69
+ navToggler += '<span>' + $exe_i18n . menu + '</span>' ;
70
+ navToggler += '</a>' ;
71
+ navToggler += '</p>' ;
72
+ var l = $ ( navToggler ) ;
73
+ var nav = $ ( "#siteNav" ) ;
74
+ nav . before ( l ) ;
75
+ $ ( "#toggle-nav" ) . click ( function ( ) {
76
+ myTheme . toggleMenu ( this ) ;
77
+ return false ;
78
+ } ) ;
79
+ $ ( "#print-page" ) . click ( function ( ) {
80
+ window . print ( ) ;
81
+ return false ;
82
+ } ) ;
83
+ if ( $ ( "A" , nav ) . attr ( "class" ) . indexOf ( "active" ) == 0 ) $ ( "BODY" ) . addClass ( "home-page" ) ;
84
+ var url = window . location . href ;
85
+ url = url . split ( "?" ) ;
86
+ if ( url . length > 1 ) {
87
+ if ( url [ 1 ] . indexOf ( "nav=false" ) != - 1 ) {
88
+ myTheme . hideMenu ( ) ;
89
+ }
90
+ }
91
+ // Set the min-height for the content wrapper
92
+ $ ( "#main-wrapper" ) . css ( "min-height" , ( nav . height ( ) + 25 ) + "px" ) ;
93
+ myTheme . hideMenu ( ) ;
94
+
95
+ } ,
96
+ hideMenu : function ( ) {
97
+ $ ( "#siteNav" ) . hide ( ) ;
98
+ $ ( document . body ) . addClass ( "no-nav" ) ;
99
+ myTheme . params ( "add" ) ;
100
+ var tit = $exe_i18n . menu + " (" + $exe_i18n . show . toLowerCase ( ) + ")" ;
101
+ $ ( "#toggle-nav" ) . attr ( "class" , "show-nav" ) . attr ( "title" , tit ) ;
102
+ } ,
103
+ toggleMenu : function ( e ) {
104
+ if ( typeof ( myTheme . isToggling ) == 'undefined' ) myTheme . isToggling = false ;
105
+ if ( myTheme . isToggling ) return false ;
106
+
107
+ var l = $ ( "#toggle-nav" ) ;
108
+
109
+ if ( ! e && $ ( window ) . width ( ) < 900 && l . css ( "display" ) != 'none' ) return false ; // No reset in mobile view
110
+ if ( ! e ) {
111
+ var tit = $exe_i18n . menu + " (" + $exe_i18n . show . toLowerCase ( ) + ")" ;
112
+ l . attr ( "class" , "show-nav" ) . attr ( "title" , tit ) ; // Reset
113
+ }
114
+
115
+ myTheme . isToggling = true ;
116
+
117
+ if ( l . attr ( "class" ) == 'hide-nav' ) {
118
+ var tit = $exe_i18n . menu + " (" + $exe_i18n . show . toLowerCase ( ) + ")" ;
119
+ l . attr ( "class" , "show-nav" ) . attr ( "title" , tit ) ;
120
+ $ ( "#siteFooter" ) . hide ( ) ;
121
+ $ ( "#siteNav" ) . slideUp ( 400 , function ( ) {
122
+ $ ( document . body ) . addClass ( "no-nav" ) ;
123
+ $ ( "#siteFooter" ) . show ( ) ;
124
+ myTheme . isToggling = false ;
125
+ } ) ;
126
+ myTheme . params ( "add" ) ;
127
+ } else {
128
+ var tit = $exe_i18n . menu + " (" + $exe_i18n . hide . toLowerCase ( ) + ")" ;
129
+ l . attr ( "class" , "hide-nav" ) . attr ( "title" , tit ) ;
130
+ $ ( document . body ) . removeClass ( "no-nav" ) ;
131
+ $ ( "#siteNav" ) . slideDown ( 400 , function ( ) {
132
+ myTheme . isToggling = false ;
133
+ } ) ;
134
+ myTheme . params ( "delete" ) ;
135
+ }
136
+
137
+ } ,
138
+ param : function ( e , act ) {
139
+ if ( act == "add" ) {
140
+ var ref = e . href ;
141
+ var con = "?" ;
142
+ if ( ref . indexOf ( ".html?" ) != - 1 ) con = "&" ;
143
+ var param = "nav=false" ;
144
+ if ( ref . indexOf ( param ) == - 1 ) {
145
+ ref += con + param ;
146
+ e . href = ref ;
147
+ }
148
+ } else {
149
+ // This will remove all params
150
+ var ref = e . href ;
151
+ ref = ref . split ( "?" ) ;
152
+ e . href = ref [ 0 ] ;
153
+ }
154
+ } ,
155
+ params : function ( act ) {
156
+ $ ( "A" , ".pagination" ) . each ( function ( ) {
157
+ myTheme . param ( this , act ) ;
158
+ } ) ;
159
+ } ,
160
+ reset : function ( ) {
161
+ myTheme . toggleMenu ( ) ;
162
+ } ,
163
+ common : {
164
+ init : function ( c ) {
165
+ var iDevices = $ ( ".iDevice_wrapper" ) ;
166
+ var firstIsText = false ;
167
+ iDevices . each ( function ( i ) {
168
+ if ( iDevices . length > 1 && i == 0 && this . className . indexOf ( "FreeTextIdevice" ) != - 1 ) {
169
+ $ ( ".iDevice" , this ) . css ( "margin-top" , 0 ) ;
170
+ firstIsText = true ;
171
+ }
172
+ // Use common CSS class names (so they have a similar presentation)
173
+ if ( ! $ ( this ) . hasClass ( "UDLcontentIdevice" ) ) {
174
+ var header = $ ( ".iDevice_header" , this ) ;
175
+ var icon = header . css ( "background-image" ) ;
176
+ if ( typeof ( icon ) == 'string' ) {
177
+ if ( icon . indexOf ( "icon_udl_eng" ) != - 1 ) $ ( this ) . addClass ( "em_iDevice_udl_eng_like" ) ;
178
+ if ( icon . indexOf ( "icon_udl_exp" ) != - 1 ) $ ( this ) . addClass ( "em_iDevice_udl_exp_like" ) ;
179
+ if ( icon . indexOf ( "icon_udl_rep" ) != - 1 ) $ ( this ) . addClass ( "em_iDevice_udl_rep_like" ) ;
180
+ }
181
+ }
182
+ } ) ;
183
+ if ( myTheme . collapseActivities ) {
184
+ var as = myTheme . activities ;
185
+ var editor = $ ( "#activeIdevice" ) ;
186
+ if ( typeof ( _ ) != 'function' || editor . length != 1 ) {
187
+ if ( $ ( ".iDevice" ) . length > 1 ) {
188
+ for ( var z = 0 ; z < as . length ; z ++ ) {
189
+ var a = as [ z ] ;
190
+ // Minimize those iDevices (like clicking on .toggle-idevice a)
191
+ var aW = $ ( ".iDevice_wrapper." + a + "Idevice" ) ;
192
+ aW . addClass ( "hidden-idevice" ) ;
193
+ $ ( ".toggle-idevice a" , aW ) . attr ( "class" , "show-idevice" ) ;
194
+ $ ( ".iDevice_inner" , aW ) . hide ( ) ;
195
+ if ( a == 'GeoGebra' ) $ ( "div.auto-geogebra" , aW ) . addClass ( "disableAutoScale" ) ; // Prevent zoom problems when the iDevice is minified
196
+ }
197
+ // The iDevices with the icon_udl_exp_tarea are minified too
198
+ $ ( ".iDevice_wrapper" ) . each ( function ( ) {
199
+ var header = $ ( ".iDevice_header" , this ) ;
200
+ if ( header . length == 1 ) {
201
+ var img = header . attr ( "style" ) ;
202
+ if ( typeof ( img ) == 'string' && ( img . indexOf ( "icon_udl_exp_tarea.svg" ) != - 1 || img . indexOf ( "icon_udl_exp_interactivo.svg" ) != - 1 ) ) {
203
+ var aW = $ ( this ) ;
204
+ aW . addClass ( "hidden-idevice" ) ;
205
+ $ ( ".toggle-idevice a" , aW ) . attr ( "class" , "show-idevice" ) ;
206
+ $ ( ".iDevice_inner" , aW ) . hide ( ) ;
207
+ }
208
+ }
209
+ } ) ;
210
+ // You can toggle the iDevice clicking on any part of its header
211
+ $ ( ".iDevice_header" ) . click ( function ( ) {
212
+ $ ( ".toggle-idevice a" , this ) . trigger ( "click" ) ;
213
+ var i = $ ( this ) . closest ( ".iDevice" ) ;
214
+ if ( i . length == 1 ) {
215
+ // H5P dynamic size
216
+ $ ( "iframe" , i ) . each ( function ( ) {
217
+ if ( this . src && ( this . src . indexOf ( "https://h5p.org/" ) == 0 || this . src . indexOf ( "/wp-admin/admin-ajax.php?action=h5p_embed" ) != - 1 ) ) {
218
+ if ( ! this . style || ! this . style . height || this . style . height == "" ) {
219
+ this . src = this . src ;
220
+ }
221
+ }
222
+ } ) ;
223
+ }
224
+ } ) . css ( "cursor" , "pointer" ) ;
225
+ }
226
+ }
227
+ }
228
+ // "Do it here" will be the default title of the Interactive Activities
229
+ if ( document . body . className . indexOf ( "exe-authoring-page" ) == 0 ) {
230
+ if ( typeof ( top . _ ) != 'undefined' ) {
231
+ var d = [
232
+ "DropDown Activity" ,
233
+ "SCORM Quiz" ,
234
+ "Scrambled List" ,
235
+ "Multi-choice" ,
236
+ "Multi-select" ,
237
+ "True-False Question" ,
238
+ "Cloze Activity" ,
239
+ "Interactive Video" ,
240
+ "GeoGebra Activity"
241
+ ] ;
242
+ var l = [
243
+ "ListaIdevice" ,
244
+ "QuizTestIdevice" ,
245
+ "ScrambledListIdevice" ,
246
+ "MultichoiceIdevice" ,
247
+ "MultiSelectIdevice" ,
248
+ "TrueFalseIdevice" ,
249
+ "ClozeIdevice" ,
250
+ "interactive-videoIdevice" ,
251
+ "GeoGebraIdevice"
252
+ ] ;
253
+ var editor = $ ( "#activeIdevice" ) ;
254
+ if ( editor . length != 1 ) return ;
255
+ var c = editor . attr ( "class" ) ;
256
+ var i = l . indexOf ( c ) ;
257
+ if ( i == - 1 ) return ;
258
+ var t = $ ( "input[type='text']" , editor ) . eq ( 0 ) ;
259
+ if ( t . length != 1 ) return ;
260
+ if ( t . val ( ) == _ ( d [ i ] ) ) t . val ( _ ( "Do it here" ) ) ;
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
266
+
267
+ $ ( function ( ) {
268
+ if ( $ ( "body" ) . hasClass ( "exe-web-site" ) ) {
269
+ if ( $ ( window ) . width ( ) < 829 && $ ( window ) . height ( ) < 1800 ) {
270
+ myTheme . init2 ( ) ;
271
+ } else {
272
+ myTheme . init ( ) ;
273
+ }
274
+ }
275
+ myTheme . common . init ( ) ;
276
+ } ) ;
0 commit comments