(function ($) {
var RADIO_SETTINGS_TOGGLE = {
inputSel: 'dgwt-wcas-options-toggle input[type=radio]',
groupSel: 'dgwt_wcas_settings-group',
reloadChoices: function (name) {
var _this = this,
$group = $('[name="' + name + '"]').closest('.' + _this.groupSel),
value = $('[name="' + name + '"]:checked').val(),
currentClass = '';
_this.hideAll($group);
value = value.replace('_', '-');
if (value.length > 0) {
currentClass = 'wcas-opt-' + value;
}
if ($('.' + currentClass).length > 0) {
$('.' + currentClass).fadeIn();
}
},
hideAll: function ($group) {
$group.find('tr[class*="wcas-opt-"]').hide();
},
registerListeners: function () {
var _this = this;
$('.' + _this.inputSel).on('change', function () {
_this.reloadChoices($(this).attr('name'));
});
},
init: function () {
var _this = this,
$sel = $('.' + _this.inputSel + ':checked');
if ($sel.length > 0) {
_this.registerListeners();
$sel.each(function () {
_this.reloadChoices($(this).attr('name'));
});
}
}
};
var CHECKBOX_SETTINGS_TOGGLE = {
inputSel: 'dgwt-wcas-options-cb-toggle input[type=checkbox]',
groupSel: 'dgwt_wcas_settings-group',
reloadChoices: function ($el) {
var _this = this,
checked = $el.is(':checked'),
groupClass = _this.getGroupSelector($el);
$('.' + groupClass + ':not(.dgwt-wcas-options-cb-toggle)').hide();
if (checked) {
$('.' + groupClass).each(function () {
if (!(
$(this).hasClass('js-dgwt-wcas-adv-settings')
&& $('.js-dgwt-wcas-adv-settings-toggle').hasClass('woocommerce-input-toggle--disabled')
)
) {
$(this).fadeIn();
}
});
}
},
getGroupSelector($el) {
var $row = $el.closest('.dgwt-wcas-options-cb-toggle'),
className = '',
classList = $row.attr('class').split(/\s+/);
$.each(classList, function (index, item) {
if (item.indexOf('js-dgwt-wcas-cbtgroup-') !== -1) {
className = item;
}
});
return className;
},
registerListeners: function () {
var _this = this;
$(document).on('change', '.' + _this.inputSel, function () {
_this.reloadChoices($(this));
});
},
refresh: function () {
var _this = this,
$sel = $('.' + _this.inputSel);
if ($sel.length > 0) {
$sel.each(function () {
var checked = $(this).is(':checked'),
groupClass = _this.getGroupSelector($(this));
if (checked) {
$('.' + groupClass).fadeIn();
} else {
$('.' + groupClass + ':not(.dgwt-wcas-options-cb-toggle)').hide();
}
});
}
},
init: function () {
var _this = this,
$sel = $('.' + _this.inputSel);
if ($sel.length > 0) {
_this.registerListeners();
$sel.each(function () {
_this.reloadChoices($(this));
});
}
}
};
var CHECKBOX_SETTINGS_TOGGLE_SIBLING = {
inputSel: 'js-dgwt-wcas-options-toggle-sibling input[type=checkbox]',
toogleSibling: function ($el) {
var _this = this;
var checked = $el.is(':checked');
if (checked) {
$el.closest('label').next().fadeIn();
} else {
$el.closest('label').next().hide();
}
},
registerListeners: function () {
var _this = this;
$(document).on('change', '.' + _this.inputSel, function () {
_this.toogleSibling($(this));
});
},
init: function () {
var _this = this;
var $sel = $('.' + _this.inputSel);
if ($sel.length > 0) {
_this.registerListeners();
$sel.each(function () {
_this.toogleSibling($(this));
});
}
}
};
var CONDITIONAL_LAYOUT_SETTINGS = {
layoutSelect: "select[id*='search_layout']",
overlayMobile: "input[id*='enable_mobile_overlay']",
switchLayoutBreakpoint: "input[id*='mobile_breakpoint']",
mobileOverlayBreakpoint: "input[id*='mobile_overlay_breakpoint']",
searchIconColor: "input[id*='search_icon_color']",
$layoutSelectEl: null,
$overlayMobileEl: null,
$switchLayoutBreakpointEl: null,
$mobileOverlayBreakpointEl: null,
$searchIconColorEl: null,
setConditions: function () {
var _this = this,
layoutVal = _this.$layoutSelectEl.find('option:selected').val(),
overlayOnMobileVal = _this.$overlayMobileEl.is(':checked'),
hasAdvSettings = $('.js-dgwt-wcas-adv-settings-toggle').hasClass('woocommerce-input-toggle--enabled');
_this.hideOption(_this.$switchLayoutBreakpointEl);
_this.hideOption(_this.$mobileOverlayBreakpointEl);
_this.hideOption(_this.$searchIconColorEl);
$("input[id*='bg_search_icon_color']").closest('tr').show();
switch (layoutVal) {
case 'icon':
if (hasAdvSettings) {
_this.showOption(_this.$searchIconColorEl);
}
break;
case 'icon-flexible':
case 'icon-flexible-inv':
if (hasAdvSettings) {
_this.showOption(_this.$switchLayoutBreakpointEl);
_this.showOption(_this.$searchIconColorEl);
}
break;
default:
if (hasAdvSettings) {
$("input[id*='bg_search_icon_color']").closest('tr').hide();
}
break;
}
if (overlayOnMobileVal) {
_this.showOption(_this.$mobileOverlayBreakpointEl);
}
},
hideOption: function ($el) {
$el.closest('tr').hide();
},
showOption: function ($el) {
$el.closest('tr').show();
},
registerListeners: function () {
var _this = this;
_this.$layoutSelectEl.on('change', function () {
_this.setConditions();
});
_this.$overlayMobileEl.on('change', function () {
_this.setConditions();
});
},
init: function () {
var _this = this,
$layoutSelectEl = $(_this.layoutSelect);
if ($layoutSelectEl.length > 0) {
_this.$layoutSelectEl = $layoutSelectEl;
_this.$overlayMobileEl = $(_this.overlayMobile);
_this.$switchLayoutBreakpointEl = $(_this.switchLayoutBreakpoint);
_this.$mobileOverlayBreakpointEl = $(_this.mobileOverlayBreakpoint);
_this.$searchIconColorEl = $(_this.searchIconColor);
_this.registerListeners();
setTimeout(function () {
_this.setConditions();
}, 400);
}
}
};
var AJAX_BUILD_INDEX = {
actionTriggerClass: 'js-ajax-build-index',
actionStopTriggerClass: 'js-ajax-stop-build-index',
indexingWrapperClass: 'js-dgwt-wcas-indexing-wrapper',
indexerTabProgressClass: 'js-dgwt-wcas-indexer-tab-progress',
indexerTabErrorClass: 'js-dgwt-wcas-indexer-tab-error',
indexerMenuErrorClass: 'dgwt-wcas-menu-warning-icon',
getWrapper: function () {
var _this = this;
return $('.' + _this.indexingWrapperClass).closest('.dgwt-wcas-settings-info');
},
registerListeners: function () {
var _this = this;
$(document).on('click', '.' + _this.actionTriggerClass, function (e) {
e.preventDefault();
var $btn = $(this);
$btn.attr('disabled', 'disabled');
$('.dgwt-wcas-settings-info').addClass('wcas-ajax-build-index-wait');
$('.' + _this.indexerTabErrorClass).removeClass('active');
$('.' + _this.indexerTabProgressClass).addClass('active');
var emergency = $btn.hasClass('js-ajax-build-index-emergency') ? true : false;
if (emergency) {
$('.dgwt-wcas-indexing-header__title').text('[Emergency mode] Wait... Indexing in progress');
$('.dgwt-wcas-indexing-header__troubleshooting, .dgwt-wcas-indexing-header__actions, .js-dgwt-wcas-indexer-details').hide();
}
$.ajax({
url: ajaxurl,
type: 'post',
data: {
action: 'dgwt_wcas_build_index',
emergency: emergency,
_wpnonce: dgwt_wcas.nonces.build_index,
},
success: function (response) {
if (typeof response != 'undefined' && response.success) {
_this.getWrapper().html(response.data.html);
_this.heartbeat();
}
},
complete: function () {
$btn.removeAttr('disabled');
$('.dgwt-wcas-settings-info').removeClass('wcas-ajax-build-index-wait');
if (emergency) {
window.location.reload();
}
}
});
})
$(document).on('click', '.' + _this.actionStopTriggerClass, function (e) {
e.preventDefault();
var $btn = $(this);
$btn.attr('disabled', 'disabled');
_this.getWrapper().attr('data-stopping', '1');
$.ajax({
url: ajaxurl,
type: 'post',
data: {
action: 'dgwt_wcas_stop_build_index',
_wpnonce: dgwt_wcas.nonces.stop_build_index,
},
success: function (response) {
if (typeof response != 'undefined' && response.success) {
_this.getWrapper().html(response.data.html);
_this.heartbeat();
}
},
complete: function () {
_this.getWrapper().attr('data-stopping', '0');
}
});
})
},
heartbeat: function () {
var _this = this;
setTimeout(function () {
$.ajax({
url: ajaxurl,
type: 'post',
data: {
action: 'dgwt_wcas_build_index_heartbeat',
_wpnonce: dgwt_wcas.nonces.build_index_heartbeat,
},
success: function (response) {
if (typeof response != 'undefined' && response.success) {
if (_this.getWrapper().attr('data-stopping') === '1') {
return;
}
_this.getWrapper().html(response.data.html);
if (response.data.loop) {
_this.heartbeat();
} else {
$('.' + _this.indexerTabProgressClass).removeClass('active');
if (response.data.status === 'error') {
$('.' + _this.indexerTabErrorClass).addClass('active');
} else if (response.data.status === 'completed') {
$('.' + _this.indexerMenuErrorClass).remove();
}
}
if (!response.data.loop && response.data.refresh_once.length > 0) {
// If refresh cookie non exist and Troubleshooting tab is hidden then reload
if (
!document.cookie.split(';').some(function (item) {
return item.trim().indexOf('dgwt_wcas_refresh_once=' + response.data.refresh_once) === 0;
}) &&
$('#dgwt_wcas_troubleshooting-tab').css('display') === 'none'
) {
document.cookie = 'dgwt_wcas_refresh_once=' + response.data.refresh_once;
location.reload();
}
}
}
}
});
}, 1000);
},
detailsToggle: function () {
var _this = this,
display;
$(document).on('click', '.js-dgwt-wcas-indexing-details-trigger', function (e) {
e.preventDefault();
var $details = $('.js-dgwt-wcas-indexer-details');
if ($details.hasClass('show')) {
$details.removeClass('show');
$details.addClass('hide');
$('.js-dgwt-wcas-indexing__showd').addClass('show').removeClass('hide');
$('.js-dgwt-wcas-indexing__hided').addClass('hide').removeClass('show');
display = false;
} else {
$details.addClass('show');
$details.removeClass('hide');
$('.js-dgwt-wcas-indexing__showd').addClass('hide').removeClass('show');
$('.js-dgwt-wcas-indexing__hided').addClass('show').removeClass('hide');
display = true;
}
$.ajax({
url: ajaxurl,
type: 'post',
data: {
action: 'dgwt_wcas_index_details_toggle',
display: display
}
});
});
},
init: function () {
var _this = this;
_this.registerListeners();
if ($('.' + _this.indexingWrapperClass).length > 0 && typeof dgwt_wcas['is_premium'] !== 'undefined') {
_this.heartbeat();
}
_this.detailsToggle();
}
};
var SELECTIZE = {
init: function () {
var _this = this;
if ($('.dgwt-wcas-selectize').length > 0) {
$.ajax({
url: ajaxurl,
data: {
action: 'dgwt_wcas_settings_list_custom_fields',
_wpnonce: $('.dgwt-wcas-selectize').data('security')
},
success: function (res) {
if (typeof res != 'undefined' && typeof res.data != 'undefined') {
_this.initSelectize(res.data);
}
}
});
}
},
initSelectize: function (loadedOptions) {
var $inputs = $('.dgwt-wcas-selectize');
if ($inputs.length > 0) {
$inputs.each(function () {
var $input = $(this);
var optionsRaw = $input.data('options');
var options = loadedOptions;
if (optionsRaw.length > 0) {
optionsRaw = JSON.parse('["' + decodeURI(optionsRaw.replace(/&/g, "\",\"").replace(/=/g, "\",\"")) + '"]');
var lastKey = '';
optionsRaw.forEach(function (el, i) {
if ((i + 1) % 2 === 0) {
var obj = {value: el, label: lastKey};
options.push(obj);
lastKey = '';
}
lastKey = el;
});
}
$(this).selectize({
persist: false,
maxItems: null,
valueField: 'key',
labelField: 'label',
searchField: ['value', 'label'],
options: options,
create: function (input) {
return {
value: input.key,
label: input.label
}
},
load: function (query, callback) {
if (!query.length) return callback();
$.ajax({
url: ajaxurl,
data: {
action: 'dgwt_wcas_settings_list_custom_fields',
_wpnonce: $input.data('security')
},
error: function () {
callback();
},
success: function (res) {
callback(res.data);
}
});
}
});
});
}
}
};
var TOOLTIP = {
init: function () {
var _this = this;
var $tooltips = $('.js-dgwt-wcas-tooltip');
if ($tooltips.length > 0) {
$tooltips.each(function () {
var element = $(this)[0];
var contentEl = $(this).data('tooltip-html-el');
var placement = $(this).data('tooltip-placement');
if (contentEl) {
const instance = new DgwtWcasTooltip(element, {
title: $('.' + contentEl + ' > .dgwt-wcas-tooltip-wrapper')[0],
placement: placement,
trigger: "hover",
html: true
});
}
});
}
}
};
var ADVANCED_SETTINGS = {
advClass: 'js-dgwt-wcas-adv-settings',
highlightClass: 'dgwt-wcas-opt-highlight',
transClass: 'dgwt-wcas-opt-transition',
init: function () {
var _this = this;
_this.clickListener();
_this.setStartingState();
},
clickListener: function () {
var _this = this;
$(document).on('click', '.js-dgwt-wcas-settings__advanced', function () {
var $toggleEl = $('.js-dgwt-wcas-adv-settings-toggle'),
choice;
if ($toggleEl.hasClass('woocommerce-input-toggle--disabled')) {
choice = 'show';
} else {
choice = 'hide';
}
_this.saveChoice(choice);
});
},
setStartingState: function () {
var _this = this,
$options = $('.' + _this.advClass);
if ($options.length > 0) {
var showAdvanced = $('.js-dgwt-wcas-adv-settings-toggle').hasClass('woocommerce-input-toggle--enabled');
if (!showAdvanced) {
$options.hide();
} else {
$options.show();
CHECKBOX_SETTINGS_TOGGLE.refresh();
}
}
},
saveChoice: function (choice) {
var _this = this;
$('.js-dgwt-wcas-settings__advanced').append('saving...');
$.ajax({
url: ajaxurl,
data: {
_wpnonce: dgwt_wcas.nonces.advanced_options_switch,
action: 'dgwt_wcas_adv_settings',
adv_settings_value: choice
}
}).done(function (data) {
$('.dgwt-wcas-adv-settings-saving').remove();
});
var $el = $('.js-dgwt-wcas-adv-settings-toggle');
if (choice === 'show') {
$el.removeClass('woocommerce-input-toggle--disabled');
$el.addClass('woocommerce-input-toggle--enabled');
}
if (choice === 'hide') {
$el.removeClass('woocommerce-input-toggle--enabled');
$el.addClass('woocommerce-input-toggle--disabled');
}
_this.toggleAdvancedOpt(choice);
},
toggleAdvancedOpt: function (action) {
var _this = this,
$options = $('.' + _this.advClass);
if ($options.length > 0) {
$options.addClass(_this.highlightClass);
$options.addClass(_this.transClass);
if (action === 'show') {
$options.fadeIn(500, function () {
setTimeout(function () {
$options.removeClass(_this.highlightClass);
setTimeout(function () {
$options.removeClass(_this.transClass);
CHECKBOX_SETTINGS_TOGGLE.refresh();
CONDITIONAL_LAYOUT_SETTINGS.setConditions();
}, 500)
}, 500);
});
}
if (action === 'hide') {
setTimeout(function () {
$options.removeClass(_this.transClass);
$options.fadeOut(500, function () {
$options.removeClass(_this.highlightClass);
});
}, 500);
}
}
},
};
var STATS_INTERFACE = {
placeholderClass: 'js-dgwt-wcas-stats-placeholder',
placeholderClassLoaded: 'js-dgwt-wcas-stats-placeholder-loaded',
preloaderClass: 'dgwt-wcas-stats-preloader',
settingsGroupSel: '#dgwt_wcas_analytics',
criticalSearchesLoadMoreClass: 'js-dgwt-wcas-critical-searches-load-more',
autocompleteWithResultsLoadMoreClass: 'js-dgwt-wcas-autocomplete-with-results-load-more',
searchPageWithResultsLoadMoreClass: 'js-dgwt-wcas-search-page-with-results-load-more',
checkPhraseStatusClass: 'js-dgwt-wcas-stats-critical-check',
checkPhraseStatusInitClass: 'js-dgwt-wcas-stats-critical-check-init',
rowLoadingClass: 'dgwt-wcas-analytics-row-loading',
languageSwitcherClass: 'js-dgwt-wcas-analytics-lang',
excludePhraseClass: 'js-dgwt-wcas-analytics-exclude-phrase',
checkIndexerAction: 'js-dgwt-wcas-analytics-check-indexer',
resetAnalyticsAction: 'js-dgwt-wcas-analytics-reset',
analyticsExportCSVAction: 'js-dgwt-wcas-analytics-export-csv',
init: function () {
var _this = this;
// Do nothing if the analytics module is disabled
if (typeof dgwt_wcas.analytics == 'undefined' || !dgwt_wcas.analytics.enabled) {
return;
}
_this.interfaceLoaderListener();
},
interfaceLoaderListener: function () {
var _this = this,
$languageSelectorEl = $('.' + _this.languageSwitcherClass);
$(document).on('dgwt_wcas_settings_group_active', function (event, el) {
if ($(el).length > 0 && el.id === 'dgwt_wcas_analytics') {
if (!_this.isLoaded()) {
_this.loadInterface();
}
}
});
if ($languageSelectorEl.length > 0) {
$languageSelectorEl.on('change', function () {
var $canvas = $('.' + _this.placeholderClass);
if ($canvas.length > 0) {
$canvas.html('');
_this.loadInterface();
}
});
}
},
isLoaded: function () {
var _this = this;
return $('.' + _this.placeholderClassLoaded).length > 0;
},
showPreloader: function () {
var _this = this,
$placeholder = $('.' + _this.placeholderClass),
html = '';
if ($placeholder.length) {
$placeholder.append(html);
}
},
loadInterface: function () {
var _this = this,
$lang = $('.' + _this.languageSwitcherClass + ' option:selected');
_this.showPreloader();
var data = {
'action': 'dgwt_wcas_load_stats_interface',
'_wpnonce': dgwt_wcas.analytics.nonce.analytics_load_interface
};
if ($lang.length > 0) {
data.lang = $lang.val();
}
$.post(
ajaxurl,
data,
function (response) {
var $el = $('.' + _this.placeholderClass);
if (typeof response == 'object' && response.success && $el.length > 0) {
$el.addClass(_this.placeholderClassLoaded);
$el.html(response.data.html);
_this.loadCheckCriticalSearchesListeners();
_this.loadMoreListeners();
_this.resetStatsListener();
_this.exportStatsListener();
}
}
);
},
loadCheckCriticalSearchesListeners: function () {
var _this = this,
$elements = $('.' + _this.checkPhraseStatusClass + ':not(.' + _this.checkPhraseStatusInitClass + ')');
// Critical searches - check status
$elements.on('click', function (e) {
e.preventDefault();
$(e.target).after('
');
_this.checkPhraseStatus($(e.target));
})
$elements.each(function () {
$(this).addClass(_this.checkPhraseStatusInitClass);
});
},
loadMoreListeners: function () {
var _this = this;
// Critical searches - load more
$('.' + _this.criticalSearchesLoadMoreClass).on('click', function (e) {
e.preventDefault();
$(this).before('
');
$(this).closest('tr').addClass(_this.rowLoadingClass);
_this.loadMoreCriticalSearches();
})
// Autocomplete with results - load more
$('.' + _this.autocompleteWithResultsLoadMoreClass).on('click', function (e) {
e.preventDefault();
_this.loadMorePhrases('autocomplete', $(e.target));
})
// Search page with results - load more
$('.' + _this.searchPageWithResultsLoadMoreClass).on('click', function (e) {
e.preventDefault();
_this.loadMorePhrases('search-page', $(e.target));
})
},
resetStatsListener: function () {
var _this = this;
$('.' + _this.resetAnalyticsAction).on('click', function (e) {
var $el = $(this);
e.preventDefault();
if (confirm(dgwt_wcas.analytics.labels.reset_stats_confirm)) {
var data = {
'action': 'dgwt_wcas_reset_stats',
'_wpnonce': dgwt_wcas.analytics.nonce.reset_stats
};
$el.next().addClass('loading');
$.post(
ajaxurl,
data,
function (response) {
location.reload();
}
);
}
})
},
exportStatsListener: function () {
var _this = this,
$lang = $('.' + _this.languageSwitcherClass + ' option:selected');
$('.' + _this.analyticsExportCSVAction).on('click', function (e) {
var $el = $(this);
e.preventDefault();
var url = new URL(dgwt_wcas.adminurl);
url.searchParams.append('action', 'dgwt_wcas_export_stats_csv');
url.searchParams.append('context', $(this).data('context'));
url.searchParams.append('_wpnonce', dgwt_wcas.analytics.nonce.export_stats_csv);
if ($lang.length > 0) {
url.searchParams.append('lang', $lang.val());
}
window.location = url;
})
},
checkPhraseStatus: function ($el) {
var _this = this,
$lang = $('.' + _this.languageSwitcherClass + ' option:selected');
var data = {
'action': 'dgwt_wcas_check_critical_phrase',
'phrase': $el.closest('tr').find('td:nth-child(2)').text(),
'_wpnonce': dgwt_wcas.analytics.nonce.check_critical_phrase
};
if ($lang.length > 0) {
data.lang = $lang.val();
}
$.post(
ajaxurl,
data,
function (response) {
if (typeof response == 'object' && response.success) {
var $row = $el.closest('tr');
$el.closest('td').html(response.data.html);
var $excludeEl = $row.find('.' + _this.excludePhraseClass);
var $checkIndexerEl = $row.find('.' + _this.checkIndexerAction);
// Critical searches - exclude phrase
if ($excludeEl.length > 0) {
$excludeEl.on('click', function (e) {
e.preventDefault();
var html = '
Processing...
'; $(e.target).closest('td').html(html); _this.excludePhrase($row); }) } // Check the indexer status if ($checkIndexerEl.length > 0) { $('.' + _this.checkIndexerAction).on('click', function (e) { e.preventDefault(); var $tab = $('#dgwt_wcas_performance-tab'); if ($tab.length > 0) { $tab[0].click(); $([document.documentElement, document.body]).animate({ scrollTop: 0 }, 1000); } }) } } } ); }, excludePhrase: function ($el) { var _this = this, $lang = $('.' + _this.languageSwitcherClass + ' option:selected'); var data = { 'action': 'dgwt_wcas_exclude_critical_phrase', 'phrase': $el.find('td:nth-child(2)').text(), '_wpnonce': dgwt_wcas.analytics.nonce.exclude_critical_phrase }; if ($lang.length > 0) { data.lang = $lang.val(); } $.post( ajaxurl, data, function (response) { if (typeof response == 'object' && response.success) { $el.addClass('dgwt-wcas-analytics-disable-row'); $el.find('td:last-child').html(response.data); } } ); }, loadMoreCriticalSearches: function () { var _this = this, $lang = $('.' + _this.languageSwitcherClass + ' option:selected'); var data = { 'action': 'dgwt_wcas_laod_more_critical_searches', 'loaded': $('.js-dgwt-wcas-critical-searches-row').length, '_wpnonce': dgwt_wcas.analytics.nonce.load_more_critical_searches }; if ($lang.length > 0) { data.lang = $lang.val(); } $.post( ajaxurl, data, function (response) { if (typeof response == 'object' && response.success) { var $loadMoreRow = $('.' + _this.criticalSearchesLoadMoreClass).closest('tr'); if (response.data.html.length > 0) { $loadMoreRow.before(response.data.html); } if (response.data.more > 0) { $loadMoreRow.removeClass(_this.rowLoadingClass); $loadMoreRow.find('img').remove(); $('.' + _this.criticalSearchesLoadMoreClass + ' span:first-child').text(response.data.more_label); } else { $loadMoreRow.remove(); } _this.loadCheckCriticalSearchesListeners(); } } ); }, loadMorePhrases: function (context, $el) { var _this = this, $lang = $('.' + _this.languageSwitcherClass + ' option:selected'); $el.before('