subs-cpt.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. jQuery(document).ready(function($) {
  2. var nf_columns = {
  3. init: function() {
  4. //this.move_row_actions();
  5. // Remove our "ID" checkbox.
  6. $( '#id-hide' ).parent().remove();
  7. var that = this;
  8. $( document ).on( 'click', '.hide-column-tog', that.save_hidden_columns );
  9. },
  10. save_hidden_columns: function() {
  11. // Send our hidden columns to our backend for saving.
  12. var hidden = columns.hidden();
  13. $.post(
  14. ajaxurl,
  15. {
  16. form_id: nf_sub.form_id,
  17. hidden: hidden,
  18. action:'nf_hide_columns'
  19. }
  20. );
  21. // Move our row-actions
  22. //nf_columns.move_row_actions();
  23. },
  24. move_row_actions: function() {
  25. // Move our row-actions class to our first column.
  26. $( "#the-list tr" ).each( function( e ) {
  27. var first_column = $( this ).find( 'td:visible' ).eq(0);
  28. if ( typeof $( first_column ).html() == 'undefined' ) {
  29. first_column = $( this ).find( 'td:first' );
  30. }
  31. $( this ).find( 'td div.row-actions' ).detach().appendTo( first_column );
  32. });
  33. }
  34. }
  35. nf_columns.init();
  36. $( '.datepicker' ).datepicker( nf_sub.datepicker_args );
  37. $( document ).on( 'change', '.nf-form-jump', function( e ) {
  38. $( '#posts-filter' ).submit();
  39. });
  40. $( document ).on( 'submit', function( e ) {
  41. $( '.spinner' ).show();
  42. if ( $( 'select[name="action"]' ).val() == 'export' || $( 'select[name="action2"]' ).val() == 'export' ) {
  43. setTimeout(function(){ // Delay for Chrome
  44. $( 'input:checkbox' ).attr( 'checked', false );
  45. $( '.spinner' ).hide();
  46. $( 'select[name="action"]' ).val( '-1' );
  47. $( 'select[name="action2"]' ).val( '-1' );
  48. }, 2000);
  49. }
  50. });
  51. $( '.screen-options' ).prepend( $( '#nf-subs-screen-options' ).html() );
  52. $( '#nf-subs-screen-options' ).remove();
  53. });