r114134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114133‎ | r114134 | r114135 >
Date:13:03, 19 March 2012
Author:jdlrobson
Status:ok
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/javascripts/references.js
@@ -28,7 +28,7 @@
2929
3030 function init() {
3131 $( '<div id="mf-references"><div></div></div>' ).hide().appendTo( document.body );
32 - var close = function( ev ) {
 32+ var close = function() {
3333 $( '#mf-references' ).fadeOut( 500 );
3434 };
3535 $( '<button>close</button>' ).click( close ).appendTo( '#mf-references' );
@@ -40,14 +40,18 @@
4141 data = href && href.charAt(0) === '#' ?
4242 references[ href.substr( 1, href.length ) ] : null;
4343
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 );
4653 } else {
47 - html = $( '<a />' ).text( $(this).text() ).
48 - attr( 'href', href ).appendTo('<div />').parent().html();
 54+ close();
4955 }
50 - $( '#mf-references div' ).html( html );
51 - $( '#mf-references' ).fadeIn( 1000 );
5256 calculatePosition();
5357 ev.preventDefault();
5458 });

Follow-up revisions

RevisionCommit summaryAuthorDate
r114152track last link...jdlrobson16:40, 19 March 2012
r114206MFT r114134, r114136, r114144, r114145, r114150, r114152, r114157awjrichards22:26, 19 March 2012

Status & tagging log