';
var _hasActive = false;
if ($('.nasa-widget-has-active, .widget_rating_filter, .widget_price_filter, .widget_layered_nav').length) {
$('.nasa-widget-has-active, .widget_rating_filter, .widget_price_filter, .widget_layered_nav').each(function() {
var _this = $(this);
var _title = $(_this).find('.widget-title').length ? $(_this).find('.widget-title').html() : '';
/**
* Attributes
*/
var _widget_act = $(_this).find('.nasa-filter-var-chosen').length ? true : false;
if (_widget_act) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.nasa-filter-var-chosen').each(function() {
var _href = $(this).attr('href');
var _class_item = 'nasa-ignore-variation-item nasa-filter-by-attrs';
_class_item += $(this).hasClass('nasa-filter-color') ? ' nasa-ignore-color-item' : '';
_class_item += $(this).hasClass('nasa-filter-image') ? ' nasa-ignore-image-item' : '';
_class_item += $(this).hasClass('nasa-filter-brand-item') ? ' nasa-ignore-brand-item' : '';
var _item = '
' + _close_svg + $(this).html() + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
/**
* Attributes Default
*/
var _df_act = $(_this).find('.woocommerce-widget-layered-nav-list__item--chosen').length ? true : false;
if (_df_act) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.woocommerce-widget-layered-nav-list__item--chosen').each(function() {
var _href = $(this).find('a').attr('href');
var _class_item = 'nasa-ignore-variation-item nasa-filter-by-attrs';
var _text = '
' + $(this).find('a').html() + '';
_text += $(this).find('.count').length ? '
' + $(this).find('.count').html() + '' : '';
var _item = '
' + _close_svg + _text + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
/**
* Filter Status
*/
var _filter_act = $(_this).find('.nasa-filter-status.nasa-active').length ? true : false;
if (_filter_act) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.nasa-filter-status.nasa-active').each(function() {
var _href = $(this).attr('href');
var _data_filter = $(this).attr('data-filter');
var _item = '
' + _close_svg + $(this).html() + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
/**
* Filter Alphabet
*/
var _filter_alp = $(_this).find('.nasa-filter-alphabet.nasa-active').length ? true : false;
if (_filter_alp) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.nasa-filter-alphabet.nasa-active').each(function() {
var _href = $(this).attr('href');
var _data_filter = $(this).attr('data-filter');
var _item = '
' + _close_svg + $(this).html() + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
/**
* Nasa Price Slide
*/
if ($(_this).find('.reset_price[data-filtered="1"]').length) {
_hasActive = true;
var _price_label = '';
if ($(_this).find('.price_label .from').length) {
_price_label += '
' + $(_this).find('.price_label .from').html() + '';
}
if ($(_this).find('.price_label .to').length) {
_price_label += _price_label !== '' ? ' — ' : '';
_price_label += '
' + $(_this).find('.price_label .to').html() + '';
}
var _class_price = _price_label !== '' ? 'nasa-wrap-active-top' : 'nasa-price-active-init hidden-tag';
_act_content += '
';
if (_price_label !== '') {
_act_content += _title ? '
' + _title + '' : '';
var _item = '
' + _close_svg + _price_label + '';
_act_content += '
' + _item + '';
}
_act_content += '
';
}
/**
* Filter List
*/
if ($(_this).find('.nasa-price-filter-list .nasa-active').length) {
var _active_price_list = $(_this).find('.nasa-price-filter-list .nasa-active');
if (!$(_active_price_list).hasClass('nasa-all-price')) {
_hasActive = true;
_act_content += '
';
var _price_label = $(_this).find('.nasa-price-filter-list .nasa-active').find('.nasa-filter-price-text').html();
_act_content += _title ? '
' + _title + '' : '';
var _item = '
' + _close_svg + _price_label + '';
_act_content += '
' + _item + '';
_act_content += '
';
}
}
/**
* Filter Tags
*/
if ($(_this).find('.nasa-filter-tag.nasa-active').length) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.nasa-filter-tag.nasa-active').each(function() {
var _href = $(this).attr('href');
var _data_filter = $(this).attr('data-filter');
var _item = '
' + _close_svg + $(this).html() + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
/**
* Filter Multi Cat
*/
if ($(_this).find('.nasa-filter-cat.nasa-active').length) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.nasa-filter-cat.nasa-active').each(function() {
var _href = $(this).attr('href');
var _data_filter = $(this).attr('data-filter');
var _item = '
' + _close_svg + $(this).html() + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
/**
* Filter Rating
*/
if ($(_this).find('.wc-layered-nav-rating.chosen').length) {
_hasActive = true;
_act_content += '
';
_act_content += _title ? '
' + _title + '' : '';
$(_this).find('.wc-layered-nav-rating.chosen').each(function() {
var _this = $(this).find('a');
var _href = $(_this).attr('href');
var _item = '
' + $(_this).html() + '';
_act_content += '
' + _item + '';
});
_act_content += '
';
}
});
}
// Reset btn
if (_hasActive && $('.nasa-widget-has-active .nasa-reset-filters-btn').length) {
_act_content += '
';
$('.nasa-widget-has-active .nasa-reset-filters-btn').addClass('nasa-reset-filters-top');
$('.nasa-widget-has-active .nasa-reset-filters-btn').wrap('
');
var _reset_text = $('.nasa-widget-has-active .nasa-reset-filters-btn-wrap').html();
_act_content += _reset_text;
_act_content += '
';
}
_act_content += '
';
return _hasActive ? _act_content : '';
}
/**
* Check have items active filter topbar type 1
* @param {type} $
* @param {type} _widget
* @returns {Boolean}
*/
function active_topbar_check($, _widget) {
if (
$(_widget).find('.nasa-act-filter-item').length ||
$(_widget).find('.nasa-filter-var-chosen').length ||
$(_widget).find('.nasa-filter-status.nasa-active').length ||
$(_widget).find('.nasa-filter-alphabet.nasa-active').length ||
$(_widget).find('.nasa-price-filter-list .nasa-active').length ||
$(_widget).find('.nasa-filter-tag.nasa-active').length ||
($(_widget).find('input[name="nasa_hasPrice"]').length && $(_widget).find('input[name="nasa_hasPrice"]').val() === '1')
) {
return true;
}
return false;
}
/**
* Active Topbar
* @param {type} $
* @returns {undefined}
*/
function load_active_topbar($) {
if ($('.nasa-tab-filter-topbar').length) {
$('.nasa-tab-filter-topbar').each(function() {
var _this = $(this);
var _widget = $(_this).attr('data-widget');
if ($(_widget).length) {
if (active_topbar_check($, _widget)) {
if (!$(_this).hasClass('nasa-active')) {
$(_this).addClass('nasa-active');
}
} else {
$(_this).removeClass('nasa-active');
}
}
});
}
$('.nasa-tranparent-filter').trigger('click');
$('.transparent-mobile').trigger('click');
}
/**
* Toggle Sidebar classic
* @param {type} $
* @returns {undefined}
*/
function load_toggle_sidebar_classic($) {
if ($('.nasa-with-sidebar-classic').length && $('.nasa-toogle-sidebar-classic').length) {
var toggle_show = $.cookie('toggle_sidebar_classic');
if (toggle_show === 'hide') {
$('.nasa-toogle-sidebar-classic').addClass('nasa-hide');
$('.nasa-with-sidebar-classic').addClass('nasa-with-sidebar-hide');
} else {
$('.nasa-toogle-sidebar-classic').removeClass('nasa-hide');
$('.nasa-with-sidebar-classic').removeClass('nasa-with-sidebar-hide');
}
setTimeout(function() {
$('body').trigger('nasa_after_toggle_sidebar_classic_timeout');
}, 500);
}
if ($('.nasa-with-sidebar-classic').length && !$('.nasa-with-sidebar-classic').hasClass('nasa-inited')) {
$('.nasa-with-sidebar-classic').addClass('nasa-inited');
}
}
/**
* Render top bar shop page
*
* @param {type} $
* @returns {undefined}
*/
function init_nasa_top_sidebar($) {
if ($('.nasa-top-sidebar').length) {
$('body').trigger('before_init_nasa_topsidebar');
var wk = 0;
var top_row = '