Index: trunk/extensions/MobileFrontend/javascripts/references.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | |
30 | 30 | function init() { |
31 | 31 | $( '<div id="mf-references"><div></div></div>' ).hide().appendTo( document.body ); |
32 | | - var close = function( ev ) { |
| 32 | + var close = function() { |
33 | 33 | $( '#mf-references' ).fadeOut( 500 ); |
34 | 34 | }; |
35 | 35 | $( '<button>close</button>' ).click( close ).appendTo( '#mf-references' ); |
— | — | @@ -40,14 +40,18 @@ |
41 | 41 | data = href && href.charAt(0) === '#' ? |
42 | 42 | references[ href.substr( 1, href.length ) ] : null; |
43 | 43 | |
44 | | - if( data ) { |
45 | | - html = '<h3>[' + data.label + ']</h3>' + data.html; |
| 44 | + if( !$("#mf-references").is(":visible") ) { |
| 45 | + if( data ) { |
| 46 | + html = '<h3>[' + data.label + ']</h3>' + data.html; |
| 47 | + } else { |
| 48 | + html = $( '<a />' ).text( $(this).text() ). |
| 49 | + attr( 'href', href ).appendTo('<div />').parent().html(); |
| 50 | + } |
| 51 | + $( '#mf-references div' ).html( html ); |
| 52 | + $( '#mf-references' ).fadeIn( 1000 ); |
46 | 53 | } else { |
47 | | - html = $( '<a />' ).text( $(this).text() ). |
48 | | - attr( 'href', href ).appendTo('<div />').parent().html(); |
| 54 | + close(); |
49 | 55 | } |
50 | | - $( '#mf-references div' ).html( html ); |
51 | | - $( '#mf-references' ).fadeIn( 1000 ); |
52 | 56 | calculatePosition(); |
53 | 57 | ev.preventDefault(); |
54 | 58 | }); |