Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/jet-smart-filters   php

Repository URL to install this package:

Version: 2.2.1 

/ src / js / filters / ButtonRemove.js

import Filter from 'bases/Filter';
import eventBus from 'includes/event-bus';

export default class ButtonRemove extends Filter {
	name = 'button-remove';

	constructor ($container) {
		const $filter = $container.find('.jet-remove-all-filters__button');

		super($filter, $container.find('.jet-remove-all-filters'));

		this.$elementorWidget = this.$container.closest('.hide-widget');

		this.$filter.on('click', () => {
			this.emitFitersRemove();
		});

		// Event subscriptions
		eventBus.subscribe('activeItems/change', (activeItems, provider, queryId) => {
			if (!this.isCurrentProvider({ provider, queryId }) && !this.isAdditionalProvider({ provider, queryId }))
				return;

			if (activeItems.length) {
				this.show();
				this.$elementorWidget.removeClass('hide-widget');
			} else {
				this.hide();
				this.$elementorWidget.addClass('hide-widget');
			}
		});
	}
}