Move focus event handlers to mmv.ui.Element

Needed to make sure the download dialog can use the handlers.

Change-Id: If62146f1181f0e722be691f61e5fdc133c9b3795
This commit is contained in:
Mark Holmquist 2014-09-22 10:44:44 -07:00 committed by Gilles Dubuc
parent 325a8a3e27
commit 133a94cb89
2 changed files with 23 additions and 23 deletions

View file

@ -219,6 +219,29 @@
} );
};
/**
* Makes the entire input/textarea selected when focused.
* Invoked with that input/textarea as context.
*/
EP.selectAllOnEvent = function () {
try {
this.select();
} catch ( e ) {
// IE doesn't like when select() is called during the onfocus handler
}
};
/**
* Reduces the action of clicks to solely focusing the input/textarea.
* Essentialy disables clicking inside the text to select a portion of it.
* Invoked with that input/textarea as context.
*/
EP.onlyFocus = function ( e ) {
this.focus();
e.preventDefault();
return false;
};
mw.mmv.ui = {};
mw.mmv.ui.reuse = {};
mw.mmv.ui.Element = Element;

View file

@ -52,28 +52,5 @@
this.$pane.removeClass( 'active' );
};
/**
* Makes the entire input/textarea selected when focused.
* Invoked with that input/textarea as context.
*/
TP.selectAllOnEvent = function () {
try {
this.select();
} catch ( e ) {
// IE doesn't like when select() is called during the onfocus handler
}
};
/**
* Reduces the action of clicks to solely focusing the input/textarea.
* Essentialy disables clicking inside the text to select a portion of it.
* Invoked with that input/textarea as context.
*/
TP.onlyFocus = function ( e ) {
this.focus();
e.preventDefault();
return false;
};
mw.mmv.ui.reuse.Tab = Tab;
}( mediaWiki, jQuery, OO ) );