diff -r 346c88efed21 -r 5e2f62d02dcd wp/wp-content/plugins/portfolio/js/script.js --- a/wp/wp-content/plugins/portfolio/js/script.js Mon Jun 08 16:11:51 2015 +0000 +++ b/wp/wp-content/plugins/portfolio/js/script.js Tue Jun 09 03:35:32 2015 +0200 @@ -1,94 +1,40 @@ -function update_postmeta() { +function update_images() { (function($){ - setMessage("
"+update_message+"
"); + setMessage( "" + prtfl_var.update_img_message + "
" ); var curr = 0; $.ajax({ - url: '../wp-admin/admin-ajax.php?action=prtfl_update_info',//update_url, + url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', type: "POST", - data: "action1=get_portfolio_id", - success: function(result) { - var list = eval('('+result+')'); - - if (!list) { - setError( ""+not_found_info+"
" ); - $("#ajax_update_postmeta").removeAttr("disabled"); + data: "action1=get_all_attachment" + '&prtfl_ajax_nonce_field=' + prtfl_var.prtfl_nonce, + success: function( result ) { + var list = eval( '(' + result + ')' ); + if ( ! list ) { + setError( "" + prtfl_var.not_found_img_info + "
" ); + $( "#ajax_update_images" ).removeAttr( "disabled" ); return; } - $('#prtfl_loader').show(); - - function updatenItem() { - if (curr >= list.length) { - $.ajax({ - url: '../wp-admin/admin-ajax.php?action=prtfl_update_info', - type: "POST", - data: "action1=update_options", - success: function(result) { - } - }); - $("#ajax_update_postmeta").removeAttr("disabled"); - setMessage(""+success+"
"); - $('#prtfl_loader').hide(); - return; - } - - $.ajax({ - url: '../wp-admin/admin-ajax.php?action=prtfl_update_info', - type: "POST", - data: "action1=update_info&id="+list[curr].ID, - success: function(result) { - curr = curr + 1; - updatenItem(); - } - }); - } - - updatenItem(); - }, - error: function( request, status, error ) { - setError( ""+error + request.status+"
" ); - } - }); - })(jQuery); -} - -function update_images() { - (function($){ - setMessage(""+update_img_message+"
"); - var curr = 0; - $.ajax({ - url: '../wp-admin/admin-ajax.php?action=prtfl_update_image',//update_img_url, - type: "POST", - data: "action1=get_all_attachment", - success: function(result) { - var list = eval('('+result+')'); - - if (!list) { - setError( ""+not_found_img_info+"
" ); - $("#ajax_update_images").removeAttr("disabled"); - return; - } - $('#prtfl_img_loader').show(); + $( '#prtfl_img_loader' ).show(); function updatenImageItem() { - if (curr >= list.length) { + if ( curr >= list.length ) { $.ajax({ url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', type: "POST", - data: "action1=update_options", - success: function(result) { + data: "action1=update_options" + '&prtfl_ajax_nonce_field=' + prtfl_var.prtfl_nonce, + success: function( result ) { + /**/ } }); - $("#ajax_update_images").removeAttr("disabled"); - setMessage(""+img_success+"
"); - $('#prtfl_img_loader').hide(); + $( "#ajax_update_images" ).removeAttr( "disabled" ); + setMessage("" + prtfl_var.img_success + "
"); + $( '#prtfl_img_loader' ).hide(); return; } - $.ajax({ url: '../wp-admin/admin-ajax.php?action=prtfl_update_image', type: "POST", - data: "action1=update_image&id="+list[curr].ID, - success: function(result) { + data: "action1=update_image&id=" + list[ curr ].ID + '&prtfl_ajax_nonce_field=' + prtfl_var.prtfl_nonce, + success: function( result ) { curr = curr + 1; updatenImageItem(); } @@ -98,24 +44,36 @@ updatenImageItem(); }, error: function( request, status, error ) { - setError( ""+img_error + request.status+"
" ); + setError( "" + prtfl_var.img_error + request.status + "
" ); } }); })(jQuery); } -function setMessage(msg) { +function setMessage( msg ) { (function($){ - $(".error").hide(); - $(".updated").html(msg); - $(".updated").show(); + $( ".error" ).hide(); + $( ".updated" ).html( msg ); + $( ".updated" ).show(); + $( '#prtfl_settings_notice' ).hide(); })(jQuery); } -function setError(msg) { +function setError( msg ) { (function($){ - $(".updated").hide(); - $(".error").html(msg); - $(".error").show(); + $( ".updated" ).hide(); + $( ".error" ).html( msg ); + $( ".error" ).show(); })(jQuery); } + +(function($) { + $(document).ready( function() { + $( '#prtfl_form_image_size input' ).bind( "change click select", function() { + if ( $( this ).attr( 'type' ) != 'submit' ) { + $( '.updated.fade' ).css( 'display', 'none' ); + $( '#prtfl_settings_notice' ).css( 'display', 'block' ); + }; + }); + }); +})(jQuery); \ No newline at end of file