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