PluginProbe
bbPress / 2.6.19
bbPress v2.6.19
2.6.19 2.6.18 2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 All 74 releases
bbpress / templates / default / js / engagements.js

engagements.js in bbPress 2.6.19, at templates/default/js/engagements.js

62 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery( document ).ready( function ( $ ) {
2
3 function bbp_ajax_call( action, object, type, nonce, update_selector ) {
4 var $data = {
5 action : action,
6 id : object,
7 type : type,
8 nonce : nonce
9 };
10
11 $.post( bbpEngagementJS.bbp_ajaxurl, $data, function ( response ) {
12 if ( response.success ) {
13 $( update_selector ).html( response.content );
14 } else {
15 if ( !response.content ) {
16 response.content = bbpEngagementJS.generic_ajax_error;
17 }
18 window.alert( response.content );
19 }
20 } );
21 }
22
23 $( '#favorite-toggle' ).on( 'click', 'span a.favorite-toggle', function( e ) {
24 e.preventDefault();
25 bbp_ajax_call(
26 'favorite',
27 $( this ).data( 'bbp-object-id' ),
28 $( this ).data( 'bbp-object-type' ),
29 $( this ).data( 'bbp-nonce' ),
30 '#favorite-toggle'
31 );
32 } );
33
34 $( '#subscription-toggle' ).on( 'click', 'span a.subscription-toggle', function( e ) {
35 e.preventDefault();
36 bbp_ajax_call(
37 'subscription',
38 $( this ).data( 'bbp-object-id' ),
39 $( this ).data( 'bbp-object-type' ),
40 $( this ).data( 'bbp-nonce' ),
41 '#subscription-toggle'
42 );
43 } );
44
45 $( '.bbp-alert-outer' ).on( 'click', '.bbp-alert-close', function( e ) {
46 e.preventDefault();
47 $( this ).closest( '.bbp-alert-outer' ).fadeOut();
48 } );
49
50 $( '.bbp-alert-outer' ).on( 'click', function( e ) {
51 if ( this === e.target ) {
52 $( this ).closest( '.bbp-alert-outer' ).fadeOut();
53 }
54 } );
55
56 $( document ).keyup( function( e ) {
57 if ( e.keyCode === 27 ) {
58 $( '.bbp-alert-outer .bbp-alert-close' ).click();
59 }
60 } );
61 } );
62