-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbppbg.js
37 lines (27 loc) · 964 Bytes
/
bppbg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
jQuery( document ).ready( function () {
var jq = jQuery;
jq( "#bpprofbpg_change" ).on( 'click', '#bppg-del-image', function () {
var $this = jq( this );
jq.post( ajaxurl, {
action: 'bppg_delete_bg',
cookie: encodeURIComponent( document.cookie ),
_wpnonce: jq( $this.parents( 'form' ).get( 0 ) ).find( '#_wpnonce' ).val()
},
function ( response ) {
//remove the current image
jq( "div#message" ).remove();
$this.parent().before( jq( "<div id='message' class='update'>" + response + "</div>" ) );
$this.prev( 'current-bg' ).fadeOut( 100 );//hide current image
$this.parent().remove();//remove from dom the delete link
//give feedback
//remove the body class
jq( 'body' ).removeClass( 'is-user-profile' );
}
);
return false;
} )
//bind for live changes
jq( '.bppg-repeat-options' ).on( 'click', 'input', function () {
jq( ".is-user-profile" ).css( 'background-repeat', jq( this ).val() );
} );
} );