2 * JavaScript to enable right click edit functionality
4 jQuery( function( $ ) {
5 // Select all h1-h6 elements that contain editsection links
6 $( 'h1:has(.editsection a), ' +
7 'h2:has(.editsection a), ' +
8 'h3:has(.editsection a), ' +
9 'h4:has(.editsection a), ' +
10 'h5:has(.editsection a), ' +
11 'h6:has(.editsection a)'
12 ).live( 'contextmenu', function( e
) {
13 // Get href of the [edit] link
14 var href
= $(this).find( '.editsection a' ).attr( 'href' );
15 // Check if target is the anchor link itself. If so, don't suppress the context menu; this
16 // way the reader can still do things like copy URL, open in new tab etc.
17 var $target
= $( e
.target
);
18 if ( !$target
.is( 'a' ) && !$target
.parent().is( '.editsection' ) ){
19 window
.location
= href
;