summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
blob: 2be29f096385b3a2295e12c9259fd510809510cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*!
 * Enables double-click-to-edit functionality.
 */
( function ( mw, $ ) {
	$( function () {
		mw.util.$content.dblclick( function ( e ) {
			// Recheck preference so extensions can do a hack to disable this code.
			if ( parseInt( mw.user.options.get( 'editondblclick' ), 10 ) ) {
				e.preventDefault();
				// Trigger native HTMLElement click instead of opening URL (bug 43052)
				var $a = $( '#ca-edit a' );
				// Not every page has an edit link (bug 57713)
				if ( $a.length ) {
					$a.get( 0 ).click();
				}
			}
		} );
	} );
}( mediaWiki, jQuery ) );