mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-24 00:03:56 +00:00
Replace weird .select() reimplementation
Browsers have had a .select() method on <input>s and <textarea>s since the dawn of the web. Change-Id: Ib35415115291086300494ef1c6cb3063cd6b8e94
This commit is contained in:
parent
3ed21410a6
commit
1ed2804863
|
@ -739,23 +739,4 @@
|
|||
} );
|
||||
|
||||
mw.MultimediaViewer = MultimediaViewer;
|
||||
|
||||
// Quick hack to select all text in a text box
|
||||
$.fn.selectAll = function () {
|
||||
return this.each( function () {
|
||||
var range,
|
||||
start = 0,
|
||||
end = this.value.length;
|
||||
|
||||
if ( this.setSelectionRange ) {
|
||||
this.setSelectionRange( start, end );
|
||||
} else if ( this.createTextRange ) {
|
||||
range = this.createTextRange();
|
||||
range.collapse( true );
|
||||
range.moveEnd( 'character', end );
|
||||
range.moveStart( 'character', start );
|
||||
range.select();
|
||||
}
|
||||
} );
|
||||
};
|
||||
}( mediaWiki, jQuery, moment ) );
|
||||
|
|
|
@ -233,15 +233,7 @@
|
|||
|
||||
LIP.openFileUsageDialog = function () {
|
||||
function selectAllOnEvent() {
|
||||
var $this = $( this );
|
||||
|
||||
if ( $this.is( 'label' ) ) {
|
||||
$this = $this.parent().find( '#' + $this.prop( 'for' ) );
|
||||
}
|
||||
|
||||
$this.selectAll();
|
||||
|
||||
return false;
|
||||
this.select();
|
||||
}
|
||||
|
||||
var fileTitle = this.$useFile.data( 'title' ),
|
||||
|
|
Loading…
Reference in a new issue