| 1 |
(function( $ ) { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
$(function() { |
| 5 |
|
| 6 |
/* For Input Switch */ |
| 7 |
$( '.input-switch' ).on( 'click', function() { |
| 8 |
var loader = $( this ).parent().next(); |
| 9 |
|
| 10 |
loader.show(); |
| 11 |
|
| 12 |
var main_control = $( this ); |
| 13 |
var data = { |
| 14 |
'action' : 'ew_switch', |
| 15 |
'value' : this.checked, |
| 16 |
'option_name' : main_control.attr( 'rel' ) |
| 17 |
}; |
| 18 |
|
| 19 |
$.post( ajaxurl, data, function( response ) { |
| 20 |
response = $.trim( response ); |
| 21 |
|
| 22 |
if ( '1' == response ) { |
| 23 |
main_control.parent().parent().addClass( 'active' ); |
| 24 |
main_control.parent().parent().removeClass( 'inactive' ); |
| 25 |
} else if( '0' == response ) { |
| 26 |
main_control.parent().parent().addClass( 'inactive' ); |
| 27 |
main_control.parent().parent().removeClass( 'active' ); |
| 28 |
} else { |
| 29 |
alert( response ); |
| 30 |
} |
| 31 |
|
| 32 |
loader.hide(); |
| 33 |
}); |
| 34 |
}); |
| 35 |
/* For Input Switch End */ |
| 36 |
}); |
| 37 |
|
| 38 |
$(function() { |
| 39 |
|
| 40 |
// Tabs |
| 41 |
$('.catchp_widget_settings .nav-tab-wrapper a').on('click', function(e){ |
| 42 |
e.preventDefault(); |
| 43 |
|
| 44 |
if( !$(this).hasClass('ui-state-active') ){ |
| 45 |
$('.nav-tab').removeClass('nav-tab-active'); |
| 46 |
$('.wpcatchtab').removeClass('active').fadeOut(0); |
| 47 |
|
| 48 |
$(this).addClass('nav-tab-active'); |
| 49 |
|
| 50 |
var anchorAttr = $(this).attr('href'); |
| 51 |
|
| 52 |
$(anchorAttr).addClass('active').fadeOut(0).fadeIn(500); |
| 53 |
} |
| 54 |
|
| 55 |
}); |
| 56 |
}); |
| 57 |
|
| 58 |
// jQuery Match Height init for sidebar spots |
| 59 |
$(document).ready(function() { |
| 60 |
$('.catchp-sidebar-spot .sidebar-spot-inner, .col-2 .catchp-lists li, .col-3 .catchp-lists li, .catch-modules').matchHeight(); |
| 61 |
}); |
| 62 |
|
| 63 |
$(function(){ |
| 64 |
/* CPT switch */ |
| 65 |
$( '.ctp-switch' ).on( 'click', function() { |
| 66 |
var loader = $( this ).parent().next(); |
| 67 |
|
| 68 |
loader.show(); |
| 69 |
|
| 70 |
var main_control = $( this ); |
| 71 |
var data = { |
| 72 |
'action' : 'ctp_switch', |
| 73 |
'value' : this.checked, |
| 74 |
'option_name' : main_control.attr( 'rel' ) |
| 75 |
}; |
| 76 |
|
| 77 |
$.post( ajaxurl, data, function( response ) { |
| 78 |
response = $.trim( response ); |
| 79 |
|
| 80 |
if ( '1' == response ) { |
| 81 |
main_control.parent().parent().addClass( 'active' ); |
| 82 |
main_control.parent().parent().removeClass( 'inactive' ); |
| 83 |
} else if( '0' == response ) { |
| 84 |
main_control.parent().parent().addClass( 'inactive' ); |
| 85 |
main_control.parent().parent().removeClass( 'active' ); |
| 86 |
} else { |
| 87 |
alert( response ); |
| 88 |
} |
| 89 |
loader.hide(); |
| 90 |
}); |
| 91 |
}); |
| 92 |
/* CPT switch End */ |
| 93 |
}); |
| 94 |
|
| 95 |
})( jQuery ); |
| 96 |
|