| 1 |
(function( $ ) { |
| 2 |
'use strict'; |
| 3 |
$(function() { |
| 4 |
// Tabs |
| 5 |
$('.catch_widget_settings .nav-tab-wrapper a').on('click', function(e){ |
| 6 |
e.preventDefault(); |
| 7 |
|
| 8 |
if( !$(this).hasClass('ui-state-active') ){ |
| 9 |
$('.nav-tab').removeClass('nav-tab-active'); |
| 10 |
|
| 11 |
$('.wpcatchtab').removeClass('active').fadeOut(0); |
| 12 |
|
| 13 |
$(this).addClass('nav-tab-active'); |
| 14 |
|
| 15 |
var anchorAttr = $(this).attr('href'); |
| 16 |
|
| 17 |
$(anchorAttr).addClass('active').fadeOut(0).fadeIn(500); |
| 18 |
} |
| 19 |
|
| 20 |
}); |
| 21 |
|
| 22 |
/* CPT switch */ |
| 23 |
$( '.ctp-switch' ).on( 'click', function() { |
| 24 |
var loader = $( this ).parent().next(); |
| 25 |
|
| 26 |
loader.show(); |
| 27 |
|
| 28 |
var main_control = $( this ); |
| 29 |
var data = { |
| 30 |
'action' : 'ctp_switch', |
| 31 |
'value' : this.checked, |
| 32 |
'option_name' : main_control.attr( 'rel' ) |
| 33 |
}; |
| 34 |
|
| 35 |
$.post( ajaxurl, data, function( response ) { |
| 36 |
response = $.trim( response ); |
| 37 |
|
| 38 |
if ( '1' == response ) { |
| 39 |
main_control.parent().parent().addClass( 'active' ); |
| 40 |
main_control.parent().parent().removeClass( 'inactive' ); |
| 41 |
} else if( '0' == response ) { |
| 42 |
main_control.parent().parent().addClass( 'inactive' ); |
| 43 |
main_control.parent().parent().removeClass( 'active' ); |
| 44 |
} else { |
| 45 |
alert( response ); |
| 46 |
} |
| 47 |
loader.hide(); |
| 48 |
}); |
| 49 |
}); |
| 50 |
/* CPT switch End */ |
| 51 |
}); |
| 52 |
|
| 53 |
// jQuery Match Height init for sidebar spots |
| 54 |
$(document).ready(function() { |
| 55 |
$('.catch-sidebar-spot .sidebar-spot-inner, .col-2 .catch-lists li, .col-3 .catch-lists li, .catch-modules').matchHeight(); |
| 56 |
}); |
| 57 |
// jQuery UI Tooltip initializaion |
| 58 |
$(document).ready(function() { |
| 59 |
$('.tooltip').tooltip(); |
| 60 |
}); |
| 61 |
})( jQuery ); |
| 62 |
|