30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
jQuery(document).ready(function($){
|
|
|
|
// Switch tabs
|
|
$('.sp-tab-panel').siblings('.sp-tab-bar').find('a').click(function() {
|
|
$(this).closest('li').removeClass('wp-tab').addClass('wp-tab-active').siblings().removeClass('wp-tab-active').addClass('wp-tab').closest('.wp-tab-bar').siblings($(this).attr('href')).show().siblings('.wp-tab-panel').hide();
|
|
return false;
|
|
});
|
|
|
|
// Filter tabs
|
|
$('.sp-tab-panel').siblings('.sp-tab-select').find('select').change(function() {
|
|
var val = $(this).val();
|
|
$(this).closest('.sp-tab-select').siblings('.sp-tab-panel').find('.sp-post').hide(0, function() {
|
|
$(this).find('input').prop('disabled', true);
|
|
$(this).filter('.sp-filter-'+val).show(0, function() {
|
|
$(this).find('input').prop('disabled', false);
|
|
});
|
|
});
|
|
});
|
|
|
|
// Activate tab filters
|
|
$('.sp-tab-panel').siblings('.sp-tab-select').find('select').change();
|
|
|
|
// Change title
|
|
$('.sp-title-generator select').change(function() {
|
|
title = $('.sp-title-generator select[value!=0]').map(function(){
|
|
return $(this).find(':selected').html().replace(/&[^;]+;/g, '');
|
|
}).get().join(' vs ');
|
|
$('input[name=post_title]').val(title);
|
|
});
|
|
}); |