https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114134
Revision: 114134 Author: jdlrobson Date: 2012-03-19 13:03:41 +0000 (Mon, 19 Mar 2012) Log Message: ----------- make references close on a second click following erik's suggestion clicking on a reference a second time now turns it off (Reduces need for finger movement when checking multiple refs or accidentally opening refs.) Modified Paths: -------------- trunk/extensions/MobileFrontend/javascripts/references.js Modified: trunk/extensions/MobileFrontend/javascripts/references.js =================================================================== --- trunk/extensions/MobileFrontend/javascripts/references.js 2012-03-19 12:57:12 UTC (rev 114133) +++ trunk/extensions/MobileFrontend/javascripts/references.js 2012-03-19 13:03:41 UTC (rev 114134) @@ -28,7 +28,7 @@ function init() { $( '<div id="mf-references"><div></div></div>' ).hide().appendTo( document.body ); - var close = function( ev ) { + var close = function() { $( '#mf-references' ).fadeOut( 500 ); }; $( '<button>close</button>' ).click( close ).appendTo( '#mf-references' ); @@ -40,14 +40,18 @@ data = href && href.charAt(0) === '#' ? references[ href.substr( 1, href.length ) ] : null; - if( data ) { - html = '<h3>[' + data.label + ']</h3>' + data.html; + if( !$("#mf-references").is(":visible") ) { + if( data ) { + html = '<h3>[' + data.label + ']</h3>' + data.html; + } else { + html = $( '<a />' ).text( $(this).text() ). + attr( 'href', href ).appendTo('<div />').parent().html(); + } + $( '#mf-references div' ).html( html ); + $( '#mf-references' ).fadeIn( 1000 ); } else { - html = $( '<a />' ).text( $(this).text() ). - attr( 'href', href ).appendTo('<div />').parent().html(); + close(); } - $( '#mf-references div' ).html( html ); - $( '#mf-references' ).fadeIn( 1000 ); calculatePosition(); ev.preventDefault(); }); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs