Index: trunk/phase3/skins/common/rightclickedit.js |
— | — | @@ -43,6 +43,4 @@ |
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | | -} |
48 | | - |
49 | | -hookEvent("load", setupRightClickEdit); |
| 47 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1641,7 +1641,7 @@ |
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | if( $wgUser->getBoolOption( 'editsectiononrightclick' ) ) { |
1645 | | - $this->addModules( 'mediawiki.legacy.rightclickedit' ); |
| 1645 | + $this->addModules( 'mediawiki.advanced.rightclickedit' ); |
1646 | 1646 | } |
1647 | 1647 | |
1648 | 1648 | if( $wgUniversalEditButton ) { |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -319,6 +319,9 @@ |
320 | 320 | 'debugScripts' => 'resources/mediawiki/mediawiki.log.js', |
321 | 321 | 'debugRaw' => false |
322 | 322 | ) ), |
| 323 | + 'mediawiki.advanced.rightclickedit' => new ResourceLoaderFileModule( array( |
| 324 | + 'scripts' => 'resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js', |
| 325 | + ) ), |
323 | 326 | 'mediawiki.specials.preferences' => new ResourceLoaderFileModule( array( |
324 | 327 | 'scripts' => 'resources/mediawiki.specials/mediawiki.specials.preferences.js', |
325 | 328 | 'styles' => 'resources/mediawiki.specials/mediawiki.specials.preferences.css', |
Index: trunk/phase3/resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * JavaScript to enable right click edit functionality |
| 4 | + */ |
| 5 | + |
| 6 | +// Select all h1-h6 elements that contain editsection links |
| 7 | +$('h1, h2, h3, h4, h5, h6').filter( ':has(.editsection a)' ).bind( 'contextmenu', function( e ) { |
| 8 | + |
| 9 | + // Get href of the [edit] link |
| 10 | + var href = $(this).find( '.editsection a' ).attr( 'href' ); |
| 11 | + |
| 12 | + // Check if target is the anchor link itself. If so, dont supress the contextmenu |
| 13 | + // So that the reader can still do things like copy url, open in new tab etc. |
| 14 | + $target = $( e.target ); |
| 15 | + if( !$target.is( 'a' ) && !$target.parent().is( '.editsection' ) ){ |
| 16 | + window.location = href; |
| 17 | + e.preventDefault(); |
| 18 | + } |
| 19 | + |
| 20 | +}); |
\ No newline at end of file |
Property changes on: trunk/phase3/resources/mediawiki.advanced/mediawiki.advanced.rightclickedit.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |