diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
commit | 9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch) | |
tree | 46d1a0dee7febef5c2d57a9f7b972be16a163b3d /resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js | |
parent | 78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff) |
update to MediaWiki 1.17.0
Diffstat (limited to 'resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js')
-rw-r--r-- | resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js b/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js new file mode 100644 index 00000000..5a7c777f --- /dev/null +++ b/resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js @@ -0,0 +1,24 @@ +/* + * JavaScript to enable right click edit functionality + */ +$( function() { + // Select all h1-h6 elements that contain editsection links + $( 'h1:has(.editsection a), ' + + 'h2:has(.editsection a), ' + + 'h3:has(.editsection a), ' + + 'h4:has(.editsection a), ' + + 'h5:has(.editsection a), ' + + 'h6:has(.editsection a)' + ).live( 'contextmenu', function( e ) { + // Get href of the [edit] link + var href = $(this).find( '.editsection a' ).attr( 'href' ); + // Check if target is the anchor link itself. If so, don't suppress the context menu; this + // way the reader can still do things like copy URL, open in new tab etc. + var $target = $( e.target ); + if ( !$target.is( 'a' ) && !$target.parent().is( '.editsection' ) ){ + window.location = href; + e.preventDefault(); + return false; + } + } ); +} ); |