mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 04:43:18 +00:00
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:
parent
325a8a3e27
commit
133a94cb89
|
@ -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;
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
Loading…
Reference in a new issue