Debian Codegraph @

resources/src/mediawiki.misc-authed-pref/dblClickEdit.js

raw symbols SCIP
1 /*!
2 * Enable double-click-to-edit functionality.
3 */
4 ( function () {
5 if ( Number( mw.user.options.get( 'editondblclick' ) ) !== 1 ) {
6 // Support both 1 or "1" (T54542)
7 return;
8 }
9
10 if ( mw.config.get( 'wgAction' ) !== 'view' ) {
11 // Only trigger during view action.
12 return;
13 }
14
15 $( () => {
16 $( '#mw-content-text' ).on( 'dblclick', ( e ) => {
17 // Trigger native HTMLElement click instead of opening URL (T45052)
18 const $a = $( '#ca-edit a' );
19 // Not every page has an edit link (T59713)
20 if ( $a.length ) {
21 e.preventDefault();
22 $a.get( 0 ).click();
23 }
24 } );
25 } );
26 }() );