Index: trunk/extensions/MobileFrontend/javascripts/toggle.js |
— | — | @@ -26,7 +26,6 @@ |
27 | 27 | label = document.createTextNode( MobileFrontend.message( visible ? 'expand-section' : 'collapse-section' ) ); |
28 | 28 | btn.className = visible ? 'show' : 'hide'; |
29 | 29 | btn.appendChild( label ); |
30 | | - btn.style.display = visible ? 'inline-block' : 'none'; |
31 | 30 | return btn; |
32 | 31 | } |
33 | 32 | if(!sectionHeadings) { |
— | — | @@ -73,9 +72,10 @@ |
74 | 73 | function wm_toggle_section( section_id ) { |
75 | 74 | var b = document.getElementById( 'section_' + section_id ), |
76 | 75 | bb = b.getElementsByTagName( 'button' ), i, s, e; |
77 | | - for ( i = 0; i <= 1; i++ ) { |
78 | | - s = bb[i].style; |
79 | | - s.display = s.display === 'none' || ( i && !s.display ) ? 'inline-block' : 'none'; |
| 76 | + if( u(b).hasClass( 'openSection' ) ) { |
| 77 | + u(b).removeClass( 'openSection' ); |
| 78 | + } else { |
| 79 | + u(b).addClass( 'openSection' ); |
80 | 80 | } |
81 | 81 | for ( i = 0, d = ['content_','anchor_']; i<=1; i++ ) { |
82 | 82 | e = document.getElementById( d[i] + section_id ); |
Index: trunk/extensions/MobileFrontend/javascripts/application.js |
— | — | @@ -36,6 +36,12 @@ |
37 | 37 | return [].slice.call( document.querySelectorAll( el ) ); |
38 | 38 | } |
39 | 39 | } |
| 40 | + |
| 41 | + function hasClass( name ) { |
| 42 | + var classNames = el.className.split( '' ); |
| 43 | + return classNames.indexOf( name ) > -1; |
| 44 | + } |
| 45 | + |
40 | 46 | function addClass( name ) { |
41 | 47 | var className = el.className, |
42 | 48 | classNames = className.split( ' ' ); |
— | — | @@ -66,6 +72,7 @@ |
67 | 73 | return { |
68 | 74 | addClass: addClass, |
69 | 75 | bind: bind, |
| 76 | + hasClass: hasClass, |
70 | 77 | remove: remove, |
71 | 78 | removeClass: removeClass |
72 | 79 | }; |
Index: trunk/extensions/MobileFrontend/stylesheets/common.css |
— | — | @@ -332,17 +332,23 @@ |
333 | 333 | margin: 0px; |
334 | 334 | } |
335 | 335 | |
336 | | -button.show { |
| 336 | +button.show, |
| 337 | +button.hide { /* for non-js browsers */ |
337 | 338 | display: none; |
338 | 339 | } |
339 | 340 | |
| 341 | +.togglingEnabled button.hide, |
| 342 | +.togglingEnabled .openSection button.show { |
| 343 | + display: none; |
| 344 | +} |
| 345 | + |
| 346 | +.togglingEnabled .openSection button.hide, |
340 | 347 | .togglingEnabled button.show { |
341 | 348 | display: inline-block; |
342 | 349 | } |
343 | 350 | |
344 | 351 | .togglingEnabled .content_block, |
345 | | -.togglingEnabled .section_anchors, |
346 | | -button.section_heading.hide { |
| 352 | +.togglingEnabled .section_anchors { |
347 | 353 | display: none; |
348 | 354 | } |
349 | 355 | |
Index: trunk/extensions/MobileFrontend/stylesheets/beta_common.css |
— | — | @@ -318,17 +318,23 @@ |
319 | 319 | margin: 0px; |
320 | 320 | } |
321 | 321 | |
322 | | -button.show { |
| 322 | +button.show, |
| 323 | +button.hide { /* for non-js browsers */ |
323 | 324 | display: none; |
324 | 325 | } |
325 | 326 | |
| 327 | +.togglingEnabled button.hide, |
| 328 | +.togglingEnabled .openSection button.show { |
| 329 | + display: none; |
| 330 | +} |
| 331 | + |
| 332 | +.togglingEnabled .openSection button.hide, |
326 | 333 | .togglingEnabled button.show { |
327 | 334 | display: inline-block; |
328 | 335 | } |
329 | 336 | |
330 | 337 | .togglingEnabled .content_block, |
331 | | -.togglingEnabled .section_anchors, |
332 | | -button.section_heading.hide { |
| 338 | +.togglingEnabled .section_anchors { |
333 | 339 | display: none; |
334 | 340 | } |
335 | 341 | |