'
+ );
+ $('.atbdp-form-feedback').append(
+ _alert
+ );
+ }
+ }
+ if (
+ response !== null &&
+ response !== void 0 &&
+ (_response$status2 =
+ response.status) !== null &&
+ _response$status2 !== void 0 &&
+ _response$status2.success
+ ) {
+ location.reload();
+ return;
+ // removed by dead control flow
+
+ // removed by dead control flow
+
+ // removed by dead control flow
+ var form_response_page;
+ // removed by dead control flow
+
+ // Append Response
+ // removed by dead control flow
+
+ // removed by dead control flow
+ var themes;
+ // removed by dead control flow
+ var plugins;
+ // removed by dead control flow
+ var total_theme;
+ // removed by dead control flow
+ var total_plugin;
+
+ // console.log( { plugins, themes } );
+
+ // removed by dead control flow
+ var title;
+ // removed by dead control flow
+ var title;
+ // removed by dead control flow
+
+ // Show Log - Themes
+ // removed by dead control flow
+ var li,
+ list_action,
+ label,
+ checkbox,
+ theme,
+ _iterator,
+ _step,
+ counter,
+ theme_check_lists,
+ theme_title,
+ theme_section;
+
+ // Show Log - Extensions
+ // removed by dead control flow
+ var li,
+ label,
+ list_action,
+ checkbox,
+ extension,
+ _iterator2,
+ _step2,
+ counter,
+ plugin_check_lists,
+ plugin_title,
+ plugin_section;
+ // removed by dead control flow
+ var continue_button;
+ // removed by dead control flow
+ var skip_button;
+ // removed by dead control flow
+
+ // removed by dead control flow
+
+ // removed by dead control flow
+ }
+ },
+ error: function error(_error2) {
+ console.log(_error2);
+ is_sending = false;
+ submit_button.attr('disabled', false);
+ submit_button
+ .find('.atbdp-loading')
+ .remove();
+ },
+ });
+ }
+ );
+
+ // Reload Button
+ $('body').on('click', '.reload', function (e) {
+ e.preventDefault();
+ // console.log('reloading...');
+ location.reload();
+ });
+
+ // Extension Update Button
+ $('.ext-update-btn').on('click', function (e) {
+ e.preventDefault();
+ $(this).prop('disabled', true);
+ var plugin_key = $(this).data('key');
+ var button_default_html = $(this).html();
+ var form_data = {
+ action: 'atbdp_update_plugins',
+ nonce: directorist_admin.nonce,
+ };
+ if (plugin_key) {
+ form_data.plugin_key = plugin_key;
+ }
+
+ // console.log( { plugin_key } );
+
+ var self = this;
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ var icon =
+ '
Updating';
+ $(self).html(icon);
+ },
+ success: function success(response) {
+ // console.log( { response } );
+
+ if (response.status.success) {
+ $(self).html('Updated');
+ location.reload();
+ } else {
+ $(self).html(button_default_html);
+ alert(response.status.message);
+ }
+ },
+ error: function error(_error3) {
+ console.log(_error3);
+ $(self).html(button_default_html);
+ $(this).prop('disabled', false);
+ },
+ });
+ });
+
+ // Install Button
+ $('.file-install-btn').on('click', function (e) {
+ e.preventDefault();
+ if ($(this).hasClass('in-progress')) {
+ // console.log('Wait...');
+ return;
+ }
+ var data_key = $(this).data('key');
+ var data_type = $(this).data('type');
+ var form_data = {
+ action: 'atbdp_install_file_from_subscriptions',
+ item_key: data_key,
+ type: data_type,
+ nonce: directorist_admin.nonce,
+ };
+ var btn_default_html = $(this).html();
+ ext_is_installing = true;
+ var self = this;
+ $(this).prop('disabled', true);
+ $(this).addClass('in-progress');
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).html('Installing');
+ var icon =
+ '
';
+ $(self).prepend(icon);
+ },
+ success: function success(response) {
+ // console.log(response);
+
+ if (
+ response.status &&
+ !response.status.success &&
+ response.status.message
+ ) {
+ alert(response.status.message);
+ }
+ if (
+ response.status &&
+ response.status.success
+ ) {
+ $(self).html('Installed');
+ location.reload();
+ } else {
+ $(self).html('Failed');
+ }
+ },
+ error: function error(_error4) {
+ console.log(_error4);
+ $(this).prop('disabled', false);
+ $(this).removeClass('in-progress');
+ $(self).html(btn_default_html);
+ },
+ });
+ });
+
+ // Plugin Active Button
+ $('.plugin-active-btn').on('click', function (e) {
+ e.preventDefault();
+ if ($(this).hasClass('in-progress')) {
+ // console.log('Wait...');
+ return;
+ }
+ var data_key = $(this).data('key');
+ var form_data = {
+ action: 'atbdp_activate_plugin',
+ item_key: data_key,
+ nonce: directorist_admin.nonce,
+ };
+ var btn_default_html = $(this).html();
+ var self = this;
+ $(this).prop('disabled', true);
+ $(this).addClass('in-progress');
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).html('Activating');
+ var icon =
+ '
';
+ $(self).prepend(icon);
+ },
+ success: function success(response) {
+ // console.log(response);
+
+ // return;
+
+ if (
+ response.status &&
+ !response.status.success &&
+ response.status.message
+ ) {
+ alert(response.status.message);
+ }
+ if (
+ response.status &&
+ response.status.success
+ ) {
+ $(self).html('Activated');
+ } else {
+ $(self).html('Failed');
+ }
+ location.reload();
+ },
+ error: function error(_error5) {
+ console.log(_error5);
+ $(this).prop('disabled', false);
+ $(this).removeClass('in-progress');
+ $(self).html(btn_default_html);
+ },
+ });
+ });
+
+ // Purchase refresh btn
+ $('.purchase-refresh-btn').on('click', function (e) {
+ e.preventDefault();
+ var purchase_refresh_btn_wrapper = $(this).parent();
+ var auth_section = $('.et-auth-section');
+ $(purchase_refresh_btn_wrapper).animate(
+ {
+ width: 0,
+ },
+ 500
+ );
+ $(auth_section).animate(
+ {
+ width: 330,
+ },
+ 500
+ );
+ });
+
+ // et-close-auth-btn
+ $('.et-close-auth-btn').on('click', function (e) {
+ e.preventDefault();
+ var auth_section = $('.et-auth-section');
+ var purchase_refresh_btn_wrapper = $(
+ '.purchase-refresh-btn-wrapper'
+ );
+ $(purchase_refresh_btn_wrapper).animate(
+ {
+ width: 182,
+ },
+ 500
+ );
+ $(auth_section).animate(
+ {
+ width: 0,
+ },
+ 500
+ );
+ });
+
+ // purchase-refresh-form
+ $('#purchase-refresh-form').on('submit', function (e) {
+ e.preventDefault();
+ // console.log( 'purchase-refresh-form' );
+
+ var submit_btn = $(this).find('button[type="submit"]');
+ var btn_default_html = submit_btn.html();
+ var close_btn = $(this).find('.et-close-auth-btn');
+ var form_feedback = $(this).find(
+ '.atbdp-form-feedback'
+ );
+ $(submit_btn).prop('disabled', true);
+ $(close_btn).addClass('atbdp-d-none');
+ var password = $(this)
+ .find('input[name="password"]')
+ .val();
+ var form_data = {
+ action: 'atbdp_refresh_purchase_status',
+ password: password,
+ nonce: directorist_admin.nonce,
+ };
+ form_feedback.html('');
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(submit_btn).html(
+ '
'
+ );
+ },
+ success: function success(response) {
+ // console.log(response);
+
+ if (response.status.message) {
+ var feedback_type = response.status.success
+ ? 'success'
+ : 'danger';
+ var message = '
')
+ .concat(
+ response.status.message,
+ ' '
+ );
+ form_feedback.html(message);
+ }
+ if (!response.status.success) {
+ $(submit_btn).html(btn_default_html);
+ $(submit_btn).prop('disabled', false);
+ $(close_btn).removeClass('atbdp-d-none');
+ if (response.status.reload) {
+ location.reload();
+ }
+ } else {
+ location.reload();
+ }
+ },
+ error: function error(_error6) {
+ console.log(_error6);
+ $(submit_btn).prop('disabled', false);
+ $(submit_btn).html(btn_default_html);
+ $(close_btn).removeClass('atbdp-d-none');
+ },
+ });
+ });
+
+ // Logout
+ $('.subscriptions-logout-btn').on('click', function (e) {
+ e.preventDefault();
+ var hard_logout = $(this).data('hard-logout');
+ var form_data = {
+ action: 'atbdp_close_subscriptions_sassion',
+ hard_logout: hard_logout,
+ nonce: directorist_admin.nonce,
+ };
+ var self = this;
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).html(
+ '
Logging out'
+ );
+ },
+ success: function success(response) {
+ // console.log( response );
+ location.reload();
+ },
+ error: function error(_error7) {
+ // console.log(error);
+ $(this).prop('disabled', false);
+ $(this).removeClass('in-progress');
+ $(self).html(btn_default_html);
+ },
+ });
+
+ // atbdp_close_subscriptions_sassion
+ });
+
+ // Form Actions
+ // Apply button active status - My extension form
+ var extFormCheckboxes = document.querySelectorAll(
+ '#atbdp-extensions-tab input[type="checkbox"]'
+ );
+ var extFormActionSelect = document.querySelectorAll(
+ '#atbdp-extensions-tab select[name="bulk-actions"]'
+ );
+ //console.log(extFormActionSelect);
+ extFormCheckboxes.forEach(function (elm) {
+ var thisClosest = elm.closest('form');
+ var bulkAction = thisClosest.querySelector(
+ '.ei-action-dropdown select'
+ );
+ var actionBtn =
+ thisClosest.querySelector('.ei-action-btn');
+ elm.addEventListener('change', function () {
+ this.checked === true && bulkAction.value !== ''
+ ? actionBtn.classList.add('ei-action-active')
+ : this.checked === false
+ ? actionBtn.classList.remove(
+ 'ei-action-active'
+ )
+ : '';
+ });
+ });
+ extFormActionSelect.forEach(function (elm) {
+ var thisClosest = elm.closest('form');
+ var checkboxes = thisClosest.querySelectorAll(
+ 'input[type="checkbox"]'
+ );
+ var actionBtn =
+ thisClosest.querySelector('.ei-action-btn');
+ elm.addEventListener('change', function () {
+ checkboxes.forEach(function (checkbox) {
+ if (
+ checkbox.checked === true &&
+ this.value !== ''
+ ) {
+ actionBtn.classList.add('ei-action-active');
+ }
+ });
+ if (this.value === '') {
+ actionBtn.classList.remove('ei-action-active');
+ }
+ });
+ });
+
+ // Bulk Actions - My extensions form
+ var is_bulk_processing = false;
+ $('#atbdp-my-extensions-form').on('submit', function (e) {
+ e.preventDefault();
+ if (is_bulk_processing) {
+ return;
+ }
+ var task = $(this)
+ .find('select[name="bulk-actions"]')
+ .val();
+ var plugins_items = [];
+ $(this)
+ .find('.extension-name-checkbox')
+ .each(function (i, e) {
+ var is_checked = $(e).is(':checked');
+ var id = $(e).attr('id');
+ if (is_checked) {
+ plugins_items.push(id);
+ }
+ });
+ if (!task.length || !plugins_items.length) {
+ return;
+ }
+ var self = this;
+ is_bulk_processing = true;
+ form_data = {
+ action: 'atbdp_plugins_bulk_action',
+ task: task,
+ plugin_items: plugins_items,
+ directorist_nonce:
+ directorist_admin.directorist_nonce,
+ };
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self)
+ .find('button[type="submit"]')
+ .prepend(
+ '
'
+ );
+ },
+ success: function success(response) {
+ $(self)
+ .find('button[type="submit"] .atbdp-icon')
+ .remove();
+ location.reload();
+ },
+ error: function error(_error8) {
+ uninstalling = false;
+ },
+ });
+
+ // console.log( task, plugins_items );
+ });
+
+ // Bulk Actions - My extensions form
+ var is_bulk_processing = false;
+ $('#atbdp-my-subscribed-extensions-form').on(
+ 'submit',
+ function (e) {
+ e.preventDefault();
+ if (is_bulk_processing) {
+ return;
+ }
+ var self = this;
+ var task = $(this)
+ .find('select[name="bulk-actions"]')
+ .val();
+ var plugins_items = [];
+ var tergeted_items_elm = '.extension-name-checkbox';
+ $(self)
+ .find(tergeted_items_elm)
+ .each(function (i, e) {
+ var is_checked = $(e).is(':checked');
+ var key = $(e).attr('name');
+ if (is_checked) {
+ plugins_items.push(key);
+ }
+ });
+ if (!task.length || !plugins_items.length) {
+ return;
+ }
+
+ // Before Install
+ $(this)
+ .find('.file-install-btn')
+ .prop('disabled', true)
+ .addClass('in-progress');
+ var loading_icon =
+ '
';
+ $(this)
+ .find('button[type="submit"]')
+ .prop('disabled', true)
+ .prepend(loading_icon);
+ is_bulk_processing = true;
+ var after_bulk_process =
+ function after_bulk_process() {
+ is_bulk_processing = false;
+ $(self)
+ .find('button[type="submit"]')
+ .find('.atbdp-icon')
+ .remove();
+ $(self)
+ .find('button[type="submit"]')
+ .prop('disabled', false);
+ location.reload();
+ };
+ plugins_bulk_actions(
+ 'install',
+ plugins_items,
+ after_bulk_process
+ );
+ }
+ );
+
+ // Bulk Actions - Required extensions form
+ var is_bulk_processing = false;
+ $('#atbdp-required-extensions-form').on(
+ 'submit',
+ function (e) {
+ e.preventDefault();
+ if (is_bulk_processing) {
+ return;
+ }
+ var self = this;
+ var task = $(this)
+ .find('select[name="bulk-actions"]')
+ .val();
+ var plugins_items = [];
+ var tergeted_items_elm =
+ 'install' === task
+ ? '.extension-install-checkbox'
+ : '.extension-activate-checkbox';
+ $(self)
+ .find(tergeted_items_elm)
+ .each(function (i, e) {
+ var is_checked = $(e).is(':checked');
+ var key = $(e).attr('value');
+ if (is_checked) {
+ plugins_items.push(key);
+ }
+ });
+ if (!task.length || !plugins_items.length) {
+ return;
+ }
+
+ // Before Install
+ $(this)
+ .find('.file-install-btn')
+ .prop('disabled', true)
+ .addClass('in-progress');
+ $(this)
+ .find('.plugin-active-btn')
+ .prop('disabled', true)
+ .addClass('in-progress');
+ var loading_icon =
+ '
';
+ $(this)
+ .find('button[type="submit"]')
+ .prop('disabled', true)
+ .prepend(loading_icon);
+ is_bulk_processing = true;
+ var after_bulk_process =
+ function after_bulk_process() {
+ is_bulk_processing = false;
+ $(self)
+ .find('button[type="submit"]')
+ .find('.atbdp-icon')
+ .remove();
+ $(self)
+ .find('button[type="submit"]')
+ .prop('disabled', false);
+ location.reload();
+ };
+ var available_task_list = ['install', 'activate'];
+ if (available_task_list.includes(task)) {
+ plugins_bulk_actions(
+ task,
+ plugins_items,
+ after_bulk_process
+ );
+ }
+ }
+ );
+
+ // plugins_bulk__actions
+ function plugins_bulk_actions(
+ task,
+ plugins_items,
+ after_plugins_install
+ ) {
+ var action = {
+ install: 'atbdp_install_file_from_subscriptions',
+ activate: 'atbdp_activate_plugin',
+ };
+ var btnLabelOnProgress = {
+ install: 'Installing',
+ activate: 'Activating',
+ };
+ var btnLabelOnSuccess = {
+ install: 'Installed',
+ activate: 'Activated',
+ };
+ var processStartBtn = {
+ install: '.file-install-btn',
+ activate: '.plugin-active-btn',
+ };
+ var _bulk_task = function bulk_task(
+ plugins,
+ counter,
+ callback
+ ) {
+ if (counter > plugins.length - 1) {
+ if (callback) {
+ callback();
+ }
+ return;
+ }
+ var current_item = plugins[counter];
+ var action_wrapper_key =
+ 'install' === task
+ ? plugins[counter]
+ : plugins[counter].replace(/\/.+$/g, '');
+ var action_wrapper = $(
+ '.ext-action-'.concat(action_wrapper_key)
+ );
+ var action_btn = action_wrapper.find(
+ processStartBtn[task]
+ );
+ var next_index = counter + 1;
+ var form_action = action[task] ? action[task] : '';
+ form_data = {
+ action: form_action,
+ item_key: current_item,
+ type: 'plugin',
+ nonce: directorist_admin.nonce,
+ };
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ action_btn.html(
+ '
\n \n '.concat(
+ btnLabelOnProgress[task]
+ )
+ );
+ },
+ success: function success(response) {
+ // console.log( { response } );
+ if (response.status.success) {
+ action_btn.html(
+ btnLabelOnSuccess[task]
+ );
+ } else {
+ action_btn.html('Failed');
+ }
+ _bulk_task(plugins, next_index, callback);
+ },
+ error: function error(_error9) {
+ // console.log(error);
+ },
+ });
+ };
+ _bulk_task(plugins_items, 0, after_plugins_install);
+ }
+
+ // Ext Actions | Uninstall
+ var uninstalling = false;
+ $('.ext-action-uninstall').on('click', function (e) {
+ e.preventDefault();
+ if (uninstalling) {
+ return;
+ }
+ var data_target = $(this).data('target');
+ var form_data = {
+ action: 'atbdp_plugins_bulk_action',
+ task: 'uninstall',
+ plugin_items: [data_target],
+ nonce: directorist_admin.nonce,
+ };
+ var self = this;
+ uninstalling = true;
+ jQuery.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).prepend(
+ '
'
+ );
+ },
+ success: function success(response) {
+ // console.log( response );
+ $(self)
+ .closest('.ext-action')
+ .find('.ext-action-drop')
+ .removeClass('active');
+ location.reload();
+ },
+ error: function error(_error0) {
+ // console.log(error);
+ uninstalling = false;
+ },
+ });
+ });
+
+ // Bulk checkbox toggle
+ $('#select-all-installed').on('change', function (e) {
+ var is_checked = $(this).is(':checked');
+ if (is_checked) {
+ $('#atbdp-my-extensions-form')
+ .find('.extension-name-checkbox')
+ .prop('checked', true);
+ } else {
+ $('#atbdp-my-extensions-form')
+ .find('.extension-name-checkbox')
+ .prop('checked', false);
+ }
+ });
+ $('#select-all-subscription').on('change', function (e) {
+ var is_checked = $(this).is(':checked');
+ if (is_checked) {
+ $('#atbdp-my-subscribed-extensions-form')
+ .find('.extension-name-checkbox')
+ .prop('checked', true);
+ } else {
+ $('#atbdp-my-subscribed-extensions-form')
+ .find('.extension-name-checkbox')
+ .prop('checked', false);
+ }
+ });
+ $('#select-all-required-extensions').on(
+ 'change',
+ function (e) {
+ var is_checked = $(this).is(':checked');
+ if (is_checked) {
+ $('#atbdp-required-extensions-form')
+ .find('.extension-name-checkbox')
+ .prop('checked', true);
+ } else {
+ $('#atbdp-required-extensions-form')
+ .find('.extension-name-checkbox')
+ .prop('checked', false);
+ }
+ }
+ );
+
+ //
+ $('.ext-action-drop').each(function (i, e) {
+ $(e).on('click', function (elm) {
+ elm.preventDefault();
+ if ($(this).hasClass('active')) {
+ $(this).removeClass('active');
+ } else {
+ $('.ext-action-drop').removeClass('active');
+ $(this).addClass('active');
+ }
+ });
+ });
+
+ // Theme Activation
+ var theme_is_activating = false;
+ $('.theme-activate-btn').on('click', function (e) {
+ e.preventDefault();
+ if (theme_is_activating) {
+ return;
+ }
+ var data_target = $(this).data('target');
+ if (!data_target) {
+ return;
+ }
+ if (!data_target.length) {
+ return;
+ }
+ var form_data = {
+ action: 'atbdp_activate_theme',
+ theme_stylesheet: data_target,
+ nonce: directorist_admin.nonce,
+ };
+ var self = this;
+ theme_is_activating = true;
+ $.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).prepend(
+ '
'
+ );
+ },
+ success: function success(response) {
+ // console.log({ response });
+ $(self).find('.atbdp-icon').remove();
+ if (
+ response.status &&
+ response.status.success
+ ) {
+ location.reload();
+ }
+ },
+ error: function error(_error1) {
+ // console.log({ error });
+ theme_is_activating = false;
+ $(self).find('.atbdp-icon').remove();
+ },
+ });
+ });
+
+ // Theme Update
+ $('.theme-update-btn').on('click', function (e) {
+ e.preventDefault();
+ $(this).prop('disabled', true);
+ if ($(this).hasClass('in-progress')) {
+ return;
+ }
+ var theme_stylesheet = $(this).data('target');
+ var button_default_html = $(this).html();
+ var form_data = {
+ action: 'atbdp_update_theme',
+ nonce: directorist_admin.nonce,
+ };
+ if (theme_stylesheet) {
+ form_data.theme_stylesheet = theme_stylesheet;
+ }
+ var self = this;
+ $(this).addClass('in-progress');
+ $.ajax({
+ type: 'post',
+ url: directorist_admin.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).html(
+ '
Updating'
+ );
+ },
+ success: function success(response) {
+ // console.log({ response });
+
+ if (
+ response.status &&
+ response.status.success
+ ) {
+ $(self).html('Updated');
+ location.reload();
+ } else {
+ $(self).removeClass('in-progress');
+ $(self).html(button_default_html);
+ $(self).prop('disabled', false);
+ alert(response.status.message);
+ }
+ },
+ error: function error(_error10) {
+ // console.log({ error });
+ $(self).removeClass('in-progress');
+ $(self).html(button_default_html);
+ $(self).prop('disabled', false);
+ },
+ });
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/debounce.js':
+ /*!*****************************************************!*\
!*** ./assets/src/js/global/components/debounce.js ***!
\*****************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ debounce; }
-/* harmony export */ });
-function debounce(func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/modal.js":
-/*!**************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ debounce;
+ },
+ /* harmony export */
+ }
+ );
+ function debounce(func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function later() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/modal.js':
+ /*!**************************************************!*\
!*** ./assets/src/js/global/components/modal.js ***!
\**************************************************/
-/***/ (function() {
-
-var $ = jQuery;
-$(document).ready(function () {
- modalToggle();
-});
-function modalToggle() {
- $('.atbdp_recovery_pass').on('click', function (e) {
- e.preventDefault();
- $('#recover-pass-modal').slideToggle().show();
- });
-
- // Contact form [on modal closed]
- $('#atbdp-contact-modal').on('hidden.bs.modal', function (e) {
- $('#atbdp-contact-message').val('');
- $('#atbdp-contact-message-display').html('');
- });
-
- // Template Restructured
- // Modal
- var directoristModal = document.querySelector('.directorist-modal-js');
- $('body').on('click', '.directorist-btn-modal-js', function (e) {
- e.preventDefault();
- var data_target = $(this).attr('data-directorist_target');
- document.querySelector(".".concat(data_target)).classList.add('directorist-show');
- });
- $('body').on('click', '.directorist-modal-close-js', function (e) {
- e.preventDefault();
- $(this).closest('.directorist-modal-js').removeClass('directorist-show');
- });
- $(document).bind('click', function (e) {
- if (e.target == directoristModal) {
- directoristModal.classList.remove('directorist-show');
- }
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/select2-custom-control.js":
-/*!*******************************************************************!*\
+ /***/ function () {
+ var $ = jQuery;
+ $(document).ready(function () {
+ modalToggle();
+ });
+ function modalToggle() {
+ $('.atbdp_recovery_pass').on('click', function (e) {
+ e.preventDefault();
+ $('#recover-pass-modal').slideToggle().show();
+ });
+
+ // Contact form [on modal closed]
+ $('#atbdp-contact-modal').on(
+ 'hidden.bs.modal',
+ function (e) {
+ $('#atbdp-contact-message').val('');
+ $('#atbdp-contact-message-display').html('');
+ }
+ );
+
+ // Template Restructured
+ // Modal
+ var directoristModal = document.querySelector(
+ '.directorist-modal-js'
+ );
+ $('body').on(
+ 'click',
+ '.directorist-btn-modal-js',
+ function (e) {
+ e.preventDefault();
+ var data_target = $(this).attr(
+ 'data-directorist_target'
+ );
+ document
+ .querySelector('.'.concat(data_target))
+ .classList.add('directorist-show');
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-modal-close-js',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .closest('.directorist-modal-js')
+ .removeClass('directorist-show');
+ }
+ );
+ $(document).bind('click', function (e) {
+ if (e.target == directoristModal) {
+ directoristModal.classList.remove(
+ 'directorist-show'
+ );
+ }
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/select2-custom-control.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/global/components/select2-custom-control.js ***!
\*******************************************************************/
-/***/ (function() {
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-var $ = jQuery;
-window.addEventListener('load', waitAndInit);
-window.addEventListener('directorist-search-form-nav-tab-reloaded', waitAndInit);
-window.addEventListener('directorist-type-change', waitAndInit);
-window.addEventListener('directorist-instant-search-reloaded', waitAndInit);
-function waitAndInit() {
- setTimeout(init, 0);
-}
-
-// Initialize
-function init() {
- // Add custom dropdown toggle button
- selec2_add_custom_dropdown_toggle_button();
-
- // Add custom close button where needed
- selec2_add_custom_close_button_if_needed();
-
- // Add custom close button if field contains value on change
- $('.select2-hidden-accessible').on('change', function (e) {
- var value = $(this).children('option:selected').val();
- if (!value) {
- return;
- }
- selec2_add_custom_close_button($(this));
- var selectItems = this.parentElement.querySelectorAll('.select2-selection__choice');
- selectItems.forEach(function (item) {
- item.childNodes && item.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- item.title = modifiedString;
- }
- });
- });
- var customSelectItem = this.parentElement.querySelector('.select2-selection__rendered');
- customSelectItem.childNodes && customSelectItem.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- }
- });
- });
-}
-function selec2_add_custom_dropdown_toggle_button() {
- // Remove Default
- $('.select2-selection__arrow').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container('.select2-hidden-accessible');
- if (!addon_container) {
- return;
- }
- var dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
- if (!dropdown.length) {
- // Add Dropdown Toggle Button
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/chevron-down.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var dropdownHTML = "
".concat(iconHTML, " ");
- addon_container.append(dropdownHTML);
- }
- var selec2_custom_dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
-
- // Toggle --is-open class
- $('.select2-hidden-accessible').on('select2:open', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.addClass('--is-open');
- });
- $('.select2-hidden-accessible').on('select2:close', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.removeClass('--is-open');
- var dropdownParent = $(this).closest('.directorist-search-field');
- var renderTitle = $(this).next().find('.select2-selection__rendered').attr('title');
-
- // Check if renderTitle is empty and remove the focus class if so
- if (!renderTitle) {
- dropdownParent.removeClass('input-is-focused');
- } else {
- dropdownParent.addClass('input-has-value');
- }
- });
-
- // Toggle Dropdown
- selec2_custom_dropdown.on('click', function (e) {
- var isOpen = $(this).hasClass('--is-open');
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- if (isOpen) {
- field.select2('close');
- } else {
- field.select2('open');
- }
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_add_custom_close_button_if_needed() {
- var select2_fields = $('.select2-hidden-accessible');
- if (!select2_fields && !select2_fields.length) {
- return;
- }
- var _iterator = _createForOfIteratorHelper(select2_fields),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var field = _step.value;
- var value = $(field).children('option:selected').val();
- if (!value) {
- continue;
- }
- selec2_add_custom_close_button(field);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-}
-function selec2_add_custom_close_button(field) {
- // Remove Default
- $('.select2-selection__clear').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove if already exists
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Add
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/times.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- addon_container.prepend("
".concat(iconHTML, " "));
- var selec2_custom_close = addon_container.find('.directorist-select2-dropdown-close');
- selec2_custom_close.on('click', function (e) {
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- field.val(null).trigger('change');
- addon_container.find('.directorist-select2-dropdown-close').remove();
- selec2_adjust_space_for_addons();
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_remove_custom_close_button(field) {
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_get_addon_container(field) {
- var container = field ? $(field).next('.select2-container') : $('.select2-container');
- container = $(container).find('.directorist-select2-addons-area');
- if (!container.length) {
- $('.select2-container').append('
');
- container = $('.select2-container').find('.directorist-select2-addons-area');
- }
- var container = field ? $(field).next('.select2-container') : null;
- if (!container) {
- return null;
- }
- var addonsArea = $(container).find('.directorist-select2-addons-area');
- if (!addonsArea.length) {
- container.append('
');
- return container.find('.directorist-select2-addons-area');
- }
- return addonsArea;
-}
-function selec2_adjust_space_for_addons() {
- var container = $('.select2-container').find('.directorist-select2-addons-area');
- if (!container.length) {
- return;
- }
- var width = container.outerWidth();
- $('.select2-container').find('.select2-selection__rendered').css({
- 'padding-right': width + 'px'
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/setup-select2.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ var $ = jQuery;
+ window.addEventListener('load', waitAndInit);
+ window.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ waitAndInit
+ );
+ window.addEventListener('directorist-type-change', waitAndInit);
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ waitAndInit
+ );
+ function waitAndInit() {
+ setTimeout(init, 0);
+ }
+
+ // Initialize
+ function init() {
+ // Add custom dropdown toggle button
+ selec2_add_custom_dropdown_toggle_button();
+
+ // Add custom close button where needed
+ selec2_add_custom_close_button_if_needed();
+
+ // Add custom close button if field contains value on change
+ $('.select2-hidden-accessible').on('change', function (e) {
+ var value = $(this).children('option:selected').val();
+ if (!value) {
+ return;
+ }
+ selec2_add_custom_close_button($(this));
+ var selectItems = this.parentElement.querySelectorAll(
+ '.select2-selection__choice'
+ );
+ selectItems.forEach(function (item) {
+ item.childNodes &&
+ item.childNodes.forEach(function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ item.title = modifiedString;
+ }
+ });
+ });
+ var customSelectItem = this.parentElement.querySelector(
+ '.select2-selection__rendered'
+ );
+ customSelectItem.childNodes &&
+ customSelectItem.childNodes.forEach(
+ function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ }
+ }
+ );
+ });
+ }
+ function selec2_add_custom_dropdown_toggle_button() {
+ // Remove Default
+ $('.select2-selection__arrow').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(
+ '.select2-hidden-accessible'
+ );
+ if (!addon_container) {
+ return;
+ }
+ var dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+ if (!dropdown.length) {
+ // Add Dropdown Toggle Button
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/chevron-down.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ var dropdownHTML =
+ '
'.concat(
+ iconHTML,
+ ' '
+ );
+ addon_container.append(dropdownHTML);
+ }
+ var selec2_custom_dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+
+ // Toggle --is-open class
+ $('.select2-hidden-accessible').on(
+ 'select2:open',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.addClass('--is-open');
+ }
+ );
+ $('.select2-hidden-accessible').on(
+ 'select2:close',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.removeClass('--is-open');
+ var dropdownParent = $(this).closest(
+ '.directorist-search-field'
+ );
+ var renderTitle = $(this)
+ .next()
+ .find('.select2-selection__rendered')
+ .attr('title');
+
+ // Check if renderTitle is empty and remove the focus class if so
+ if (!renderTitle) {
+ dropdownParent.removeClass('input-is-focused');
+ } else {
+ dropdownParent.addClass('input-has-value');
+ }
+ }
+ );
+
+ // Toggle Dropdown
+ selec2_custom_dropdown.on('click', function (e) {
+ var isOpen = $(this).hasClass('--is-open');
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ if (isOpen) {
+ field.select2('close');
+ } else {
+ field.select2('open');
+ }
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_add_custom_close_button_if_needed() {
+ var select2_fields = $('.select2-hidden-accessible');
+ if (!select2_fields && !select2_fields.length) {
+ return;
+ }
+ var _iterator = _createForOfIteratorHelper(select2_fields),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
+ var field = _step.value;
+ var value = $(field)
+ .children('option:selected')
+ .val();
+ if (!value) {
+ continue;
+ }
+ selec2_add_custom_close_button(field);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+ function selec2_add_custom_close_button(field) {
+ // Remove Default
+ $('.select2-selection__clear').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove if already exists
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Add
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/times.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ addon_container.prepend(
+ '
'.concat(
+ iconHTML,
+ ' '
+ )
+ );
+ var selec2_custom_close = addon_container.find(
+ '.directorist-select2-dropdown-close'
+ );
+ selec2_custom_close.on('click', function (e) {
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ field.val(null).trigger('change');
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+ selec2_adjust_space_for_addons();
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_remove_custom_close_button(field) {
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_get_addon_container(field) {
+ var container = field
+ ? $(field).next('.select2-container')
+ : $('.select2-container');
+ container = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ $('.select2-container').append(
+ '
'
+ );
+ container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ var container = field
+ ? $(field).next('.select2-container')
+ : null;
+ if (!container) {
+ return null;
+ }
+ var addonsArea = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!addonsArea.length) {
+ container.append(
+ '
'
+ );
+ return container.find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ return addonsArea;
+ }
+ function selec2_adjust_space_for_addons() {
+ var container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ return;
+ }
+ var width = container.outerWidth();
+ $('.select2-container')
+ .find('.select2-selection__rendered')
+ .css({
+ 'padding-right': width + 'px',
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/setup-select2.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/global/components/setup-select2.js ***!
\**********************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_select2_custom_control__WEBPACK_IMPORTED_MODULE_2__);
-
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-var $ = jQuery;
-window.addEventListener('load', initSelect2);
-document.body.addEventListener('directorist-search-form-nav-tab-reloaded', initSelect2);
-document.body.addEventListener('directorist-reload-select2-fields', initSelect2);
-window.addEventListener('directorist-instant-search-reloaded', initSelect2);
-
-// Init Static Select 2 Fields
-function initSelect2() {
- var selectors = ['.directorist-select select', '#directorist-select-js',
- // Not found in any template
- '#directorist-search-category-js',
- // Not found in any template
- // '#directorist-select-st-s-js',
- // '#directorist-select-sn-s-js',
- // '#directorist-select-mn-e-js',
- // '#directorist-select-tu-e-js',
- // '#directorist-select-wd-s-js',
- // '#directorist-select-wd-e-js',
- // '#directorist-select-th-e-js',
- // '#directorist-select-fr-s-js',
- // '#directorist-select-fr-e-js',
- '.select-basic',
- // Not found in any template
- '#loc-type', '#cat-type', '#at_biz_dir-category', '.bdas-location-search',
- // Not found in any template
- '.bdas-category-search' // Not found in any template
- ];
- selectors.forEach(function (selector) {
- return (0,_lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(selector);
- });
- initMaybeLazyLoadedTaxonomySelect2();
-}
-
-// Init Select2 Ajax Fields
-function initMaybeLazyLoadedTaxonomySelect2() {
- var restBase = "".concat(directorist.rest_url, "directorist/v1");
- maybeLazyLoadCategories({
- selector: '.directorist-search-category select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadCategories({
- selector: '.directorist-form-categories-field select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-search-location select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-form-location-field select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadTags({
- selector: '.directorist-form-tag-field select',
- url: "".concat(restBase, "/listings/tags")
- });
-}
-function maybeLazyLoadCategories(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'categories'
- }), args));
-}
-function maybeLazyLoadLocations(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'locations'
- }), args));
-}
-function maybeLazyLoadTags(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'tags'
- }), args));
-}
-
-// maybeLazyLoadTaxonomyTermsSelect2
-function maybeLazyLoadTaxonomyTermsSelect2(args) {
- var defaults = {
- selector: '',
- url: '',
- taxonomy: 'tags'
- };
- args = _objectSpread(_objectSpread({}, defaults), args);
- if (!args.selector) {
- return;
- }
- var $el = $(args.selector);
- var $addListing = $el.closest('.directorist-add-listing-form');
- var canCreate = $el.data('allow_new');
- var maxLength = $el.data('max');
- var directoryId = 0;
- if (args.taxonomy !== 'tags') {
- var $searchForm = $el.closest('.directorist-search-form');
- var $archivePage = $el.closest('.directorist-archive-contents');
- var $directory = $addListing.find('input[name="directory_type"]');
- var $navListItem = null;
-
- // If search page
- if ($searchForm.length) {
- $navListItem = $searchForm.find('.directorist-listing-type-selection__link--current');
- }
- if ($archivePage.length) {
- $navListItem = $archivePage.find('.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link');
- }
- if ($navListItem && $navListItem.length) {
- directoryId = Number($navListItem.data('listing_type_id'));
- }
- if ($directory.length) {
- directoryId = $directory.val();
- }
- if (directoryId) {
- directoryId = Number(directoryId);
- }
- }
- var currentPage = 1;
- var select2Options = {
- allowClear: true,
- tags: canCreate,
- maximumSelectionLength: maxLength,
- width: '100%',
- escapeMarkup: function escapeMarkup(text) {
- return text;
- },
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
-
- // Fetch the data-icon attribute
- var iconURI = $(data.element).attr('data-icon');
-
- // Get the original text
- var originalText = data.text;
-
- // Match and count leading spaces
- var leadingSpaces = originalText.match(/^\s+/);
- var spaceCount = leadingSpaces ? leadingSpaces[0].length : 0;
-
- // Trim leading spaces from the original text
- originalText = originalText.trim();
-
- // Construct the icon element
- var iconElm = iconURI ? "
") : '';
-
- // Prepare the combined text (icon + text)
- var combinedText = iconElm + originalText;
-
- // Create the state container
- var $state = $('
');
-
- // Determine the level based on space count
- var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
- if (level > 1) {
- $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
- }
- $state.html(combinedText); // Set the combined content (icon + text)
-
- return $state;
- }
- };
- if (directorist.lazy_load_taxonomy_fields) {
- select2Options.ajax = {
- url: args.url,
- dataType: 'json',
- cache: true,
- delay: 250,
- data: function data(params) {
- currentPage = params.page || 1;
- var query = {
- page: currentPage,
- per_page: args.perPage,
- hide_empty: true
- };
-
- // Load empty terms on add listings.
- if ($addListing.length) {
- query.hide_empty = false;
- }
- if (params.term) {
- query.search = params.term;
- query.hide_empty = false;
- }
- if (directoryId) {
- query.directory = directoryId;
- }
- return query;
- },
- processResults: function processResults(data) {
- return {
- results: data.items,
- pagination: {
- more: data.paginationMore
- }
- };
- },
- transport: function transport(params, success, failure) {
- var $request = $.ajax(params);
- $request.then(function (data, textStatus, jqXHR) {
- var totalPage = Number(jqXHR.getResponseHeader('x-wp-totalpages'));
- var paginationMore = currentPage < totalPage;
- var items = data.map(function (item) {
- var text = item.name;
- if (!$addListing.length && params.data.search) {
- text = "".concat(item.name, " (").concat(item.count, ")");
- }
- return {
- id: item.id,
- text: text
- };
- });
- return {
- items: items,
- paginationMore: paginationMore
- };
- }).then(success);
- $request.fail(failure);
- return $request;
- }
- };
- }
- $el.length && $el.select2(select2Options);
- if (directorist.lazy_load_taxonomy_fields) {
- function setupSelectedItems($el, selectedId, selectedLabel) {
- if (!$el.length || !selectedId) {
- return;
- }
- var selectedIds = "".concat(selectedId).split(',');
- var selectedLabels = selectedLabel ? "".concat(selectedLabel).split(',') : [];
- selectedIds.forEach(function (id, index) {
- var label = selectedLabels.length >= index + 1 ? selectedLabels[index] : '';
- var option = new Option(label, id, true, true);
- $el.append(option);
- $el.trigger({
- type: 'select2:select',
- params: {
- data: {
- id: id,
- text: label
- }
- }
- });
- });
- }
- setupSelectedItems($el, $el.data('selected-id'), $el.data('selected-label'));
- }
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/tabs.js":
-/*!*************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__
+ );
+
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+
+ var $ = jQuery;
+ window.addEventListener('load', initSelect2);
+ document.body.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ initSelect2
+ );
+ document.body.addEventListener(
+ 'directorist-reload-select2-fields',
+ initSelect2
+ );
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ initSelect2
+ );
+
+ // Init Static Select 2 Fields
+ function initSelect2() {
+ var selectors = [
+ '.directorist-select select',
+ '#directorist-select-js',
+ // Not found in any template
+ '#directorist-search-category-js',
+ // Not found in any template
+ // '#directorist-select-st-s-js',
+ // '#directorist-select-sn-s-js',
+ // '#directorist-select-mn-e-js',
+ // '#directorist-select-tu-e-js',
+ // '#directorist-select-wd-s-js',
+ // '#directorist-select-wd-e-js',
+ // '#directorist-select-th-e-js',
+ // '#directorist-select-fr-s-js',
+ // '#directorist-select-fr-e-js',
+ '.select-basic',
+ // Not found in any template
+ '#loc-type',
+ '#cat-type',
+ '#at_biz_dir-category',
+ '.bdas-location-search',
+ // Not found in any template
+ '.bdas-category-search', // Not found in any template
+ ];
+ selectors.forEach(function (selector) {
+ return (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(
+ selector
+ );
+ });
+ initMaybeLazyLoadedTaxonomySelect2();
+ }
+
+ // Init Select2 Ajax Fields
+ function initMaybeLazyLoadedTaxonomySelect2() {
+ var restBase = ''.concat(
+ directorist.rest_url,
+ 'directorist/v1'
+ );
+ maybeLazyLoadCategories({
+ selector: '.directorist-search-category select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadCategories({
+ selector: '.directorist-form-categories-field select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-search-location select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-form-location-field select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadTags({
+ selector: '.directorist-form-tag-field select',
+ url: ''.concat(restBase, '/listings/tags'),
+ });
+ }
+ function maybeLazyLoadCategories(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'categories',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadLocations(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'locations',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadTags(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'tags',
+ }
+ ),
+ args
+ )
+ );
+ }
+
+ // maybeLazyLoadTaxonomyTermsSelect2
+ function maybeLazyLoadTaxonomyTermsSelect2(args) {
+ var defaults = {
+ selector: '',
+ url: '',
+ taxonomy: 'tags',
+ };
+ args = _objectSpread(_objectSpread({}, defaults), args);
+ if (!args.selector) {
+ return;
+ }
+ var $el = $(args.selector);
+ var $addListing = $el.closest(
+ '.directorist-add-listing-form'
+ );
+ var canCreate = $el.data('allow_new');
+ var maxLength = $el.data('max');
+ var directoryId = 0;
+ if (args.taxonomy !== 'tags') {
+ var $searchForm = $el.closest(
+ '.directorist-search-form'
+ );
+ var $archivePage = $el.closest(
+ '.directorist-archive-contents'
+ );
+ var $directory = $addListing.find(
+ 'input[name="directory_type"]'
+ );
+ var $navListItem = null;
+
+ // If search page
+ if ($searchForm.length) {
+ $navListItem = $searchForm.find(
+ '.directorist-listing-type-selection__link--current'
+ );
+ }
+ if ($archivePage.length) {
+ $navListItem = $archivePage.find(
+ '.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link'
+ );
+ }
+ if ($navListItem && $navListItem.length) {
+ directoryId = Number(
+ $navListItem.data('listing_type_id')
+ );
+ }
+ if ($directory.length) {
+ directoryId = $directory.val();
+ }
+ if (directoryId) {
+ directoryId = Number(directoryId);
+ }
+ }
+ var currentPage = 1;
+ var select2Options = {
+ allowClear: true,
+ tags: canCreate,
+ maximumSelectionLength: maxLength,
+ width: '100%',
+ escapeMarkup: function escapeMarkup(text) {
+ return text;
+ },
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+
+ // Fetch the data-icon attribute
+ var iconURI = $(data.element).attr('data-icon');
+
+ // Get the original text
+ var originalText = data.text;
+
+ // Match and count leading spaces
+ var leadingSpaces = originalText.match(/^\s+/);
+ var spaceCount = leadingSpaces
+ ? leadingSpaces[0].length
+ : 0;
+
+ // Trim leading spaces from the original text
+ originalText = originalText.trim();
+
+ // Construct the icon element
+ var iconElm = iconURI
+ ? '
'
+ )
+ : '';
+
+ // Prepare the combined text (icon + text)
+ var combinedText = iconElm + originalText;
+
+ // Create the state container
+ var $state = $(
+ '
'
+ );
+
+ // Determine the level based on space count
+ var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
+ if (level > 1) {
+ $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
+ }
+ $state.html(combinedText); // Set the combined content (icon + text)
+
+ return $state;
+ },
+ };
+ if (directorist.lazy_load_taxonomy_fields) {
+ select2Options.ajax = {
+ url: args.url,
+ dataType: 'json',
+ cache: true,
+ delay: 250,
+ data: function data(params) {
+ currentPage = params.page || 1;
+ var query = {
+ page: currentPage,
+ per_page: args.perPage,
+ hide_empty: true,
+ };
+
+ // Load empty terms on add listings.
+ if ($addListing.length) {
+ query.hide_empty = false;
+ }
+ if (params.term) {
+ query.search = params.term;
+ query.hide_empty = false;
+ }
+ if (directoryId) {
+ query.directory = directoryId;
+ }
+ return query;
+ },
+ processResults: function processResults(data) {
+ return {
+ results: data.items,
+ pagination: {
+ more: data.paginationMore,
+ },
+ };
+ },
+ transport: function transport(
+ params,
+ success,
+ failure
+ ) {
+ var $request = $.ajax(params);
+ $request
+ .then(function (data, textStatus, jqXHR) {
+ var totalPage = Number(
+ jqXHR.getResponseHeader(
+ 'x-wp-totalpages'
+ )
+ );
+ var paginationMore =
+ currentPage < totalPage;
+ var items = data.map(function (item) {
+ var text = item.name;
+ if (
+ !$addListing.length &&
+ params.data.search
+ ) {
+ text = ''
+ .concat(item.name, ' (')
+ .concat(item.count, ')');
+ }
+ return {
+ id: item.id,
+ text: text,
+ };
+ });
+ return {
+ items: items,
+ paginationMore: paginationMore,
+ };
+ })
+ .then(success);
+ $request.fail(failure);
+ return $request;
+ },
+ };
+ }
+ $el.length && $el.select2(select2Options);
+ if (directorist.lazy_load_taxonomy_fields) {
+ function setupSelectedItems(
+ $el,
+ selectedId,
+ selectedLabel
+ ) {
+ if (!$el.length || !selectedId) {
+ return;
+ }
+ var selectedIds = ''.concat(selectedId).split(',');
+ var selectedLabels = selectedLabel
+ ? ''.concat(selectedLabel).split(',')
+ : [];
+ selectedIds.forEach(function (id, index) {
+ var label =
+ selectedLabels.length >= index + 1
+ ? selectedLabels[index]
+ : '';
+ var option = new Option(label, id, true, true);
+ $el.append(option);
+ $el.trigger({
+ type: 'select2:select',
+ params: {
+ data: {
+ id: id,
+ text: label,
+ },
+ },
+ });
+ });
+ }
+ setupSelectedItems(
+ $el,
+ $el.data('selected-id'),
+ $el.data('selected-label')
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/tabs.js':
+ /*!*************************************************!*\
!*** ./assets/src/js/global/components/tabs.js ***!
\*************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
-
-document.addEventListener('load', init, false);
-function Tasks() {
- return {
- init: function init() {
- this.initToggleTabLinks();
- },
- initToggleTabLinks: function initToggleTabLinks() {
- var links = document.querySelectorAll('.directorist-toggle-tab');
- if (!links) {
- return;
- }
- var self = this;
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(links).forEach(function (item) {
- item.addEventListener('click', function (event) {
- self.handleToggleTabLinksEvent(item, event);
- });
- });
- },
- handleToggleTabLinksEvent: function handleToggleTabLinksEvent(item, event) {
- event.preventDefault();
- var navContainerClass = item.getAttribute('data-nav-container');
- var tabContainerClass = item.getAttribute('data-tab-container');
- var tabClass = item.getAttribute('data-tab');
- if (!navContainerClass || !tabContainerClass || !tabClass) {
- return;
- }
- var navContainer = item.closest('.' + navContainerClass);
- var tabContainer = document.querySelector('.' + tabContainerClass);
- if (!navContainer || !tabContainer) {
- return;
- }
- var tab = tabContainer.querySelector('.' + tabClass);
- if (!tab) {
- return;
- }
-
- // Remove Active Class
- var removeActiveClass = function removeActiveClass(item) {
- item.classList.remove('--is-active');
- };
-
- // Toggle Nav
- var activeNavItems = navContainer.querySelectorAll('.--is-active');
- if (activeNavItems) {
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(activeNavItems).forEach(removeActiveClass);
- }
- item.classList.add('--is-active');
-
- // Toggle Tab
- var activeTabItems = tabContainer.querySelectorAll('.--is-active');
- if (activeTabItems) {
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(activeTabItems).forEach(removeActiveClass);
- }
- tab.classList.add('--is-active');
-
- // Update Query Var
- var queryVarKey = item.getAttribute('data-query-var-key');
- var queryVarValue = item.getAttribute('data-query-var-value');
- if (!queryVarKey || !queryVarValue) {
- return;
- }
- this.addQueryParam(queryVarKey, queryVarValue);
- },
- addQueryParam: function addQueryParam(key, value) {
- var url = new URL(window.location.href);
- url.searchParams.set(key, value);
- window.history.pushState({}, '', url.toString());
- }
- };
-}
-function init() {
- var tasks = new Tasks();
- tasks.init();
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/utility.js":
-/*!****************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/toConsumableArray */ './node_modules/@babel/runtime/helpers/esm/toConsumableArray.js'
+ );
+
+ document.addEventListener('load', init, false);
+ function Tasks() {
+ return {
+ init: function init() {
+ this.initToggleTabLinks();
+ },
+ initToggleTabLinks: function initToggleTabLinks() {
+ var links = document.querySelectorAll(
+ '.directorist-toggle-tab'
+ );
+ if (!links) {
+ return;
+ }
+ var self = this;
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(links).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (event) {
+ self.handleToggleTabLinksEvent(
+ item,
+ event
+ );
+ }
+ );
+ });
+ },
+ handleToggleTabLinksEvent:
+ function handleToggleTabLinksEvent(item, event) {
+ event.preventDefault();
+ var navContainerClass =
+ item.getAttribute('data-nav-container');
+ var tabContainerClass =
+ item.getAttribute('data-tab-container');
+ var tabClass = item.getAttribute('data-tab');
+ if (
+ !navContainerClass ||
+ !tabContainerClass ||
+ !tabClass
+ ) {
+ return;
+ }
+ var navContainer = item.closest(
+ '.' + navContainerClass
+ );
+ var tabContainer = document.querySelector(
+ '.' + tabContainerClass
+ );
+ if (!navContainer || !tabContainer) {
+ return;
+ }
+ var tab = tabContainer.querySelector(
+ '.' + tabClass
+ );
+ if (!tab) {
+ return;
+ }
+
+ // Remove Active Class
+ var removeActiveClass =
+ function removeActiveClass(item) {
+ item.classList.remove('--is-active');
+ };
+
+ // Toggle Nav
+ var activeNavItems =
+ navContainer.querySelectorAll(
+ '.--is-active'
+ );
+ if (activeNavItems) {
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(activeNavItems).forEach(
+ removeActiveClass
+ );
+ }
+ item.classList.add('--is-active');
+
+ // Toggle Tab
+ var activeTabItems =
+ tabContainer.querySelectorAll(
+ '.--is-active'
+ );
+ if (activeTabItems) {
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(activeTabItems).forEach(
+ removeActiveClass
+ );
+ }
+ tab.classList.add('--is-active');
+
+ // Update Query Var
+ var queryVarKey =
+ item.getAttribute('data-query-var-key');
+ var queryVarValue = item.getAttribute(
+ 'data-query-var-value'
+ );
+ if (!queryVarKey || !queryVarValue) {
+ return;
+ }
+ this.addQueryParam(queryVarKey, queryVarValue);
+ },
+ addQueryParam: function addQueryParam(key, value) {
+ var url = new URL(window.location.href);
+ url.searchParams.set(key, value);
+ window.history.pushState({}, '', url.toString());
+ },
+ };
+ }
+ function init() {
+ var tasks = new Tasks();
+ tasks.init();
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/utility.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/global/components/utility.js ***!
\****************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- var $ = jQuery;
- document.querySelectorAll('.la-icon i').forEach(function (item) {
- className.push(item.getAttribute('class'));
- });
-
- // Handle Disabled Link Action
- $('.atbdp-disabled').on('click', function (e) {
- e.preventDefault();
- });
-
- // Toggle Modal
- $('.cptm-modal-toggle').on('click', function (e) {
- e.preventDefault();
- var target_class = $(this).data('target');
- $('.' + target_class).toggleClass('active');
- });
-
- // Change label on file select/change
- $('.cptm-file-field').on('change', function (e) {
- var target_id = $(this).attr('id');
- $('label[for=' + target_id + ']').text('Change');
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/global/global.js":
-/*!****************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ var $ = jQuery;
+ document
+ .querySelectorAll('.la-icon i')
+ .forEach(function (item) {
+ className.push(item.getAttribute('class'));
+ });
+
+ // Handle Disabled Link Action
+ $('.atbdp-disabled').on('click', function (e) {
+ e.preventDefault();
+ });
+
+ // Toggle Modal
+ $('.cptm-modal-toggle').on('click', function (e) {
+ e.preventDefault();
+ var target_class = $(this).data('target');
+ $('.' + target_class).toggleClass('active');
+ });
+
+ // Change label on file select/change
+ $('.cptm-file-field').on('change', function (e) {
+ var target_id = $(this).attr('id');
+ $('label[for=' + target_id + ']').text('Change');
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/global.js':
+ /*!****************************************!*\
!*** ./assets/src/js/global/global.js ***!
\****************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/modal */ "./assets/src/js/global/components/modal.js");
-/* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_modal__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _components_setup_select2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/setup-select2 */ "./assets/src/js/global/components/setup-select2.js");
-/* harmony import */ var _components_tabs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/tabs */ "./assets/src/js/global/components/tabs.js");
-/* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/utility */ "./assets/src/js/global/components/utility.js");
-/* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_components_utility__WEBPACK_IMPORTED_MODULE_4__);
-
-
-
-
-
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./components/modal */ './assets/src/js/global/components/modal.js'
+ );
+ /* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_modal__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./components/select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _components_setup_select2__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./components/setup-select2 */ './assets/src/js/global/components/setup-select2.js'
+ );
+ /* harmony import */ var _components_tabs__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./components/tabs */ './assets/src/js/global/components/tabs.js'
+ );
+ /* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ./components/utility */ './assets/src/js/global/components/utility.js'
+ );
+ /* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_utility__WEBPACK_IMPORTED_MODULE_4__
+ );
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = "
");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("
".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ }),
-
-/***/ "./assets/src/scss/layout/admin/admin-style.scss":
-/*!*******************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ '
'
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ '
'.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/scss/layout/admin/admin-style.scss':
+ /*!*******************************************************!*\
!*** ./assets/src/scss/layout/admin/admin-style.scss ***!
\*******************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":
-/*!*********************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ // extracted by mini-css-extract-plugin
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js':
+ /*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; }
-/* harmony export */ });
-function _arrayLikeToArray(r, a) {
- (null == a || a > r.length) && (a = r.length);
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
- return n;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayLikeToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayWithoutHoles; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _arrayWithoutHoles(r) {
- if (Array.isArray(r)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayWithoutHoles;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _arrayWithoutHoles(r) {
+ if (Array.isArray(r))
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/defineProperty.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _defineProperty; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperty(e, r, t) {
- return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js":
-/*!********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _defineProperty;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperty(e, r, t) {
+ return (
+ (r = (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r)) in e
+ ? Object.defineProperty(e, r, {
+ value: t,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0,
+ })
+ : (e[r] = t),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/iterableToArray.js':
+ /*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***!
\********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _iterableToArray; }
-/* harmony export */ });
-function _iterableToArray(r) {
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _iterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _iterableToArray(r) {
+ if (
+ ('undefined' != typeof Symbol &&
+ null != r[Symbol.iterator]) ||
+ null != r['@@iterator']
+ )
+ return Array.from(r);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _nonIterableSpread; }
-/* harmony export */ });
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _nonIterableSpread;
+ },
+ /* harmony export */
+ }
+ );
+ function _nonIterableSpread() {
+ throw new TypeError(
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toConsumableArray.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _toConsumableArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js");
-/* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js");
-/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
-/* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js");
-
-
-
-
-function _toConsumableArray(r) {
- return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__["default"])();
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _toConsumableArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayWithoutHoles.js */ './node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js'
+ );
+ /* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./iterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/iterableToArray.js'
+ );
+ /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./unsupportedIterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js'
+ );
+ /* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./nonIterableSpread.js */ './node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js'
+ );
+
+ function _toConsumableArray(r) {
+ return (
+ (0,
+ _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r) ||
+ (0,
+ _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(r) ||
+ (0,
+ _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(r) ||
+ (0,
+ _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])()
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPrimitive; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-function toPrimitive(t, r) {
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPrimitive;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ function toPrimitive(t, r) {
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ t
+ ) ||
+ !t
+ )
+ return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || 'default');
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ )
+ return i;
+ throw new TypeError(
+ '@@toPrimitive must return a primitive value.'
+ );
+ }
+ return ('string' === r ? String : Number)(t);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPropertyKey; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");
-
-
-function toPropertyKey(t) {
- var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string");
- return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + "";
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPropertyKey;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./toPrimitive.js */ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js'
+ );
+
+ function toPropertyKey(t) {
+ var i = (0,
+ _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__['default'])(
+ t,
+ 'string'
+ );
+ return 'symbol' ==
+ (0, _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ ? i
+ : i + '';
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":
-/*!*******************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js':
+ /*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _unsupportedIterableToArray(r, a) {
- if (r) {
- if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a);
- var t = {}.toString.call(r).slice(8, -1);
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0;
- }
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!**************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _unsupportedIterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a)
+ : void 0
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!**************************************!*\
!*** ./assets/src/js/admin/admin.js ***!
\**************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _scss_layout_admin_admin_style_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../scss/layout/admin/admin-style.scss */ "./assets/src/scss/layout/admin/admin-style.scss");
-/* harmony import */ var _global_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../global/global */ "./assets/src/js/global/global.js");
-/* harmony import */ var _components_block_1__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/block-1 */ "./assets/src/js/admin/components/block-1.js");
-/* harmony import */ var _components_block_1__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_components_block_1__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _components_block_2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/block-2 */ "./assets/src/js/admin/components/block-2.js");
-/* harmony import */ var _components_block_2__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_components_block_2__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var _components_block_3__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/block-3 */ "./assets/src/js/admin/components/block-3.js");
-/* harmony import */ var _components_block_4__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/block-4 */ "./assets/src/js/admin/components/block-4.js");
-/* harmony import */ var _components_block_4__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_components_block_4__WEBPACK_IMPORTED_MODULE_5__);
-/* harmony import */ var _components_block_5__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/block-5 */ "./assets/src/js/admin/components/block-5.js");
-/* harmony import */ var _components_block_5__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_block_5__WEBPACK_IMPORTED_MODULE_6__);
-/* harmony import */ var _components_admin_user__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/admin-user */ "./assets/src/js/admin/components/admin-user.js");
-/* harmony import */ var _components_admin_user__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_components_admin_user__WEBPACK_IMPORTED_MODULE_7__);
-/* harmony import */ var _components_subscriptionManagement__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/subscriptionManagement */ "./assets/src/js/admin/components/subscriptionManagement.js");
-/* harmony import */ var _components_subscriptionManagement__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_components_subscriptionManagement__WEBPACK_IMPORTED_MODULE_8__);
-
-
-// Global
-
-
-// Blocks
-
-
-
-
-
-
-
-// subscriptionManagement
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=admin-main.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _scss_layout_admin_admin_style_scss__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./../../scss/layout/admin/admin-style.scss */ './assets/src/scss/layout/admin/admin-style.scss'
+ );
+ /* harmony import */ var _global_global__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../global/global */ './assets/src/js/global/global.js'
+ );
+ /* harmony import */ var _components_block_1__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./components/block-1 */ './assets/src/js/admin/components/block-1.js'
+ );
+ /* harmony import */ var _components_block_1__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_block_1__WEBPACK_IMPORTED_MODULE_2__
+ );
+ /* harmony import */ var _components_block_2__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./components/block-2 */ './assets/src/js/admin/components/block-2.js'
+ );
+ /* harmony import */ var _components_block_2__WEBPACK_IMPORTED_MODULE_3___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_block_2__WEBPACK_IMPORTED_MODULE_3__
+ );
+ /* harmony import */ var _components_block_3__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ./components/block-3 */ './assets/src/js/admin/components/block-3.js'
+ );
+ /* harmony import */ var _components_block_4__WEBPACK_IMPORTED_MODULE_5__ =
+ __webpack_require__(
+ /*! ./components/block-4 */ './assets/src/js/admin/components/block-4.js'
+ );
+ /* harmony import */ var _components_block_4__WEBPACK_IMPORTED_MODULE_5___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_block_4__WEBPACK_IMPORTED_MODULE_5__
+ );
+ /* harmony import */ var _components_block_5__WEBPACK_IMPORTED_MODULE_6__ =
+ __webpack_require__(
+ /*! ./components/block-5 */ './assets/src/js/admin/components/block-5.js'
+ );
+ /* harmony import */ var _components_block_5__WEBPACK_IMPORTED_MODULE_6___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_block_5__WEBPACK_IMPORTED_MODULE_6__
+ );
+ /* harmony import */ var _components_admin_user__WEBPACK_IMPORTED_MODULE_7__ =
+ __webpack_require__(
+ /*! ./components/admin-user */ './assets/src/js/admin/components/admin-user.js'
+ );
+ /* harmony import */ var _components_admin_user__WEBPACK_IMPORTED_MODULE_7___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_admin_user__WEBPACK_IMPORTED_MODULE_7__
+ );
+ /* harmony import */ var _components_subscriptionManagement__WEBPACK_IMPORTED_MODULE_8__ =
+ __webpack_require__(
+ /*! ./components/subscriptionManagement */ './assets/src/js/admin/components/subscriptionManagement.js'
+ );
+ /* harmony import */ var _components_subscriptionManagement__WEBPACK_IMPORTED_MODULE_8___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_subscriptionManagement__WEBPACK_IMPORTED_MODULE_8__
+ );
+
+ // Global
+
+ // Blocks
+
+ // subscriptionManagement
+ })();
+ /******/
+})();
+//# sourceMappingURL=admin-main.js.map
diff --git a/assets/js/all-authors.js b/assets/js/all-authors.js
index affa1b5b9..42a83a5da 100644
--- a/assets/js/all-authors.js
+++ b/assets/js/all-authors.js
@@ -1,190 +1,272 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/public/components/author.js":
-/*!***************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/public/components/author.js':
+ /*!***************************************************!*\
!*** ./assets/src/js/public/components/author.js ***!
\***************************************************/
-/***/ (function() {
-
-// author sorting
-(function ($) {
- window.addEventListener('load', function () {
- /* Masonry layout */
- function authorsMasonry() {
- var authorsCard = $('.directorist-authors__cards');
- $(authorsCard).each(function (id, elm) {
- var authorsCardRow = $(elm).find('.directorist-row');
- var authorMasonryInit = $(authorsCardRow).imagesLoaded(function () {
- $(authorMasonryInit).masonry({
- percentPosition: true,
- horizontalOrder: true
- });
- });
- });
- }
- authorsMasonry();
+ /***/ function () {
+ // author sorting
+ (function ($) {
+ window.addEventListener('load', function () {
+ /* Masonry layout */
+ function authorsMasonry() {
+ var authorsCard = $('.directorist-authors__cards');
+ $(authorsCard).each(function (id, elm) {
+ var authorsCardRow =
+ $(elm).find('.directorist-row');
+ var authorMasonryInit = $(
+ authorsCardRow
+ ).imagesLoaded(function () {
+ $(authorMasonryInit).masonry({
+ percentPosition: true,
+ horizontalOrder: true,
+ });
+ });
+ });
+ }
+ authorsMasonry();
- /* alphabet data value */
- var alphabetValue;
+ /* alphabet data value */
+ var alphabetValue;
- /* authors nav default active item */
- if ($('.directorist-authors__nav').length) {
- $('.directorist-authors__nav ul li:first-child').addClass('active');
- }
- /* authors nav item */
- $('body').on('click', '.directorist-alphabet', function (e) {
- e.preventDefault();
- var _this = $(this);
- var alphabet = $(this).attr('data-alphabet');
- $('body').addClass('atbdp-form-fade');
- $.ajax({
- method: 'POST',
- url: directorist.ajaxurl,
- data: {
- action: 'directorist_author_alpha_sorting',
- _nonce: $(this).attr('data-nonce'),
- alphabet: $(this).attr('data-alphabet')
- },
- success: function success(response) {
- $('#directorist-all-authors').empty().append(response);
- $('body').removeClass('atbdp-form-fade');
- $('.' + alphabet).parent().addClass('active');
- alphabetValue = $(_this).attr('data-alphabet');
- authorsMasonry();
- },
- error: function error(_error) {
- //console.log(error);
- }
- });
- });
+ /* authors nav default active item */
+ if ($('.directorist-authors__nav').length) {
+ $(
+ '.directorist-authors__nav ul li:first-child'
+ ).addClass('active');
+ }
+ /* authors nav item */
+ $('body').on(
+ 'click',
+ '.directorist-alphabet',
+ function (e) {
+ e.preventDefault();
+ var _this = $(this);
+ var alphabet = $(this).attr('data-alphabet');
+ $('body').addClass('atbdp-form-fade');
+ $.ajax({
+ method: 'POST',
+ url: directorist.ajaxurl,
+ data: {
+ action: 'directorist_author_alpha_sorting',
+ _nonce: $(this).attr('data-nonce'),
+ alphabet: $(this).attr('data-alphabet'),
+ },
+ success: function success(response) {
+ $('#directorist-all-authors')
+ .empty()
+ .append(response);
+ $('body').removeClass(
+ 'atbdp-form-fade'
+ );
+ $('.' + alphabet)
+ .parent()
+ .addClass('active');
+ alphabetValue =
+ $(_this).attr('data-alphabet');
+ authorsMasonry();
+ },
+ error: function error(_error) {
+ //console.log(error);
+ },
+ });
+ }
+ );
- /* authors pagination */
- $('body').on('click', '.directorist-authors-pagination a', function (e) {
- e.preventDefault();
- var paged = $(this).text();
- if ($(this).hasClass('prev')) {
- paged = parseInt($('.directorist-authors-pagination .current').text()) - 1;
- }
- if ($(this).hasClass('next')) {
- paged = parseInt($('.directorist-authors-pagination .current').text()) + 1;
- }
- $('body').addClass('atbdp-form-fade');
- var getAlphabetValue = alphabetValue;
- $.ajax({
- method: 'POST',
- url: directorist.ajaxurl,
- data: {
- action: 'directorist_author_pagination',
- paged: paged
- },
- success: function success(response) {
- $('body').removeClass('atbdp-form-fade');
- $('#directorist-all-authors').empty().append(response);
- authorsMasonry();
- if (document.querySelector('.' + getAlphabetValue) !== null) {
- document.querySelector('.' + getAlphabetValue).closest('li').classList.add('active');
- } else if ($('.directorist-authors__nav').length) {
- $('.directorist-authors__nav ul li:first-child').addClass('active');
- }
- },
- error: function error(_error2) {
- //console.log(error);
- }
- });
- });
- });
-})(jQuery);
+ /* authors pagination */
+ $('body').on(
+ 'click',
+ '.directorist-authors-pagination a',
+ function (e) {
+ e.preventDefault();
+ var paged = $(this).text();
+ if ($(this).hasClass('prev')) {
+ paged =
+ parseInt(
+ $(
+ '.directorist-authors-pagination .current'
+ ).text()
+ ) - 1;
+ }
+ if ($(this).hasClass('next')) {
+ paged =
+ parseInt(
+ $(
+ '.directorist-authors-pagination .current'
+ ).text()
+ ) + 1;
+ }
+ $('body').addClass('atbdp-form-fade');
+ var getAlphabetValue = alphabetValue;
+ $.ajax({
+ method: 'POST',
+ url: directorist.ajaxurl,
+ data: {
+ action: 'directorist_author_pagination',
+ paged: paged,
+ },
+ success: function success(response) {
+ $('body').removeClass(
+ 'atbdp-form-fade'
+ );
+ $('#directorist-all-authors')
+ .empty()
+ .append(response);
+ authorsMasonry();
+ if (
+ document.querySelector(
+ '.' + getAlphabetValue
+ ) !== null
+ ) {
+ document
+ .querySelector(
+ '.' + getAlphabetValue
+ )
+ .closest('li')
+ .classList.add('active');
+ } else if (
+ $('.directorist-authors__nav')
+ .length
+ ) {
+ $(
+ '.directorist-authors__nav ul li:first-child'
+ ).addClass('active');
+ }
+ },
+ error: function error(_error2) {
+ //console.log(error);
+ },
+ });
+ }
+ );
+ });
+ })(jQuery);
-/***/ })
+ /***/
+ },
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!*****************************************************!*\
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!*****************************************************!*\
!*** ./assets/src/js/public/modules/all-authors.js ***!
\*****************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_author__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/author */ "./assets/src/js/public/components/author.js");
-/* harmony import */ var _components_author__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_author__WEBPACK_IMPORTED_MODULE_0__);
-//General Components
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=all-authors.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_author__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../components/author */ './assets/src/js/public/components/author.js'
+ );
+ /* harmony import */ var _components_author__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_author__WEBPACK_IMPORTED_MODULE_0__
+ );
+ //General Components
+ })();
+ /******/
+})();
+//# sourceMappingURL=all-authors.js.map
diff --git a/assets/js/all-listings.js b/assets/js/all-listings.js
index 1a6e6e2df..7a03859bf 100644
--- a/assets/js/all-listings.js
+++ b/assets/js/all-listings.js
@@ -1,3515 +1,6117 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/components/debounce.js":
-/*!*****************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/components/debounce.js':
+ /*!*****************************************************!*\
!*** ./assets/src/js/global/components/debounce.js ***!
\*****************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ debounce; }
-/* harmony export */ });
-function debounce(func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/select2-custom-control.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ debounce;
+ },
+ /* harmony export */
+ }
+ );
+ function debounce(func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function later() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/select2-custom-control.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/global/components/select2-custom-control.js ***!
\*******************************************************************/
-/***/ (function() {
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-var $ = jQuery;
-window.addEventListener('load', waitAndInit);
-window.addEventListener('directorist-search-form-nav-tab-reloaded', waitAndInit);
-window.addEventListener('directorist-type-change', waitAndInit);
-window.addEventListener('directorist-instant-search-reloaded', waitAndInit);
-function waitAndInit() {
- setTimeout(init, 0);
-}
-
-// Initialize
-function init() {
- // Add custom dropdown toggle button
- selec2_add_custom_dropdown_toggle_button();
-
- // Add custom close button where needed
- selec2_add_custom_close_button_if_needed();
-
- // Add custom close button if field contains value on change
- $('.select2-hidden-accessible').on('change', function (e) {
- var value = $(this).children('option:selected').val();
- if (!value) {
- return;
- }
- selec2_add_custom_close_button($(this));
- var selectItems = this.parentElement.querySelectorAll('.select2-selection__choice');
- selectItems.forEach(function (item) {
- item.childNodes && item.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- item.title = modifiedString;
- }
- });
- });
- var customSelectItem = this.parentElement.querySelector('.select2-selection__rendered');
- customSelectItem.childNodes && customSelectItem.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- }
- });
- });
-}
-function selec2_add_custom_dropdown_toggle_button() {
- // Remove Default
- $('.select2-selection__arrow').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container('.select2-hidden-accessible');
- if (!addon_container) {
- return;
- }
- var dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
- if (!dropdown.length) {
- // Add Dropdown Toggle Button
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/chevron-down.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var dropdownHTML = "
".concat(iconHTML, " ");
- addon_container.append(dropdownHTML);
- }
- var selec2_custom_dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
-
- // Toggle --is-open class
- $('.select2-hidden-accessible').on('select2:open', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.addClass('--is-open');
- });
- $('.select2-hidden-accessible').on('select2:close', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.removeClass('--is-open');
- var dropdownParent = $(this).closest('.directorist-search-field');
- var renderTitle = $(this).next().find('.select2-selection__rendered').attr('title');
-
- // Check if renderTitle is empty and remove the focus class if so
- if (!renderTitle) {
- dropdownParent.removeClass('input-is-focused');
- } else {
- dropdownParent.addClass('input-has-value');
- }
- });
-
- // Toggle Dropdown
- selec2_custom_dropdown.on('click', function (e) {
- var isOpen = $(this).hasClass('--is-open');
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- if (isOpen) {
- field.select2('close');
- } else {
- field.select2('open');
- }
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_add_custom_close_button_if_needed() {
- var select2_fields = $('.select2-hidden-accessible');
- if (!select2_fields && !select2_fields.length) {
- return;
- }
- var _iterator = _createForOfIteratorHelper(select2_fields),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var field = _step.value;
- var value = $(field).children('option:selected').val();
- if (!value) {
- continue;
- }
- selec2_add_custom_close_button(field);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-}
-function selec2_add_custom_close_button(field) {
- // Remove Default
- $('.select2-selection__clear').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove if already exists
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Add
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/times.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- addon_container.prepend("
".concat(iconHTML, " "));
- var selec2_custom_close = addon_container.find('.directorist-select2-dropdown-close');
- selec2_custom_close.on('click', function (e) {
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- field.val(null).trigger('change');
- addon_container.find('.directorist-select2-dropdown-close').remove();
- selec2_adjust_space_for_addons();
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_remove_custom_close_button(field) {
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_get_addon_container(field) {
- var container = field ? $(field).next('.select2-container') : $('.select2-container');
- container = $(container).find('.directorist-select2-addons-area');
- if (!container.length) {
- $('.select2-container').append('
');
- container = $('.select2-container').find('.directorist-select2-addons-area');
- }
- var container = field ? $(field).next('.select2-container') : null;
- if (!container) {
- return null;
- }
- var addonsArea = $(container).find('.directorist-select2-addons-area');
- if (!addonsArea.length) {
- container.append('
');
- return container.find('.directorist-select2-addons-area');
- }
- return addonsArea;
-}
-function selec2_adjust_space_for_addons() {
- var container = $('.select2-container').find('.directorist-select2-addons-area');
- if (!container.length) {
- return;
- }
- var width = container.outerWidth();
- $('.select2-container').find('.select2-selection__rendered').css({
- 'padding-right': width + 'px'
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/setup-select2.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ var $ = jQuery;
+ window.addEventListener('load', waitAndInit);
+ window.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ waitAndInit
+ );
+ window.addEventListener('directorist-type-change', waitAndInit);
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ waitAndInit
+ );
+ function waitAndInit() {
+ setTimeout(init, 0);
+ }
+
+ // Initialize
+ function init() {
+ // Add custom dropdown toggle button
+ selec2_add_custom_dropdown_toggle_button();
+
+ // Add custom close button where needed
+ selec2_add_custom_close_button_if_needed();
+
+ // Add custom close button if field contains value on change
+ $('.select2-hidden-accessible').on('change', function (e) {
+ var value = $(this).children('option:selected').val();
+ if (!value) {
+ return;
+ }
+ selec2_add_custom_close_button($(this));
+ var selectItems = this.parentElement.querySelectorAll(
+ '.select2-selection__choice'
+ );
+ selectItems.forEach(function (item) {
+ item.childNodes &&
+ item.childNodes.forEach(function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ item.title = modifiedString;
+ }
+ });
+ });
+ var customSelectItem = this.parentElement.querySelector(
+ '.select2-selection__rendered'
+ );
+ customSelectItem.childNodes &&
+ customSelectItem.childNodes.forEach(
+ function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ }
+ }
+ );
+ });
+ }
+ function selec2_add_custom_dropdown_toggle_button() {
+ // Remove Default
+ $('.select2-selection__arrow').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(
+ '.select2-hidden-accessible'
+ );
+ if (!addon_container) {
+ return;
+ }
+ var dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+ if (!dropdown.length) {
+ // Add Dropdown Toggle Button
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/chevron-down.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ var dropdownHTML =
+ '
'.concat(
+ iconHTML,
+ ' '
+ );
+ addon_container.append(dropdownHTML);
+ }
+ var selec2_custom_dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+
+ // Toggle --is-open class
+ $('.select2-hidden-accessible').on(
+ 'select2:open',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.addClass('--is-open');
+ }
+ );
+ $('.select2-hidden-accessible').on(
+ 'select2:close',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.removeClass('--is-open');
+ var dropdownParent = $(this).closest(
+ '.directorist-search-field'
+ );
+ var renderTitle = $(this)
+ .next()
+ .find('.select2-selection__rendered')
+ .attr('title');
+
+ // Check if renderTitle is empty and remove the focus class if so
+ if (!renderTitle) {
+ dropdownParent.removeClass('input-is-focused');
+ } else {
+ dropdownParent.addClass('input-has-value');
+ }
+ }
+ );
+
+ // Toggle Dropdown
+ selec2_custom_dropdown.on('click', function (e) {
+ var isOpen = $(this).hasClass('--is-open');
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ if (isOpen) {
+ field.select2('close');
+ } else {
+ field.select2('open');
+ }
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_add_custom_close_button_if_needed() {
+ var select2_fields = $('.select2-hidden-accessible');
+ if (!select2_fields && !select2_fields.length) {
+ return;
+ }
+ var _iterator = _createForOfIteratorHelper(select2_fields),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
+ var field = _step.value;
+ var value = $(field)
+ .children('option:selected')
+ .val();
+ if (!value) {
+ continue;
+ }
+ selec2_add_custom_close_button(field);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+ function selec2_add_custom_close_button(field) {
+ // Remove Default
+ $('.select2-selection__clear').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove if already exists
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Add
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/times.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ addon_container.prepend(
+ '
'.concat(
+ iconHTML,
+ ' '
+ )
+ );
+ var selec2_custom_close = addon_container.find(
+ '.directorist-select2-dropdown-close'
+ );
+ selec2_custom_close.on('click', function (e) {
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ field.val(null).trigger('change');
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+ selec2_adjust_space_for_addons();
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_remove_custom_close_button(field) {
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_get_addon_container(field) {
+ var container = field
+ ? $(field).next('.select2-container')
+ : $('.select2-container');
+ container = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ $('.select2-container').append(
+ '
'
+ );
+ container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ var container = field
+ ? $(field).next('.select2-container')
+ : null;
+ if (!container) {
+ return null;
+ }
+ var addonsArea = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!addonsArea.length) {
+ container.append(
+ '
'
+ );
+ return container.find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ return addonsArea;
+ }
+ function selec2_adjust_space_for_addons() {
+ var container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ return;
+ }
+ var width = container.outerWidth();
+ $('.select2-container')
+ .find('.select2-selection__rendered')
+ .css({
+ 'padding-right': width + 'px',
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/setup-select2.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/global/components/setup-select2.js ***!
\**********************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_select2_custom_control__WEBPACK_IMPORTED_MODULE_2__);
-
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-var $ = jQuery;
-window.addEventListener('load', initSelect2);
-document.body.addEventListener('directorist-search-form-nav-tab-reloaded', initSelect2);
-document.body.addEventListener('directorist-reload-select2-fields', initSelect2);
-window.addEventListener('directorist-instant-search-reloaded', initSelect2);
-
-// Init Static Select 2 Fields
-function initSelect2() {
- var selectors = ['.directorist-select select', '#directorist-select-js',
- // Not found in any template
- '#directorist-search-category-js',
- // Not found in any template
- // '#directorist-select-st-s-js',
- // '#directorist-select-sn-s-js',
- // '#directorist-select-mn-e-js',
- // '#directorist-select-tu-e-js',
- // '#directorist-select-wd-s-js',
- // '#directorist-select-wd-e-js',
- // '#directorist-select-th-e-js',
- // '#directorist-select-fr-s-js',
- // '#directorist-select-fr-e-js',
- '.select-basic',
- // Not found in any template
- '#loc-type', '#cat-type', '#at_biz_dir-category', '.bdas-location-search',
- // Not found in any template
- '.bdas-category-search' // Not found in any template
- ];
- selectors.forEach(function (selector) {
- return (0,_lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(selector);
- });
- initMaybeLazyLoadedTaxonomySelect2();
-}
-
-// Init Select2 Ajax Fields
-function initMaybeLazyLoadedTaxonomySelect2() {
- var restBase = "".concat(directorist.rest_url, "directorist/v1");
- maybeLazyLoadCategories({
- selector: '.directorist-search-category select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadCategories({
- selector: '.directorist-form-categories-field select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-search-location select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-form-location-field select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadTags({
- selector: '.directorist-form-tag-field select',
- url: "".concat(restBase, "/listings/tags")
- });
-}
-function maybeLazyLoadCategories(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'categories'
- }), args));
-}
-function maybeLazyLoadLocations(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'locations'
- }), args));
-}
-function maybeLazyLoadTags(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'tags'
- }), args));
-}
-
-// maybeLazyLoadTaxonomyTermsSelect2
-function maybeLazyLoadTaxonomyTermsSelect2(args) {
- var defaults = {
- selector: '',
- url: '',
- taxonomy: 'tags'
- };
- args = _objectSpread(_objectSpread({}, defaults), args);
- if (!args.selector) {
- return;
- }
- var $el = $(args.selector);
- var $addListing = $el.closest('.directorist-add-listing-form');
- var canCreate = $el.data('allow_new');
- var maxLength = $el.data('max');
- var directoryId = 0;
- if (args.taxonomy !== 'tags') {
- var $searchForm = $el.closest('.directorist-search-form');
- var $archivePage = $el.closest('.directorist-archive-contents');
- var $directory = $addListing.find('input[name="directory_type"]');
- var $navListItem = null;
-
- // If search page
- if ($searchForm.length) {
- $navListItem = $searchForm.find('.directorist-listing-type-selection__link--current');
- }
- if ($archivePage.length) {
- $navListItem = $archivePage.find('.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link');
- }
- if ($navListItem && $navListItem.length) {
- directoryId = Number($navListItem.data('listing_type_id'));
- }
- if ($directory.length) {
- directoryId = $directory.val();
- }
- if (directoryId) {
- directoryId = Number(directoryId);
- }
- }
- var currentPage = 1;
- var select2Options = {
- allowClear: true,
- tags: canCreate,
- maximumSelectionLength: maxLength,
- width: '100%',
- escapeMarkup: function escapeMarkup(text) {
- return text;
- },
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
-
- // Fetch the data-icon attribute
- var iconURI = $(data.element).attr('data-icon');
-
- // Get the original text
- var originalText = data.text;
-
- // Match and count leading spaces
- var leadingSpaces = originalText.match(/^\s+/);
- var spaceCount = leadingSpaces ? leadingSpaces[0].length : 0;
-
- // Trim leading spaces from the original text
- originalText = originalText.trim();
-
- // Construct the icon element
- var iconElm = iconURI ? "
") : '';
-
- // Prepare the combined text (icon + text)
- var combinedText = iconElm + originalText;
-
- // Create the state container
- var $state = $('
');
-
- // Determine the level based on space count
- var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
- if (level > 1) {
- $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
- }
- $state.html(combinedText); // Set the combined content (icon + text)
-
- return $state;
- }
- };
- if (directorist.lazy_load_taxonomy_fields) {
- select2Options.ajax = {
- url: args.url,
- dataType: 'json',
- cache: true,
- delay: 250,
- data: function data(params) {
- currentPage = params.page || 1;
- var query = {
- page: currentPage,
- per_page: args.perPage,
- hide_empty: true
- };
-
- // Load empty terms on add listings.
- if ($addListing.length) {
- query.hide_empty = false;
- }
- if (params.term) {
- query.search = params.term;
- query.hide_empty = false;
- }
- if (directoryId) {
- query.directory = directoryId;
- }
- return query;
- },
- processResults: function processResults(data) {
- return {
- results: data.items,
- pagination: {
- more: data.paginationMore
- }
- };
- },
- transport: function transport(params, success, failure) {
- var $request = $.ajax(params);
- $request.then(function (data, textStatus, jqXHR) {
- var totalPage = Number(jqXHR.getResponseHeader('x-wp-totalpages'));
- var paginationMore = currentPage < totalPage;
- var items = data.map(function (item) {
- var text = item.name;
- if (!$addListing.length && params.data.search) {
- text = "".concat(item.name, " (").concat(item.count, ")");
- }
- return {
- id: item.id,
- text: text
- };
- });
- return {
- items: items,
- paginationMore: paginationMore
- };
- }).then(success);
- $request.fail(failure);
- return $request;
- }
- };
- }
- $el.length && $el.select2(select2Options);
- if (directorist.lazy_load_taxonomy_fields) {
- function setupSelectedItems($el, selectedId, selectedLabel) {
- if (!$el.length || !selectedId) {
- return;
- }
- var selectedIds = "".concat(selectedId).split(',');
- var selectedLabels = selectedLabel ? "".concat(selectedLabel).split(',') : [];
- selectedIds.forEach(function (id, index) {
- var label = selectedLabels.length >= index + 1 ? selectedLabels[index] : '';
- var option = new Option(label, id, true, true);
- $el.append(option);
- $el.trigger({
- type: 'select2:select',
- params: {
- data: {
- id: id,
- text: label
- }
- }
- });
- });
- }
- setupSelectedItems($el, $el.data('selected-id'), $el.data('selected-label'));
- }
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__
+ );
+
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+
+ var $ = jQuery;
+ window.addEventListener('load', initSelect2);
+ document.body.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ initSelect2
+ );
+ document.body.addEventListener(
+ 'directorist-reload-select2-fields',
+ initSelect2
+ );
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ initSelect2
+ );
+
+ // Init Static Select 2 Fields
+ function initSelect2() {
+ var selectors = [
+ '.directorist-select select',
+ '#directorist-select-js',
+ // Not found in any template
+ '#directorist-search-category-js',
+ // Not found in any template
+ // '#directorist-select-st-s-js',
+ // '#directorist-select-sn-s-js',
+ // '#directorist-select-mn-e-js',
+ // '#directorist-select-tu-e-js',
+ // '#directorist-select-wd-s-js',
+ // '#directorist-select-wd-e-js',
+ // '#directorist-select-th-e-js',
+ // '#directorist-select-fr-s-js',
+ // '#directorist-select-fr-e-js',
+ '.select-basic',
+ // Not found in any template
+ '#loc-type',
+ '#cat-type',
+ '#at_biz_dir-category',
+ '.bdas-location-search',
+ // Not found in any template
+ '.bdas-category-search', // Not found in any template
+ ];
+ selectors.forEach(function (selector) {
+ return (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(
+ selector
+ );
+ });
+ initMaybeLazyLoadedTaxonomySelect2();
+ }
+
+ // Init Select2 Ajax Fields
+ function initMaybeLazyLoadedTaxonomySelect2() {
+ var restBase = ''.concat(
+ directorist.rest_url,
+ 'directorist/v1'
+ );
+ maybeLazyLoadCategories({
+ selector: '.directorist-search-category select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadCategories({
+ selector: '.directorist-form-categories-field select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-search-location select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-form-location-field select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadTags({
+ selector: '.directorist-form-tag-field select',
+ url: ''.concat(restBase, '/listings/tags'),
+ });
+ }
+ function maybeLazyLoadCategories(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'categories',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadLocations(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'locations',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadTags(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'tags',
+ }
+ ),
+ args
+ )
+ );
+ }
+
+ // maybeLazyLoadTaxonomyTermsSelect2
+ function maybeLazyLoadTaxonomyTermsSelect2(args) {
+ var defaults = {
+ selector: '',
+ url: '',
+ taxonomy: 'tags',
+ };
+ args = _objectSpread(_objectSpread({}, defaults), args);
+ if (!args.selector) {
+ return;
+ }
+ var $el = $(args.selector);
+ var $addListing = $el.closest(
+ '.directorist-add-listing-form'
+ );
+ var canCreate = $el.data('allow_new');
+ var maxLength = $el.data('max');
+ var directoryId = 0;
+ if (args.taxonomy !== 'tags') {
+ var $searchForm = $el.closest(
+ '.directorist-search-form'
+ );
+ var $archivePage = $el.closest(
+ '.directorist-archive-contents'
+ );
+ var $directory = $addListing.find(
+ 'input[name="directory_type"]'
+ );
+ var $navListItem = null;
+
+ // If search page
+ if ($searchForm.length) {
+ $navListItem = $searchForm.find(
+ '.directorist-listing-type-selection__link--current'
+ );
+ }
+ if ($archivePage.length) {
+ $navListItem = $archivePage.find(
+ '.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link'
+ );
+ }
+ if ($navListItem && $navListItem.length) {
+ directoryId = Number(
+ $navListItem.data('listing_type_id')
+ );
+ }
+ if ($directory.length) {
+ directoryId = $directory.val();
+ }
+ if (directoryId) {
+ directoryId = Number(directoryId);
+ }
+ }
+ var currentPage = 1;
+ var select2Options = {
+ allowClear: true,
+ tags: canCreate,
+ maximumSelectionLength: maxLength,
+ width: '100%',
+ escapeMarkup: function escapeMarkup(text) {
+ return text;
+ },
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+
+ // Fetch the data-icon attribute
+ var iconURI = $(data.element).attr('data-icon');
+
+ // Get the original text
+ var originalText = data.text;
+
+ // Match and count leading spaces
+ var leadingSpaces = originalText.match(/^\s+/);
+ var spaceCount = leadingSpaces
+ ? leadingSpaces[0].length
+ : 0;
+
+ // Trim leading spaces from the original text
+ originalText = originalText.trim();
+
+ // Construct the icon element
+ var iconElm = iconURI
+ ? '
'
+ )
+ : '';
+
+ // Prepare the combined text (icon + text)
+ var combinedText = iconElm + originalText;
+
+ // Create the state container
+ var $state = $(
+ '
'
+ );
+
+ // Determine the level based on space count
+ var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
+ if (level > 1) {
+ $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
+ }
+ $state.html(combinedText); // Set the combined content (icon + text)
+
+ return $state;
+ },
+ };
+ if (directorist.lazy_load_taxonomy_fields) {
+ select2Options.ajax = {
+ url: args.url,
+ dataType: 'json',
+ cache: true,
+ delay: 250,
+ data: function data(params) {
+ currentPage = params.page || 1;
+ var query = {
+ page: currentPage,
+ per_page: args.perPage,
+ hide_empty: true,
+ };
+
+ // Load empty terms on add listings.
+ if ($addListing.length) {
+ query.hide_empty = false;
+ }
+ if (params.term) {
+ query.search = params.term;
+ query.hide_empty = false;
+ }
+ if (directoryId) {
+ query.directory = directoryId;
+ }
+ return query;
+ },
+ processResults: function processResults(data) {
+ return {
+ results: data.items,
+ pagination: {
+ more: data.paginationMore,
+ },
+ };
+ },
+ transport: function transport(
+ params,
+ success,
+ failure
+ ) {
+ var $request = $.ajax(params);
+ $request
+ .then(function (data, textStatus, jqXHR) {
+ var totalPage = Number(
+ jqXHR.getResponseHeader(
+ 'x-wp-totalpages'
+ )
+ );
+ var paginationMore =
+ currentPage < totalPage;
+ var items = data.map(function (item) {
+ var text = item.name;
+ if (
+ !$addListing.length &&
+ params.data.search
+ ) {
+ text = ''
+ .concat(item.name, ' (')
+ .concat(item.count, ')');
+ }
+ return {
+ id: item.id,
+ text: text,
+ };
+ });
+ return {
+ items: items,
+ paginationMore: paginationMore,
+ };
+ })
+ .then(success);
+ $request.fail(failure);
+ return $request;
+ },
+ };
+ }
+ $el.length && $el.select2(select2Options);
+ if (directorist.lazy_load_taxonomy_fields) {
+ function setupSelectedItems(
+ $el,
+ selectedId,
+ selectedLabel
+ ) {
+ if (!$el.length || !selectedId) {
+ return;
+ }
+ var selectedIds = ''.concat(selectedId).split(',');
+ var selectedLabels = selectedLabel
+ ? ''.concat(selectedLabel).split(',')
+ : [];
+ selectedIds.forEach(function (id, index) {
+ var label =
+ selectedLabels.length >= index + 1
+ ? selectedLabels[index]
+ : '';
+ var option = new Option(label, id, true, true);
+ $el.append(option);
+ $el.trigger({
+ type: 'select2:select',
+ params: {
+ data: {
+ id: id,
+ text: label,
+ },
+ },
+ });
+ });
+ }
+ setupSelectedItems(
+ $el,
+ $el.data('selected-id'),
+ $el.data('selected-label')
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = "
");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("
".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/archive-sidebar.js":
-/*!************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ '
'
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ '
'.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/archive-sidebar.js':
+ /*!************************************************************!*\
!*** ./assets/src/js/public/components/archive-sidebar.js ***!
\************************************************************/
-/***/ (function() {
-
-// Archive Sidebar
-window.addEventListener('load', function () {
- var body = document.body;
-
- // Toggle sidebar and update toggle button's active state
- function toggleSidebar(toggleBtn, archiveSidebar) {
- archiveSidebar.classList.toggle('listing-with-sidebar__sidebar--open');
- toggleBtn.classList.toggle('directorist-archive-sidebar-toggle--active');
- body.classList.toggle('modal-overlay-enabled');
- }
-
- // Close sidebar and reset toggle button's active state
- function closeSidebar(toggleBtn, archiveSidebar) {
- archiveSidebar.classList.remove('listing-with-sidebar__sidebar--open');
- toggleBtn.classList.remove('directorist-archive-sidebar-toggle--active');
- body.classList.remove('modal-overlay-enabled');
- }
-
- // Toggle or close sidebar when toggle/close button is clicked
- body.addEventListener('click', function (e) {
- var targetElement = e.target;
- var toggleBtn = targetElement.closest('.directorist-archive-sidebar-toggle');
- var closeBtn = targetElement.closest('.directorist-advanced-filter__close');
- if (toggleBtn) {
- var sidebar = toggleBtn.closest('.listing-with-sidebar').querySelector('.listing-with-sidebar__sidebar');
- toggleSidebar(toggleBtn, sidebar);
- } else if (closeBtn) {
- var _sidebar = closeBtn.closest('.listing-with-sidebar').querySelector('.listing-with-sidebar__sidebar');
- var _toggleBtn = _sidebar.closest('.listing-with-sidebar').querySelector('.directorist-archive-sidebar-toggle');
- closeSidebar(_toggleBtn, _sidebar);
- } else if (body.classList.contains('modal-overlay-enabled') && !targetElement.closest('.listing-with-sidebar__sidebar')) {
- // Check directorist color picker is available or not
- var directoristColorPicker = body.querySelector('.listing-with-sidebar__sidebar--open .wp-color-result');
- if (directoristColorPicker) return;
- document.querySelectorAll('.listing-with-sidebar__sidebar--open').forEach(function (sidebar) {
- var toggleBtn = sidebar.closest('.listing-with-sidebar').querySelector('.directorist-archive-sidebar-toggle');
- closeSidebar(toggleBtn, sidebar);
- });
- }
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/category-custom-fields.js":
-/*!*******************************************************************!*\
+ /***/ function () {
+ // Archive Sidebar
+ window.addEventListener('load', function () {
+ var body = document.body;
+
+ // Toggle sidebar and update toggle button's active state
+ function toggleSidebar(toggleBtn, archiveSidebar) {
+ archiveSidebar.classList.toggle(
+ 'listing-with-sidebar__sidebar--open'
+ );
+ toggleBtn.classList.toggle(
+ 'directorist-archive-sidebar-toggle--active'
+ );
+ body.classList.toggle('modal-overlay-enabled');
+ }
+
+ // Close sidebar and reset toggle button's active state
+ function closeSidebar(toggleBtn, archiveSidebar) {
+ archiveSidebar.classList.remove(
+ 'listing-with-sidebar__sidebar--open'
+ );
+ toggleBtn.classList.remove(
+ 'directorist-archive-sidebar-toggle--active'
+ );
+ body.classList.remove('modal-overlay-enabled');
+ }
+
+ // Toggle or close sidebar when toggle/close button is clicked
+ body.addEventListener('click', function (e) {
+ var targetElement = e.target;
+ var toggleBtn = targetElement.closest(
+ '.directorist-archive-sidebar-toggle'
+ );
+ var closeBtn = targetElement.closest(
+ '.directorist-advanced-filter__close'
+ );
+ if (toggleBtn) {
+ var sidebar = toggleBtn
+ .closest('.listing-with-sidebar')
+ .querySelector(
+ '.listing-with-sidebar__sidebar'
+ );
+ toggleSidebar(toggleBtn, sidebar);
+ } else if (closeBtn) {
+ var _sidebar = closeBtn
+ .closest('.listing-with-sidebar')
+ .querySelector(
+ '.listing-with-sidebar__sidebar'
+ );
+ var _toggleBtn = _sidebar
+ .closest('.listing-with-sidebar')
+ .querySelector(
+ '.directorist-archive-sidebar-toggle'
+ );
+ closeSidebar(_toggleBtn, _sidebar);
+ } else if (
+ body.classList.contains('modal-overlay-enabled') &&
+ !targetElement.closest(
+ '.listing-with-sidebar__sidebar'
+ )
+ ) {
+ // Check directorist color picker is available or not
+ var directoristColorPicker = body.querySelector(
+ '.listing-with-sidebar__sidebar--open .wp-color-result'
+ );
+ if (directoristColorPicker) return;
+ document
+ .querySelectorAll(
+ '.listing-with-sidebar__sidebar--open'
+ )
+ .forEach(function (sidebar) {
+ var toggleBtn = sidebar
+ .closest('.listing-with-sidebar')
+ .querySelector(
+ '.directorist-archive-sidebar-toggle'
+ );
+ closeSidebar(toggleBtn, sidebar);
+ });
+ }
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/category-custom-fields.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/public/components/category-custom-fields.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ initSearchCategoryCustomFields; }
-/* harmony export */ });
-// Search Category Change
-function hideAllCustomFieldsExceptSelected(relations, categories, $container) {
- var fields = Object.keys(relations);
- var wrappers = ['.directorist-advanced-filter__advanced__element', '.directorist-search-modal__input', '.directorist-search-field'];
- if (!fields.length) {
- return;
- }
-
- // Convert categories to array if it's not already
- var categoryArray = Array.isArray(categories) ? categories : [categories];
- fields.forEach(function (field) {
- var fieldCategory = relations[field];
-
- // Try multiple selectors to find the field
- var $field = null;
- var selectors = ["[name=\"custom_field[".concat(field, "]\"]"), "[name=\"custom_field[".concat(field, "][]\"]"), "[name*=\"".concat(field, "\"]"), "[data-field-key=\"".concat(field, "\"]"), "[id*=\"".concat(field, "\"]")];
- for (var _i = 0, _selectors = selectors; _i < _selectors.length; _i++) {
- var selector = _selectors[_i];
- $field = $container.find(selector);
- if ($field.length > 0) {
- break;
- }
- }
- if (!$field || !$field.length) {
- return;
- }
-
- // Check if the field category matches any of the selected categories
- var shouldShow = categoryArray.some(function (category) {
- return Number(category) === Number(fieldCategory);
- });
- if (shouldShow) {
- $field.prop('disabled', false);
- wrappers.forEach(function (wrapper) {
- var $wrapper = $field.closest(wrapper);
- if ($wrapper.length) {
- $wrapper.show();
- }
- });
- } else {
- $field.prop('disabled', true);
- wrappers.forEach(function (wrapper) {
- var $wrapper = $field.closest(wrapper);
- if ($wrapper.length) {
- $wrapper.hide();
- }
- });
- }
- });
-}
-function initSearchCategoryCustomFields($) {
- // Handle multiple search forms and containers
- var containers = ['.directorist-search-contents', '.directorist-archive-contents', '.directorist-search-form', '.directorist-add-listing-form'];
- containers.forEach(function (containerSelector) {
- var $container = $(containerSelector);
- if ($container.length) {
- // Bind events to all category selects within this container
- $container.on('change', '.directorist-category-select, .directorist-search-category select, .bdas-category-search', function (event) {
- var $this = $(this);
- var $form = $this.parents('form');
- var categories = $this.val();
- var attributes = $form.data('atts');
-
- // If form doesn't have attributes, try container
- if (!attributes) {
- attributes = $container.data('atts');
- }
-
- // If still no attributes, try document body
- if (!attributes) {
- attributes = $(document.body).data('atts');
- }
- if (!attributes || !attributes.category_custom_fields_relations) {
- return;
- }
-
- // Handle both single and multiple category selections
- if (categories) {
- // Convert to array if it's a single value
- if (!Array.isArray(categories)) {
- categories = [categories];
- }
- // Convert string values to numbers and filter out empty values
- categories = categories.map(function (cat) {
- return Number(cat);
- }).filter(function (cat) {
- return cat > 0;
- }); // Filter out 0, null, undefined, etc.
- } else {
- categories = [];
- }
-
- // Use the specific container for field search to avoid conflicts
- hideAllCustomFieldsExceptSelected(attributes.category_custom_fields_relations, categories, $container);
- });
-
- // Trigger change event on page load for all category selects in this container
- $container.find('.directorist-category-select, .directorist-search-category select, .bdas-category-search').each(function () {
- $(this).trigger('change');
- });
- }
- });
-
- // Also handle global category selects that might not be in specific containers
- var globalSelectors = '.directorist-category-select, .directorist-search-category select, .bdas-category-search';
- $(document).on('change', globalSelectors, function (event) {
- var $this = $(this);
-
- // Only handle if not already handled by container-specific handlers
- if (!event.isDefaultPrevented()) {
- var $form = $this.parents('form');
- var categories = $this.val();
- var attributes = $form.data('atts');
- if (!attributes) {
- attributes = $(document.body).data('atts');
- }
- if (!attributes || !attributes.category_custom_fields_relations) {
- return;
- }
-
- // Handle both single and multiple category selections
- if (categories) {
- if (!Array.isArray(categories)) {
- categories = [categories];
- }
- categories = categories.map(function (cat) {
- return Number(cat);
- }).filter(function (cat) {
- return cat > 0;
- });
- } else {
- categories = [];
- }
- hideAllCustomFieldsExceptSelected(attributes.category_custom_fields_relations, categories, $(document.body));
- }
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/categoryLocation.js":
-/*!*************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ initSearchCategoryCustomFields;
+ },
+ /* harmony export */
+ }
+ );
+ // Search Category Change
+ function hideAllCustomFieldsExceptSelected(
+ relations,
+ categories,
+ $container
+ ) {
+ var fields = Object.keys(relations);
+ var wrappers = [
+ '.directorist-advanced-filter__advanced__element',
+ '.directorist-search-modal__input',
+ '.directorist-search-field',
+ ];
+ if (!fields.length) {
+ return;
+ }
+
+ // Convert categories to array if it's not already
+ var categoryArray = Array.isArray(categories)
+ ? categories
+ : [categories];
+ fields.forEach(function (field) {
+ var fieldCategory = relations[field];
+
+ // Try multiple selectors to find the field
+ var $field = null;
+ var selectors = [
+ '[name="custom_field['.concat(field, ']"]'),
+ '[name="custom_field['.concat(field, '][]"]'),
+ '[name*="'.concat(field, '"]'),
+ '[data-field-key="'.concat(field, '"]'),
+ '[id*="'.concat(field, '"]'),
+ ];
+ for (
+ var _i = 0, _selectors = selectors;
+ _i < _selectors.length;
+ _i++
+ ) {
+ var selector = _selectors[_i];
+ $field = $container.find(selector);
+ if ($field.length > 0) {
+ break;
+ }
+ }
+ if (!$field || !$field.length) {
+ return;
+ }
+
+ // Check if the field category matches any of the selected categories
+ var shouldShow = categoryArray.some(
+ function (category) {
+ return (
+ Number(category) === Number(fieldCategory)
+ );
+ }
+ );
+ if (shouldShow) {
+ $field.prop('disabled', false);
+ wrappers.forEach(function (wrapper) {
+ var $wrapper = $field.closest(wrapper);
+ if ($wrapper.length) {
+ $wrapper.show();
+ }
+ });
+ } else {
+ $field.prop('disabled', true);
+ wrappers.forEach(function (wrapper) {
+ var $wrapper = $field.closest(wrapper);
+ if ($wrapper.length) {
+ $wrapper.hide();
+ }
+ });
+ }
+ });
+ }
+ function initSearchCategoryCustomFields($) {
+ // Handle multiple search forms and containers
+ var containers = [
+ '.directorist-search-contents',
+ '.directorist-archive-contents',
+ '.directorist-search-form',
+ '.directorist-add-listing-form',
+ ];
+ containers.forEach(function (containerSelector) {
+ var $container = $(containerSelector);
+ if ($container.length) {
+ // Bind events to all category selects within this container
+ $container.on(
+ 'change',
+ '.directorist-category-select, .directorist-search-category select, .bdas-category-search',
+ function (event) {
+ var $this = $(this);
+ var $form = $this.parents('form');
+ var categories = $this.val();
+ var attributes = $form.data('atts');
+
+ // If form doesn't have attributes, try container
+ if (!attributes) {
+ attributes = $container.data('atts');
+ }
+
+ // If still no attributes, try document body
+ if (!attributes) {
+ attributes = $(document.body).data(
+ 'atts'
+ );
+ }
+ if (
+ !attributes ||
+ !attributes.category_custom_fields_relations
+ ) {
+ return;
+ }
+
+ // Handle both single and multiple category selections
+ if (categories) {
+ // Convert to array if it's a single value
+ if (!Array.isArray(categories)) {
+ categories = [categories];
+ }
+ // Convert string values to numbers and filter out empty values
+ categories = categories
+ .map(function (cat) {
+ return Number(cat);
+ })
+ .filter(function (cat) {
+ return cat > 0;
+ }); // Filter out 0, null, undefined, etc.
+ } else {
+ categories = [];
+ }
+
+ // Use the specific container for field search to avoid conflicts
+ hideAllCustomFieldsExceptSelected(
+ attributes.category_custom_fields_relations,
+ categories,
+ $container
+ );
+ }
+ );
+
+ // Trigger change event on page load for all category selects in this container
+ $container
+ .find(
+ '.directorist-category-select, .directorist-search-category select, .bdas-category-search'
+ )
+ .each(function () {
+ $(this).trigger('change');
+ });
+ }
+ });
+
+ // Also handle global category selects that might not be in specific containers
+ var globalSelectors =
+ '.directorist-category-select, .directorist-search-category select, .bdas-category-search';
+ $(document).on('change', globalSelectors, function (event) {
+ var $this = $(this);
+
+ // Only handle if not already handled by container-specific handlers
+ if (!event.isDefaultPrevented()) {
+ var $form = $this.parents('form');
+ var categories = $this.val();
+ var attributes = $form.data('atts');
+ if (!attributes) {
+ attributes = $(document.body).data('atts');
+ }
+ if (
+ !attributes ||
+ !attributes.category_custom_fields_relations
+ ) {
+ return;
+ }
+
+ // Handle both single and multiple category selections
+ if (categories) {
+ if (!Array.isArray(categories)) {
+ categories = [categories];
+ }
+ categories = categories
+ .map(function (cat) {
+ return Number(cat);
+ })
+ .filter(function (cat) {
+ return cat > 0;
+ });
+ } else {
+ categories = [];
+ }
+ hideAllCustomFieldsExceptSelected(
+ attributes.category_custom_fields_relations,
+ categories,
+ $(document.body)
+ );
+ }
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/categoryLocation.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/categoryLocation.js ***!
\*************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- var $ = jQuery;
-
- /* Make sure the codes in this file runs only once, even if enqueued twice */
- if (typeof window.directorist_catloc_executed === 'undefined') {
- window.directorist_catloc_executed = true;
- } else {
- return;
- }
-
- /* Category card grid three width/height adjustment */
- var categoryCard = document.querySelectorAll('.directorist-categories__single--style-three');
- if (categoryCard) {
- categoryCard.forEach(function (elm) {
- var categoryCardWidth = elm.offsetWidth;
- elm.style.setProperty('--directorist-category-box-width', "".concat(categoryCardWidth, "px"));
- });
- }
-
- /* Taxonomy list dropdown */
- function categoryDropdown(selector, parent) {
- var categoryListToggle = document.querySelectorAll(selector);
- categoryListToggle.forEach(function (item) {
- item.addEventListener('click', function (e) {
- var categoryName = item.querySelector('.directorist-taxonomy-list__name');
- if (e.target !== categoryName) {
- e.preventDefault();
- this.classList.toggle('directorist-taxonomy-list__toggle--open');
- }
- });
- });
- }
- categoryDropdown('.directorist-taxonomy-list-one .directorist-taxonomy-list__toggle', '.directorist-taxonomy-list-one .directorist-taxonomy-list');
- categoryDropdown('.directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle', '.directorist-taxonomy-list-one .directorist-taxonomy-list');
-
- // Taxonomy Ajax
- $(document).on('click', '.directorist-categories .directorist-pagination a', function (e) {
- taxonomyPagination(e, $(this), '.directorist-categories');
- });
- $(document).on('click', '.directorist-location .directorist-pagination a', function (e) {
- taxonomyPagination(e, $(this), '.directorist-location');
- });
- function taxonomyPagination(event, clickedElement, containerSelector) {
- event.preventDefault();
- var pageNumber = (clickedElement === null || clickedElement === void 0 ? void 0 : clickedElement.attr('data-page')) || 1;
- var container = clickedElement.closest(containerSelector);
- var containerAttributes = container ? $(container).data('attrs') : {};
- $.ajax({
- url: directorist.ajax_url,
- type: 'POST',
- dataType: 'json',
- data: {
- action: 'directorist_taxonomy_pagination',
- nonce: directorist.directorist_nonce,
- page: parseInt(pageNumber),
- attrs: containerAttributes
- },
- beforeSend: function beforeSend() {
- $(containerSelector).addClass('atbdp-form-fade');
- },
- success: function success(response) {
- var _tempContainer$queryS, _tempContainer$queryS2;
- if (!(response !== null && response !== void 0 && response.success)) {
- console.error('Failed to load taxonomy content');
- return;
- }
- var tempContainer = document.createElement('div');
- tempContainer.innerHTML = response.data.content;
- // Handle both category and location wrappers
- var taxonomyWrapper = document.querySelector('.taxonomy-category-wrapper');
- var locationWrapper = document.querySelector('.taxonomy-location-wrapper');
- var updatedCategoryContent = (_tempContainer$queryS = tempContainer.querySelector('.taxonomy-category-wrapper')) === null || _tempContainer$queryS === void 0 ? void 0 : _tempContainer$queryS.innerHTML;
- var updatedLocationContent = (_tempContainer$queryS2 = tempContainer.querySelector('.taxonomy-location-wrapper')) === null || _tempContainer$queryS2 === void 0 ? void 0 : _tempContainer$queryS2.innerHTML;
- if (taxonomyWrapper && updatedCategoryContent) {
- taxonomyWrapper.innerHTML = updatedCategoryContent;
- }
- if (locationWrapper && updatedLocationContent) {
- locationWrapper.innerHTML = updatedLocationContent;
- }
- if (!taxonomyWrapper && !locationWrapper) {
- console.error('Required elements not found in response');
- return;
- }
- },
- complete: function complete() {
- $(containerSelector).removeClass('atbdp-form-fade');
- }
- });
- }
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/colorPicker.js":
-/*!********************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ var $ = jQuery;
+
+ /* Make sure the codes in this file runs only once, even if enqueued twice */
+ if (
+ typeof window.directorist_catloc_executed ===
+ 'undefined'
+ ) {
+ window.directorist_catloc_executed = true;
+ } else {
+ return;
+ }
+
+ /* Category card grid three width/height adjustment */
+ var categoryCard = document.querySelectorAll(
+ '.directorist-categories__single--style-three'
+ );
+ if (categoryCard) {
+ categoryCard.forEach(function (elm) {
+ var categoryCardWidth = elm.offsetWidth;
+ elm.style.setProperty(
+ '--directorist-category-box-width',
+ ''.concat(categoryCardWidth, 'px')
+ );
+ });
+ }
+
+ /* Taxonomy list dropdown */
+ function categoryDropdown(selector, parent) {
+ var categoryListToggle =
+ document.querySelectorAll(selector);
+ categoryListToggle.forEach(function (item) {
+ item.addEventListener('click', function (e) {
+ var categoryName = item.querySelector(
+ '.directorist-taxonomy-list__name'
+ );
+ if (e.target !== categoryName) {
+ e.preventDefault();
+ this.classList.toggle(
+ 'directorist-taxonomy-list__toggle--open'
+ );
+ }
+ });
+ });
+ }
+ categoryDropdown(
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list__toggle',
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list'
+ );
+ categoryDropdown(
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle',
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list'
+ );
+
+ // Taxonomy Ajax
+ $(document).on(
+ 'click',
+ '.directorist-categories .directorist-pagination a',
+ function (e) {
+ taxonomyPagination(
+ e,
+ $(this),
+ '.directorist-categories'
+ );
+ }
+ );
+ $(document).on(
+ 'click',
+ '.directorist-location .directorist-pagination a',
+ function (e) {
+ taxonomyPagination(
+ e,
+ $(this),
+ '.directorist-location'
+ );
+ }
+ );
+ function taxonomyPagination(
+ event,
+ clickedElement,
+ containerSelector
+ ) {
+ event.preventDefault();
+ var pageNumber =
+ (clickedElement === null ||
+ clickedElement === void 0
+ ? void 0
+ : clickedElement.attr('data-page')) || 1;
+ var container =
+ clickedElement.closest(containerSelector);
+ var containerAttributes = container
+ ? $(container).data('attrs')
+ : {};
+ $.ajax({
+ url: directorist.ajax_url,
+ type: 'POST',
+ dataType: 'json',
+ data: {
+ action: 'directorist_taxonomy_pagination',
+ nonce: directorist.directorist_nonce,
+ page: parseInt(pageNumber),
+ attrs: containerAttributes,
+ },
+ beforeSend: function beforeSend() {
+ $(containerSelector).addClass(
+ 'atbdp-form-fade'
+ );
+ },
+ success: function success(response) {
+ var _tempContainer$queryS,
+ _tempContainer$queryS2;
+ if (
+ !(
+ response !== null &&
+ response !== void 0 &&
+ response.success
+ )
+ ) {
+ console.error(
+ 'Failed to load taxonomy content'
+ );
+ return;
+ }
+ var tempContainer =
+ document.createElement('div');
+ tempContainer.innerHTML = response.data.content;
+ // Handle both category and location wrappers
+ var taxonomyWrapper = document.querySelector(
+ '.taxonomy-category-wrapper'
+ );
+ var locationWrapper = document.querySelector(
+ '.taxonomy-location-wrapper'
+ );
+ var updatedCategoryContent =
+ (_tempContainer$queryS =
+ tempContainer.querySelector(
+ '.taxonomy-category-wrapper'
+ )) === null ||
+ _tempContainer$queryS === void 0
+ ? void 0
+ : _tempContainer$queryS.innerHTML;
+ var updatedLocationContent =
+ (_tempContainer$queryS2 =
+ tempContainer.querySelector(
+ '.taxonomy-location-wrapper'
+ )) === null ||
+ _tempContainer$queryS2 === void 0
+ ? void 0
+ : _tempContainer$queryS2.innerHTML;
+ if (taxonomyWrapper && updatedCategoryContent) {
+ taxonomyWrapper.innerHTML =
+ updatedCategoryContent;
+ }
+ if (locationWrapper && updatedLocationContent) {
+ locationWrapper.innerHTML =
+ updatedLocationContent;
+ }
+ if (!taxonomyWrapper && !locationWrapper) {
+ console.error(
+ 'Required elements not found in response'
+ );
+ return;
+ }
+ },
+ complete: function complete() {
+ $(containerSelector).removeClass(
+ 'atbdp-form-fade'
+ );
+ },
+ });
+ }
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/colorPicker.js':
+ /*!********************************************************!*\
!*** ./assets/src/js/public/components/colorPicker.js ***!
\********************************************************/
-/***/ (function() {
-
-/* Initialize wpColorPicker */
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_colorPicker_executed === 'undefined') {
- window.directorist_colorPicker_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* Initialize wp color picker */
- function colorPickerInit() {
- var wpColorPickers = document.querySelectorAll('.directorist-color-picker-wrap');
- wpColorPickers.forEach(function (wrap) {
- var $pickerInput = $(wrap).find('.directorist-color-picker');
- if ($pickerInput) {
- if ($.fn.wpColorPicker) {
- $pickerInput.wpColorPicker({
- change: function change(event, ui) {
- var color = ui.color.toString();
-
- // Dispatch custom event
- var colorChangeEvent = new CustomEvent('directorist-color-changed', {
- detail: {
- color: color,
- input: event.target,
- form: event.target.closest('form')
- }
- });
- window.dispatchEvent(colorChangeEvent);
- }
- });
- } else {
- console.warn('wpColorPicker is NOT available!');
- }
- }
- });
- }
- colorPickerInit();
-
- /* Initialize on Directory type change */
- window.addEventListener('directorist-instant-search-reloaded', colorPickerInit);
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristAlert.js":
-/*!*************************************************************!*\
+ /***/ function () {
+ /* Initialize wpColorPicker */
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_colorPicker_executed ===
+ 'undefined'
+ ) {
+ window.directorist_colorPicker_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* Initialize wp color picker */
+ function colorPickerInit() {
+ var wpColorPickers = document.querySelectorAll(
+ '.directorist-color-picker-wrap'
+ );
+ wpColorPickers.forEach(function (wrap) {
+ var $pickerInput = $(wrap).find(
+ '.directorist-color-picker'
+ );
+ if ($pickerInput) {
+ if ($.fn.wpColorPicker) {
+ $pickerInput.wpColorPicker({
+ change: function change(event, ui) {
+ var color = ui.color.toString();
+
+ // Dispatch custom event
+ var colorChangeEvent =
+ new CustomEvent(
+ 'directorist-color-changed',
+ {
+ detail: {
+ color: color,
+ input: event.target,
+ form: event.target.closest(
+ 'form'
+ ),
+ },
+ }
+ );
+ window.dispatchEvent(
+ colorChangeEvent
+ );
+ },
+ });
+ } else {
+ console.warn(
+ 'wpColorPicker is NOT available!'
+ );
+ }
+ }
+ });
+ }
+ colorPickerInit();
+
+ /* Initialize on Directory type change */
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ colorPickerInit
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristAlert.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/directoristAlert.js ***!
\*************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_alert_executed === 'undefined') {
- window.directorist_alert_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* Directorist alert dismiss */
- var getUrl = window.location.href;
- var newUrl = getUrl.replace('notice=1', '');
- if ($('.directorist-alert__close') !== null) {
- $('.directorist-alert__close').each(function (i, e) {
- $(e).on('click', function (e) {
- e.preventDefault();
- history.pushState({}, null, newUrl);
- $(this).closest('.directorist-alert').remove();
- });
- });
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristDropdown.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_alert_executed === 'undefined'
+ ) {
+ window.directorist_alert_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* Directorist alert dismiss */
+ var getUrl = window.location.href;
+ var newUrl = getUrl.replace('notice=1', '');
+ if ($('.directorist-alert__close') !== null) {
+ $('.directorist-alert__close').each(
+ function (i, e) {
+ $(e).on('click', function (e) {
+ e.preventDefault();
+ history.pushState({}, null, newUrl);
+ $(this)
+ .closest('.directorist-alert')
+ .remove();
+ });
+ }
+ );
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristDropdown.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristDropdown.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_dropdown_executed === 'undefined') {
- window.directorist_dropdown_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.directorist-dropdown-select');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.directorist-dropdown-select-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- el.querySelector('.directorist-dropdown-select-items').classList.add('directorist-dropdown-select-show');
- } else {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'directorist-dropdown-select-toggle') {
- clickCount = 0;
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (el) {
- el.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
-
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.directorist-dropdown-select-toggle').textContent = e.target.textContent;
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // Dropdown
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-toggle', function (e) {
- e.preventDefault();
- $(this).siblings('.directorist-dropdown-option').toggle();
- });
-
- // Select Option after click
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-option ul li a', function (e) {
- e.preventDefault();
- var optionText = $(this).html();
- $(this).children('.directorist-dropdown-toggle__text').html(optionText);
- $(this).closest('.directorist-dropdown-option').siblings('.directorist-dropdown-toggle').children('.directorist-dropdown-toggle__text').html(optionText);
- $('.directorist-dropdown-option').hide();
- });
-
- // Hide Clicked Anywhere
- $(document).bind('click', function (e) {
- var clickedDOM = $(e.target);
- if (!clickedDOM.parents().hasClass('directorist-dropdown')) $('.directorist-dropdown-option').hide();
- });
-
- //atbd_dropdown
- $(document).on('click', '.atbd_dropdown', function (e) {
- if ($(this).attr('class') === 'atbd_dropdown') {
- e.preventDefault();
- $(this).siblings('.atbd_dropdown').removeClass('atbd_drop--active');
- $(this).toggleClass('atbd_drop--active');
- e.stopPropagation();
- }
- });
- $(document).on('click', function (e) {
- if ($(e.target).is('.atbd_dropdown, .atbd_drop--active') === false) {
- $('.atbd_dropdown').removeClass('atbd_drop--active');
- }
- });
- $('body').on('click', '.atbd_dropdown-toggle', function (e) {
- e.preventDefault();
- });
-
- // Directorist Dropdown
- $('body').on('click', '.directorist-dropdown-js .directorist-dropdown__toggle-js', function (e) {
- e.preventDefault();
- if (!$(this).siblings('.directorist-dropdown__links-js').is(':visible')) {
- $('.directorist-dropdown__links').hide();
- }
- $(this).siblings('.directorist-dropdown__links-js').toggle();
- });
- $('body').on('click', function (e) {
- if (!e.target.closest('.directorist-dropdown-js')) {
- $('.directorist-dropdown__links-js').hide();
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristFavorite.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_dropdown_executed ===
+ 'undefined'
+ ) {
+ window.directorist_dropdown_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown = document.querySelectorAll(
+ '.directorist-dropdown-select'
+ );
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ el.querySelector(
+ '.directorist-dropdown-select-items'
+ ).classList.add(
+ 'directorist-dropdown-select-show'
+ );
+ } else {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'directorist-dropdown-select-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).textContent =
+ e.target.textContent;
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ });
+ });
+ }
+
+ // Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .siblings('.directorist-dropdown-option')
+ .toggle();
+ }
+ );
+
+ // Select Option after click
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-option ul li a',
+ function (e) {
+ e.preventDefault();
+ var optionText = $(this).html();
+ $(this)
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $(this)
+ .closest('.directorist-dropdown-option')
+ .siblings('.directorist-dropdown-toggle')
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $('.directorist-dropdown-option').hide();
+ }
+ );
+
+ // Hide Clicked Anywhere
+ $(document).bind('click', function (e) {
+ var clickedDOM = $(e.target);
+ if (
+ !clickedDOM
+ .parents()
+ .hasClass('directorist-dropdown')
+ )
+ $('.directorist-dropdown-option').hide();
+ });
+
+ //atbd_dropdown
+ $(document).on('click', '.atbd_dropdown', function (e) {
+ if ($(this).attr('class') === 'atbd_dropdown') {
+ e.preventDefault();
+ $(this)
+ .siblings('.atbd_dropdown')
+ .removeClass('atbd_drop--active');
+ $(this).toggleClass('atbd_drop--active');
+ e.stopPropagation();
+ }
+ });
+ $(document).on('click', function (e) {
+ if (
+ $(e.target).is(
+ '.atbd_dropdown, .atbd_drop--active'
+ ) === false
+ ) {
+ $('.atbd_dropdown').removeClass(
+ 'atbd_drop--active'
+ );
+ }
+ });
+ $('body').on(
+ 'click',
+ '.atbd_dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ }
+ );
+
+ // Directorist Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown-js .directorist-dropdown__toggle-js',
+ function (e) {
+ e.preventDefault();
+ if (
+ !$(this)
+ .siblings(
+ '.directorist-dropdown__links-js'
+ )
+ .is(':visible')
+ ) {
+ $('.directorist-dropdown__links').hide();
+ }
+ $(this)
+ .siblings('.directorist-dropdown__links-js')
+ .toggle();
+ }
+ );
+ $('body').on('click', function (e) {
+ if (!e.target.closest('.directorist-dropdown-js')) {
+ $('.directorist-dropdown__links-js').hide();
+ }
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristFavorite.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristFavorite.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_favorite_executed === 'undefined') {
- window.directorist_favorite_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- // Add or Remove from favourites
- $('.directorist-action-bookmark').on('click', function (e) {
- e.preventDefault();
- var data = {
- action: 'atbdp_public_add_remove_favorites',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id'),
- label: $(this).data('label')
- };
- $.post(directorist.ajaxurl, data, function (response) {
- if (response) {
- $('.directorist-action-bookmark').html(response);
- }
- });
- });
- $('.directorist-favourite-remove-btn').each(function () {
- $(this).on('click', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajaxurl, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist_favourite_' + post_id);
- if ('false' === response) {
- staElement.remove();
- }
- });
- });
- });
- $('body').on('click', '.directorist-mark-as-favorite__btn', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- var fav_tooltip_success = '
' + directorist.i18n_text.added_favourite + ' ';
- var fav_tooltip_warning = '
' + directorist.i18n_text.please_login + ' ';
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajax_url, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist-fav_' + post_id);
- var data_id = staElement.attr('data-listing_id');
- if (response === 'login_required') {
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_warning);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- } else if ('false' === response) {
- staElement.removeClass('directorist-added-to-favorite');
- $('.directorist-favorite-tooltip span').remove();
- } else {
- if (data_id === post_id) {
- staElement.addClass('directorist-added-to-favorite');
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_success);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- }
- }
- });
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristSelect.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_favorite_executed ===
+ 'undefined'
+ ) {
+ window.directorist_favorite_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ // Add or Remove from favourites
+ $('.directorist-action-bookmark').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var data = {
+ action: 'atbdp_public_add_remove_favorites',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ label: $(this).data('label'),
+ };
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ if (response) {
+ $(
+ '.directorist-action-bookmark'
+ ).html(response);
+ }
+ }
+ );
+ }
+ );
+ $('.directorist-favourite-remove-btn').each(
+ function () {
+ $(this).on('click', function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist_favourite_' +
+ post_id
+ );
+ if ('false' === response) {
+ staElement.remove();
+ }
+ }
+ );
+ });
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-mark-as-favorite__btn',
+ function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ var fav_tooltip_success =
+ '
' +
+ directorist.i18n_text.added_favourite +
+ ' ';
+ var fav_tooltip_warning =
+ '
' +
+ directorist.i18n_text.please_login +
+ ' ';
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajax_url,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist-fav_' + post_id
+ );
+ var data_id =
+ staElement.attr('data-listing_id');
+ if (response === 'login_required') {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(fav_tooltip_warning);
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ } else if ('false' === response) {
+ staElement.removeClass(
+ 'directorist-added-to-favorite'
+ );
+ $(
+ '.directorist-favorite-tooltip span'
+ ).remove();
+ } else {
+ if (data_id === post_id) {
+ staElement.addClass(
+ 'directorist-added-to-favorite'
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(
+ fav_tooltip_success
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ }
+ }
+ }
+ );
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristSelect.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/directoristSelect.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_select_executed === 'undefined') {
- window.directorist_select_executed = true;
- } else {
- return;
- }
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.atbd-dropdown-toggle').textContent = item.textContent;
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // select data-status
- var atbdSelectData = document.querySelectorAll('.atbd-drop-select.with-sort');
- atbdSelectData.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- var atbd_dropdown = el.querySelector('.atbd-dropdown-toggle');
- var dropdown_item = item.getAttribute('data-status');
- item.addEventListener('click', function (e) {
- atbd_dropdown.setAttribute('data-status', "".concat(dropdown_item));
- });
- });
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristSorting.js":
-/*!***************************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_select_executed ===
+ 'undefined'
+ ) {
+ window.directorist_select_executed = true;
+ } else {
+ return;
+ }
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.atbd-dropdown-toggle'
+ ).textContent = item.textContent;
+ el.querySelectorAll(
+ '.atbd-dropdown-item'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ }
+ );
+ });
+ }
+
+ // select data-status
+ var atbdSelectData = document.querySelectorAll(
+ '.atbd-drop-select.with-sort'
+ );
+ atbdSelectData.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ var atbd_dropdown = el.querySelector(
+ '.atbd-dropdown-toggle'
+ );
+ var dropdown_item =
+ item.getAttribute('data-status');
+ item.addEventListener('click', function (e) {
+ atbd_dropdown.setAttribute(
+ 'data-status',
+ ''.concat(dropdown_item)
+ );
+ });
+ }
+ );
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristSorting.js':
+ /*!***************************************************************!*\
!*** ./assets/src/js/public/components/directoristSorting.js ***!
\***************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_sorting_executed === 'undefined') {
- window.directorist_sorting_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- // Sorting Js
- if (!$('.directorist-instant-search').length) {
- $('.directorist-dropdown__links__single-js').click(function (e) {
- e.preventDefault();
- var href = $(this).attr('data-link');
- $('#directorsit-listing-sort').attr('action', href);
- $('#directorsit-listing-sort').submit();
- });
- }
-
- //sorting toggle
- $('.sorting span').on('click', function () {
- $(this).toggleClass('fa-sort-amount-asc fa-sort-amount-desc');
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/general.js":
-/*!****************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_sorting_executed ===
+ 'undefined'
+ ) {
+ window.directorist_sorting_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ // Sorting Js
+ if (!$('.directorist-instant-search').length) {
+ $('.directorist-dropdown__links__single-js').click(
+ function (e) {
+ e.preventDefault();
+ var href = $(this).attr('data-link');
+ $('#directorsit-listing-sort').attr(
+ 'action',
+ href
+ );
+ $('#directorsit-listing-sort').submit();
+ }
+ );
+ }
+
+ //sorting toggle
+ $('.sorting span').on('click', function () {
+ $(this).toggleClass(
+ 'fa-sort-amount-asc fa-sort-amount-desc'
+ );
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/general.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/public/components/general.js ***!
\****************************************************/
-/***/ (function() {
-
-// Fix listing with no thumb if card width is less than 220px
-(function ($) {
- window.addEventListener('load', function () {
- if ($('.directorist-listing-no-thumb').innerWidth() <= 220) {
- $('.directorist-listing-no-thumb').addClass('directorist-listing-no-thumb--fix');
- }
- // Auhtor Profile Listing responsive fix
- if ($('.directorist-author-listing-content').innerWidth() <= 750) {
- $('.directorist-author-listing-content').addClass('directorist-author-listing-grid--fix');
- }
- // Directorist Archive responsive fix
- if ($('.directorist-archive-grid-view').innerWidth() <= 500) {
- $('.directorist-archive-grid-view').addClass('directorist-archive-grid--fix');
- }
-
- // Back Button to go back to the previous page
- $('body').on('click', '.directorist-btn__back', function (e) {
- window.history.back();
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/gridResponsive.js":
-/*!***********************************************************!*\
+ /***/ function () {
+ // Fix listing with no thumb if card width is less than 220px
+ (function ($) {
+ window.addEventListener('load', function () {
+ if (
+ $('.directorist-listing-no-thumb').innerWidth() <=
+ 220
+ ) {
+ $('.directorist-listing-no-thumb').addClass(
+ 'directorist-listing-no-thumb--fix'
+ );
+ }
+ // Auhtor Profile Listing responsive fix
+ if (
+ $(
+ '.directorist-author-listing-content'
+ ).innerWidth() <= 750
+ ) {
+ $('.directorist-author-listing-content').addClass(
+ 'directorist-author-listing-grid--fix'
+ );
+ }
+ // Directorist Archive responsive fix
+ if (
+ $('.directorist-archive-grid-view').innerWidth() <=
+ 500
+ ) {
+ $('.directorist-archive-grid-view').addClass(
+ 'directorist-archive-grid--fix'
+ );
+ }
+
+ // Back Button to go back to the previous page
+ $('body').on(
+ 'click',
+ '.directorist-btn__back',
+ function (e) {
+ window.history.back();
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/gridResponsive.js':
+ /*!***********************************************************!*\
!*** ./assets/src/js/public/components/gridResponsive.js ***!
\***********************************************************/
-/***/ (function() {
-
-(function ($) {
- /* Responsive grid control */
- $(document).ready(function () {
- var d_wrapper = $('#directorist.atbd_wrapper');
- var columnLeft = $('.atbd_col_left.col-lg-8');
- var columnRight = $('.directorist.col-lg-4');
- var tabColumn = $('.atbd_dashboard_wrapper .tab-content .tab-pane .col-lg-4');
- var w_size = d_wrapper.width();
- if (w_size >= 500 && w_size <= 735) {
- columnLeft.toggleClass('col-lg-8');
- columnRight.toggleClass('col-lg-4');
- }
- if (w_size <= 600) {
- d_wrapper.addClass('size-xs');
- tabColumn.toggleClass('col-lg-4');
- }
- var listing_size = $('.atbd_dashboard_wrapper .atbd_single_listing').width();
- if (listing_size < 200) {
- $('.atbd_single_listing .db_btn_area').addClass('db_btn_area--sm');
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/helpers.js":
-/*!****************************************************!*\
+ /***/ function () {
+ (function ($) {
+ /* Responsive grid control */
+ $(document).ready(function () {
+ var d_wrapper = $('#directorist.atbd_wrapper');
+ var columnLeft = $('.atbd_col_left.col-lg-8');
+ var columnRight = $('.directorist.col-lg-4');
+ var tabColumn = $(
+ '.atbd_dashboard_wrapper .tab-content .tab-pane .col-lg-4'
+ );
+ var w_size = d_wrapper.width();
+ if (w_size >= 500 && w_size <= 735) {
+ columnLeft.toggleClass('col-lg-8');
+ columnRight.toggleClass('col-lg-4');
+ }
+ if (w_size <= 600) {
+ d_wrapper.addClass('size-xs');
+ tabColumn.toggleClass('col-lg-4');
+ }
+ var listing_size = $(
+ '.atbd_dashboard_wrapper .atbd_single_listing'
+ ).width();
+ if (listing_size < 200) {
+ $('.atbd_single_listing .db_btn_area').addClass(
+ 'db_btn_area--sm'
+ );
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/helpers.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/public/components/helpers.js ***!
\****************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _helpers_printRating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers/printRating */ "./assets/src/js/public/components/helpers/printRating.js");
-/* harmony import */ var _helpers_printRating__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_helpers_printRating__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _helpers_createMysql__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers/createMysql */ "./assets/src/js/public/components/helpers/createMysql.js");
-/* harmony import */ var _helpers_createMysql__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_helpers_createMysql__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _helpers_postDraft__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers/postDraft */ "./assets/src/js/public/components/helpers/postDraft.js");
-/* harmony import */ var _helpers_postDraft__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_helpers_postDraft__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _helpers_handleAjaxRequest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers/handleAjaxRequest */ "./assets/src/js/public/components/helpers/handleAjaxRequest.js");
-/* harmony import */ var _helpers_handleAjaxRequest__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_helpers_handleAjaxRequest__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var _helpers_noImageController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers/noImageController */ "./assets/src/js/public/components/helpers/noImageController.js");
-/* harmony import */ var _helpers_noImageController__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_helpers_noImageController__WEBPACK_IMPORTED_MODULE_4__);
-// Helper Components
-
-
-
-
-
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/helpers/createMysql.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _helpers_printRating__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./helpers/printRating */ './assets/src/js/public/components/helpers/printRating.js'
+ );
+ /* harmony import */ var _helpers_printRating__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _helpers_printRating__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _helpers_createMysql__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./helpers/createMysql */ './assets/src/js/public/components/helpers/createMysql.js'
+ );
+ /* harmony import */ var _helpers_createMysql__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _helpers_createMysql__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _helpers_postDraft__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./helpers/postDraft */ './assets/src/js/public/components/helpers/postDraft.js'
+ );
+ /* harmony import */ var _helpers_postDraft__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _helpers_postDraft__WEBPACK_IMPORTED_MODULE_2__
+ );
+ /* harmony import */ var _helpers_handleAjaxRequest__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./helpers/handleAjaxRequest */ './assets/src/js/public/components/helpers/handleAjaxRequest.js'
+ );
+ /* harmony import */ var _helpers_handleAjaxRequest__WEBPACK_IMPORTED_MODULE_3___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _helpers_handleAjaxRequest__WEBPACK_IMPORTED_MODULE_3__
+ );
+ /* harmony import */ var _helpers_noImageController__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ./helpers/noImageController */ './assets/src/js/public/components/helpers/noImageController.js'
+ );
+ /* harmony import */ var _helpers_noImageController__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _helpers_noImageController__WEBPACK_IMPORTED_MODULE_4__
+ );
+ // Helper Components
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/helpers/createMysql.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/helpers/createMysql.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Helper function to convert the mysql date
- Date.createFromMysql = function (mysql_string) {
- var t,
- result = null;
- if (typeof mysql_string === 'string') {
- t = mysql_string.split(/[- :]/);
-
- //when t[3], t[4] and t[5] are missing they defaults to zero
- result = new Date(t[0], t[1] - 1, t[2], t[3] || 0, t[4] || 0, t[5] || 0);
- }
- return result;
- };
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/helpers/handleAjaxRequest.js":
-/*!**********************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Helper function to convert the mysql date
+ Date.createFromMysql = function (mysql_string) {
+ var t,
+ result = null;
+ if (typeof mysql_string === 'string') {
+ t = mysql_string.split(/[- :]/);
+
+ //when t[3], t[4] and t[5] are missing they defaults to zero
+ result = new Date(
+ t[0],
+ t[1] - 1,
+ t[2],
+ t[3] || 0,
+ t[4] || 0,
+ t[5] || 0
+ );
+ }
+ return result;
+ };
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/helpers/handleAjaxRequest.js':
+ /*!**********************************************************************!*\
!*** ./assets/src/js/public/components/helpers/handleAjaxRequest.js ***!
\**********************************************************************/
-/***/ (function() {
-
-(function ($) {
- /*This function handles all ajax request*/
- function atbdp_do_ajax(ElementToShowLoadingIconAfter, ActionName, arg, CallBackHandler) {
- var data;
- if (ActionName) data = 'action=' + ActionName;
- if (arg) data = arg + '&action=' + ActionName;
- if (arg && !ActionName) data = arg;
- //data = data ;
-
- var n = data.search(directorist.nonceName);
- if (n < 0) {
- data = data + '&' + directorist.nonceName + '=' + directorist.nonce;
- }
- jQuery.ajax({
- type: 'post',
- url: directorist.ajaxurl,
- data: data,
- beforeSend: function beforeSend() {
- jQuery("
").insertAfter(ElementToShowLoadingIconAfter);
- },
- success: function success(data) {
- jQuery('.atbdp_ajax_loading').remove();
- CallBackHandler(data);
- }
- });
- }
- window.atbdp_do_ajax = atbdp_do_ajax;
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/helpers/noImageController.js":
-/*!**********************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ /*This function handles all ajax request*/
+ function atbdp_do_ajax(
+ ElementToShowLoadingIconAfter,
+ ActionName,
+ arg,
+ CallBackHandler
+ ) {
+ var data;
+ if (ActionName) data = 'action=' + ActionName;
+ if (arg) data = arg + '&action=' + ActionName;
+ if (arg && !ActionName) data = arg;
+ //data = data ;
+
+ var n = data.search(directorist.nonceName);
+ if (n < 0) {
+ data =
+ data +
+ '&' +
+ directorist.nonceName +
+ '=' +
+ directorist.nonce;
+ }
+ jQuery.ajax({
+ type: 'post',
+ url: directorist.ajaxurl,
+ data: data,
+ beforeSend: function beforeSend() {
+ jQuery(
+ "
"
+ ).insertAfter(ElementToShowLoadingIconAfter);
+ },
+ success: function success(data) {
+ jQuery('.atbdp_ajax_loading').remove();
+ CallBackHandler(data);
+ },
+ });
+ }
+ window.atbdp_do_ajax = atbdp_do_ajax;
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/helpers/noImageController.js':
+ /*!**********************************************************************!*\
!*** ./assets/src/js/public/components/helpers/noImageController.js ***!
\**********************************************************************/
-/***/ (function() {
-
-(function ($) {
- /* Listing No Image Controller */
- $('.atbd_listing_no_image .atbd_lower_badge').each(function (i, elm) {
- if (!$.trim($(elm).html()).length) {
- $(this).addClass('atbd-no-spacing');
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/helpers/postDraft.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ /* Listing No Image Controller */
+ $('.atbd_listing_no_image .atbd_lower_badge').each(
+ function (i, elm) {
+ if (!$.trim($(elm).html()).length) {
+ $(this).addClass('atbd-no-spacing');
+ }
+ }
+ );
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/helpers/postDraft.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/helpers/postDraft.js ***!
\**************************************************************/
-/***/ (function() {
-
-(function ($) {
- //adding temporary css class to post draft page
- if ($('.edit_btn_wrap .atbdp_float_active').length) {
- $('body').addClass('atbd_post_draft');
- }
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/helpers/printRating.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ //adding temporary css class to post draft page
+ if ($('.edit_btn_wrap .atbdp_float_active').length) {
+ $('body').addClass('atbd_post_draft');
+ }
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/helpers/printRating.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/helpers/printRating.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- /* Helper Function for priting static rating */
- function print_static_rating($star_number) {
- var v;
- if ($star_number) {
- v = '
';
- for (var i = 1; i <= 5; i++) {
- v += i <= $star_number ? " " : " ";
- }
- v += ' ';
- }
- return v;
- }
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/instantSearch.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ (function ($) {
+ /* Helper Function for priting static rating */
+ function print_static_rating($star_number) {
+ var v;
+ if ($star_number) {
+ v = '
';
+ for (var i = 1; i <= 5; i++) {
+ v +=
+ i <= $star_number
+ ? " "
+ : " ";
+ }
+ v += ' ';
+ }
+ return v;
+ }
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/instantSearch.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/public/components/instantSearch.js ***!
\**********************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../global/components/debounce */ "./assets/src/js/global/components/debounce.js");
-/* harmony import */ var _category_custom_fields__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./category-custom-fields */ "./assets/src/js/public/components/category-custom-fields.js");
-
-
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-(function ($) {
- /**
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/typeof */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/slicedToArray */ './node_modules/@babel/runtime/helpers/esm/slicedToArray.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ../../global/components/debounce */ './assets/src/js/global/components/debounce.js'
+ );
+ /* harmony import */ var _category_custom_fields__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ./category-custom-fields */ './assets/src/js/public/components/category-custom-fields.js'
+ );
+
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+
+ (function ($) {
+ /**
Global Variables
*/
- // Globally accessible form_data
- var form_data = {};
+ // Globally accessible form_data
+ var form_data = {};
- // Scrolling Pagination
- var scrollingPage = 1;
- var infinitePaginationIsLoading = false;
- var infinitePaginationCompleted = false;
+ // Scrolling Pagination
+ var scrollingPage = 1;
+ var infinitePaginationIsLoading = false;
+ var infinitePaginationCompleted = false;
- /**
+ /**
Main Functions
*/
- // Perform Instant Search
- function performInstantSearch(searchElement) {
- // get parent element
- var searchElm = searchElement.closest('.directorist-instant-search');
-
- // Instant Search Data
- var instant_search_data = prepareInstantSearchData(searchElm);
- $.ajax({
- url: directorist.ajaxurl,
- type: 'POST',
- data: instant_search_data,
- beforeSend: function beforeSend() {
- var _searchElm$offset;
- searchElm.find('.directorist-advanced-filter__form .directorist-btn-sm').attr('disabled', true);
- searchElm.find('.directorist-archive-items').addClass('atbdp-form-fade');
- searchElm.find('.directorist-header-bar .directorist-advanced-filter').removeClass('directorist-advanced-filter--show').hide();
- if (((_searchElm$offset = searchElm.offset()) === null || _searchElm$offset === void 0 ? void 0 : _searchElm$offset.top) > 0) {
- $(document).scrollTop(searchElm.offset().top);
- }
- closeAllSearchModal();
- },
- success: function success(html) {
- if (html.search_result) {
- searchElm.find('.directorist-header-found-title, .dsa-save-search-container').remove();
- if (html.header_title) {
- searchElm.find('.directorist-listings-header__left').append(html.header_title);
- searchElm.find('.directorist-header-found-title span').text(html.count);
- }
- searchElm.find('.directorist-archive-items').replaceWith(html.search_result).removeClass('atbdp-form-fade');
- searchElm.find('.directorist-advanced-filter__form .directorist-btn-sm').attr('disabled', false);
- window.dispatchEvent(new CustomEvent('directorist-instant-search-reloaded'));
- window.dispatchEvent(new CustomEvent('directorist-reload-listings-map-archive'));
-
- // Optional: Update meta title
- var new_meta_title = '';
- if (html.category_name) new_meta_title += html.category_name;
- if (html.location_name) new_meta_title += (new_meta_title ? ' within ' : '') + html.location_name;
- if (form_data.address) new_meta_title += (form_data.in_cat || form_data.in_loc ? ' near ' : '') + form_data.address;
- document.title = new_meta_title ? "".concat(new_meta_title, " | ").concat(directorist.site_name) : directorist.site_name;
- }
-
- // Initialize scrolling status
- scrollingPage = 1;
- infinitePaginationCompleted = false;
- }
- });
- }
-
- // Perform Instant Search for directory type change
- function onDirectoryChange(searchElement) {
- // get parent element
- var searchElm = searchElement.closest('.directorist-instant-search');
-
- // Instant Search Data
- var instant_search_data = prepareInstantSearchData(searchElm);
- $.ajax({
- url: directorist.ajaxurl,
- type: 'POST',
- data: instant_search_data,
- beforeSend: function beforeSend() {
- searchElm.addClass('atbdp-form-fade');
- },
- success: function success(html) {
- if (html.directory_type) {
- searchElm.replaceWith(html.directory_type);
- searchElm.find('.atbdp-form-fade').removeClass('atbdp-form-fade');
- window.dispatchEvent(new CustomEvent('directorist-instant-search-reloaded'));
- window.dispatchEvent(new CustomEvent('directorist-reload-listings-map-archive'));
-
- // SearchForm Item in Single Category Location Page Init
- singleCategoryLocationInit();
-
- // Category Custom Field Assigned Init
- (0,_category_custom_fields__WEBPACK_IMPORTED_MODULE_4__["default"])($);
- }
-
- // Initialize scrolling status
- scrollingPage = 1;
- infinitePaginationCompleted = false;
- }
- });
- }
-
- // AJAX call to load more listings
- function loadMoreListings(searchElement) {
- var loadingDiv;
- var container = $('.directorist-infinite-scroll .directorist-container-fluid .directorist-row');
-
- // get parent element
- var searchElm = searchElement.closest('.directorist-instant-search');
-
- // Instant Search Data
- var preparedData = prepareInstantSearchData(searchElm);
-
- // make ajax data
- var instant_search_data = _objectSpread(_objectSpread({}, preparedData), {}, {
- paged: scrollingPage
- });
- $.ajax({
- url: directorist.ajaxurl,
- type: 'POST',
- data: instant_search_data,
- beforeSend: function beforeSend() {
- loadingDiv = $('
', {
- class: 'directorist-on-scroll-loading'
- }).append($('
', {
- class: 'directorist-spinner'
- }), $('
').text(directorist.loading_more_text));
- container.append(loadingDiv);
- },
- success: function success(html) {
- if (loadingDiv) loadingDiv.remove();
- if (html.count > 0) {
- container.append(html.render_listings);
- } else {
- infinitePaginationCompleted = true;
- }
- triggerCustomEvents();
- },
- complete: function complete() {
- infinitePaginationIsLoading = false;
- if (loadingDiv) loadingDiv.remove();
- }
- });
- }
-
- /**
+ // Perform Instant Search
+ function performInstantSearch(searchElement) {
+ // get parent element
+ var searchElm = searchElement.closest(
+ '.directorist-instant-search'
+ );
+
+ // Instant Search Data
+ var instant_search_data =
+ prepareInstantSearchData(searchElm);
+ $.ajax({
+ url: directorist.ajaxurl,
+ type: 'POST',
+ data: instant_search_data,
+ beforeSend: function beforeSend() {
+ var _searchElm$offset;
+ searchElm
+ .find(
+ '.directorist-advanced-filter__form .directorist-btn-sm'
+ )
+ .attr('disabled', true);
+ searchElm
+ .find('.directorist-archive-items')
+ .addClass('atbdp-form-fade');
+ searchElm
+ .find(
+ '.directorist-header-bar .directorist-advanced-filter'
+ )
+ .removeClass(
+ 'directorist-advanced-filter--show'
+ )
+ .hide();
+ if (
+ ((_searchElm$offset =
+ searchElm.offset()) === null ||
+ _searchElm$offset === void 0
+ ? void 0
+ : _searchElm$offset.top) > 0
+ ) {
+ $(document).scrollTop(
+ searchElm.offset().top
+ );
+ }
+ closeAllSearchModal();
+ },
+ success: function success(html) {
+ if (html.search_result) {
+ searchElm
+ .find(
+ '.directorist-header-found-title, .dsa-save-search-container'
+ )
+ .remove();
+ if (html.header_title) {
+ searchElm
+ .find(
+ '.directorist-listings-header__left'
+ )
+ .append(html.header_title);
+ searchElm
+ .find(
+ '.directorist-header-found-title span'
+ )
+ .text(html.count);
+ }
+ searchElm
+ .find('.directorist-archive-items')
+ .replaceWith(html.search_result)
+ .removeClass('atbdp-form-fade');
+ searchElm
+ .find(
+ '.directorist-advanced-filter__form .directorist-btn-sm'
+ )
+ .attr('disabled', false);
+ window.dispatchEvent(
+ new CustomEvent(
+ 'directorist-instant-search-reloaded'
+ )
+ );
+ window.dispatchEvent(
+ new CustomEvent(
+ 'directorist-reload-listings-map-archive'
+ )
+ );
+
+ // Optional: Update meta title
+ var new_meta_title = '';
+ if (html.category_name)
+ new_meta_title += html.category_name;
+ if (html.location_name)
+ new_meta_title +=
+ (new_meta_title ? ' within ' : '') +
+ html.location_name;
+ if (form_data.address)
+ new_meta_title +=
+ (form_data.in_cat ||
+ form_data.in_loc
+ ? ' near '
+ : '') + form_data.address;
+ document.title = new_meta_title
+ ? ''
+ .concat(new_meta_title, ' | ')
+ .concat(directorist.site_name)
+ : directorist.site_name;
+ }
+
+ // Initialize scrolling status
+ scrollingPage = 1;
+ infinitePaginationCompleted = false;
+ },
+ });
+ }
+
+ // Perform Instant Search for directory type change
+ function onDirectoryChange(searchElement) {
+ // get parent element
+ var searchElm = searchElement.closest(
+ '.directorist-instant-search'
+ );
+
+ // Instant Search Data
+ var instant_search_data =
+ prepareInstantSearchData(searchElm);
+ $.ajax({
+ url: directorist.ajaxurl,
+ type: 'POST',
+ data: instant_search_data,
+ beforeSend: function beforeSend() {
+ searchElm.addClass('atbdp-form-fade');
+ },
+ success: function success(html) {
+ if (html.directory_type) {
+ searchElm.replaceWith(html.directory_type);
+ searchElm
+ .find('.atbdp-form-fade')
+ .removeClass('atbdp-form-fade');
+ window.dispatchEvent(
+ new CustomEvent(
+ 'directorist-instant-search-reloaded'
+ )
+ );
+ window.dispatchEvent(
+ new CustomEvent(
+ 'directorist-reload-listings-map-archive'
+ )
+ );
+
+ // SearchForm Item in Single Category Location Page Init
+ singleCategoryLocationInit();
+
+ // Category Custom Field Assigned Init
+ (0,
+ _category_custom_fields__WEBPACK_IMPORTED_MODULE_4__[
+ 'default'
+ ])($);
+ }
+
+ // Initialize scrolling status
+ scrollingPage = 1;
+ infinitePaginationCompleted = false;
+ },
+ });
+ }
+
+ // AJAX call to load more listings
+ function loadMoreListings(searchElement) {
+ var loadingDiv;
+ var container = $(
+ '.directorist-infinite-scroll .directorist-container-fluid .directorist-row'
+ );
+
+ // get parent element
+ var searchElm = searchElement.closest(
+ '.directorist-instant-search'
+ );
+
+ // Instant Search Data
+ var preparedData = prepareInstantSearchData(searchElm);
+
+ // make ajax data
+ var instant_search_data = _objectSpread(
+ _objectSpread({}, preparedData),
+ {},
+ {
+ paged: scrollingPage,
+ }
+ );
+ $.ajax({
+ url: directorist.ajaxurl,
+ type: 'POST',
+ data: instant_search_data,
+ beforeSend: function beforeSend() {
+ loadingDiv = $('', {
+ class: 'directorist-on-scroll-loading',
+ }).append(
+ $('
', {
+ class: 'directorist-spinner',
+ }),
+ $('
').text(
+ directorist.loading_more_text
+ )
+ );
+ container.append(loadingDiv);
+ },
+ success: function success(html) {
+ if (loadingDiv) loadingDiv.remove();
+ if (html.count > 0) {
+ container.append(html.render_listings);
+ } else {
+ infinitePaginationCompleted = true;
+ }
+ triggerCustomEvents();
+ },
+ complete: function complete() {
+ infinitePaginationIsLoading = false;
+ if (loadingDiv) loadingDiv.remove();
+ },
+ });
+ }
+
+ /**
Helper Functions
**/
- // Prepare Instant Search Data
- function prepareInstantSearchData(searchElm) {
- // Get data-atts
- var instant_search_atts = searchElm.data('atts');
-
- // Make ajax data
- var instant_search_data = _objectSpread(_objectSpread({}, form_data), {}, {
- action: 'directorist_instant_search',
- _nonce: directorist.ajax_nonce,
- current_page_id: directorist.current_page_id,
- data_atts: instant_search_atts
- });
- return instant_search_data;
- }
-
- // Update or retain existing keys in form_data
- function updateFormData(newData) {
- Object.entries(newData).forEach(function (_ref) {
- var _ref2 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref, 2),
- key = _ref2[0],
- value = _ref2[1];
- if (value === undefined || value === null || value === '' || Array.isArray(value) && value.length === 0 || (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(value) === 'object' && !Array.isArray(value) && Object.keys(value).length === 0) {
- delete form_data[key];
- } else {
- form_data[key] = value;
- }
- });
- }
-
- // Reset form_data
- function resetFormData() {
- Object.entries(form_data).forEach(function (_ref3) {
- var _ref4 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref3, 2),
- key = _ref4[0],
- value = _ref4[1];
- delete form_data[key];
- });
- }
-
- // Update search URL with form data
- function update_instant_search_url(form_data) {
- if (!history.pushState) return;
- var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname;
- var query = '';
- var appendQuery = function appendQuery(key, value) {
- if (value !== undefined && value !== null && value !== '' && (!Array.isArray(value) || value.length)) {
- if (Array.isArray(value) && value.length) {
- query += (query.length ? '&' : '?') + "".concat(key, "=").concat(value);
- } else {
- query += (query.length ? '&' : '?') + "".concat(key, "=").concat(encodeURIComponent(value));
- }
- }
- };
-
- // These keys will be ignored
- // and will not be appended to the URL
- // when updating the URL
- var ignoreKeys = ['data_atts', 'custom_field', 'current_page_id', 'action', '_nonce'];
-
- // Handle all form_data keys dynamically
- Object.entries(form_data).forEach(function (_ref5) {
- var _ref6 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref5, 2),
- key = _ref6[0],
- value = _ref6[1];
- if (ignoreKeys.includes(key)) return;
-
- // Handle default page
- if (key === 'paged' && Number(value) === 1) {
- return; // ❌ Skip default page 1
- }
-
- // Handle price & address fields specifically
- if (key === 'price' && Array.isArray(value)) {
- appendQuery('price[0]', value[0] > 0 ? value[0] : '');
- appendQuery('price[1]', value[1] > 0 ? value[1] : '');
- } else if ((key === 'cityLat' || key === 'cityLng') && !form_data.address) {
- return; // ❌ Skip lat/lng if no address
- } else {
- appendQuery(key, value);
- }
- });
-
- // Handle custom_field
- if (form_data.custom_field && (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(form_data.custom_field) === 'object') {
- Object.entries(form_data.custom_field).forEach(function (_ref7) {
- var _ref8 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref7, 2),
- key = _ref8[0],
- val = _ref8[1];
- // Skip if value is "0-0" (empty range slider)
- if (val === '0-0') {
- return;
- }
-
- // Skip empty values
- if (!val || typeof val === 'string' && val.trim() === '') {
- return;
- }
-
- // Handle multiple values (arrays or comma-separated strings)
- var values = Array.isArray(val) ? val : typeof val === 'string' && val.includes(',') ? val.split(',') : [val];
- values.forEach(function (singleVal) {
- var formattedKey = key.startsWith('custom-checkbox') ? "custom_field%5B".concat(key, "%5D%5B%5D") : "custom_field%5B".concat(key, "%5D");
- appendQuery(formattedKey, singleVal);
- });
- });
- }
- var finalUrl = query ? newurl + query : newurl;
- window.history.pushState({
- path: finalUrl
- }, '', finalUrl);
- }
-
- // Check required fields are valid or not
- function checkRequiredFields(searchElm) {
- // Select all required inputs and selects inside searchElm
- var requiredInputs = searchElm.find('input[required], select[required], textarea[required]');
- var requiredFieldsAreValid = true;
- requiredInputs.each(function () {
- var $el = $(this);
- var tagName = $el.prop('tagName').toLowerCase();
- var type = $el.attr('type');
- if (tagName === 'input') {
- if (type === 'checkbox' || type === 'radio') {
- // For checkboxes/radios, at least one with this name must be checked
- var name = $el.attr('name');
- var checked = searchElm.find("input[name=\"".concat(name, "\"]:checked")).length > 0;
- if (!checked) {
- requiredFieldsAreValid = false;
- return false; // break .each loop early
- }
- } else {
- // For other input types, value must not be empty
- if (!$el.val()) {
- requiredFieldsAreValid = false;
- return false;
- }
- }
- } else if (tagName === 'select' || tagName === 'textarea') {
- // Select or textarea must have a value
- if (!$el.val()) {
- requiredFieldsAreValid = false;
- return false;
- }
- }
- });
- return requiredFieldsAreValid;
- }
-
- // Build form_data from searchElm inputs.
- function buildFormData(searchElm) {
- var preservePaged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var tag = [];
- var price = [];
- var custom_field = {};
- var search_by_rating = [];
-
- // Collect selected tags
- searchElm.find('input[name^="in_tag["]:checked').each(function (_, el) {
- tag.push($(el).val());
- });
-
- // Collect selected ratings
- searchElm.find('input[name^="search_by_rating["]:checked').each(function (_, el) {
- search_by_rating.push($(el).val());
- });
-
- // Collect price values
- searchElm.find('input[name^="price["]').each(function (_, el) {
- price.push($(el).val());
- });
-
- // Check if **any** price is greater than 0
- var hasValidPrice = price.some(function (val) {
- return val > 0;
- });
- if (!hasValidPrice) {
- price = []; // Reset price if no valid price found
- }
-
- // Collect custom field values
- searchElm.find('[name^="custom_field"]').each(function (_, el) {
- var $el = $(el);
- var name = $el.attr('name');
- var type = $el.attr('type');
- var match = name.match(/^custom_field\[(.+?)\]/);
- var post_id = match ? match[1] : '';
- if (!post_id) return;
- if (type === 'radio') {
- var checked = searchElm.find("input[name=\"custom_field[".concat(post_id, "]\"]:checked")).val();
- if (checked) custom_field[post_id] = checked;
- } else if (type === 'checkbox') {
- var values = [];
- searchElm.find("input[name=\"custom_field[".concat(post_id, "][]\"]:checked")).each(function () {
- var val = $(this).val();
- if (val) values.push(val);
- });
- if (values.length) custom_field[post_id] = values;
- } else {
- var value = $el.val();
- if (value && value !== '0-0') custom_field[post_id] = value;
- }
- });
-
- // Collect custom range slider min/max values
- var range_slider_values = {};
- searchElm.find('.directorist-custom-range-slider__wrap').each(function () {
- var $wrap = $(this);
- var rangeField = $wrap.find('.directorist-custom-range-slider__range');
- var rangeName = rangeField.attr('name');
- if (!rangeName) {
- return;
- }
- var minInput = $wrap.find('.directorist-custom-range-slider__value__min');
- var maxInput = $wrap.find('.directorist-custom-range-slider__value__max');
- var minVal = minInput.val();
- var maxVal = maxInput.val();
- var minName = minInput.attr('name');
- var maxName = maxInput.attr('name');
- if (minName && minVal && minVal !== '0') {
- range_slider_values[minName] = minVal;
- }
- if (maxName && maxVal && maxVal !== '0') {
- range_slider_values[maxName] = maxVal;
- }
- });
-
- // Collect basic form values
- var q = searchElm.find('input[name="q"]').val();
- var in_cat = searchElm.find('.directorist-category-select').val();
- var in_loc = searchElm.find('.directorist-location-select').val();
- var price_range = searchElm.find("input[name='price_range']:checked").val();
- var address = searchElm.find('input[name="address"]').val();
- var zip = searchElm.find('input[name="zip"]').val();
- var fax = searchElm.find('input[name="fax"]').val();
- var email = searchElm.find('input[name="email"]').val();
- var website = searchElm.find('input[name="website"]').val();
- var phone = searchElm.find('input[name="phone"]').val();
- var phone2 = searchElm.find('input[name="phone2"]').val();
- var view = form_data.view;
-
- // Get directory type - look in the parent container to ensure it's found regardless of form
- var directory_type = searchElm.find('input[name="directory_type"]').val() || searchElm.closest('.directorist-instant-search').find('input[name="directory_type"]').val();
-
- // Update form_data
- updateFormData(_objectSpread({
- q: q,
- in_cat: in_cat,
- in_loc: in_loc,
- in_tag: tag,
- price: price,
- price_range: price_range,
- search_by_rating: search_by_rating,
- address: address,
- zip: zip,
- fax: fax,
- email: email,
- website: website,
- phone: phone,
- phone2: phone2,
- custom_field: custom_field,
- view: view,
- directory_type: directory_type
- }, range_slider_values));
-
- // open_now checkbox
- var open_now_val = searchElm.find('input[name="open_now"]').is(':checked') ? searchElm.find('input[name="open_now"]').val() : undefined;
- updateFormData({
- open_now: open_now_val
- });
- var radius_search_based_on = searchElm.find('.directorist-radius_search_based_on').val();
-
- // Check if the address or zip code is present to update miles, lat, and lng
- if (radius_search_based_on === 'address' && address) {
- updateFormData({
- cityLat: searchElm.find('#cityLat').val(),
- cityLng: searchElm.find('#cityLng').val(),
- miles: searchElm.find('input[name="miles"]').val()
- });
- } else if (radius_search_based_on === 'zip' && zip) {
- updateFormData({
- zip_cityLat: searchElm.find('.zip-cityLat').val(),
- zip_cityLng: searchElm.find('.zip-cityLng').val(),
- miles: searchElm.find('input[name="miles"]').val()
- });
- } else {
- updateFormData({
- cityLat: undefined,
- cityLng: undefined,
- zip_cityLat: undefined,
- zip_cityLng: undefined,
- miles: undefined
- });
- }
-
- // Reset paged to undefined for any non-pagination search
- if (!preservePaged) {
- updateFormData({
- paged: undefined
- });
- }
-
- // Update URL with form data
- update_instant_search_url(form_data);
- }
-
- // Build form data without required value
- function buildFormDataWithoutRequired() {
- var notRequiredFields = ['view', 'sort', 'paged'];
- Object.entries(form_data).forEach(function (_ref9) {
- var _ref0 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_ref9, 2),
- key = _ref0[0],
- value = _ref0[1];
- if (!notRequiredFields.includes(key)) {
- delete form_data[key];
- }
- });
-
- // Update URL with form data
- update_instant_search_url(form_data);
- }
-
- // Perform Instant Search with required value
- function performInstantSearchWithRequiredValue(searchElm) {
- // Build form data
- buildFormData(searchElm);
-
- // Check required fields
- var allRequiredFieldsAreValid = checkRequiredFields(searchElm);
-
- // If required fields are valid, proceed with filtering
- if (allRequiredFieldsAreValid) {
- performInstantSearch(searchElm);
- }
- }
-
- // Perform Instant Search without required value
- function performInstantSearchWithoutRequiredValue(searchElm) {
- var preservePaged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- // Check required fields
- var allRequiredFieldsAreValid = checkRequiredFields(searchElm);
-
- // If required fields are valid, proceed with filtering
- if (allRequiredFieldsAreValid) {
- // Build form data
- buildFormData(searchElm, preservePaged);
- performInstantSearch(searchElm);
- } else {
- // Build form data without required value
- buildFormDataWithoutRequired();
-
- // Filter Listing
- performInstantSearch(searchElm);
- }
- }
-
- // Handle Infinite Scroll
- function handleScroll() {
- var container = $('.directorist-infinite-scroll .directorist-container-fluid .directorist-row');
- if (!container.length || infinitePaginationIsLoading) {
- return;
- }
- var containerBottom = container.offset().top + container.outerHeight();
- var scrollBottom = window.scrollY + window.innerHeight;
- if (scrollBottom >= containerBottom) {
- infinitePaginationIsLoading = true;
- scrollingPage++;
-
- // get parent element
- var instantSearchElement = $('.directorist-instant-search');
- // get active form
- var activeForm = getActiveForm(instantSearchElement);
-
- // build form_data
- buildFormData(activeForm);
-
- // Load more listings
- loadMoreListings(activeForm);
- }
- }
-
- // Close all search modal
- function closeAllSearchModal() {
- var searchModalElement = document.querySelectorAll('.directorist-search-modal');
- searchModalElement.forEach(function (modal) {
- var modalOverlay = modal.querySelector('.directorist-search-modal__overlay');
- var modalContent = modal.querySelector('.directorist-search-modal__contents');
- var modalBodyOverlay = document.querySelector('.directorist-content-active');
-
- // Overlay Style
- if (modalOverlay) {
- modalOverlay.style.cssText = 'opacity: 0; visibility: hidden; transition: 0.5s ease';
- // remove overlay class on body
- modalBodyOverlay.classList.remove('directorist-overlay-active');
- }
-
- // Modal Content Style
- if (modalContent) {
- modalContent.style.cssText = 'opacity: 0; visibility: hidden; bottom: -200px;';
- }
- });
- }
-
- // Determine the active form with intelligent fallback strategy
- function getActiveForm(instantSearchElement) {
- var forms = {
- sidebar: instantSearchElement.find('.listing-with-sidebar'),
- advanced: instantSearchElement.find('.directorist-advanced-filter__form'),
- search: instantSearchElement.find('.directorist-search-form')
- };
-
- // Early return for sidebar listings
- if (forms.sidebar.length) {
- return instantSearchElement;
- }
-
- // Create form candidates with metadata
- var candidates = [{
- form: forms.advanced,
- hasDirectoryType: forms.advanced.find('input[name="directory_type"]').length > 0
- }, {
- form: forms.search,
- hasDirectoryType: forms.search.find('input[name="directory_type"]').length > 0
- }].filter(function (candidate) {
- return candidate.form.length > 0;
- });
-
- // Smart selection: prioritize forms with directory_type, fallback to responsive behavior
- var formWithDirectoryType = candidates.find(function (c) {
- return c.hasDirectoryType;
- });
- if (formWithDirectoryType) {
- return formWithDirectoryType.form;
- }
-
- // Fallback: use responsive selection if no directory_type found
- return screen.width > 575 ? forms.advanced : forms.search;
- }
-
- // Get directory type
- function getDirectoryType(directoryTypeLink) {
- var _directoryTypeLink$at;
- var typeMatch = (_directoryTypeLink$at = directoryTypeLink.attr('href')) === null || _directoryTypeLink$at === void 0 ? void 0 : _directoryTypeLink$at.match(/type=([^&]+)/);
- return typeMatch ? typeMatch[1] : '';
- }
-
- // Get view as
- function getViewAs(viewAsLink) {
- var _viewAsLink$attr;
- var viewMatch = (_viewAsLink$attr = viewAsLink.attr('href')) === null || _viewAsLink$attr === void 0 ? void 0 : _viewAsLink$attr.match(/view=([^&]+)/);
- return viewMatch ? viewMatch[1] : '';
- }
-
- // Get sort value
- function getSortValue(sortByLink) {
- var sort_href = sortByLink.attr('data-link');
- var sort_by = sort_href && sort_href.length ? sort_href.match(/sort=.+/) : '';
- return sort_by && sort_by.length ? sort_by[0].replace(/sort=/, '') : '';
- }
-
- // Trigger custom events
- function triggerCustomEvents() {
- window.dispatchEvent(new Event('directorist-instant-search-reloaded'));
- window.dispatchEvent(new Event('directorist-reload-listings-map-archive'));
- }
-
- // Range Slider searching observer
- function initObserver() {
- var targetNodes = document.querySelectorAll('.directorist-instant-search .directorist-custom-range-slider__value input');
- targetNodes.forEach(function (targetNode) {
- var searchElm = $(targetNode.closest('form'));
- if (targetNode) {
- var timeout;
- var observerCallback = function observerCallback(mutationList, observer) {
- var _iterator = _createForOfIteratorHelper(mutationList),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var mutation = _step.value;
- if (mutation.attributeName == 'value') {
- clearTimeout(timeout);
- timeout = setTimeout(function () {
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 250);
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- };
- var observer = new MutationObserver(observerCallback);
- observer.observe(targetNode, {
- attributes: true,
- childList: true,
- subtree: true
- });
- }
- });
- }
-
- // Single Location Category Page Search Form Item Disable
- function singleCategoryLocationInit() {
- var directoristArchiveContents = document.querySelector('.directorist-archive-contents');
- if (!directoristArchiveContents) {
- return;
- }
- var directoristDataAttributes = directoristArchiveContents.getAttribute('data-atts');
- var _JSON$parse = JSON.parse(directoristDataAttributes),
- shortcode = _JSON$parse.shortcode,
- location = _JSON$parse.location,
- category = _JSON$parse.category;
- if (shortcode === 'directorist_category' && category.trim() !== '') {
- var categorySelect = document.querySelector('.directorist-search-form .directorist-category-select');
- if (categorySelect) {
- categorySelect.closest('.directorist-search-category').classList.add('directorist-search-form__single-category');
- }
- }
- if (shortcode === 'directorist_location' && location.trim() !== '') {
- var locationSelect = document.querySelector('.directorist-search-form .directorist-location-select');
- if (locationSelect) {
- locationSelect.closest('.directorist-search-location').classList.add('directorist-search-form__single-location');
- }
- }
- }
-
- /**
+ // Prepare Instant Search Data
+ function prepareInstantSearchData(searchElm) {
+ // Get data-atts
+ var instant_search_atts = searchElm.data('atts');
+
+ // Make ajax data
+ var instant_search_data = _objectSpread(
+ _objectSpread({}, form_data),
+ {},
+ {
+ action: 'directorist_instant_search',
+ _nonce: directorist.ajax_nonce,
+ current_page_id: directorist.current_page_id,
+ data_atts: instant_search_atts,
+ }
+ );
+ return instant_search_data;
+ }
+
+ // Update or retain existing keys in form_data
+ function updateFormData(newData) {
+ Object.entries(newData).forEach(function (_ref) {
+ var _ref2 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(_ref, 2),
+ key = _ref2[0],
+ value = _ref2[1];
+ if (
+ value === undefined ||
+ value === null ||
+ value === '' ||
+ (Array.isArray(value) && value.length === 0) ||
+ ((0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(value) === 'object' &&
+ !Array.isArray(value) &&
+ Object.keys(value).length === 0)
+ ) {
+ delete form_data[key];
+ } else {
+ form_data[key] = value;
+ }
+ });
+ }
+
+ // Reset form_data
+ function resetFormData() {
+ Object.entries(form_data).forEach(function (_ref3) {
+ var _ref4 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(_ref3, 2),
+ key = _ref4[0],
+ value = _ref4[1];
+ delete form_data[key];
+ });
+ }
+
+ // Update search URL with form data
+ function update_instant_search_url(form_data) {
+ if (!history.pushState) return;
+ var newurl =
+ window.location.protocol +
+ '//' +
+ window.location.host +
+ window.location.pathname;
+ var query = '';
+ var appendQuery = function appendQuery(key, value) {
+ if (
+ value !== undefined &&
+ value !== null &&
+ value !== '' &&
+ (!Array.isArray(value) || value.length)
+ ) {
+ if (Array.isArray(value) && value.length) {
+ query +=
+ (query.length ? '&' : '?') +
+ ''.concat(key, '=').concat(value);
+ } else {
+ query +=
+ (query.length ? '&' : '?') +
+ ''
+ .concat(key, '=')
+ .concat(encodeURIComponent(value));
+ }
+ }
+ };
+
+ // These keys will be ignored
+ // and will not be appended to the URL
+ // when updating the URL
+ var ignoreKeys = [
+ 'data_atts',
+ 'custom_field',
+ 'current_page_id',
+ 'action',
+ '_nonce',
+ ];
+
+ // Handle all form_data keys dynamically
+ Object.entries(form_data).forEach(function (_ref5) {
+ var _ref6 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(_ref5, 2),
+ key = _ref6[0],
+ value = _ref6[1];
+ if (ignoreKeys.includes(key)) return;
+
+ // Handle default page
+ if (key === 'paged' && Number(value) === 1) {
+ return; // ❌ Skip default page 1
+ }
+
+ // Handle price & address fields specifically
+ if (key === 'price' && Array.isArray(value)) {
+ appendQuery(
+ 'price[0]',
+ value[0] > 0 ? value[0] : ''
+ );
+ appendQuery(
+ 'price[1]',
+ value[1] > 0 ? value[1] : ''
+ );
+ } else if (
+ (key === 'cityLat' || key === 'cityLng') &&
+ !form_data.address
+ ) {
+ return; // ❌ Skip lat/lng if no address
+ } else {
+ appendQuery(key, value);
+ }
+ });
+
+ // Handle custom_field
+ if (
+ form_data.custom_field &&
+ (0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(form_data.custom_field) === 'object'
+ ) {
+ Object.entries(form_data.custom_field).forEach(
+ function (_ref7) {
+ var _ref8 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(_ref7, 2),
+ key = _ref8[0],
+ val = _ref8[1];
+ // Skip if value is "0-0" (empty range slider)
+ if (val === '0-0') {
+ return;
+ }
+
+ // Skip empty values
+ if (
+ !val ||
+ (typeof val === 'string' &&
+ val.trim() === '')
+ ) {
+ return;
+ }
+
+ // Handle multiple values (arrays or comma-separated strings)
+ var values = Array.isArray(val)
+ ? val
+ : typeof val === 'string' &&
+ val.includes(',')
+ ? val.split(',')
+ : [val];
+ values.forEach(function (singleVal) {
+ var formattedKey = key.startsWith(
+ 'custom-checkbox'
+ )
+ ? 'custom_field%5B'.concat(
+ key,
+ '%5D%5B%5D'
+ )
+ : 'custom_field%5B'.concat(
+ key,
+ '%5D'
+ );
+ appendQuery(formattedKey, singleVal);
+ });
+ }
+ );
+ }
+ var finalUrl = query ? newurl + query : newurl;
+ window.history.pushState(
+ {
+ path: finalUrl,
+ },
+ '',
+ finalUrl
+ );
+ }
+
+ // Check required fields are valid or not
+ function checkRequiredFields(searchElm) {
+ // Select all required inputs and selects inside searchElm
+ var requiredInputs = searchElm.find(
+ '.directorist-search-field input[required], .directorist-search-field select[required], .directorist-search-field textarea[required]'
+ );
+ var requiredFieldsAreValid = true;
+ requiredInputs.each(function () {
+ var $el = $(this);
+ var tagName = $el.prop('tagName').toLowerCase();
+ var type = $el.attr('type');
+ if (tagName === 'input') {
+ if (type === 'checkbox' || type === 'radio') {
+ // For checkboxes/radios, at least one with this name must be checked
+ var name = $el.attr('name');
+ var checked =
+ searchElm.find(
+ 'input[name="'.concat(
+ name,
+ '"]:checked'
+ )
+ ).length > 0;
+ if (!checked) {
+ requiredFieldsAreValid = false;
+ return false; // break .each loop early
+ }
+ } else {
+ // For other input types, value must not be empty
+ if (!$el.val()) {
+ requiredFieldsAreValid = false;
+ return false;
+ }
+ }
+ } else if (
+ tagName === 'select' ||
+ tagName === 'textarea'
+ ) {
+ // Select or textarea must have a value
+ if (!$el.val()) {
+ requiredFieldsAreValid = false;
+ return false;
+ }
+ }
+ });
+ return requiredFieldsAreValid;
+ }
+
+ // Build form_data from searchElm inputs.
+ function buildFormData(searchElm) {
+ var preservePaged =
+ arguments.length > 1 && arguments[1] !== undefined
+ ? arguments[1]
+ : false;
+ var tag = [];
+ var price = [];
+ var custom_field = {};
+ var search_by_rating = [];
+
+ // Collect selected tags
+ searchElm
+ .find('input[name^="in_tag["]:checked')
+ .each(function (_, el) {
+ tag.push($(el).val());
+ });
+
+ // Collect selected ratings
+ searchElm
+ .find('input[name^="search_by_rating["]:checked')
+ .each(function (_, el) {
+ search_by_rating.push($(el).val());
+ });
+
+ // Collect price values
+ searchElm
+ .find('input[name^="price["]')
+ .each(function (_, el) {
+ price.push($(el).val());
+ });
+
+ // Check if **any** price is greater than 0
+ var hasValidPrice = price.some(function (val) {
+ return val > 0;
+ });
+ if (!hasValidPrice) {
+ price = []; // Reset price if no valid price found
+ }
+
+ // Collect custom field values
+ searchElm
+ .find('[name^="custom_field"]')
+ .each(function (_, el) {
+ var $el = $(el);
+ var name = $el.attr('name');
+ var type = $el.attr('type');
+ var match = name.match(
+ /^custom_field\[(.+?)\]/
+ );
+ var post_id = match ? match[1] : '';
+ if (!post_id) return;
+ if (type === 'radio') {
+ var checked = searchElm
+ .find(
+ 'input[name="custom_field['.concat(
+ post_id,
+ ']"]:checked'
+ )
+ )
+ .val();
+ if (checked)
+ custom_field[post_id] = checked;
+ } else if (type === 'checkbox') {
+ var values = [];
+ searchElm
+ .find(
+ 'input[name="custom_field['.concat(
+ post_id,
+ '][]"]:checked'
+ )
+ )
+ .each(function () {
+ var val = $(this).val();
+ if (val) values.push(val);
+ });
+ if (values.length)
+ custom_field[post_id] = values;
+ } else {
+ var value = $el.val();
+ if (value && value !== '0-0')
+ custom_field[post_id] = value;
+ }
+ });
+
+ // Collect custom range slider min/max values
+ var range_slider_values = {};
+ searchElm
+ .find('.directorist-custom-range-slider__wrap')
+ .each(function () {
+ var $wrap = $(this);
+ var rangeField = $wrap.find(
+ '.directorist-custom-range-slider__range'
+ );
+ var rangeName = rangeField.attr('name');
+ if (!rangeName) {
+ return;
+ }
+ var minInput = $wrap.find(
+ '.directorist-custom-range-slider__value__min'
+ );
+ var maxInput = $wrap.find(
+ '.directorist-custom-range-slider__value__max'
+ );
+ var minVal = minInput.val();
+ var maxVal = maxInput.val();
+ var minName = minInput.attr('name');
+ var maxName = maxInput.attr('name');
+ if (minName && minVal && minVal !== '0') {
+ range_slider_values[minName] = minVal;
+ }
+ if (maxName && maxVal && maxVal !== '0') {
+ range_slider_values[maxName] = maxVal;
+ }
+ });
+
+ // Collect basic form values
+ var q = searchElm.find('input[name="q"]').val();
+ var in_cat = searchElm
+ .find('.directorist-category-select')
+ .val();
+ var in_loc = searchElm
+ .find('.directorist-location-select')
+ .val();
+ var price_range = searchElm
+ .find("input[name='price_range']:checked")
+ .val();
+ var address = searchElm
+ .find('input[name="address"]')
+ .val();
+ var zip = searchElm.find('input[name="zip"]').val();
+ var fax = searchElm.find('input[name="fax"]').val();
+ var email = searchElm.find('input[name="email"]').val();
+ var website = searchElm
+ .find('input[name="website"]')
+ .val();
+ var phone = searchElm.find('input[name="phone"]').val();
+ var phone2 = searchElm
+ .find('input[name="phone2"]')
+ .val();
+ var view = form_data.view;
+
+ // Get directory type - look in the parent container to ensure it's found regardless of form
+ var directory_type =
+ searchElm
+ .find('input[name="directory_type"]')
+ .val() ||
+ searchElm
+ .closest('.directorist-instant-search')
+ .find('input[name="directory_type"]')
+ .val();
+
+ // Update form_data
+ updateFormData(
+ _objectSpread(
+ {
+ q: q,
+ in_cat: in_cat,
+ in_loc: in_loc,
+ in_tag: tag,
+ price: price,
+ price_range: price_range,
+ search_by_rating: search_by_rating,
+ address: address,
+ zip: zip,
+ fax: fax,
+ email: email,
+ website: website,
+ phone: phone,
+ phone2: phone2,
+ custom_field: custom_field,
+ view: view,
+ directory_type: directory_type,
+ },
+ range_slider_values
+ )
+ );
+
+ // open_now checkbox
+ var open_now_val = searchElm
+ .find('input[name="open_now"]')
+ .is(':checked')
+ ? searchElm.find('input[name="open_now"]').val()
+ : undefined;
+ updateFormData({
+ open_now: open_now_val,
+ });
+ var radius_search_based_on = searchElm
+ .find('.directorist-radius_search_based_on')
+ .val();
+
+ // Check if the address or zip code is present to update miles, lat, and lng
+ if (radius_search_based_on === 'address' && address) {
+ updateFormData({
+ cityLat: searchElm.find('#cityLat').val(),
+ cityLng: searchElm.find('#cityLng').val(),
+ miles: searchElm
+ .find('input[name="miles"]')
+ .val(),
+ });
+ } else if (radius_search_based_on === 'zip' && zip) {
+ updateFormData({
+ zip_cityLat: searchElm
+ .find('.zip-cityLat')
+ .val(),
+ zip_cityLng: searchElm
+ .find('.zip-cityLng')
+ .val(),
+ miles: searchElm
+ .find('input[name="miles"]')
+ .val(),
+ });
+ } else {
+ updateFormData({
+ cityLat: undefined,
+ cityLng: undefined,
+ zip_cityLat: undefined,
+ zip_cityLng: undefined,
+ miles: undefined,
+ });
+ }
+
+ // Reset paged to undefined for any non-pagination search
+ if (!preservePaged) {
+ updateFormData({
+ paged: undefined,
+ });
+ }
+
+ // Update URL with form data
+ update_instant_search_url(form_data);
+ }
+
+ // Build form data without required value
+ function buildFormDataWithoutRequired() {
+ var notRequiredFields = ['view', 'sort', 'paged'];
+ Object.entries(form_data).forEach(function (_ref9) {
+ var _ref0 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(_ref9, 2),
+ key = _ref0[0],
+ value = _ref0[1];
+ if (!notRequiredFields.includes(key)) {
+ delete form_data[key];
+ }
+ });
+
+ // Update URL with form data
+ update_instant_search_url(form_data);
+ }
+
+ // Perform Instant Search with required value
+ function performInstantSearchWithRequiredValue(searchElm) {
+ // Build form data
+ buildFormData(searchElm);
+
+ // Check required fields
+ var allRequiredFieldsAreValid =
+ checkRequiredFields(searchElm);
+
+ // If required fields are valid, proceed with filtering
+ if (allRequiredFieldsAreValid) {
+ performInstantSearch(searchElm);
+ }
+ }
+
+ // Perform Instant Search without required value
+ function performInstantSearchWithoutRequiredValue(
+ searchElm
+ ) {
+ var preservePaged =
+ arguments.length > 1 && arguments[1] !== undefined
+ ? arguments[1]
+ : false;
+ // Check required fields
+ var allRequiredFieldsAreValid =
+ checkRequiredFields(searchElm);
+
+ // If required fields are valid, proceed with filtering
+ if (allRequiredFieldsAreValid) {
+ // Build form data
+ buildFormData(searchElm, preservePaged);
+ performInstantSearch(searchElm);
+ } else {
+ // Build form data without required value
+ buildFormDataWithoutRequired();
+
+ // Filter Listing
+ performInstantSearch(searchElm);
+ }
+ }
+
+ // Handle Infinite Scroll
+ function handleScroll() {
+ var container = $(
+ '.directorist-infinite-scroll .directorist-container-fluid .directorist-row'
+ );
+ if (!container.length || infinitePaginationIsLoading) {
+ return;
+ }
+ var containerBottom =
+ container.offset().top + container.outerHeight();
+ var scrollBottom = window.scrollY + window.innerHeight;
+ if (scrollBottom >= containerBottom) {
+ infinitePaginationIsLoading = true;
+ scrollingPage++;
+
+ // get parent element
+ var instantSearchElement = $(
+ '.directorist-instant-search'
+ );
+ // get active form
+ var activeForm =
+ getActiveForm(instantSearchElement);
+
+ // build form_data
+ buildFormData(activeForm);
+
+ // Load more listings
+ loadMoreListings(activeForm);
+ }
+ }
+
+ // Close all search modal
+ function closeAllSearchModal() {
+ var searchModalElement = document.querySelectorAll(
+ '.directorist-search-modal'
+ );
+ searchModalElement.forEach(function (modal) {
+ var modalOverlay = modal.querySelector(
+ '.directorist-search-modal__overlay'
+ );
+ var modalContent = modal.querySelector(
+ '.directorist-search-modal__contents'
+ );
+ var modalBodyOverlay = document.querySelector(
+ '.directorist-content-active'
+ );
+
+ // Overlay Style
+ if (modalOverlay) {
+ modalOverlay.style.cssText =
+ 'opacity: 0; visibility: hidden; transition: 0.5s ease';
+ // remove overlay class on body
+ modalBodyOverlay.classList.remove(
+ 'directorist-overlay-active'
+ );
+ }
+
+ // Modal Content Style
+ if (modalContent) {
+ modalContent.style.cssText =
+ 'opacity: 0; visibility: hidden; bottom: -200px;';
+ }
+ });
+ }
+
+ // Determine the active form with intelligent fallback strategy
+ function getActiveForm(instantSearchElement) {
+ var forms = {
+ sidebar: instantSearchElement.find(
+ '.listing-with-sidebar'
+ ),
+ advanced: instantSearchElement.find(
+ '.directorist-advanced-filter__form'
+ ),
+ search: instantSearchElement.find(
+ '.directorist-search-form'
+ ),
+ };
+
+ // Early return for sidebar listings
+ if (forms.sidebar.length) {
+ return instantSearchElement;
+ }
+
+ // Create form candidates with metadata
+ var candidates = [
+ {
+ form: forms.advanced,
+ hasDirectoryType:
+ forms.advanced.find(
+ 'input[name="directory_type"]'
+ ).length > 0,
+ },
+ {
+ form: forms.search,
+ hasDirectoryType:
+ forms.search.find(
+ 'input[name="directory_type"]'
+ ).length > 0,
+ },
+ ].filter(function (candidate) {
+ return candidate.form.length > 0;
+ });
+
+ // Smart selection: prioritize forms with directory_type, fallback to responsive behavior
+ var formWithDirectoryType = candidates.find(
+ function (c) {
+ return c.hasDirectoryType;
+ }
+ );
+ if (formWithDirectoryType) {
+ return formWithDirectoryType.form;
+ }
+
+ // Fallback: use responsive selection if no directory_type found
+ return screen.width > 575
+ ? forms.advanced
+ : forms.search;
+ }
+
+ // Get directory type
+ function getDirectoryType(directoryTypeLink) {
+ var _directoryTypeLink$at;
+ var typeMatch =
+ (_directoryTypeLink$at =
+ directoryTypeLink.attr('href')) === null ||
+ _directoryTypeLink$at === void 0
+ ? void 0
+ : _directoryTypeLink$at.match(/type=([^&]+)/);
+ return typeMatch ? typeMatch[1] : '';
+ }
+
+ // Get view as
+ function getViewAs(viewAsLink) {
+ var _viewAsLink$attr;
+ var viewMatch =
+ (_viewAsLink$attr = viewAsLink.attr('href')) ===
+ null || _viewAsLink$attr === void 0
+ ? void 0
+ : _viewAsLink$attr.match(/view=([^&]+)/);
+ return viewMatch ? viewMatch[1] : '';
+ }
+
+ // Get sort value
+ function getSortValue(sortByLink) {
+ var sort_href = sortByLink.attr('data-link');
+ var sort_by =
+ sort_href && sort_href.length
+ ? sort_href.match(/sort=.+/)
+ : '';
+ return sort_by && sort_by.length
+ ? sort_by[0].replace(/sort=/, '')
+ : '';
+ }
+
+ // Trigger custom events
+ function triggerCustomEvents() {
+ window.dispatchEvent(
+ new Event('directorist-instant-search-reloaded')
+ );
+ window.dispatchEvent(
+ new Event('directorist-reload-listings-map-archive')
+ );
+ }
+
+ // Range Slider searching observer
+ function initObserver() {
+ var targetNodes = document.querySelectorAll(
+ '.directorist-instant-search .directorist-custom-range-slider__value input'
+ );
+ targetNodes.forEach(function (targetNode) {
+ var searchElm = $(targetNode.closest('form'));
+ if (targetNode) {
+ var timeout;
+ var observerCallback =
+ function observerCallback(
+ mutationList,
+ observer
+ ) {
+ var _iterator =
+ _createForOfIteratorHelper(
+ mutationList
+ ),
+ _step;
+ try {
+ for (
+ _iterator.s();
+ !(_step = _iterator.n()).done;
+
+ ) {
+ var mutation = _step.value;
+ if (
+ mutation.attributeName ==
+ 'value'
+ ) {
+ clearTimeout(timeout);
+ timeout = setTimeout(
+ function () {
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(
+ searchElm
+ );
+ },
+ 250
+ );
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ };
+ var observer = new MutationObserver(
+ observerCallback
+ );
+ observer.observe(targetNode, {
+ attributes: true,
+ childList: true,
+ subtree: true,
+ });
+ }
+ });
+ }
+
+ // Single Location Category Page Search Form Item Disable
+ function singleCategoryLocationInit() {
+ var directoristArchiveContents = document.querySelector(
+ '.directorist-archive-contents'
+ );
+ if (!directoristArchiveContents) {
+ return;
+ }
+ var directoristDataAttributes =
+ directoristArchiveContents.getAttribute(
+ 'data-atts'
+ );
+ var _JSON$parse = JSON.parse(directoristDataAttributes),
+ shortcode = _JSON$parse.shortcode,
+ location = _JSON$parse.location,
+ category = _JSON$parse.category;
+ if (
+ shortcode === 'directorist_category' &&
+ category.trim() !== ''
+ ) {
+ var categorySelect = document.querySelector(
+ '.directorist-search-form .directorist-category-select'
+ );
+ if (categorySelect) {
+ categorySelect
+ .closest('.directorist-search-category')
+ .classList.add(
+ 'directorist-search-form__single-category'
+ );
+ }
+ }
+ if (
+ shortcode === 'directorist_location' &&
+ location.trim() !== ''
+ ) {
+ var locationSelect = document.querySelector(
+ '.directorist-search-form .directorist-location-select'
+ );
+ if (locationSelect) {
+ locationSelect
+ .closest('.directorist-search-location')
+ .classList.add(
+ 'directorist-search-form__single-location'
+ );
+ }
+ }
+ }
+
+ /**
Event Listeners
*/
- // sidebar on keyup searching
- $('body').on('keyup', '.directorist-instant-search .listing-with-sidebar form', (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function (e) {
- if ($(e.target).closest('.directorist-custom-range-slider__value').length > 0 || e.key === 'Enter' && e.target.value === '') {
- return; // Skip search for this element
- }
- e.preventDefault();
- var searchElm = $(this).closest('.listing-with-sidebar');
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 250));
-
- // sidebar on change searching - radio/checkbox/location/range
- $('body').on('change', ".directorist-instant-search .listing-with-sidebar input[type='checkbox'],.directorist-instant-search .listing-with-sidebar input[type='radio'], .directorist-instant-search .listing-with-sidebar input[type='time'], .directorist-instant-search .listing-with-sidebar input[type='date'], .directorist-instant-search .listing-with-sidebar .directorist-custom-range-slider__wrap .directorist-custom-range-slider__range, .directorist-instant-search .listing-with-sidebar .directorist-search-location .location-name", (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function (e) {
- e.preventDefault();
- var searchElm = $(this).closest('.listing-with-sidebar');
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 250));
-
- // sidebar on change searching - zipcode/location
- $('body').on('change', '.directorist-instant-search .listing-with-sidebar .directorist-search-location, .directorist-instant-search .listing-with-sidebar .directorist-zipcode-search', (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function (e) {
- e.preventDefault();
- var searchElm = $(this).closest('.listing-with-sidebar');
-
- // If it's a location field, ensure it has a value before triggering the filter
- if ($(this).hasClass('directorist-search-location')) {
- var locationField = $(this).find('input[name="address"]');
- if (!locationField.val()) {
- return;
- }
- }
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 250));
-
- // sidebar on change searching - select
- $('body').on('change', '.directorist-instant-search .listing-with-sidebar select', (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function (e) {
- e.preventDefault();
- if (!$(this).val()) {
- return; // Skip search if the value is empty
- }
- e.preventDefault();
- var searchElm = $(this).val() && $(this).closest('.listing-with-sidebar');
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 250));
-
- // sidebar on change searching - color
- window.addEventListener('directorist-color-changed', (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function (e) {
- var input = e.detail.input;
- var searchElm = $(input).closest('.listing-with-sidebar');
- if (!searchElm.length) return;
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 250));
-
- // sidebar on click searching - location icon
- $('body').on('click', '.directorist-instant-search .listing-with-sidebar .directorist-filter-location-icon', (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function (e) {
- e.preventDefault();
- var searchElm = $(this).closest('.listing-with-sidebar');
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(searchElm);
- }, 1000));
-
- // Clear Input Value
- $('body').on('click', '.directorist-instant-search .listing-with-sidebar .directorist-search-field__btn--clear', function (e) {
- // Clear Color Field Value
- var irisPicker = $(this).closest('.directorist-search-field.directorist-color').find('input.wp-picker-clear');
- if (irisPicker !== null) {
- irisPicker.click();
- }
- var $searchField = $(this).closest('.directorist-search-field');
- var searchElm = $(this).closest('.listing-with-sidebar');
-
- // Clear text, email, number, select fields etc
- $searchField.find('input:not([type="checkbox"]):not([type="radio"]):not(.wp-picker-clear), select').val('');
-
- // Clear checkboxes
- $searchField.find('input[type="checkbox"]').prop('checked', false);
-
- // Clear radio buttons
- $searchField.find('input[type="radio"]').prop('checked', false);
-
- // Proceed if form exists
- if (searchElm.length) {
- performInstantSearchWithRequiredValue(searchElm);
- }
- });
-
- // Directorist instant search reset
- $('body').on('click', '.directorist-instant-search .listing-with-sidebar .directorist-btn-reset-js', function (e) {
- e.preventDefault();
- var searchElm = $(this).closest('.directorist-instant-search');
- // Get active form
- var activeForm = getActiveForm(searchElm);
-
- // ✅ only update `page`, preserve others
- updateFormData({
- paged: 1
- });
-
- // ✅ Define Filter Listing debounced function
- var debouncedResetSearch = (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(function () {
- // Build form data
- buildFormData(activeForm);
- performInstantSearch(activeForm);
- }, 250);
-
- // Reset Search after resetting form value
- debouncedResetSearch();
- });
-
- // Directorist instant search submit
- $('body').on('submit', '.directorist-instant-search form', function (e) {
- e.preventDefault();
- var _this = $(this);
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(_this);
- });
-
- // Directorist instant search submit - for advanced filter
- $('body').on('submit', '.widget .default-ad-search:not(.directorist_single) .directorist-advanced-filter__form', function (e) {
- if ($('.directorist-instant-search').length) {
- e.preventDefault();
- var _this = $(this);
-
- // Instant search with required value
- performInstantSearchWithRequiredValue(_this);
- }
- });
-
- // Directorist type changes
- $('body').on('click', '.directorist-instant-search .directorist-type-nav__link', function (e) {
- e.preventDefault();
-
- // Check if the clicked item is already active
- if ($(this).closest('.directorist-type-nav__list li').hasClass('directorist-type-nav__list__current')) {
- return; // Skip if already active
- }
-
- // get parent element
- var searchElm = $(this).closest('.directorist-instant-search');
-
- // reset form data
- resetFormData();
-
- // Get directory_type
- var directory_type = getDirectoryType($(this));
-
- // ✅ only update `directory_type`, preserve others
- updateFormData({
- directory_type: directory_type
- });
-
- // Update URL with form data
- update_instant_search_url(form_data);
-
- // Set the directory_type value in the input
- $(this).closest('.directorist-instant-search').find('input[name="directory_type"]').val(directory_type);
-
- // Get active form
- var activeForm = getActiveForm(searchElm);
-
- // Instant search for directory type change
- onDirectoryChange(activeForm);
- });
-
- // Directorist view as changes
- $('body').on('click', '.directorist-instant-search .directorist-viewas .directorist-viewas__item', function (e) {
- e.preventDefault();
-
- // Check if the clicked item is already active
- if ($(this).hasClass('active')) {
- return; // Skip if already active
- }
-
- // get parent element
- var searchElm = $(this).closest('.directorist-instant-search');
-
- // get view as value
- var view = getViewAs($(this));
- // ✅ only update `view`, preserve others
- updateFormData({
- view: view
- });
-
- // Get active form
- var activeForm = getActiveForm(searchElm);
-
- // Instant search without required value
- performInstantSearchWithoutRequiredValue(activeForm);
- });
-
- // Directorist sort by changes
- $('body').on('click', '.directorist-instant-search .directorist-sortby-dropdown .directorist-dropdown__links__single-js', function (e) {
- e.preventDefault();
-
- // toggle active class
- $(this).addClass('active').siblings('.directorist-dropdown__links__single-js').removeClass('active');
-
- // get parent element
- var searchElm = $(this).closest('.directorist-instant-search');
-
- // get sort value
- var sort = getSortValue($(this));
- // ✅ only update `sort`, preserve others
- updateFormData({
- sort: sort
- });
-
- // get active form
- var activeForm = getActiveForm(searchElm);
-
- // Instant search without required value
- performInstantSearchWithoutRequiredValue(activeForm);
- });
-
- // Directorist pagination changes
- $('body').on('click', '.directorist-instant-search .directorist-pagination .page-numbers', function (e) {
- e.preventDefault();
- var page = form_data.paged || 1;
- var currentPage = $(this).text();
- if (currentPage) {
- page = parseInt(currentPage);
- } else if ($(this).hasClass('next')) {
- page = parseInt(page) + 1;
- } else if ($(this).hasClass('prev')) {
- page = parseInt(page) - 1;
- }
- // ✅ only update `paged`, preserve others
- updateFormData({
- paged: page
- });
-
- // get parent element
- var searchElm = $(this).closest('.directorist-instant-search');
-
- // get active form
- var activeForm = getActiveForm(searchElm);
-
- // Instant search without required value - preserve paged in form_data
- performInstantSearchWithoutRequiredValue(activeForm, true);
- });
-
- // Submit on sidebar form
- if ($('.directorist-instant-search').length === 0) {
- $('body').on('submit', '.listing-with-sidebar .directorist-basic-search, .listing-with-sidebar .directorist-advanced-search', function (e) {
- e.preventDefault();
- var basic_data = $('.listing-with-sidebar .directorist-basic-search').serialize();
- var advanced_data = $('.listing-with-sidebar .directorist-advanced-search').serialize();
- var action_value = $('.directorist-advanced-search').attr('action');
- var url = action_value + '?' + basic_data + '&' + advanced_data;
- window.location.href = url;
- });
- }
-
- // Prevent disabled links from being clicked
- $('body').on('click', '.disabled-link', function (e) {
- e.preventDefault();
- });
-
- // Prevent default action for dropdown links
- $('.directorist-instant-search .directorist-dropdown__links__single-js').off('click');
-
- // Initialize Infinite Scroll
- window.addEventListener('scroll', function () {
- if (infinitePaginationCompleted) {
- scrollingPage = 1;
- return;
- }
- handleScroll();
- });
-
- // Initialize the observer for single category location
- window.addEventListener('load', function () {
- (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_3__["default"])(initObserver(), 250);
- singleCategoryLocationInit();
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/legacy-support.js":
-/*!***********************************************************!*\
+ // sidebar on keyup searching
+ $('body').on(
+ 'keyup',
+ '.directorist-instant-search .listing-with-sidebar form',
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function (e) {
+ if (
+ $(e.target).closest(
+ '.directorist-custom-range-slider__value'
+ ).length > 0 ||
+ (e.key === 'Enter' && e.target.value === '')
+ ) {
+ return; // Skip search for this element
+ }
+ e.preventDefault();
+ var searchElm = $(this).closest(
+ '.listing-with-sidebar'
+ );
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(searchElm);
+ }, 250)
+ );
+
+ // sidebar on change searching - radio/checkbox/location/range
+ $('body').on(
+ 'change',
+ ".directorist-instant-search .listing-with-sidebar input[type='checkbox'],.directorist-instant-search .listing-with-sidebar input[type='radio'], .directorist-instant-search .listing-with-sidebar input[type='time'], .directorist-instant-search .listing-with-sidebar input[type='date'], .directorist-instant-search .listing-with-sidebar .directorist-custom-range-slider__wrap .directorist-custom-range-slider__range, .directorist-instant-search .listing-with-sidebar .directorist-search-location .location-name",
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function (e) {
+ e.preventDefault();
+ var searchElm = $(this).closest(
+ '.listing-with-sidebar'
+ );
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(searchElm);
+ }, 250)
+ );
+
+ // sidebar on change searching - zipcode/location
+ $('body').on(
+ 'change',
+ '.directorist-instant-search .listing-with-sidebar .directorist-search-location, .directorist-instant-search .listing-with-sidebar .directorist-zipcode-search',
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function (e) {
+ e.preventDefault();
+ var searchElm = $(this).closest(
+ '.listing-with-sidebar'
+ );
+
+ // If it's a location field, ensure it has a value before triggering the filter
+ if (
+ $(this).hasClass('directorist-search-location')
+ ) {
+ var locationField = $(this).find(
+ 'input[name="address"]'
+ );
+ if (!locationField.val()) {
+ return;
+ }
+ }
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(searchElm);
+ }, 250)
+ );
+
+ // sidebar on change searching - select
+ $('body').on(
+ 'change',
+ '.directorist-instant-search .listing-with-sidebar select',
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function (e) {
+ e.preventDefault();
+ if (!$(this).val()) {
+ return; // Skip search if the value is empty
+ }
+ e.preventDefault();
+ var searchElm =
+ $(this).val() &&
+ $(this).closest('.listing-with-sidebar');
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(searchElm);
+ }, 250)
+ );
+
+ // sidebar on change searching - color
+ window.addEventListener(
+ 'directorist-color-changed',
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function (e) {
+ var input = e.detail.input;
+ var searchElm = $(input).closest(
+ '.listing-with-sidebar'
+ );
+ if (!searchElm.length) return;
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(searchElm);
+ }, 250)
+ );
+
+ // sidebar on click searching - location icon
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .listing-with-sidebar .directorist-filter-location-icon',
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function (e) {
+ e.preventDefault();
+ var searchElm = $(this).closest(
+ '.listing-with-sidebar'
+ );
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(searchElm);
+ }, 1000)
+ );
+
+ // Clear Input Value
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .listing-with-sidebar .directorist-search-field__btn--clear',
+ function (e) {
+ // Clear Color Field Value
+ var irisPicker = $(this)
+ .closest(
+ '.directorist-search-field.directorist-color'
+ )
+ .find('input.wp-picker-clear');
+ if (irisPicker !== null) {
+ irisPicker.click();
+ }
+ var $searchField = $(this).closest(
+ '.directorist-search-field'
+ );
+ var searchElm = $(this).closest(
+ '.listing-with-sidebar'
+ );
+
+ // Clear text, email, number, select fields etc
+ $searchField
+ .find(
+ 'input:not([type="checkbox"]):not([type="radio"]):not(.wp-picker-clear), select'
+ )
+ .val('');
+
+ // Clear checkboxes
+ $searchField
+ .find('input[type="checkbox"]')
+ .prop('checked', false);
+
+ // Clear radio buttons
+ $searchField
+ .find('input[type="radio"]')
+ .prop('checked', false);
+
+ // Proceed if form exists
+ if (searchElm.length) {
+ performInstantSearchWithRequiredValue(
+ searchElm
+ );
+ }
+ }
+ );
+
+ // Directorist instant search reset
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .listing-with-sidebar .directorist-btn-reset-js',
+ function (e) {
+ e.preventDefault();
+ var searchElm = $(this).closest(
+ '.directorist-instant-search'
+ );
+ // Get active form
+ var activeForm = getActiveForm(searchElm);
+
+ // ✅ only update `page`, preserve others
+ updateFormData({
+ paged: 1,
+ });
+
+ // ✅ Define Filter Listing debounced function
+ var debouncedResetSearch = (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(function () {
+ // Build form data
+ buildFormData(activeForm);
+ performInstantSearch(activeForm);
+ }, 250);
+
+ // Reset Search after resetting form value
+ debouncedResetSearch();
+ }
+ );
+
+ // Directorist instant search submit
+ $('body').on(
+ 'submit',
+ '.directorist-instant-search form',
+ function (e) {
+ e.preventDefault();
+ var _this = $(this);
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(_this);
+ }
+ );
+
+ // Directorist instant search submit - for advanced filter
+ $('body').on(
+ 'submit',
+ '.widget .default-ad-search:not(.directorist_single) .directorist-advanced-filter__form',
+ function (e) {
+ if ($('.directorist-instant-search').length) {
+ e.preventDefault();
+ var _this = $(this);
+
+ // Instant search with required value
+ performInstantSearchWithRequiredValue(_this);
+ }
+ }
+ );
+
+ // Directorist type changes
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .directorist-type-nav__link',
+ function (e) {
+ e.preventDefault();
+
+ // Check if the clicked item is already active
+ if (
+ $(this)
+ .closest('.directorist-type-nav__list li')
+ .hasClass(
+ 'directorist-type-nav__list__current'
+ )
+ ) {
+ return; // Skip if already active
+ }
+
+ // get parent element
+ var searchElm = $(this).closest(
+ '.directorist-instant-search'
+ );
+
+ // reset form data
+ resetFormData();
+
+ // Get directory_type
+ var directory_type = getDirectoryType($(this));
+
+ // ✅ only update `directory_type`, preserve others
+ updateFormData({
+ directory_type: directory_type,
+ });
+
+ // Update URL with form data
+ update_instant_search_url(form_data);
+
+ // Set the directory_type value in the input
+ $(this)
+ .closest('.directorist-instant-search')
+ .find('input[name="directory_type"]')
+ .val(directory_type);
+
+ // Get active form
+ var activeForm = getActiveForm(searchElm);
+
+ // Instant search for directory type change
+ onDirectoryChange(activeForm);
+ }
+ );
+
+ // Directorist view as changes
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .directorist-viewas .directorist-viewas__item',
+ function (e) {
+ e.preventDefault();
+
+ // Check if the clicked item is already active
+ if ($(this).hasClass('active')) {
+ return; // Skip if already active
+ }
+
+ // get parent element
+ var searchElm = $(this).closest(
+ '.directorist-instant-search'
+ );
+
+ // get view as value
+ var view = getViewAs($(this));
+ // ✅ only update `view`, preserve others
+ updateFormData({
+ view: view,
+ });
+
+ // Get active form
+ var activeForm = getActiveForm(searchElm);
+
+ // Instant search without required value
+ performInstantSearchWithoutRequiredValue(
+ activeForm
+ );
+ }
+ );
+
+ // Directorist sort by changes
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .directorist-sortby-dropdown .directorist-dropdown__links__single-js',
+ function (e) {
+ e.preventDefault();
+
+ // toggle active class
+ $(this)
+ .addClass('active')
+ .siblings(
+ '.directorist-dropdown__links__single-js'
+ )
+ .removeClass('active');
+
+ // get parent element
+ var searchElm = $(this).closest(
+ '.directorist-instant-search'
+ );
+
+ // get sort value
+ var sort = getSortValue($(this));
+ // ✅ only update `sort`, preserve others
+ updateFormData({
+ sort: sort,
+ });
+
+ // get active form
+ var activeForm = getActiveForm(searchElm);
+
+ // Instant search without required value
+ performInstantSearchWithoutRequiredValue(
+ activeForm
+ );
+ }
+ );
+
+ // Directorist pagination changes
+ $('body').on(
+ 'click',
+ '.directorist-instant-search .directorist-pagination .page-numbers',
+ function (e) {
+ e.preventDefault();
+ var page = form_data.paged || 1;
+ var currentPage = $(this).text();
+ if (currentPage) {
+ page = parseInt(currentPage);
+ } else if ($(this).hasClass('next')) {
+ page = parseInt(page) + 1;
+ } else if ($(this).hasClass('prev')) {
+ page = parseInt(page) - 1;
+ }
+ // ✅ only update `paged`, preserve others
+ updateFormData({
+ paged: page,
+ });
+
+ // get parent element
+ var searchElm = $(this).closest(
+ '.directorist-instant-search'
+ );
+
+ // get active form
+ var activeForm = getActiveForm(searchElm);
+
+ // Instant search without required value - preserve paged in form_data
+ performInstantSearchWithoutRequiredValue(
+ activeForm,
+ true
+ );
+ }
+ );
+
+ // Submit on sidebar form
+ if ($('.directorist-instant-search').length === 0) {
+ $('body').on(
+ 'submit',
+ '.listing-with-sidebar .directorist-basic-search, .listing-with-sidebar .directorist-advanced-search',
+ function (e) {
+ e.preventDefault();
+ var basic_data = $(
+ '.listing-with-sidebar .directorist-basic-search'
+ ).serialize();
+ var advanced_data = $(
+ '.listing-with-sidebar .directorist-advanced-search'
+ ).serialize();
+ var action_value = $(
+ '.directorist-advanced-search'
+ ).attr('action');
+ var url =
+ action_value +
+ '?' +
+ basic_data +
+ '&' +
+ advanced_data;
+ window.location.href = url;
+ }
+ );
+ }
+
+ // Prevent disabled links from being clicked
+ $('body').on('click', '.disabled-link', function (e) {
+ e.preventDefault();
+ });
+
+ // Prevent default action for dropdown links
+ $(
+ '.directorist-instant-search .directorist-dropdown__links__single-js'
+ ).off('click');
+
+ // Initialize Infinite Scroll
+ window.addEventListener('scroll', function () {
+ if (infinitePaginationCompleted) {
+ scrollingPage = 1;
+ return;
+ }
+ handleScroll();
+ });
+
+ // Initialize the observer for single category location
+ window.addEventListener('load', function () {
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(initObserver(), 250);
+ singleCategoryLocationInit();
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/legacy-support.js':
+ /*!***********************************************************!*\
!*** ./assets/src/js/public/components/legacy-support.js ***!
\***********************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.atbd-dropdown');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.atbd-dropdown-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.atbd-dropdown-items').forEach(function (el) {
- el.classList.remove('atbd-show');
- });
- el.querySelector('.atbd-dropdown-items').classList.add('atbd-show');
- } else {
- document.querySelectorAll('.atbd-dropdown-items').forEach(function (el) {
- el.classList.remove('atbd-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'atbd-toggle') {
- clickCount = 0;
- document.querySelectorAll('.atbd-dropdown-items').forEach(function (el) {
- el.classList.remove('atbd-show');
- });
- }
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/masonry.js":
-/*!****************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown =
+ document.querySelectorAll('.atbd-dropdown');
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.atbd-dropdown-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.atbd-dropdown-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove('atbd-show');
+ });
+ el.querySelector(
+ '.atbd-dropdown-items'
+ ).classList.add('atbd-show');
+ } else {
+ document
+ .querySelectorAll(
+ '.atbd-dropdown-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove('atbd-show');
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'atbd-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll('.atbd-dropdown-items')
+ .forEach(function (el) {
+ el.classList.remove('atbd-show');
+ });
+ }
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/masonry.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/public/components/masonry.js ***!
\****************************************************/
-/***/ (function() {
-
-// DOM Mutation observer
-function initObserver() {
- var targetNode = document.querySelector('.directorist-archive-contents');
- var observer = new MutationObserver(initMasonry);
- if (targetNode) {
- observer.observe(targetNode, {
- childList: true
- });
- }
-}
-
-// All listings Masonry layout
-function initMasonry() {
- var $ = jQuery;
- function authorsMasonry(selector) {
- var authorsCard = $(selector);
- $(authorsCard).each(function (id, elm) {
- var authorsCardRow = $(elm).find('.directorist-masonry');
- var authorMasonryInit = $(authorsCardRow).imagesLoaded(function () {
- $(authorMasonryInit).masonry({
- percentPosition: true,
- horizontalOrder: true
- });
- });
- });
- }
- authorsMasonry('.directorist-archive-grid-view');
-}
-window.addEventListener('load', initObserver);
-window.addEventListener('load', initMasonry);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review.js":
-/*!***************************************************!*\
+ /***/ function () {
+ // DOM Mutation observer
+ function initObserver() {
+ var targetNode = document.querySelector(
+ '.directorist-archive-contents'
+ );
+ var observer = new MutationObserver(initMasonry);
+ if (targetNode) {
+ observer.observe(targetNode, {
+ childList: true,
+ });
+ }
+ }
+
+ // All listings Masonry layout
+ function initMasonry() {
+ var $ = jQuery;
+ function authorsMasonry(selector) {
+ var authorsCard = $(selector);
+ $(authorsCard).each(function (id, elm) {
+ var authorsCardRow = $(elm).find(
+ '.directorist-masonry'
+ );
+ var authorMasonryInit = $(
+ authorsCardRow
+ ).imagesLoaded(function () {
+ $(authorMasonryInit).masonry({
+ percentPosition: true,
+ horizontalOrder: true,
+ });
+ });
+ });
+ }
+ authorsMasonry('.directorist-archive-grid-view');
+ }
+ window.addEventListener('load', initObserver);
+ window.addEventListener('load', initMasonry);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review.js':
+ /*!***************************************************!*\
!*** ./assets/src/js/public/components/review.js ***!
\***************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./review/starRating */ "./assets/src/js/public/components/review/starRating.js");
-/* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_review_starRating__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _review_advanced_review__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./review/advanced-review */ "./assets/src/js/public/components/review/advanced-review.js");
-// Helper Components
-
-// import './review/addReview'
-// import './review/reviewAttatchment'
-// import './review/deleteReview'
-// import './review/reviewPagination'
-
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review/advanced-review.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./review/starRating */ './assets/src/js/public/components/review/starRating.js'
+ );
+ /* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _review_starRating__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _review_advanced_review__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./review/advanced-review */ './assets/src/js/public/components/review/advanced-review.js'
+ );
+ // Helper Components
+
+ // import './review/addReview'
+ // import './review/reviewAttatchment'
+ // import './review/deleteReview'
+ // import './review/reviewPagination'
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review/advanced-review.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/public/components/review/advanced-review.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
-/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
-
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-window.addEventListener('load', function () {
- (function ($) {
- 'use strict';
-
- var ReplyFormObserver = /*#__PURE__*/function () {
- function ReplyFormObserver() {
- var _this = this;
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, ReplyFormObserver);
- this.init();
- $(document).on('directorist_review_updated', function () {
- return _this.init();
- });
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(ReplyFormObserver, [{
- key: "init",
- value: function init() {
- var node = document.querySelector('.commentlist');
- if (node) {
- this.observe(node);
- }
- }
- }, {
- key: "observe",
- value: function observe(node) {
- var config = {
- childList: true,
- subtree: true
- };
- var observer = new MutationObserver(this.callback);
- observer.observe(node, config);
- }
- }, {
- key: "callback",
- value: function callback(mutationsList, observer) {
- var _iterator = _createForOfIteratorHelper(mutationsList),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var mutation = _step.value;
- var target = mutation.target;
- if (mutation.removedNodes) {
- target.classList.remove('directorist-form-added');
- var _iterator2 = _createForOfIteratorHelper(mutation.removedNodes),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var node = _step2.value;
- if (!node.id || node.id !== 'respond') {
- continue;
- }
- var criteria = node.querySelector('.directorist-review-criteria');
- if (criteria) {
- criteria.style.display = '';
- }
- var ratings = node.querySelectorAll('.directorist-review-criteria-select');
- var _iterator3 = _createForOfIteratorHelper(ratings),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var rating = _step3.value;
- rating.removeAttribute('disabled');
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- node.querySelector('#submit').innerHTML = 'Submit Review';
- node.querySelector('#comment').setAttribute('placeholder', 'Leave a review');
- //console.log(node.querySelector('#comment'))
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- }
- var form = target.querySelector('#commentform');
- if (form) {
- target.classList.add('directorist-form-added');
- var isReview = target.classList.contains('review');
- var isEditing = target.classList.contains('directorist-form-editing');
- if (!isReview || isReview && !isEditing) {
- var _criteria = form.querySelector('.directorist-review-criteria');
- if (_criteria) {
- _criteria.style.display = 'none';
- }
- var _ratings = form.querySelectorAll('.directorist-review-criteria-select');
- var _iterator4 = _createForOfIteratorHelper(_ratings),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _rating = _step4.value;
- _rating.setAttribute('disabled', 'disabled');
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- }
- var alert = form.querySelector('.directorist-alert');
- if (alert) {
- alert.style.display = 'none';
- }
- form.querySelector('#submit').innerHTML = 'Submit Reply';
- form.querySelector('#comment').setAttribute('placeholder', 'Leave your reply');
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- }]);
- }();
- var CommentEditHandler = /*#__PURE__*/function () {
- function CommentEditHandler() {
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CommentEditHandler);
- this.init();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CommentEditHandler, [{
- key: "init",
- value: function init() {
- $(document).on('submit', '#directorist-form-comment-edit', this.onSubmit);
- }
- }, {
- key: "onSubmit",
- value: function onSubmit(event) {
- event.preventDefault();
- var $form = $(event.target);
- var originalButtonLabel = $form.find('[type="submit"]').val();
- $(document).trigger('directorist_review_before_submit', $form);
- var formData = new FormData($form[0]);
-
- // Apply the filter
- formData = wp.hooks.applyFilters('directorist_add_review_form_data', formData, 'directorist-advanced-review');
- var updateComment = $.ajax({
- url: $form.attr('action'),
- type: 'POST',
- contentType: false,
- cache: false,
- processData: false,
- data: formData
- });
- $form.find('#comment').prop('disabled', true);
- $form.find('[type="submit"]').prop('disabled', true).val('loading');
- var commentID = $form.find('input[name="comment_id"]').val();
- var $wrap = $('#div-comment-' + commentID);
- $wrap.addClass('directorist-comment-edit-request');
- updateComment.done(function (data, status, request) {
- if (typeof data !== 'string' && !data.success) {
- $wrap.removeClass('directorist-comment-edit-request');
- CommentEditHandler.showError($form, data.data.html);
- return;
- }
- var body = $('
');
- body.append(data);
- var comment_section = '.directorist-review-container';
- var comments = body.find(comment_section);
- $(comment_section).replaceWith(comments);
- $(document).trigger('directorist_review_updated', data);
- var commentTop = $('#comment-' + commentID).offset().top;
- if ($('body').hasClass('admin-bar')) {
- commentTop = commentTop - $('#wpadminbar').height();
- }
-
- // scroll to comment
- if (commentID) {
- $('body, html').animate({
- scrollTop: commentTop
- }, 600);
- }
- });
- updateComment.fail(function (data) {
- CommentEditHandler.showError($form, data.responseText);
- });
- updateComment.always(function () {
- $form.find('#comment').prop('disabled', false);
- $form.find('[type="submit"]').prop('disabled', false).val(originalButtonLabel);
- });
- $(document).trigger('directorist_review_after_submit', $form);
- }
- }], [{
- key: "showError",
- value: function showError($form, msg) {
- $form.find('.directorist-alert').remove();
- $form.prepend(msg);
- }
- }]);
- }();
- var CommentAddReplyHandler = /*#__PURE__*/function () {
- function CommentAddReplyHandler() {
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CommentAddReplyHandler);
- this.init();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CommentAddReplyHandler, [{
- key: "init",
- value: function init() {
- var t = setTimeout(function () {
- if ($('.directorist-review-container').length) {
- $(document).off('submit', '#commentform');
- }
- clearTimeout(t);
- }, 2000);
- $(document).off('submit', '.directorist-review-container #commentform');
- $(document).on('submit', '.directorist-review-container #commentform', this.onSubmit);
- }
- }, {
- key: "onSubmit",
- value: function onSubmit(event) {
- var _this2 = this;
- event.preventDefault();
- console.log(wp.hooks);
- var form = $('.directorist-review-container #commentform');
- var originalButtonLabel = form.find('[type="submit"]').val();
- $(document).trigger('directorist_review_before_submit', form);
- var formData = new FormData(form[0]);
-
- // Apply the filter
- formData = wp.hooks.applyFilters('directorist_add_review_form_data', formData, 'directorist-advanced-review');
- var do_comment = $.ajax({
- url: form.attr('action'),
- type: 'POST',
- contentType: false,
- cache: false,
- processData: false,
- data: formData
- });
- $('#comment').prop('disabled', true);
- form.find('[type="submit"]').prop('disabled', true).val('loading');
- do_comment.done(function (data, status, request) {
- var body = $('
');
- body.append(data);
- var comment_section = '.directorist-review-container';
- var comments = body.find(comment_section);
- var errorMsg = body.find('.wp-die-message');
- if (errorMsg.length > 0) {
- CommentAddReplyHandler.showError(form, errorMsg);
- $(document).trigger('directorist_review_update_failed');
- return;
- }
- $(comment_section).replaceWith(comments);
- $(document).trigger('directorist_review_updated', data);
- var newComment = comments.find('.commentlist li:first-child');
- var newCommentId = newComment.attr('id');
-
- // // catch the new comment id by comparing to old dom.
- // commentsLists.each(
- // function ( index ) {
- // var _this = $( commentsLists[ index ] );
- // if ( $( '#' + _this.attr( 'id' ) ).length == 0 ) {
- // newCommentId = _this.attr( 'id' );
- // }
- // }
- // );
-
- // console.log(newComment, newCommentId)
-
- var commentTop = $('#' + newCommentId).offset().top;
- if ($('body').hasClass('admin-bar')) {
- commentTop = commentTop - $('#wpadminbar').height();
- }
-
- // scroll to comment
- if (newCommentId) {
- $('body, html').animate({
- scrollTop: commentTop
- }, 600);
- }
- });
- do_comment.fail(function (data) {
- var body = $('
');
- body.append(data.responseText);
- console.log(data);
- CommentAddReplyHandler.showError(form, body.find('.wp-die-message'));
- $(document).trigger('directorist_review_update_failed');
- if (data.status === 403 || data.status === 401) {
- $(document).off('submit', '.directorist-review-container #commentform', _this2.onSubmit);
- $('#comment').prop('disabled', false);
- form.find('[type="submit"]').prop('disabled', false).click();
- }
- });
- do_comment.always(function () {
- $('#comment').prop('disabled', false);
- $('#commentform').find('[type="submit"]').prop('disabled', false).val(originalButtonLabel);
- });
- $(document).trigger('directorist_review_after_submit', form);
- }
- }], [{
- key: "getErrorMsg",
- value: function getErrorMsg($dom) {
- if ($dom.find('p').length) {
- $dom = $dom.find('p');
- }
- var words = $dom.text().split(':');
- if (words.length > 1) {
- words.shift();
- }
- return words.join(' ').trim();
- }
- }, {
- key: "showError",
- value: function showError(form, $dom) {
- if (form.find('.directorist-alert').length) {
- form.find('.directorist-alert').remove();
- }
- var $error = $('
', {
- class: 'directorist-alert directorist-alert-danger'
- }).html(CommentAddReplyHandler.getErrorMsg($dom));
- form.prepend($error);
- }
- }]);
- }();
- var CommentsManager = /*#__PURE__*/function () {
- function CommentsManager() {
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CommentsManager);
- this.$doc = $(document);
- this.setupComponents();
- this.addEventListeners();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CommentsManager, [{
- key: "initStarRating",
- value: function initStarRating() {
- $('.directorist-review-criteria-select').barrating({
- theme: 'fontawesome-stars'
- });
- }
- }, {
- key: "cancelOthersEditMode",
- value: function cancelOthersEditMode(currentCommentId) {
- $('.directorist-comment-editing').each(function (index, comment) {
- var $cancelButton = $(comment).find('.directorist-js-cancel-comment-edit');
- if ($cancelButton.data('commentid') != currentCommentId) {
- $cancelButton.click();
- }
- });
- }
- }, {
- key: "cancelReplyMode",
- value: function cancelReplyMode() {
- var replyLink = document.querySelector('.directorist-review-content #cancel-comment-reply-link');
- replyLink && replyLink.click();
- }
- }, {
- key: "addEventListeners",
- value: function addEventListeners() {
- var _this3 = this;
- var self = this;
- this.$doc.on('directorist_review_updated', function (event) {
- _this3.initStarRating();
- });
- this.$doc.on('directorist_comment_edit_form_loaded', function (event) {
- _this3.initStarRating();
- });
- this.$doc.on('click', 'a[href="#respond"]', function (event) {
- // First cancle the reply form then scroll to review form. Order matters.
- _this3.cancelReplyMode();
- _this3.onWriteReivewClick(event);
- });
- this.$doc.on('click', '.directorist-js-edit-comment', function (event) {
- event.preventDefault();
- var $target = $(event.target);
- var $wrap = $target.parents('#div-comment-' + $target.data('commentid'));
- $wrap.addClass('directorist-comment-edit-request');
- $.ajax({
- url: $target.attr('href'),
- data: {
- post_id: $target.data('postid'),
- comment_id: $target.data('commentid')
- },
- setContent: false,
- method: 'GET',
- reload: 'strict',
- success: function success(response) {
- $target.prop('disabled', true);
- $target.parents('#div-comment-' + $target.data('commentid')).find('.directorist-review-single__info').append(response.data.html);
- $wrap.removeClass('directorist-comment-edit-request').addClass('directorist-comment-editing');
- self.cancelOthersEditMode($target.data('commentid'));
- self.cancelReplyMode();
- var $editForm = $('#directorist-form-comment-edit');
- $editForm.find('textarea').focus();
- self.$doc.trigger('directorist_comment_edit_form_loaded', $target.data('commentid'));
- }
- });
- });
- this.$doc.on('click', '.directorist-js-cancel-comment-edit', function (event) {
- event.preventDefault();
- var $target = $(event.target);
- var $wrap = $target.parents('#div-comment-' + $target.data('commentid'));
- $wrap.removeClass(['directorist-comment-edit-request', 'directorist-comment-editing']).find('form').remove();
- $wrap.find('.directorist-js-edit-comment').prop('disabled', false);
- });
- }
- }, {
- key: "onWriteReivewClick",
- value: function onWriteReivewClick(event) {
- event.preventDefault();
- var scrollTop = $('#respond').offset().top;
- if ($('body').hasClass('admin-bar')) {
- scrollTop = scrollTop - $('#wpadminbar').height();
- }
- $('body, html').animate({
- scrollTop: scrollTop
- }, 600);
- }
- }, {
- key: "setupComponents",
- value: function setupComponents() {
- new ReplyFormObserver();
- new CommentAddReplyHandler();
- new CommentEditHandler();
- }
- }]);
- }();
- var commentsManager = new CommentsManager();
- })(jQuery);
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review/starRating.js":
-/*!**************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/classCallCheck */ './node_modules/@babel/runtime/helpers/esm/classCallCheck.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/createClass */ './node_modules/@babel/runtime/helpers/esm/createClass.js'
+ );
+
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ window.addEventListener('load', function () {
+ (function ($) {
+ 'use strict';
+
+ var ReplyFormObserver = /*#__PURE__*/ (function () {
+ function ReplyFormObserver() {
+ var _this = this;
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, ReplyFormObserver);
+ this.init();
+ $(document).on(
+ 'directorist_review_updated',
+ function () {
+ return _this.init();
+ }
+ );
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(ReplyFormObserver, [
+ {
+ key: 'init',
+ value: function init() {
+ var node =
+ document.querySelector(
+ '.commentlist'
+ );
+ if (node) {
+ this.observe(node);
+ }
+ },
+ },
+ {
+ key: 'observe',
+ value: function observe(node) {
+ var config = {
+ childList: true,
+ subtree: true,
+ };
+ var observer = new MutationObserver(
+ this.callback
+ );
+ observer.observe(node, config);
+ },
+ },
+ {
+ key: 'callback',
+ value: function callback(
+ mutationsList,
+ observer
+ ) {
+ var _iterator =
+ _createForOfIteratorHelper(
+ mutationsList
+ ),
+ _step;
+ try {
+ for (
+ _iterator.s();
+ !(_step = _iterator.n()).done;
+
+ ) {
+ var mutation = _step.value;
+ var target = mutation.target;
+ if (mutation.removedNodes) {
+ target.classList.remove(
+ 'directorist-form-added'
+ );
+ var _iterator2 =
+ _createForOfIteratorHelper(
+ mutation.removedNodes
+ ),
+ _step2;
+ try {
+ for (
+ _iterator2.s();
+ !(_step2 =
+ _iterator2.n())
+ .done;
+
+ ) {
+ var node =
+ _step2.value;
+ if (
+ !node.id ||
+ node.id !==
+ 'respond'
+ ) {
+ continue;
+ }
+ var criteria =
+ node.querySelector(
+ '.directorist-review-criteria'
+ );
+ if (criteria) {
+ criteria.style.display =
+ '';
+ }
+ var ratings =
+ node.querySelectorAll(
+ '.directorist-review-criteria-select'
+ );
+ var _iterator3 =
+ _createForOfIteratorHelper(
+ ratings
+ ),
+ _step3;
+ try {
+ for (
+ _iterator3.s();
+ !(_step3 =
+ _iterator3.n())
+ .done;
+
+ ) {
+ var rating =
+ _step3.value;
+ rating.removeAttribute(
+ 'disabled'
+ );
+ }
+ } catch (err) {
+ _iterator3.e(
+ err
+ );
+ } finally {
+ _iterator3.f();
+ }
+ node.querySelector(
+ '#submit'
+ ).innerHTML =
+ 'Submit Review';
+ node.querySelector(
+ '#comment'
+ ).setAttribute(
+ 'placeholder',
+ 'Leave a review'
+ );
+ //console.log(node.querySelector('#comment'))
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
+ }
+ var form =
+ target.querySelector(
+ '#commentform'
+ );
+ if (form) {
+ target.classList.add(
+ 'directorist-form-added'
+ );
+ var isReview =
+ target.classList.contains(
+ 'review'
+ );
+ var isEditing =
+ target.classList.contains(
+ 'directorist-form-editing'
+ );
+ if (
+ !isReview ||
+ (isReview && !isEditing)
+ ) {
+ var _criteria =
+ form.querySelector(
+ '.directorist-review-criteria'
+ );
+ if (_criteria) {
+ _criteria.style.display =
+ 'none';
+ }
+ var _ratings =
+ form.querySelectorAll(
+ '.directorist-review-criteria-select'
+ );
+ var _iterator4 =
+ _createForOfIteratorHelper(
+ _ratings
+ ),
+ _step4;
+ try {
+ for (
+ _iterator4.s();
+ !(_step4 =
+ _iterator4.n())
+ .done;
+
+ ) {
+ var _rating =
+ _step4.value;
+ _rating.setAttribute(
+ 'disabled',
+ 'disabled'
+ );
+ }
+ } catch (err) {
+ _iterator4.e(err);
+ } finally {
+ _iterator4.f();
+ }
+ }
+ var alert =
+ form.querySelector(
+ '.directorist-alert'
+ );
+ if (alert) {
+ alert.style.display =
+ 'none';
+ }
+ form.querySelector(
+ '#submit'
+ ).innerHTML =
+ 'Submit Reply';
+ form.querySelector(
+ '#comment'
+ ).setAttribute(
+ 'placeholder',
+ 'Leave your reply'
+ );
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ },
+ },
+ ]);
+ })();
+ var CommentEditHandler = /*#__PURE__*/ (function () {
+ function CommentEditHandler() {
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, CommentEditHandler);
+ this.init();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(
+ CommentEditHandler,
+ [
+ {
+ key: 'init',
+ value: function init() {
+ $(document).on(
+ 'submit',
+ '#directorist-form-comment-edit',
+ this.onSubmit
+ );
+ },
+ },
+ {
+ key: 'onSubmit',
+ value: function onSubmit(event) {
+ event.preventDefault();
+ var $form = $(event.target);
+ var originalButtonLabel = $form
+ .find('[type="submit"]')
+ .val();
+ $(document).trigger(
+ 'directorist_review_before_submit',
+ $form
+ );
+ var formData = new FormData(
+ $form[0]
+ );
+
+ // Apply the filter
+ formData = wp.hooks.applyFilters(
+ 'directorist_add_review_form_data',
+ formData,
+ 'directorist-advanced-review'
+ );
+ var updateComment = $.ajax({
+ url: $form.attr('action'),
+ type: 'POST',
+ contentType: false,
+ cache: false,
+ processData: false,
+ data: formData,
+ });
+ $form
+ .find('#comment')
+ .prop('disabled', true);
+ $form
+ .find('[type="submit"]')
+ .prop('disabled', true)
+ .val('loading');
+ var commentID = $form
+ .find(
+ 'input[name="comment_id"]'
+ )
+ .val();
+ var $wrap = $(
+ '#div-comment-' + commentID
+ );
+ $wrap.addClass(
+ 'directorist-comment-edit-request'
+ );
+ updateComment.done(
+ function (
+ data,
+ status,
+ request
+ ) {
+ if (
+ typeof data !==
+ 'string' &&
+ !data.success
+ ) {
+ $wrap.removeClass(
+ 'directorist-comment-edit-request'
+ );
+ CommentEditHandler.showError(
+ $form,
+ data.data.html
+ );
+ return;
+ }
+ var body = $('
');
+ body.append(data);
+ var comment_section =
+ '.directorist-review-container';
+ var comments =
+ body.find(
+ comment_section
+ );
+ $(
+ comment_section
+ ).replaceWith(comments);
+ $(document).trigger(
+ 'directorist_review_updated',
+ data
+ );
+ var commentTop = $(
+ '#comment-' + commentID
+ ).offset().top;
+ if (
+ $('body').hasClass(
+ 'admin-bar'
+ )
+ ) {
+ commentTop =
+ commentTop -
+ $(
+ '#wpadminbar'
+ ).height();
+ }
+
+ // scroll to comment
+ if (commentID) {
+ $('body, html').animate(
+ {
+ scrollTop:
+ commentTop,
+ },
+ 600
+ );
+ }
+ }
+ );
+ updateComment.fail(function (data) {
+ CommentEditHandler.showError(
+ $form,
+ data.responseText
+ );
+ });
+ updateComment.always(function () {
+ $form
+ .find('#comment')
+ .prop('disabled', false);
+ $form
+ .find('[type="submit"]')
+ .prop('disabled', false)
+ .val(originalButtonLabel);
+ });
+ $(document).trigger(
+ 'directorist_review_after_submit',
+ $form
+ );
+ },
+ },
+ ],
+ [
+ {
+ key: 'showError',
+ value: function showError($form, msg) {
+ $form
+ .find('.directorist-alert')
+ .remove();
+ $form.prepend(msg);
+ },
+ },
+ ]
+ );
+ })();
+ var CommentAddReplyHandler =
+ /*#__PURE__*/ (function () {
+ function CommentAddReplyHandler() {
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, CommentAddReplyHandler);
+ this.init();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(
+ CommentAddReplyHandler,
+ [
+ {
+ key: 'init',
+ value: function init() {
+ var t = setTimeout(function () {
+ if (
+ $(
+ '.directorist-review-container'
+ ).length
+ ) {
+ $(document).off(
+ 'submit',
+ '#commentform'
+ );
+ }
+ clearTimeout(t);
+ }, 2000);
+ $(document).off(
+ 'submit',
+ '.directorist-review-container #commentform'
+ );
+ $(document).on(
+ 'submit',
+ '.directorist-review-container #commentform',
+ this.onSubmit
+ );
+ },
+ },
+ {
+ key: 'onSubmit',
+ value: function onSubmit(event) {
+ var _this2 = this;
+ event.preventDefault();
+ console.log(wp.hooks);
+ var form = $(
+ '.directorist-review-container #commentform'
+ );
+ var originalButtonLabel = form
+ .find('[type="submit"]')
+ .val();
+ $(document).trigger(
+ 'directorist_review_before_submit',
+ form
+ );
+ var formData = new FormData(
+ form[0]
+ );
+
+ // Apply the filter
+ formData =
+ wp.hooks.applyFilters(
+ 'directorist_add_review_form_data',
+ formData,
+ 'directorist-advanced-review'
+ );
+ var do_comment = $.ajax({
+ url: form.attr('action'),
+ type: 'POST',
+ contentType: false,
+ cache: false,
+ processData: false,
+ data: formData,
+ });
+ $('#comment').prop(
+ 'disabled',
+ true
+ );
+ form.find('[type="submit"]')
+ .prop('disabled', true)
+ .val('loading');
+ do_comment.done(
+ function (
+ data,
+ status,
+ request
+ ) {
+ var body =
+ $('
');
+ body.append(data);
+ var comment_section =
+ '.directorist-review-container';
+ var comments =
+ body.find(
+ comment_section
+ );
+ var errorMsg =
+ body.find(
+ '.wp-die-message'
+ );
+ if (
+ errorMsg.length > 0
+ ) {
+ CommentAddReplyHandler.showError(
+ form,
+ errorMsg
+ );
+ $(document).trigger(
+ 'directorist_review_update_failed'
+ );
+ return;
+ }
+ $(
+ comment_section
+ ).replaceWith(comments);
+ $(document).trigger(
+ 'directorist_review_updated',
+ data
+ );
+ var newComment =
+ comments.find(
+ '.commentlist li:first-child'
+ );
+ var newCommentId =
+ newComment.attr(
+ 'id'
+ );
+
+ // // catch the new comment id by comparing to old dom.
+ // commentsLists.each(
+ // function ( index ) {
+ // var _this = $( commentsLists[ index ] );
+ // if ( $( '#' + _this.attr( 'id' ) ).length == 0 ) {
+ // newCommentId = _this.attr( 'id' );
+ // }
+ // }
+ // );
+
+ // console.log(newComment, newCommentId)
+
+ var commentTop = $(
+ '#' + newCommentId
+ ).offset().top;
+ if (
+ $('body').hasClass(
+ 'admin-bar'
+ )
+ ) {
+ commentTop =
+ commentTop -
+ $(
+ '#wpadminbar'
+ ).height();
+ }
+
+ // scroll to comment
+ if (newCommentId) {
+ $(
+ 'body, html'
+ ).animate(
+ {
+ scrollTop:
+ commentTop,
+ },
+ 600
+ );
+ }
+ }
+ );
+ do_comment.fail(
+ function (data) {
+ var body =
+ $('
');
+ body.append(
+ data.responseText
+ );
+ console.log(data);
+ CommentAddReplyHandler.showError(
+ form,
+ body.find(
+ '.wp-die-message'
+ )
+ );
+ $(document).trigger(
+ 'directorist_review_update_failed'
+ );
+ if (
+ data.status ===
+ 403 ||
+ data.status === 401
+ ) {
+ $(document).off(
+ 'submit',
+ '.directorist-review-container #commentform',
+ _this2.onSubmit
+ );
+ $('#comment').prop(
+ 'disabled',
+ false
+ );
+ form.find(
+ '[type="submit"]'
+ )
+ .prop(
+ 'disabled',
+ false
+ )
+ .click();
+ }
+ }
+ );
+ do_comment.always(function () {
+ $('#comment').prop(
+ 'disabled',
+ false
+ );
+ $('#commentform')
+ .find('[type="submit"]')
+ .prop('disabled', false)
+ .val(
+ originalButtonLabel
+ );
+ });
+ $(document).trigger(
+ 'directorist_review_after_submit',
+ form
+ );
+ },
+ },
+ ],
+ [
+ {
+ key: 'getErrorMsg',
+ value: function getErrorMsg($dom) {
+ if ($dom.find('p').length) {
+ $dom = $dom.find('p');
+ }
+ var words = $dom
+ .text()
+ .split(':');
+ if (words.length > 1) {
+ words.shift();
+ }
+ return words.join(' ').trim();
+ },
+ },
+ {
+ key: 'showError',
+ value: function showError(
+ form,
+ $dom
+ ) {
+ if (
+ form.find(
+ '.directorist-alert'
+ ).length
+ ) {
+ form.find(
+ '.directorist-alert'
+ ).remove();
+ }
+ var $error = $('
', {
+ class: 'directorist-alert directorist-alert-danger',
+ }).html(
+ CommentAddReplyHandler.getErrorMsg(
+ $dom
+ )
+ );
+ form.prepend($error);
+ },
+ },
+ ]
+ );
+ })();
+ var CommentsManager = /*#__PURE__*/ (function () {
+ function CommentsManager() {
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, CommentsManager);
+ this.$doc = $(document);
+ this.setupComponents();
+ this.addEventListeners();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(CommentsManager, [
+ {
+ key: 'initStarRating',
+ value: function initStarRating() {
+ $(
+ '.directorist-review-criteria-select'
+ ).barrating({
+ theme: 'fontawesome-stars',
+ });
+ },
+ },
+ {
+ key: 'cancelOthersEditMode',
+ value: function cancelOthersEditMode(
+ currentCommentId
+ ) {
+ $('.directorist-comment-editing').each(
+ function (index, comment) {
+ var $cancelButton = $(
+ comment
+ ).find(
+ '.directorist-js-cancel-comment-edit'
+ );
+ if (
+ $cancelButton.data(
+ 'commentid'
+ ) != currentCommentId
+ ) {
+ $cancelButton.click();
+ }
+ }
+ );
+ },
+ },
+ {
+ key: 'cancelReplyMode',
+ value: function cancelReplyMode() {
+ var replyLink = document.querySelector(
+ '.directorist-review-content #cancel-comment-reply-link'
+ );
+ replyLink && replyLink.click();
+ },
+ },
+ {
+ key: 'addEventListeners',
+ value: function addEventListeners() {
+ var _this3 = this;
+ var self = this;
+ this.$doc.on(
+ 'directorist_review_updated',
+ function (event) {
+ _this3.initStarRating();
+ }
+ );
+ this.$doc.on(
+ 'directorist_comment_edit_form_loaded',
+ function (event) {
+ _this3.initStarRating();
+ }
+ );
+ this.$doc.on(
+ 'click',
+ 'a[href="#respond"]',
+ function (event) {
+ // First cancle the reply form then scroll to review form. Order matters.
+ _this3.cancelReplyMode();
+ _this3.onWriteReivewClick(
+ event
+ );
+ }
+ );
+ this.$doc.on(
+ 'click',
+ '.directorist-js-edit-comment',
+ function (event) {
+ event.preventDefault();
+ var $target = $(event.target);
+ var $wrap = $target.parents(
+ '#div-comment-' +
+ $target.data(
+ 'commentid'
+ )
+ );
+ $wrap.addClass(
+ 'directorist-comment-edit-request'
+ );
+ $.ajax({
+ url: $target.attr('href'),
+ data: {
+ post_id:
+ $target.data(
+ 'postid'
+ ),
+ comment_id:
+ $target.data(
+ 'commentid'
+ ),
+ },
+ setContent: false,
+ method: 'GET',
+ reload: 'strict',
+ success: function success(
+ response
+ ) {
+ $target.prop(
+ 'disabled',
+ true
+ );
+ $target
+ .parents(
+ '#div-comment-' +
+ $target.data(
+ 'commentid'
+ )
+ )
+ .find(
+ '.directorist-review-single__info'
+ )
+ .append(
+ response.data
+ .html
+ );
+ $wrap
+ .removeClass(
+ 'directorist-comment-edit-request'
+ )
+ .addClass(
+ 'directorist-comment-editing'
+ );
+ self.cancelOthersEditMode(
+ $target.data(
+ 'commentid'
+ )
+ );
+ self.cancelReplyMode();
+ var $editForm = $(
+ '#directorist-form-comment-edit'
+ );
+ $editForm
+ .find('textarea')
+ .focus();
+ self.$doc.trigger(
+ 'directorist_comment_edit_form_loaded',
+ $target.data(
+ 'commentid'
+ )
+ );
+ },
+ });
+ }
+ );
+ this.$doc.on(
+ 'click',
+ '.directorist-js-cancel-comment-edit',
+ function (event) {
+ event.preventDefault();
+ var $target = $(event.target);
+ var $wrap = $target.parents(
+ '#div-comment-' +
+ $target.data(
+ 'commentid'
+ )
+ );
+ $wrap
+ .removeClass([
+ 'directorist-comment-edit-request',
+ 'directorist-comment-editing',
+ ])
+ .find('form')
+ .remove();
+ $wrap
+ .find(
+ '.directorist-js-edit-comment'
+ )
+ .prop('disabled', false);
+ }
+ );
+ },
+ },
+ {
+ key: 'onWriteReivewClick',
+ value: function onWriteReivewClick(event) {
+ event.preventDefault();
+ var scrollTop =
+ $('#respond').offset().top;
+ if ($('body').hasClass('admin-bar')) {
+ scrollTop =
+ scrollTop -
+ $('#wpadminbar').height();
+ }
+ $('body, html').animate(
+ {
+ scrollTop: scrollTop,
+ },
+ 600
+ );
+ },
+ },
+ {
+ key: 'setupComponents',
+ value: function setupComponents() {
+ new ReplyFormObserver();
+ new CommentAddReplyHandler();
+ new CommentEditHandler();
+ },
+ },
+ ]);
+ })();
+ var commentsManager = new CommentsManager();
+ })(jQuery);
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review/starRating.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/review/starRating.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- (function ($) {
- //Star rating
- if ($('.directorist-review-criteria-select').length) {
- $('.directorist-review-criteria-select').barrating({
- theme: 'fontawesome-stars'
- });
- }
- })(jQuery);
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/update-view-count.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ (function ($) {
+ //Star rating
+ if ($('.directorist-review-criteria-select').length) {
+ $('.directorist-review-criteria-select').barrating({
+ theme: 'fontawesome-stars',
+ });
+ }
+ })(jQuery);
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/update-view-count.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/update-view-count.js ***!
\**************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
-
-
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-/**
- * Update listings grid view count.
- */
-jQuery(function ($) {
- var _window$directorist, _window$localStorage;
- var isDynamicViewCountCacheEnabled = Boolean((_window$directorist = window.directorist) === null || _window$directorist === void 0 ? void 0 : _window$directorist.dynamic_view_count_cache);
- if (!isDynamicViewCountCacheEnabled) {
- return;
- }
- var updateMarkup = function updateMarkup(viewCounts) {
- for (var _i = 0, _Object$entries = Object.entries(viewCounts); _i < _Object$entries.length; _i++) {
- var _Object$entries$_i = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_Object$entries[_i], 2),
- id = _Object$entries$_i[0],
- count = _Object$entries$_i[1];
- var $el = $(".directorist-view-count[data-id=\"".concat(id, "\"]"));
- var $elIcon = $el.find('.directorist-icon-mask');
- if ($elIcon.length) {
- $elIcon[0].nextSibling.textContent = count;
- } else {
- $el.text(count);
- }
- }
- };
- var ids = [];
- $('.directorist-view-count[data-id]').each(function (i, item) {
- ids.push(+item.dataset.id);
- });
- if (ids.length === 0) {
- return;
- }
- var CACHE_EXPIRATION = 1000 * 60 * 60 * 5; // 5 hours.
- var cache = (_window$localStorage = window.localStorage) === null || _window$localStorage === void 0 ? void 0 : _window$localStorage.getItem('directorist_view_count');
- var hasCache = false;
- if (cache) {
- var _cache, _cache2;
- cache = JSON.parse(cache);
- var cachedIds = ((_cache = cache) === null || _cache === void 0 ? void 0 : _cache.viewCount) || {};
- hasCache = Object.keys(cachedIds).length;
- ids = ids.filter(function (id) {
- return !(id in cachedIds);
- });
- if (hasCache && (_cache2 = cache) !== null && _cache2 !== void 0 && _cache2.lastUpdated && Date.now() - cache.lastUpdated < CACHE_EXPIRATION) {
- updateMarkup(cache.viewCount);
- }
- if (!ids.length) {
- return;
- }
- }
- $.post(directorist.ajax_url, {
- action: 'directorist_update_view_count',
- nonce: directorist.directorist_nonce,
- ids: ids
- }, function (response) {
- var _window$localStorage2;
- if (!response.success) {
- console.warn(response.data.message);
- return;
- }
- updateMarkup(response.data.view_count);
- if (hasCache) {
- response.data.view_count = _objectSpread(_objectSpread({}, cache.viewCount), response.data.view_count);
- }
- (_window$localStorage2 = window.localStorage) === null || _window$localStorage2 === void 0 || _window$localStorage2.setItem('directorist_view_count', JSON.stringify({
- lastUpdated: Date.now(),
- viewCount: response.data.view_count
- }));
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/scss/layout/public/main-style.scss":
-/*!*******************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/slicedToArray */ './node_modules/@babel/runtime/helpers/esm/slicedToArray.js'
+ );
+
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+ /**
+ * Update listings grid view count.
+ */
+ jQuery(function ($) {
+ var _window$directorist, _window$localStorage;
+ var isDynamicViewCountCacheEnabled = Boolean(
+ (_window$directorist = window.directorist) === null ||
+ _window$directorist === void 0
+ ? void 0
+ : _window$directorist.dynamic_view_count_cache
+ );
+ if (!isDynamicViewCountCacheEnabled) {
+ return;
+ }
+ var updateMarkup = function updateMarkup(viewCounts) {
+ for (
+ var _i = 0,
+ _Object$entries = Object.entries(viewCounts);
+ _i < _Object$entries.length;
+ _i++
+ ) {
+ var _Object$entries$_i = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(_Object$entries[_i], 2),
+ id = _Object$entries$_i[0],
+ count = _Object$entries$_i[1];
+ var $el = $(
+ '.directorist-view-count[data-id="'.concat(
+ id,
+ '"]'
+ )
+ );
+ var $elIcon = $el.find('.directorist-icon-mask');
+ if ($elIcon.length) {
+ $elIcon[0].nextSibling.textContent = count;
+ } else {
+ $el.text(count);
+ }
+ }
+ };
+ var ids = [];
+ $('.directorist-view-count[data-id]').each(
+ function (i, item) {
+ ids.push(+item.dataset.id);
+ }
+ );
+ if (ids.length === 0) {
+ return;
+ }
+ var CACHE_EXPIRATION = 1000 * 60 * 60 * 5; // 5 hours.
+ var cache =
+ (_window$localStorage = window.localStorage) === null ||
+ _window$localStorage === void 0
+ ? void 0
+ : _window$localStorage.getItem(
+ 'directorist_view_count'
+ );
+ var hasCache = false;
+ if (cache) {
+ var _cache, _cache2;
+ cache = JSON.parse(cache);
+ var cachedIds =
+ ((_cache = cache) === null || _cache === void 0
+ ? void 0
+ : _cache.viewCount) || {};
+ hasCache = Object.keys(cachedIds).length;
+ ids = ids.filter(function (id) {
+ return !(id in cachedIds);
+ });
+ if (
+ hasCache &&
+ (_cache2 = cache) !== null &&
+ _cache2 !== void 0 &&
+ _cache2.lastUpdated &&
+ Date.now() - cache.lastUpdated < CACHE_EXPIRATION
+ ) {
+ updateMarkup(cache.viewCount);
+ }
+ if (!ids.length) {
+ return;
+ }
+ }
+ $.post(
+ directorist.ajax_url,
+ {
+ action: 'directorist_update_view_count',
+ nonce: directorist.directorist_nonce,
+ ids: ids,
+ },
+ function (response) {
+ var _window$localStorage2;
+ if (!response.success) {
+ console.warn(response.data.message);
+ return;
+ }
+ updateMarkup(response.data.view_count);
+ if (hasCache) {
+ response.data.view_count = _objectSpread(
+ _objectSpread({}, cache.viewCount),
+ response.data.view_count
+ );
+ }
+ (_window$localStorage2 = window.localStorage) ===
+ null ||
+ _window$localStorage2 === void 0 ||
+ _window$localStorage2.setItem(
+ 'directorist_view_count',
+ JSON.stringify({
+ lastUpdated: Date.now(),
+ viewCount: response.data.view_count,
+ })
+ );
+ }
+ );
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/scss/layout/public/main-style.scss':
+ /*!*******************************************************!*\
!*** ./assets/src/scss/layout/public/main-style.scss ***!
\*******************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":
-/*!*********************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ // extracted by mini-css-extract-plugin
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js':
+ /*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; }
-/* harmony export */ });
-function _arrayLikeToArray(r, a) {
- (null == a || a > r.length) && (a = r.length);
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
- return n;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayLikeToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayWithHoles; }
-/* harmony export */ });
-function _arrayWithHoles(r) {
- if (Array.isArray(r)) return r;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayWithHoles;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayWithHoles(r) {
+ if (Array.isArray(r)) return r;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/classCallCheck.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _classCallCheck; }
-/* harmony export */ });
-function _classCallCheck(a, n) {
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _classCallCheck;
+ },
+ /* harmony export */
+ }
+ );
+ function _classCallCheck(a, n) {
+ if (!(a instanceof n))
+ throw new TypeError(
+ 'Cannot call a class as a function'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/createClass.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _createClass; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperties(e, r) {
- for (var t = 0; t < r.length; t++) {
- var o = r[t];
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o.key), o);
- }
-}
-function _createClass(e, r, t) {
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
- writable: !1
- }), e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _createClass;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperties(e, r) {
+ for (var t = 0; t < r.length; t++) {
+ var o = r[t];
+ ((o.enumerable = o.enumerable || !1),
+ (o.configurable = !0),
+ 'value' in o && (o.writable = !0),
+ Object.defineProperty(
+ e,
+ (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(o.key),
+ o
+ ));
+ }
+ }
+ function _createClass(e, r, t) {
+ return (
+ r && _defineProperties(e.prototype, r),
+ t && _defineProperties(e, t),
+ Object.defineProperty(e, 'prototype', {
+ writable: !1,
+ }),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/defineProperty.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _defineProperty; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperty(e, r, t) {
- return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js":
-/*!*************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _defineProperty;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperty(e, r, t) {
+ return (
+ (r = (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r)) in e
+ ? Object.defineProperty(e, r, {
+ value: t,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0,
+ })
+ : (e[r] = t),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js':
+ /*!*************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***!
\*************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _iterableToArrayLimit; }
-/* harmony export */ });
-function _iterableToArrayLimit(r, l) {
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
- if (null != t) {
- var e,
- n,
- i,
- u,
- a = [],
- f = !0,
- o = !1;
- try {
- if (i = (t = t.call(r)).next, 0 === l) {
- if (Object(t) !== t) return;
- f = !1;
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
- } catch (r) {
- o = !0, n = r;
- } finally {
- try {
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
- } finally {
- if (o) throw n;
- }
- }
- return a;
- }
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js":
-/*!********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _iterableToArrayLimit;
+ },
+ /* harmony export */
+ }
+ );
+ function _iterableToArrayLimit(r, l) {
+ var t =
+ null == r
+ ? null
+ : ('undefined' != typeof Symbol &&
+ r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (null != t) {
+ var e,
+ n,
+ i,
+ u,
+ a = [],
+ f = !0,
+ o = !1;
+ try {
+ if (((i = (t = t.call(r)).next), 0 === l)) {
+ if (Object(t) !== t) return;
+ f = !1;
+ } else
+ for (
+ ;
+ !(f = (e = i.call(t)).done) &&
+ (a.push(e.value), a.length !== l);
+ f = !0
+ );
+ } catch (r) {
+ ((o = !0), (n = r));
+ } finally {
+ try {
+ if (
+ !f &&
+ null != t['return'] &&
+ ((u = t['return']()), Object(u) !== u)
+ )
+ return;
+ } finally {
+ if (o) throw n;
+ }
+ }
+ return a;
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/nonIterableRest.js':
+ /*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***!
\********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _nonIterableRest; }
-/* harmony export */ });
-function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _nonIterableRest;
+ },
+ /* harmony export */
+ }
+ );
+ function _nonIterableRest() {
+ throw new TypeError(
+ 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/slicedToArray.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _slicedToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js");
-/* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js");
-/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
-/* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js");
-
-
-
-
-function _slicedToArray(r, e) {
- return (0,_arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r, e) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r, e) || (0,_nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__["default"])();
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _slicedToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayWithHoles.js */ './node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js'
+ );
+ /* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./iterableToArrayLimit.js */ './node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js'
+ );
+ /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./unsupportedIterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js'
+ );
+ /* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./nonIterableRest.js */ './node_modules/@babel/runtime/helpers/esm/nonIterableRest.js'
+ );
+
+ function _slicedToArray(r, e) {
+ return (
+ (0,
+ _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r) ||
+ (0,
+ _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(r, e) ||
+ (0,
+ _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(r, e) ||
+ (0,
+ _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])()
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPrimitive; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-function toPrimitive(t, r) {
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPrimitive;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ function toPrimitive(t, r) {
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ t
+ ) ||
+ !t
+ )
+ return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || 'default');
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ )
+ return i;
+ throw new TypeError(
+ '@@toPrimitive must return a primitive value.'
+ );
+ }
+ return ('string' === r ? String : Number)(t);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPropertyKey; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");
-
-
-function toPropertyKey(t) {
- var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string");
- return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + "";
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPropertyKey;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./toPrimitive.js */ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js'
+ );
+
+ function toPropertyKey(t) {
+ var i = (0,
+ _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__['default'])(
+ t,
+ 'string'
+ );
+ return 'symbol' ==
+ (0, _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ ? i
+ : i + '';
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":
-/*!*******************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js':
+ /*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _unsupportedIterableToArray(r, a) {
- if (r) {
- if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a);
- var t = {}.toString.call(r).slice(8, -1);
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0;
- }
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!******************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _unsupportedIterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a)
+ : void 0
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!******************************************************!*\
!*** ./assets/src/js/public/modules/all-listings.js ***!
\******************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _scss_layout_public_main_style_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../scss/layout/public/main-style.scss */ "./assets/src/scss/layout/public/main-style.scss");
-/* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/general */ "./assets/src/js/public/components/general.js");
-/* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_general__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _components_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/helpers */ "./assets/src/js/public/components/helpers.js");
-/* harmony import */ var _components_review__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/review */ "./assets/src/js/public/components/review.js");
-/* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/directoristSorting */ "./assets/src/js/public/components/directoristSorting.js");
-/* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_components_directoristSorting__WEBPACK_IMPORTED_MODULE_4__);
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/directoristAlert */ "./assets/src/js/public/components/directoristAlert.js");
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_components_directoristAlert__WEBPACK_IMPORTED_MODULE_5__);
-/* harmony import */ var _components_gridResponsive__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/gridResponsive */ "./assets/src/js/public/components/gridResponsive.js");
-/* harmony import */ var _components_gridResponsive__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_gridResponsive__WEBPACK_IMPORTED_MODULE_6__);
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/directoristFavorite */ "./assets/src/js/public/components/directoristFavorite.js");
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_components_directoristFavorite__WEBPACK_IMPORTED_MODULE_7__);
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/directoristDropdown */ "./assets/src/js/public/components/directoristDropdown.js");
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_components_directoristDropdown__WEBPACK_IMPORTED_MODULE_8__);
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/directoristSelect */ "./assets/src/js/public/components/directoristSelect.js");
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_components_directoristSelect__WEBPACK_IMPORTED_MODULE_9__);
-/* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/categoryLocation */ "./assets/src/js/public/components/categoryLocation.js");
-/* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_components_categoryLocation__WEBPACK_IMPORTED_MODULE_10__);
-/* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../components/colorPicker */ "./assets/src/js/public/components/colorPicker.js");
-/* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_components_colorPicker__WEBPACK_IMPORTED_MODULE_11__);
-/* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/legacy-support */ "./assets/src/js/public/components/legacy-support.js");
-/* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_components_legacy_support__WEBPACK_IMPORTED_MODULE_12__);
-/* harmony import */ var _components_masonry__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../components/masonry */ "./assets/src/js/public/components/masonry.js");
-/* harmony import */ var _components_masonry__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_components_masonry__WEBPACK_IMPORTED_MODULE_13__);
-/* harmony import */ var _components_instantSearch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../components/instantSearch */ "./assets/src/js/public/components/instantSearch.js");
-/* harmony import */ var _global_components_setup_select2__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../global/components/setup-select2 */ "./assets/src/js/global/components/setup-select2.js");
-/* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../global/components/select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_16__);
-/* harmony import */ var _components_archive_sidebar__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../components/archive-sidebar */ "./assets/src/js/public/components/archive-sidebar.js");
-/* harmony import */ var _components_archive_sidebar__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_components_archive_sidebar__WEBPACK_IMPORTED_MODULE_17__);
-/* harmony import */ var _components_update_view_count__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../components/update-view-count */ "./assets/src/js/public/components/update-view-count.js");
-/*
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _scss_layout_public_main_style_scss__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../../../scss/layout/public/main-style.scss */ './assets/src/scss/layout/public/main-style.scss'
+ );
+ /* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ../components/general */ './assets/src/js/public/components/general.js'
+ );
+ /* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_general__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _components_helpers__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ../components/helpers */ './assets/src/js/public/components/helpers.js'
+ );
+ /* harmony import */ var _components_review__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ../components/review */ './assets/src/js/public/components/review.js'
+ );
+ /* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ../components/directoristSorting */ './assets/src/js/public/components/directoristSorting.js'
+ );
+ /* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristSorting__WEBPACK_IMPORTED_MODULE_4__
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_5__ =
+ __webpack_require__(
+ /*! ../components/directoristAlert */ './assets/src/js/public/components/directoristAlert.js'
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_5___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristAlert__WEBPACK_IMPORTED_MODULE_5__
+ );
+ /* harmony import */ var _components_gridResponsive__WEBPACK_IMPORTED_MODULE_6__ =
+ __webpack_require__(
+ /*! ../components/gridResponsive */ './assets/src/js/public/components/gridResponsive.js'
+ );
+ /* harmony import */ var _components_gridResponsive__WEBPACK_IMPORTED_MODULE_6___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_gridResponsive__WEBPACK_IMPORTED_MODULE_6__
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_7__ =
+ __webpack_require__(
+ /*! ../components/directoristFavorite */ './assets/src/js/public/components/directoristFavorite.js'
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_7___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_7__
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_8__ =
+ __webpack_require__(
+ /*! ../components/directoristDropdown */ './assets/src/js/public/components/directoristDropdown.js'
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_8___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_8__
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_9__ =
+ __webpack_require__(
+ /*! ../components/directoristSelect */ './assets/src/js/public/components/directoristSelect.js'
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_9___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristSelect__WEBPACK_IMPORTED_MODULE_9__
+ );
+ /* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_10__ =
+ __webpack_require__(
+ /*! ../components/categoryLocation */ './assets/src/js/public/components/categoryLocation.js'
+ );
+ /* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_10___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_categoryLocation__WEBPACK_IMPORTED_MODULE_10__
+ );
+ /* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_11__ =
+ __webpack_require__(
+ /*! ../components/colorPicker */ './assets/src/js/public/components/colorPicker.js'
+ );
+ /* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_11___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_colorPicker__WEBPACK_IMPORTED_MODULE_11__
+ );
+ /* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_12__ =
+ __webpack_require__(
+ /*! ../components/legacy-support */ './assets/src/js/public/components/legacy-support.js'
+ );
+ /* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_12___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_legacy_support__WEBPACK_IMPORTED_MODULE_12__
+ );
+ /* harmony import */ var _components_masonry__WEBPACK_IMPORTED_MODULE_13__ =
+ __webpack_require__(
+ /*! ../components/masonry */ './assets/src/js/public/components/masonry.js'
+ );
+ /* harmony import */ var _components_masonry__WEBPACK_IMPORTED_MODULE_13___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_masonry__WEBPACK_IMPORTED_MODULE_13__
+ );
+ /* harmony import */ var _components_instantSearch__WEBPACK_IMPORTED_MODULE_14__ =
+ __webpack_require__(
+ /*! ../components/instantSearch */ './assets/src/js/public/components/instantSearch.js'
+ );
+ /* harmony import */ var _global_components_setup_select2__WEBPACK_IMPORTED_MODULE_15__ =
+ __webpack_require__(
+ /*! ../../global/components/setup-select2 */ './assets/src/js/global/components/setup-select2.js'
+ );
+ /* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_16__ =
+ __webpack_require__(
+ /*! ../../global/components/select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_16___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_16__
+ );
+ /* harmony import */ var _components_archive_sidebar__WEBPACK_IMPORTED_MODULE_17__ =
+ __webpack_require__(
+ /*! ../components/archive-sidebar */ './assets/src/js/public/components/archive-sidebar.js'
+ );
+ /* harmony import */ var _components_archive_sidebar__WEBPACK_IMPORTED_MODULE_17___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_archive_sidebar__WEBPACK_IMPORTED_MODULE_17__
+ );
+ /* harmony import */ var _components_update_view_count__WEBPACK_IMPORTED_MODULE_18__ =
+ __webpack_require__(
+ /*! ../components/update-view-count */ './assets/src/js/public/components/update-view-count.js'
+ );
+ /*
File: all-listings.js
Plugin: Directorist – Business Directory & Classified Listings WordPress Plugin
Author: wpWax
Author URI: www.wpwax.com
*/
-
-
-// General Components
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=all-listings.js.map
\ No newline at end of file
+ // General Components
+ })();
+ /******/
+})();
+//# sourceMappingURL=all-listings.js.map
diff --git a/assets/js/all-location-category.js b/assets/js/all-location-category.js
index 4de59761e..6cfb4e18e 100644
--- a/assets/js/all-location-category.js
+++ b/assets/js/all-location-category.js
@@ -1,191 +1,307 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/public/components/categoryLocation.js":
-/*!*************************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/public/components/categoryLocation.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/categoryLocation.js ***!
\*************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- var $ = jQuery;
+ /***/ function () {
+ window.addEventListener('load', function () {
+ var $ = jQuery;
- /* Make sure the codes in this file runs only once, even if enqueued twice */
- if (typeof window.directorist_catloc_executed === 'undefined') {
- window.directorist_catloc_executed = true;
- } else {
- return;
- }
+ /* Make sure the codes in this file runs only once, even if enqueued twice */
+ if (
+ typeof window.directorist_catloc_executed ===
+ 'undefined'
+ ) {
+ window.directorist_catloc_executed = true;
+ } else {
+ return;
+ }
- /* Category card grid three width/height adjustment */
- var categoryCard = document.querySelectorAll('.directorist-categories__single--style-three');
- if (categoryCard) {
- categoryCard.forEach(function (elm) {
- var categoryCardWidth = elm.offsetWidth;
- elm.style.setProperty('--directorist-category-box-width', "".concat(categoryCardWidth, "px"));
- });
- }
+ /* Category card grid three width/height adjustment */
+ var categoryCard = document.querySelectorAll(
+ '.directorist-categories__single--style-three'
+ );
+ if (categoryCard) {
+ categoryCard.forEach(function (elm) {
+ var categoryCardWidth = elm.offsetWidth;
+ elm.style.setProperty(
+ '--directorist-category-box-width',
+ ''.concat(categoryCardWidth, 'px')
+ );
+ });
+ }
- /* Taxonomy list dropdown */
- function categoryDropdown(selector, parent) {
- var categoryListToggle = document.querySelectorAll(selector);
- categoryListToggle.forEach(function (item) {
- item.addEventListener('click', function (e) {
- var categoryName = item.querySelector('.directorist-taxonomy-list__name');
- if (e.target !== categoryName) {
- e.preventDefault();
- this.classList.toggle('directorist-taxonomy-list__toggle--open');
- }
- });
- });
- }
- categoryDropdown('.directorist-taxonomy-list-one .directorist-taxonomy-list__toggle', '.directorist-taxonomy-list-one .directorist-taxonomy-list');
- categoryDropdown('.directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle', '.directorist-taxonomy-list-one .directorist-taxonomy-list');
+ /* Taxonomy list dropdown */
+ function categoryDropdown(selector, parent) {
+ var categoryListToggle =
+ document.querySelectorAll(selector);
+ categoryListToggle.forEach(function (item) {
+ item.addEventListener('click', function (e) {
+ var categoryName = item.querySelector(
+ '.directorist-taxonomy-list__name'
+ );
+ if (e.target !== categoryName) {
+ e.preventDefault();
+ this.classList.toggle(
+ 'directorist-taxonomy-list__toggle--open'
+ );
+ }
+ });
+ });
+ }
+ categoryDropdown(
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list__toggle',
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list'
+ );
+ categoryDropdown(
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle',
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list'
+ );
- // Taxonomy Ajax
- $(document).on('click', '.directorist-categories .directorist-pagination a', function (e) {
- taxonomyPagination(e, $(this), '.directorist-categories');
- });
- $(document).on('click', '.directorist-location .directorist-pagination a', function (e) {
- taxonomyPagination(e, $(this), '.directorist-location');
- });
- function taxonomyPagination(event, clickedElement, containerSelector) {
- event.preventDefault();
- var pageNumber = (clickedElement === null || clickedElement === void 0 ? void 0 : clickedElement.attr('data-page')) || 1;
- var container = clickedElement.closest(containerSelector);
- var containerAttributes = container ? $(container).data('attrs') : {};
- $.ajax({
- url: directorist.ajax_url,
- type: 'POST',
- dataType: 'json',
- data: {
- action: 'directorist_taxonomy_pagination',
- nonce: directorist.directorist_nonce,
- page: parseInt(pageNumber),
- attrs: containerAttributes
- },
- beforeSend: function beforeSend() {
- $(containerSelector).addClass('atbdp-form-fade');
- },
- success: function success(response) {
- var _tempContainer$queryS, _tempContainer$queryS2;
- if (!(response !== null && response !== void 0 && response.success)) {
- console.error('Failed to load taxonomy content');
- return;
- }
- var tempContainer = document.createElement('div');
- tempContainer.innerHTML = response.data.content;
- // Handle both category and location wrappers
- var taxonomyWrapper = document.querySelector('.taxonomy-category-wrapper');
- var locationWrapper = document.querySelector('.taxonomy-location-wrapper');
- var updatedCategoryContent = (_tempContainer$queryS = tempContainer.querySelector('.taxonomy-category-wrapper')) === null || _tempContainer$queryS === void 0 ? void 0 : _tempContainer$queryS.innerHTML;
- var updatedLocationContent = (_tempContainer$queryS2 = tempContainer.querySelector('.taxonomy-location-wrapper')) === null || _tempContainer$queryS2 === void 0 ? void 0 : _tempContainer$queryS2.innerHTML;
- if (taxonomyWrapper && updatedCategoryContent) {
- taxonomyWrapper.innerHTML = updatedCategoryContent;
- }
- if (locationWrapper && updatedLocationContent) {
- locationWrapper.innerHTML = updatedLocationContent;
- }
- if (!taxonomyWrapper && !locationWrapper) {
- console.error('Required elements not found in response');
- return;
- }
- },
- complete: function complete() {
- $(containerSelector).removeClass('atbdp-form-fade');
- }
- });
- }
-});
+ // Taxonomy Ajax
+ $(document).on(
+ 'click',
+ '.directorist-categories .directorist-pagination a',
+ function (e) {
+ taxonomyPagination(
+ e,
+ $(this),
+ '.directorist-categories'
+ );
+ }
+ );
+ $(document).on(
+ 'click',
+ '.directorist-location .directorist-pagination a',
+ function (e) {
+ taxonomyPagination(
+ e,
+ $(this),
+ '.directorist-location'
+ );
+ }
+ );
+ function taxonomyPagination(
+ event,
+ clickedElement,
+ containerSelector
+ ) {
+ event.preventDefault();
+ var pageNumber =
+ (clickedElement === null ||
+ clickedElement === void 0
+ ? void 0
+ : clickedElement.attr('data-page')) || 1;
+ var container =
+ clickedElement.closest(containerSelector);
+ var containerAttributes = container
+ ? $(container).data('attrs')
+ : {};
+ $.ajax({
+ url: directorist.ajax_url,
+ type: 'POST',
+ dataType: 'json',
+ data: {
+ action: 'directorist_taxonomy_pagination',
+ nonce: directorist.directorist_nonce,
+ page: parseInt(pageNumber),
+ attrs: containerAttributes,
+ },
+ beforeSend: function beforeSend() {
+ $(containerSelector).addClass(
+ 'atbdp-form-fade'
+ );
+ },
+ success: function success(response) {
+ var _tempContainer$queryS,
+ _tempContainer$queryS2;
+ if (
+ !(
+ response !== null &&
+ response !== void 0 &&
+ response.success
+ )
+ ) {
+ console.error(
+ 'Failed to load taxonomy content'
+ );
+ return;
+ }
+ var tempContainer =
+ document.createElement('div');
+ tempContainer.innerHTML = response.data.content;
+ // Handle both category and location wrappers
+ var taxonomyWrapper = document.querySelector(
+ '.taxonomy-category-wrapper'
+ );
+ var locationWrapper = document.querySelector(
+ '.taxonomy-location-wrapper'
+ );
+ var updatedCategoryContent =
+ (_tempContainer$queryS =
+ tempContainer.querySelector(
+ '.taxonomy-category-wrapper'
+ )) === null ||
+ _tempContainer$queryS === void 0
+ ? void 0
+ : _tempContainer$queryS.innerHTML;
+ var updatedLocationContent =
+ (_tempContainer$queryS2 =
+ tempContainer.querySelector(
+ '.taxonomy-location-wrapper'
+ )) === null ||
+ _tempContainer$queryS2 === void 0
+ ? void 0
+ : _tempContainer$queryS2.innerHTML;
+ if (taxonomyWrapper && updatedCategoryContent) {
+ taxonomyWrapper.innerHTML =
+ updatedCategoryContent;
+ }
+ if (locationWrapper && updatedLocationContent) {
+ locationWrapper.innerHTML =
+ updatedLocationContent;
+ }
+ if (!taxonomyWrapper && !locationWrapper) {
+ console.error(
+ 'Required elements not found in response'
+ );
+ return;
+ }
+ },
+ complete: function complete() {
+ $(containerSelector).removeClass(
+ 'atbdp-form-fade'
+ );
+ },
+ });
+ }
+ });
-/***/ })
+ /***/
+ },
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!***************************************************************!*\
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!***************************************************************!*\
!*** ./assets/src/js/public/modules/all-location-category.js ***!
\***************************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/categoryLocation */ "./assets/src/js/public/components/categoryLocation.js");
-/* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__);
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=all-location-category.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../components/categoryLocation */ './assets/src/js/public/components/categoryLocation.js'
+ );
+ /* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__
+ );
+ })();
+ /******/
+})();
+//# sourceMappingURL=all-location-category.js.map
diff --git a/assets/js/author-profile.js b/assets/js/author-profile.js
index 5eb17891b..41ad0265c 100644
--- a/assets/js/author-profile.js
+++ b/assets/js/author-profile.js
@@ -1,430 +1,696 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/public/components/directoristAlert.js":
-/*!*************************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/public/components/directoristAlert.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/directoristAlert.js ***!
\*************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_alert_executed === 'undefined') {
- window.directorist_alert_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* Directorist alert dismiss */
- var getUrl = window.location.href;
- var newUrl = getUrl.replace('notice=1', '');
- if ($('.directorist-alert__close') !== null) {
- $('.directorist-alert__close').each(function (i, e) {
- $(e).on('click', function (e) {
- e.preventDefault();
- history.pushState({}, null, newUrl);
- $(this).closest('.directorist-alert').remove();
- });
- });
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristDropdown.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_alert_executed === 'undefined'
+ ) {
+ window.directorist_alert_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* Directorist alert dismiss */
+ var getUrl = window.location.href;
+ var newUrl = getUrl.replace('notice=1', '');
+ if ($('.directorist-alert__close') !== null) {
+ $('.directorist-alert__close').each(
+ function (i, e) {
+ $(e).on('click', function (e) {
+ e.preventDefault();
+ history.pushState({}, null, newUrl);
+ $(this)
+ .closest('.directorist-alert')
+ .remove();
+ });
+ }
+ );
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristDropdown.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristDropdown.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_dropdown_executed === 'undefined') {
- window.directorist_dropdown_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.directorist-dropdown-select');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.directorist-dropdown-select-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- el.querySelector('.directorist-dropdown-select-items').classList.add('directorist-dropdown-select-show');
- } else {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'directorist-dropdown-select-toggle') {
- clickCount = 0;
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (el) {
- el.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
-
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.directorist-dropdown-select-toggle').textContent = e.target.textContent;
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // Dropdown
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-toggle', function (e) {
- e.preventDefault();
- $(this).siblings('.directorist-dropdown-option').toggle();
- });
-
- // Select Option after click
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-option ul li a', function (e) {
- e.preventDefault();
- var optionText = $(this).html();
- $(this).children('.directorist-dropdown-toggle__text').html(optionText);
- $(this).closest('.directorist-dropdown-option').siblings('.directorist-dropdown-toggle').children('.directorist-dropdown-toggle__text').html(optionText);
- $('.directorist-dropdown-option').hide();
- });
-
- // Hide Clicked Anywhere
- $(document).bind('click', function (e) {
- var clickedDOM = $(e.target);
- if (!clickedDOM.parents().hasClass('directorist-dropdown')) $('.directorist-dropdown-option').hide();
- });
-
- //atbd_dropdown
- $(document).on('click', '.atbd_dropdown', function (e) {
- if ($(this).attr('class') === 'atbd_dropdown') {
- e.preventDefault();
- $(this).siblings('.atbd_dropdown').removeClass('atbd_drop--active');
- $(this).toggleClass('atbd_drop--active');
- e.stopPropagation();
- }
- });
- $(document).on('click', function (e) {
- if ($(e.target).is('.atbd_dropdown, .atbd_drop--active') === false) {
- $('.atbd_dropdown').removeClass('atbd_drop--active');
- }
- });
- $('body').on('click', '.atbd_dropdown-toggle', function (e) {
- e.preventDefault();
- });
-
- // Directorist Dropdown
- $('body').on('click', '.directorist-dropdown-js .directorist-dropdown__toggle-js', function (e) {
- e.preventDefault();
- if (!$(this).siblings('.directorist-dropdown__links-js').is(':visible')) {
- $('.directorist-dropdown__links').hide();
- }
- $(this).siblings('.directorist-dropdown__links-js').toggle();
- });
- $('body').on('click', function (e) {
- if (!e.target.closest('.directorist-dropdown-js')) {
- $('.directorist-dropdown__links-js').hide();
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristFavorite.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_dropdown_executed ===
+ 'undefined'
+ ) {
+ window.directorist_dropdown_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown = document.querySelectorAll(
+ '.directorist-dropdown-select'
+ );
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ el.querySelector(
+ '.directorist-dropdown-select-items'
+ ).classList.add(
+ 'directorist-dropdown-select-show'
+ );
+ } else {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'directorist-dropdown-select-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).textContent =
+ e.target.textContent;
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ });
+ });
+ }
+
+ // Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .siblings('.directorist-dropdown-option')
+ .toggle();
+ }
+ );
+
+ // Select Option after click
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-option ul li a',
+ function (e) {
+ e.preventDefault();
+ var optionText = $(this).html();
+ $(this)
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $(this)
+ .closest('.directorist-dropdown-option')
+ .siblings('.directorist-dropdown-toggle')
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $('.directorist-dropdown-option').hide();
+ }
+ );
+
+ // Hide Clicked Anywhere
+ $(document).bind('click', function (e) {
+ var clickedDOM = $(e.target);
+ if (
+ !clickedDOM
+ .parents()
+ .hasClass('directorist-dropdown')
+ )
+ $('.directorist-dropdown-option').hide();
+ });
+
+ //atbd_dropdown
+ $(document).on('click', '.atbd_dropdown', function (e) {
+ if ($(this).attr('class') === 'atbd_dropdown') {
+ e.preventDefault();
+ $(this)
+ .siblings('.atbd_dropdown')
+ .removeClass('atbd_drop--active');
+ $(this).toggleClass('atbd_drop--active');
+ e.stopPropagation();
+ }
+ });
+ $(document).on('click', function (e) {
+ if (
+ $(e.target).is(
+ '.atbd_dropdown, .atbd_drop--active'
+ ) === false
+ ) {
+ $('.atbd_dropdown').removeClass(
+ 'atbd_drop--active'
+ );
+ }
+ });
+ $('body').on(
+ 'click',
+ '.atbd_dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ }
+ );
+
+ // Directorist Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown-js .directorist-dropdown__toggle-js',
+ function (e) {
+ e.preventDefault();
+ if (
+ !$(this)
+ .siblings(
+ '.directorist-dropdown__links-js'
+ )
+ .is(':visible')
+ ) {
+ $('.directorist-dropdown__links').hide();
+ }
+ $(this)
+ .siblings('.directorist-dropdown__links-js')
+ .toggle();
+ }
+ );
+ $('body').on('click', function (e) {
+ if (!e.target.closest('.directorist-dropdown-js')) {
+ $('.directorist-dropdown__links-js').hide();
+ }
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristFavorite.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristFavorite.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_favorite_executed === 'undefined') {
- window.directorist_favorite_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- // Add or Remove from favourites
- $('.directorist-action-bookmark').on('click', function (e) {
- e.preventDefault();
- var data = {
- action: 'atbdp_public_add_remove_favorites',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id'),
- label: $(this).data('label')
- };
- $.post(directorist.ajaxurl, data, function (response) {
- if (response) {
- $('.directorist-action-bookmark').html(response);
- }
- });
- });
- $('.directorist-favourite-remove-btn').each(function () {
- $(this).on('click', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajaxurl, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist_favourite_' + post_id);
- if ('false' === response) {
- staElement.remove();
- }
- });
- });
- });
- $('body').on('click', '.directorist-mark-as-favorite__btn', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- var fav_tooltip_success = '' + directorist.i18n_text.added_favourite + ' ';
- var fav_tooltip_warning = '' + directorist.i18n_text.please_login + ' ';
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajax_url, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist-fav_' + post_id);
- var data_id = staElement.attr('data-listing_id');
- if (response === 'login_required') {
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_warning);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- } else if ('false' === response) {
- staElement.removeClass('directorist-added-to-favorite');
- $('.directorist-favorite-tooltip span').remove();
- } else {
- if (data_id === post_id) {
- staElement.addClass('directorist-added-to-favorite');
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_success);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- }
- }
- });
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristSorting.js":
-/*!***************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_favorite_executed ===
+ 'undefined'
+ ) {
+ window.directorist_favorite_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ // Add or Remove from favourites
+ $('.directorist-action-bookmark').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var data = {
+ action: 'atbdp_public_add_remove_favorites',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ label: $(this).data('label'),
+ };
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ if (response) {
+ $(
+ '.directorist-action-bookmark'
+ ).html(response);
+ }
+ }
+ );
+ }
+ );
+ $('.directorist-favourite-remove-btn').each(
+ function () {
+ $(this).on('click', function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist_favourite_' +
+ post_id
+ );
+ if ('false' === response) {
+ staElement.remove();
+ }
+ }
+ );
+ });
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-mark-as-favorite__btn',
+ function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ var fav_tooltip_success =
+ '' +
+ directorist.i18n_text.added_favourite +
+ ' ';
+ var fav_tooltip_warning =
+ '' +
+ directorist.i18n_text.please_login +
+ ' ';
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajax_url,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist-fav_' + post_id
+ );
+ var data_id =
+ staElement.attr('data-listing_id');
+ if (response === 'login_required') {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(fav_tooltip_warning);
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ } else if ('false' === response) {
+ staElement.removeClass(
+ 'directorist-added-to-favorite'
+ );
+ $(
+ '.directorist-favorite-tooltip span'
+ ).remove();
+ } else {
+ if (data_id === post_id) {
+ staElement.addClass(
+ 'directorist-added-to-favorite'
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(
+ fav_tooltip_success
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ }
+ }
+ }
+ );
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristSorting.js':
+ /*!***************************************************************!*\
!*** ./assets/src/js/public/components/directoristSorting.js ***!
\***************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_sorting_executed === 'undefined') {
- window.directorist_sorting_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- // Sorting Js
- if (!$('.directorist-instant-search').length) {
- $('.directorist-dropdown__links__single-js').click(function (e) {
- e.preventDefault();
- var href = $(this).attr('data-link');
- $('#directorsit-listing-sort').attr('action', href);
- $('#directorsit-listing-sort').submit();
- });
- }
-
- //sorting toggle
- $('.sorting span').on('click', function () {
- $(this).toggleClass('fa-sort-amount-asc fa-sort-amount-desc');
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/general.js":
-/*!****************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_sorting_executed ===
+ 'undefined'
+ ) {
+ window.directorist_sorting_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ // Sorting Js
+ if (!$('.directorist-instant-search').length) {
+ $('.directorist-dropdown__links__single-js').click(
+ function (e) {
+ e.preventDefault();
+ var href = $(this).attr('data-link');
+ $('#directorsit-listing-sort').attr(
+ 'action',
+ href
+ );
+ $('#directorsit-listing-sort').submit();
+ }
+ );
+ }
+
+ //sorting toggle
+ $('.sorting span').on('click', function () {
+ $(this).toggleClass(
+ 'fa-sort-amount-asc fa-sort-amount-desc'
+ );
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/general.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/public/components/general.js ***!
\****************************************************/
-/***/ (function() {
-
-// Fix listing with no thumb if card width is less than 220px
-(function ($) {
- window.addEventListener('load', function () {
- if ($('.directorist-listing-no-thumb').innerWidth() <= 220) {
- $('.directorist-listing-no-thumb').addClass('directorist-listing-no-thumb--fix');
- }
- // Auhtor Profile Listing responsive fix
- if ($('.directorist-author-listing-content').innerWidth() <= 750) {
- $('.directorist-author-listing-content').addClass('directorist-author-listing-grid--fix');
- }
- // Directorist Archive responsive fix
- if ($('.directorist-archive-grid-view').innerWidth() <= 500) {
- $('.directorist-archive-grid-view').addClass('directorist-archive-grid--fix');
- }
-
- // Back Button to go back to the previous page
- $('body').on('click', '.directorist-btn__back', function (e) {
- window.history.back();
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review/starRating.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ // Fix listing with no thumb if card width is less than 220px
+ (function ($) {
+ window.addEventListener('load', function () {
+ if (
+ $('.directorist-listing-no-thumb').innerWidth() <=
+ 220
+ ) {
+ $('.directorist-listing-no-thumb').addClass(
+ 'directorist-listing-no-thumb--fix'
+ );
+ }
+ // Auhtor Profile Listing responsive fix
+ if (
+ $(
+ '.directorist-author-listing-content'
+ ).innerWidth() <= 750
+ ) {
+ $('.directorist-author-listing-content').addClass(
+ 'directorist-author-listing-grid--fix'
+ );
+ }
+ // Directorist Archive responsive fix
+ if (
+ $('.directorist-archive-grid-view').innerWidth() <=
+ 500
+ ) {
+ $('.directorist-archive-grid-view').addClass(
+ 'directorist-archive-grid--fix'
+ );
+ }
+
+ // Back Button to go back to the previous page
+ $('body').on(
+ 'click',
+ '.directorist-btn__back',
+ function (e) {
+ window.history.back();
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review/starRating.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/review/starRating.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- (function ($) {
- //Star rating
- if ($('.directorist-review-criteria-select').length) {
- $('.directorist-review-criteria-select').barrating({
- theme: 'fontawesome-stars'
- });
- }
- })(jQuery);
-});
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!********************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ (function ($) {
+ //Star rating
+ if ($('.directorist-review-criteria-select').length) {
+ $('.directorist-review-criteria-select').barrating({
+ theme: 'fontawesome-stars',
+ });
+ }
+ })(jQuery);
+ });
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!********************************************************!*\
!*** ./assets/src/js/public/modules/author-profile.js ***!
\********************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/general */ "./assets/src/js/public/components/general.js");
-/* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_general__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _components_review_starRating__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/review/starRating */ "./assets/src/js/public/components/review/starRating.js");
-/* harmony import */ var _components_review_starRating__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_review_starRating__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/directoristSorting */ "./assets/src/js/public/components/directoristSorting.js");
-/* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_components_directoristSorting__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/directoristAlert */ "./assets/src/js/public/components/directoristAlert.js");
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_components_directoristAlert__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/directoristFavorite */ "./assets/src/js/public/components/directoristFavorite.js");
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__);
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/directoristDropdown */ "./assets/src/js/public/components/directoristDropdown.js");
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__);
-// General Components
-
-
-
-
-
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=author-profile.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../components/general */ './assets/src/js/public/components/general.js'
+ );
+ /* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_general__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _components_review_starRating__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ../components/review/starRating */ './assets/src/js/public/components/review/starRating.js'
+ );
+ /* harmony import */ var _components_review_starRating__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_review_starRating__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ../components/directoristSorting */ './assets/src/js/public/components/directoristSorting.js'
+ );
+ /* harmony import */ var _components_directoristSorting__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristSorting__WEBPACK_IMPORTED_MODULE_2__
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ../components/directoristAlert */ './assets/src/js/public/components/directoristAlert.js'
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_3___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristAlert__WEBPACK_IMPORTED_MODULE_3__
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ../components/directoristFavorite */ './assets/src/js/public/components/directoristFavorite.js'
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__ =
+ __webpack_require__(
+ /*! ../components/directoristDropdown */ './assets/src/js/public/components/directoristDropdown.js'
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__
+ );
+ // General Components
+ })();
+ /******/
+})();
+//# sourceMappingURL=author-profile.js.map
diff --git a/assets/js/directorist-dashboard.js b/assets/js/directorist-dashboard.js
index 1ded7c4e9..a9459a4c2 100644
--- a/assets/js/directorist-dashboard.js
+++ b/assets/js/directorist-dashboard.js
@@ -1,1273 +1,2080 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/public/atmodal.js":
-/*!*****************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/public/atmodal.js':
+ /*!*****************************************!*\
!*** ./assets/src/js/public/atmodal.js ***!
\*****************************************/
-/***/ (function() {
-
-/*
+ /***/ function () {
+ /*
Name: ATModal
Version: 1.0
Author: Sovware
Author URI: https://sovware.com/
*/
-/* disable-eslint */
-var aazztechModal1 = function aazztechModal1(selector) {
- var element = document.querySelectorAll(selector);
- element.forEach(function (el, index) {
- el.style.display = 'none';
- document.addEventListener('click', function (event) {
- var current_elm = event.target;
- var target_id = current_elm.getAttribute('data-target');
- var el_id = el.getAttribute('id');
- if (target_id === el_id) {
- event.preventDefault();
- el.style.display = 'block';
- document.body.classList.add('atm-open');
- setTimeout(function () {
- el.classList.add('atm-show');
- }, 100);
- document.querySelector('html').style.overflow = 'hidden';
- }
- }, false);
- el.querySelector('a.at-modal-close').addEventListener('click', function (e) {
- e.preventDefault();
- el.classList.remove('atm-show');
- document.body.classList.remove('atm-open');
- setTimeout(function () {
- el.style.display = 'none';
- }, 100);
- document.querySelector('html').removeAttribute('style');
- });
- el.addEventListener('click', function (e) {
- if (e.target.closest('.atm-contents-inner')) return;
- el.classList.remove('atm-show');
- document.body.classList.remove('atm-open');
- setTimeout(function () {
- el.style.display = 'none';
- }, 100);
- document.querySelector('html').removeAttribute('style');
- });
- });
-};
-function initModal() {
- aazztechModal1('#dcl-claim-modal, #atbdp-report-abuse-modal, #atpp-plan-change-modal, #pyn-plan-change-modal');
-}
-window.addEventListener('load', function () {
- setTimeout(function () {
- initModal();
- }, 500);
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashBoardMoreBtn.js":
-/*!***********************************************************************!*\
+ /* disable-eslint */
+ var aazztechModal1 = function aazztechModal1(selector) {
+ var element = document.querySelectorAll(selector);
+ element.forEach(function (el, index) {
+ el.style.display = 'none';
+ document.addEventListener(
+ 'click',
+ function (event) {
+ var current_elm = event.target;
+ var target_id =
+ current_elm.getAttribute('data-target');
+ var el_id = el.getAttribute('id');
+ if (target_id === el_id) {
+ event.preventDefault();
+ el.style.display = 'block';
+ document.body.classList.add('atm-open');
+ setTimeout(function () {
+ el.classList.add('atm-show');
+ }, 100);
+ document.querySelector(
+ 'html'
+ ).style.overflow = 'hidden';
+ }
+ },
+ false
+ );
+ el.querySelector('a.at-modal-close').addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.classList.remove('atm-show');
+ document.body.classList.remove('atm-open');
+ setTimeout(function () {
+ el.style.display = 'none';
+ }, 100);
+ document
+ .querySelector('html')
+ .removeAttribute('style');
+ }
+ );
+ el.addEventListener('click', function (e) {
+ if (e.target.closest('.atm-contents-inner')) return;
+ el.classList.remove('atm-show');
+ document.body.classList.remove('atm-open');
+ setTimeout(function () {
+ el.style.display = 'none';
+ }, 100);
+ document
+ .querySelector('html')
+ .removeAttribute('style');
+ });
+ });
+ };
+ function initModal() {
+ aazztechModal1(
+ '#dcl-claim-modal, #atbdp-report-abuse-modal, #atpp-plan-change-modal, #pyn-plan-change-modal'
+ );
+ }
+ window.addEventListener('load', function () {
+ setTimeout(function () {
+ initModal();
+ }, 500);
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashBoardMoreBtn.js':
+ /*!***********************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashBoardMoreBtn.js ***!
\***********************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _atmodal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../atmodal */ "./assets/src/js/public/atmodal.js");
-/* harmony import */ var _atmodal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_atmodal__WEBPACK_IMPORTED_MODULE_0__);
-
-(function ($) {
- window.addEventListener('load', function () {
- // User Dashboard Table More Button
- $('.directorist-dashboard-listings-tbody').on('click', '.directorist-btn-more', function (e) {
- e.preventDefault();
- $(this).toggleClass('active');
- $('.directorist-dropdown-menu').removeClass('active');
- $(this).next('.directorist-dropdown-menu').toggleClass('active');
- e.stopPropagation();
- });
- $(document).bind('click', function (e) {
- if (!$(e.target).parents().hasClass('directorist-dropdown-menu__list')) {
- $('.directorist-dropdown-menu').removeClass('active');
- $('.directorist-btn-more').removeClass('active');
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashboardAnnouncement.js":
-/*!****************************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _atmodal__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../../atmodal */ './assets/src/js/public/atmodal.js'
+ );
+ /* harmony import */ var _atmodal__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _atmodal__WEBPACK_IMPORTED_MODULE_0__
+ );
+
+ (function ($) {
+ window.addEventListener('load', function () {
+ // User Dashboard Table More Button
+ $('.directorist-dashboard-listings-tbody').on(
+ 'click',
+ '.directorist-btn-more',
+ function (e) {
+ e.preventDefault();
+ $(this).toggleClass('active');
+ $('.directorist-dropdown-menu').removeClass(
+ 'active'
+ );
+ $(this)
+ .next('.directorist-dropdown-menu')
+ .toggleClass('active');
+ e.stopPropagation();
+ }
+ );
+ $(document).bind('click', function (e) {
+ if (
+ !$(e.target)
+ .parents()
+ .hasClass('directorist-dropdown-menu__list')
+ ) {
+ $('.directorist-dropdown-menu').removeClass(
+ 'active'
+ );
+ $('.directorist-btn-more').removeClass(
+ 'active'
+ );
+ }
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashboardAnnouncement.js':
+ /*!****************************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashboardAnnouncement.js ***!
\****************************************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- // Clear seen Announcements
- var cleared_seen_announcements = false;
- $('.directorist-tab__nav__link').on('click', function () {
- if (cleared_seen_announcements) {
- return;
- }
- var target = $(this).attr('target');
- if ('dashboard_announcement' === target) {
- $.ajax({
- type: 'post',
- url: directorist.ajaxurl,
- data: {
- action: 'atbdp_clear_seen_announcements'
- },
- success: function success(response) {
- if (response.success) {
- cleared_seen_announcements = true;
- $('.directorist-announcement-count').removeClass('show');
- $('.directorist-announcement-count').html('');
- }
- },
- error: function error(_error) {
- // console.log({
- // error
- // });
- }
- });
- }
- });
-
- // Closing the Announcement
- var closing_announcement = false;
- $('.close-announcement').on('click', function (e) {
- e.preventDefault();
- if (closing_announcement) {
- return;
- }
- var post_id = $(this).closest('.directorist-announcement').data('post-id');
- var form_data = {
- action: 'atbdp_close_announcement',
- post_id: post_id,
- nonce: directorist.directorist_nonce
- };
- var button_default_html = $(self).html();
- closing_announcement = true;
- var self = this;
- $.ajax({
- type: 'post',
- url: directorist.ajaxurl,
- data: form_data,
- beforeSend: function beforeSend() {
- $(self).html(' ');
- $(self).addClass('disable');
- $(self).attr('disable', true);
- },
- success: function success(response) {
- // console.log( { response } );
- closing_announcement = false;
- $(self).removeClass('disable');
- $(self).attr('disable', false);
- if (response.success) {
- $('.announcement-id-' + post_id).remove();
- if (!$('.announcement-item').length) {
- location.reload();
- }
- } else {
- $(self).html('Close');
- }
- },
- error: function error(_error2) {
- console.log({
- error: _error2
- });
- $(self).html(button_default_html);
- $(self).removeClass('disable');
- $(self).attr('disable', false);
- closing_announcement = false;
- }
- });
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashboardBecomeAuthor.js":
-/*!****************************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ // Clear seen Announcements
+ var cleared_seen_announcements = false;
+ $('.directorist-tab__nav__link').on(
+ 'click',
+ function () {
+ if (cleared_seen_announcements) {
+ return;
+ }
+ var target = $(this).attr('target');
+ if ('dashboard_announcement' === target) {
+ $.ajax({
+ type: 'post',
+ url: directorist.ajaxurl,
+ data: {
+ action: 'atbdp_clear_seen_announcements',
+ },
+ success: function success(response) {
+ if (response.success) {
+ cleared_seen_announcements = true;
+ $(
+ '.directorist-announcement-count'
+ ).removeClass('show');
+ $(
+ '.directorist-announcement-count'
+ ).html('');
+ }
+ },
+ error: function error(_error) {
+ // console.log({
+ // error
+ // });
+ },
+ });
+ }
+ }
+ );
+
+ // Closing the Announcement
+ var closing_announcement = false;
+ $('.close-announcement').on('click', function (e) {
+ e.preventDefault();
+ if (closing_announcement) {
+ return;
+ }
+ var post_id = $(this)
+ .closest('.directorist-announcement')
+ .data('post-id');
+ var form_data = {
+ action: 'atbdp_close_announcement',
+ post_id: post_id,
+ nonce: directorist.directorist_nonce,
+ };
+ var button_default_html = $(self).html();
+ closing_announcement = true;
+ var self = this;
+ $.ajax({
+ type: 'post',
+ url: directorist.ajaxurl,
+ data: form_data,
+ beforeSend: function beforeSend() {
+ $(self).html(
+ ' '
+ );
+ $(self).addClass('disable');
+ $(self).attr('disable', true);
+ },
+ success: function success(response) {
+ // console.log( { response } );
+ closing_announcement = false;
+ $(self).removeClass('disable');
+ $(self).attr('disable', false);
+ if (response.success) {
+ $(
+ '.announcement-id-' + post_id
+ ).remove();
+ if (!$('.announcement-item').length) {
+ location.reload();
+ }
+ } else {
+ $(self).html('Close');
+ }
+ },
+ error: function error(_error2) {
+ console.log({
+ error: _error2,
+ });
+ $(self).html(button_default_html);
+ $(self).removeClass('disable');
+ $(self).attr('disable', false);
+ closing_announcement = false;
+ },
+ });
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashboardBecomeAuthor.js':
+ /*!****************************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashboardBecomeAuthor.js ***!
\****************************************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- // Dashboard become an author
- $('.directorist-become-author').on('click', function (e) {
- e.preventDefault();
- $('.directorist-become-author-modal').addClass('directorist-become-author-modal__show');
- });
- $('.directorist-become-author-modal__cancel').on('click', function (e) {
- e.preventDefault();
- $('.directorist-become-author-modal').removeClass('directorist-become-author-modal__show');
- });
- $('.directorist-become-author-modal__approve').on('click', function (e) {
- e.preventDefault();
- var userId = $(this).attr('data-userId');
- var nonce = $(this).attr('data-nonce');
- var data = {
- userId: userId,
- nonce: nonce,
- action: 'atbdp_become_author'
- };
-
- // Send the data
- $.post(directorist.ajaxurl, data, function (response) {
- $('.directorist-become-author__loader').addClass('active');
- $('#directorist-become-author-success').html(response);
- $('.directorist-become-author').hide();
- $('.directorist-become-author-modal').removeClass('directorist-become-author-modal__show');
- });
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashboardListing.js":
-/*!***********************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ // Dashboard become an author
+ $('.directorist-become-author').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ $('.directorist-become-author-modal').addClass(
+ 'directorist-become-author-modal__show'
+ );
+ }
+ );
+ $('.directorist-become-author-modal__cancel').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ $(
+ '.directorist-become-author-modal'
+ ).removeClass(
+ 'directorist-become-author-modal__show'
+ );
+ }
+ );
+ $('.directorist-become-author-modal__approve').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var userId = $(this).attr('data-userId');
+ var nonce = $(this).attr('data-nonce');
+ var data = {
+ userId: userId,
+ nonce: nonce,
+ action: 'atbdp_become_author',
+ };
+
+ // Send the data
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ $(
+ '.directorist-become-author__loader'
+ ).addClass('active');
+ $(
+ '#directorist-become-author-success'
+ ).html(response);
+ $('.directorist-become-author').hide();
+ $(
+ '.directorist-become-author-modal'
+ ).removeClass(
+ 'directorist-become-author-modal__show'
+ );
+ }
+ );
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashboardListing.js':
+ /*!***********************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashboardListing.js ***!
\***********************************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- // Dashboard Listing Ajax
- function directorist_dashboard_listing_ajax($activeTab) {
- var paged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
- var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
- var task = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
- var taskdata = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
- var tab = $activeTab.data('tab');
- $.ajax({
- url: directorist.ajaxurl,
- type: 'POST',
- dataType: 'json',
- data: {
- action: 'directorist_dashboard_listing_tab',
- _ajax_nonce: directorist.directorist_nonce,
- tab: tab,
- paged: paged,
- search: search,
- task: task,
- taskdata: taskdata
- },
- beforeSend: function beforeSend() {
- $('#directorist-dashboard-preloader').show();
- },
- success: function success(response) {
- $('.directorist-dashboard-listings-tbody').html(response.data.content);
- $('.directorist-dashboard-pagination').html(response.data.pagination);
- $('.directorist-dashboard-listing-nav-js a').removeClass('directorist-tab__nav__active');
- $activeTab.addClass('directorist-tab__nav__active');
- $('#directorist-dashboard-mylistings-js').data('paged', paged);
- },
- complete: function complete() {
- $('#directorist-dashboard-preloader').hide();
- }
- });
- }
-
- // Dashboard Listing Tabs
- $('.directorist-dashboard-listing-nav-js a').on('click', function (event) {
- var $item = $(this);
- if ($item.hasClass('directorist-tab__nav__active')) {
- return false;
- }
- directorist_dashboard_listing_ajax($item);
- $('#directorist-dashboard-listing-searchform input[name=searchtext').val('');
- $('#directorist-dashboard-mylistings-js').data('search', '');
- return false;
- });
-
- // Dashboard Tasks eg. delete
- $('.directorist-dashboard-listings-tbody').on('click', '.directorist-dashboard-listing-actions a[data-task]', function (event) {
- var task = $(this).data('task');
- var postid = $(this).closest('tr').data('id');
- var $activeTab = $('.directorist-dashboard-listing-nav-js a.directorist-tab__nav__active');
- var paged = $('#directorist-dashboard-mylistings-js').data('paged');
- var search = $('#directorist-dashboard-mylistings-js').data('search');
- if (task == 'delete') {
- swal({
- title: directorist.listing_remove_title,
- text: directorist.listing_remove_text,
- type: 'warning',
- cancelButtonText: directorist.review_cancel_btn_text,
- showCancelButton: true,
- confirmButtonColor: '#DD6B55',
- confirmButtonText: directorist.listing_remove_confirm_text,
- showLoaderOnConfirm: true,
- closeOnConfirm: false
- }, function (isConfirm) {
- if (isConfirm) {
- directorist_dashboard_listing_ajax($activeTab, paged, search, task, postid);
- swal({
- title: directorist.listing_delete,
- type: 'success',
- timer: 200,
- showConfirmButton: false
- });
- }
- });
- }
- return false;
- });
-
- // Remove Listing
- $(document).on('click', '#remove_listing', function (e) {
- e.preventDefault();
- var $this = $(this);
- var id = $this.data('listing_id');
- var data = 'listing_id=' + id;
- swal({
- title: directorist.listing_remove_title,
- text: directorist.listing_remove_text,
- type: 'warning',
- cancelButtonText: directorist.review_cancel_btn_text,
- showCancelButton: true,
- confirmButtonColor: '#DD6B55',
- confirmButtonText: directorist.listing_remove_confirm_text,
- showLoaderOnConfirm: true,
- closeOnConfirm: false
- }, function (isConfirm) {
- if (isConfirm) {
- // user has confirmed, now remove the listing
- atbdp_do_ajax($this, 'remove_listing', data, function (response) {
- $('body').append(response);
- if ('success' === response) {
- // show success message
- swal({
- title: directorist.listing_delete,
- type: 'success',
- timer: 200,
- showConfirmButton: false
- });
- $('#listing_id_' + id).remove();
- $this.remove();
- } else {
- // show error message
- swal({
- title: directorist.listing_error_title,
- text: directorist.listing_error_text,
- type: 'error',
- timer: 2000,
- showConfirmButton: false
- });
- }
- });
- }
- });
-
- // send an ajax request to the ajax-handler.php and then delete the review of the given id
- });
-
- // Dashboard pagination
- $('.directorist-dashboard-pagination').on('click', 'a', function (event) {
- var $link = $(this);
- var paged = $link.attr('href');
- paged = paged.split('/page/')[1];
- paged = parseInt(paged);
- var search = $('#directorist-dashboard-mylistings-js').data('search');
- $activeTab = $('.directorist-dashboard-listing-nav-js a.directorist-tab__nav__active');
- directorist_dashboard_listing_ajax($activeTab, paged, search);
- return false;
- });
-
- // Dashboard Search
- $('#directorist-dashboard-listing-searchform input[name=searchtext').val(''); //onready
-
- $('#directorist-dashboard-listing-searchform').on('submit', function (event) {
- var $activeTab = $('.directorist-dashboard-listing-nav-js a.directorist-tab__nav__active');
- var search = $(this).find('input[name=searchtext]').val();
- directorist_dashboard_listing_ajax($activeTab, 1, search);
- $('#directorist-dashboard-mylistings-js').data('search', search);
- return false;
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashboardResponsive.js":
-/*!**************************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ // Dashboard Listing Ajax
+ function directorist_dashboard_listing_ajax(
+ $activeTab
+ ) {
+ var paged =
+ arguments.length > 1 &&
+ arguments[1] !== undefined
+ ? arguments[1]
+ : 1;
+ var search =
+ arguments.length > 2 &&
+ arguments[2] !== undefined
+ ? arguments[2]
+ : '';
+ var task =
+ arguments.length > 3 &&
+ arguments[3] !== undefined
+ ? arguments[3]
+ : '';
+ var taskdata =
+ arguments.length > 4 &&
+ arguments[4] !== undefined
+ ? arguments[4]
+ : '';
+ var tab = $activeTab.data('tab');
+ $.ajax({
+ url: directorist.ajaxurl,
+ type: 'POST',
+ dataType: 'json',
+ data: {
+ action: 'directorist_dashboard_listing_tab',
+ _ajax_nonce: directorist.directorist_nonce,
+ tab: tab,
+ paged: paged,
+ search: search,
+ task: task,
+ taskdata: taskdata,
+ },
+ beforeSend: function beforeSend() {
+ $(
+ '#directorist-dashboard-preloader'
+ ).show();
+ },
+ success: function success(response) {
+ $(
+ '.directorist-dashboard-listings-tbody'
+ ).html(response.data.content);
+ $('.directorist-dashboard-pagination').html(
+ response.data.pagination
+ );
+ $(
+ '.directorist-dashboard-listing-nav-js a'
+ ).removeClass(
+ 'directorist-tab__nav__active'
+ );
+ $activeTab.addClass(
+ 'directorist-tab__nav__active'
+ );
+ $(
+ '#directorist-dashboard-mylistings-js'
+ ).data('paged', paged);
+ },
+ complete: function complete() {
+ $(
+ '#directorist-dashboard-preloader'
+ ).hide();
+ },
+ });
+ }
+
+ // Dashboard Listing Tabs
+ $('.directorist-dashboard-listing-nav-js a').on(
+ 'click',
+ function (event) {
+ var $item = $(this);
+ if (
+ $item.hasClass(
+ 'directorist-tab__nav__active'
+ )
+ ) {
+ return false;
+ }
+ directorist_dashboard_listing_ajax($item);
+ $(
+ '#directorist-dashboard-listing-searchform input[name=searchtext'
+ ).val('');
+ $('#directorist-dashboard-mylistings-js').data(
+ 'search',
+ ''
+ );
+ return false;
+ }
+ );
+
+ // Dashboard Tasks eg. delete
+ $('.directorist-dashboard-listings-tbody').on(
+ 'click',
+ '.directorist-dashboard-listing-actions a[data-task]',
+ function (event) {
+ var task = $(this).data('task');
+ var postid = $(this).closest('tr').data('id');
+ var $activeTab = $(
+ '.directorist-dashboard-listing-nav-js a.directorist-tab__nav__active'
+ );
+ var paged = $(
+ '#directorist-dashboard-mylistings-js'
+ ).data('paged');
+ var search = $(
+ '#directorist-dashboard-mylistings-js'
+ ).data('search');
+ if (task == 'delete') {
+ swal(
+ {
+ title: directorist.listing_remove_title,
+ text: directorist.listing_remove_text,
+ type: 'warning',
+ cancelButtonText:
+ directorist.review_cancel_btn_text,
+ showCancelButton: true,
+ confirmButtonColor: '#DD6B55',
+ confirmButtonText:
+ directorist.listing_remove_confirm_text,
+ showLoaderOnConfirm: true,
+ closeOnConfirm: false,
+ },
+ function (isConfirm) {
+ if (isConfirm) {
+ directorist_dashboard_listing_ajax(
+ $activeTab,
+ paged,
+ search,
+ task,
+ postid
+ );
+ swal({
+ title: directorist.listing_delete,
+ type: 'success',
+ timer: 200,
+ showConfirmButton: false,
+ });
+ }
+ }
+ );
+ }
+ return false;
+ }
+ );
+
+ // Remove Listing
+ $(document).on(
+ 'click',
+ '#remove_listing',
+ function (e) {
+ e.preventDefault();
+ var $this = $(this);
+ var id = $this.data('listing_id');
+ var data = 'listing_id=' + id;
+ swal(
+ {
+ title: directorist.listing_remove_title,
+ text: directorist.listing_remove_text,
+ type: 'warning',
+ cancelButtonText:
+ directorist.review_cancel_btn_text,
+ showCancelButton: true,
+ confirmButtonColor: '#DD6B55',
+ confirmButtonText:
+ directorist.listing_remove_confirm_text,
+ showLoaderOnConfirm: true,
+ closeOnConfirm: false,
+ },
+ function (isConfirm) {
+ if (isConfirm) {
+ // user has confirmed, now remove the listing
+ atbdp_do_ajax(
+ $this,
+ 'remove_listing',
+ data,
+ function (response) {
+ $('body').append(response);
+ if (
+ 'success' === response
+ ) {
+ // show success message
+ swal({
+ title: directorist.listing_delete,
+ type: 'success',
+ timer: 200,
+ showConfirmButton: false,
+ });
+ $(
+ '#listing_id_' + id
+ ).remove();
+ $this.remove();
+ } else {
+ // show error message
+ swal({
+ title: directorist.listing_error_title,
+ text: directorist.listing_error_text,
+ type: 'error',
+ timer: 2000,
+ showConfirmButton: false,
+ });
+ }
+ }
+ );
+ }
+ }
+ );
+
+ // send an ajax request to the ajax-handler.php and then delete the review of the given id
+ }
+ );
+
+ // Dashboard pagination
+ $('.directorist-dashboard-pagination').on(
+ 'click',
+ 'a',
+ function (event) {
+ var $link = $(this);
+ var paged = $link.attr('href');
+ paged = paged.split('/page/')[1];
+ paged = parseInt(paged);
+ var search = $(
+ '#directorist-dashboard-mylistings-js'
+ ).data('search');
+ $activeTab = $(
+ '.directorist-dashboard-listing-nav-js a.directorist-tab__nav__active'
+ );
+ directorist_dashboard_listing_ajax(
+ $activeTab,
+ paged,
+ search
+ );
+ return false;
+ }
+ );
+
+ // Dashboard Search
+ $(
+ '#directorist-dashboard-listing-searchform input[name=searchtext'
+ ).val(''); //onready
+
+ $('#directorist-dashboard-listing-searchform').on(
+ 'submit',
+ function (event) {
+ var $activeTab = $(
+ '.directorist-dashboard-listing-nav-js a.directorist-tab__nav__active'
+ );
+ var search = $(this)
+ .find('input[name=searchtext]')
+ .val();
+ directorist_dashboard_listing_ajax(
+ $activeTab,
+ 1,
+ search
+ );
+ $('#directorist-dashboard-mylistings-js').data(
+ 'search',
+ search
+ );
+ return false;
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashboardResponsive.js':
+ /*!**************************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashboardResponsive.js ***!
\**************************************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- //dashboard content responsive fix
- var tabContentWidth = $('.directorist-user-dashboard .directorist-user-dashboard__contents').innerWidth();
- if (tabContentWidth < 1399) {
- $('.directorist-user-dashboard .directorist-user-dashboard__contents').addClass('directorist-tab-content-grid-fix');
- }
- $(window).bind('resize', function () {
- if ($(this).width() <= 1199) {
- $('.directorist-user-dashboard__nav').addClass('directorist-dashboard-nav-collapsed');
- $('.directorist-shade').removeClass('directorist-active');
- }
- }).trigger('resize');
- $('.directorist-dashboard__nav__close, .directorist-shade').on('click', function () {
- $('.directorist-user-dashboard__nav').addClass('directorist-dashboard-nav-collapsed');
- $('.directorist-shade').removeClass('directorist-active');
- });
-
- // Profile Responsive
- $('.directorist-tab__nav__link').on('click', function () {
- if ($('#user_profile_form').width() < 800 && $('#user_profile_form').width() !== 0) {
- $('#user_profile_form').addClass('directorist-profile-responsive');
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashboardSidebar.js":
-/*!***********************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ //dashboard content responsive fix
+ var tabContentWidth = $(
+ '.directorist-user-dashboard .directorist-user-dashboard__contents'
+ ).innerWidth();
+ if (tabContentWidth < 1399) {
+ $(
+ '.directorist-user-dashboard .directorist-user-dashboard__contents'
+ ).addClass('directorist-tab-content-grid-fix');
+ }
+ $(window)
+ .bind('resize', function () {
+ if ($(this).width() <= 1199) {
+ $(
+ '.directorist-user-dashboard__nav'
+ ).addClass(
+ 'directorist-dashboard-nav-collapsed'
+ );
+ $('.directorist-shade').removeClass(
+ 'directorist-active'
+ );
+ }
+ })
+ .trigger('resize');
+ $(
+ '.directorist-dashboard__nav__close, .directorist-shade'
+ ).on('click', function () {
+ $('.directorist-user-dashboard__nav').addClass(
+ 'directorist-dashboard-nav-collapsed'
+ );
+ $('.directorist-shade').removeClass(
+ 'directorist-active'
+ );
+ });
+
+ // Profile Responsive
+ $('.directorist-tab__nav__link').on(
+ 'click',
+ function () {
+ if (
+ $('#user_profile_form').width() < 800 &&
+ $('#user_profile_form').width() !== 0
+ ) {
+ $('#user_profile_form').addClass(
+ 'directorist-profile-responsive'
+ );
+ }
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashboardSidebar.js':
+ /*!***********************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashboardSidebar.js ***!
\***********************************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- //dashboard sidebar nav toggler
- $('.directorist-user-dashboard__toggle__link').on('click', function (e) {
- e.preventDefault();
- $('.directorist-user-dashboard__nav').toggleClass('directorist-dashboard-nav-collapsed');
- // $(".directorist-shade").toggleClass("directorist-active");
- });
- if ($(window).innerWidth() < 767) {
- $('.directorist-user-dashboard__nav').addClass('directorist-dashboard-nav-collapsed');
- $('.directorist-user-dashboard__nav').addClass('directorist-dashboard-nav-collapsed--fixed');
- }
-
- //dashboard nav dropdown
- $('.directorist-tab__nav__link').on('click', function (e) {
- e.preventDefault();
- if ($(this).hasClass('atbd-dash-nav-dropdown')) {
- // Slide toggle the sibling ul element
- $(this).siblings('ul').slideToggle();
- } else if (!$(this).parents('.atbdp_tab_nav--has-child').length > 0) {
- // Slide up all the dropdown contents while clicked item is not inside dropdown
- $('.atbd-dash-nav-dropdown').siblings('ul').slideUp();
- }
- });
- if ($(window).innerWidth() < 1199) {
- $('.directorist-tab__nav__link:not(.atbd-dash-nav-dropdown)').on('click', function () {
- $('.directorist-user-dashboard__nav').addClass('directorist-dashboard-nav-collapsed');
- $('.directorist-shade').removeClass('directorist-active');
- });
- $('.directorist-user-dashboard__toggle__link').on('click', function (e) {
- e.preventDefault();
- $('.directorist-shade').toggleClass('directorist-active');
- });
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/dashboard/dashboardTab.js":
-/*!*******************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ //dashboard sidebar nav toggler
+ $('.directorist-user-dashboard__toggle__link').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ $(
+ '.directorist-user-dashboard__nav'
+ ).toggleClass(
+ 'directorist-dashboard-nav-collapsed'
+ );
+ // $(".directorist-shade").toggleClass("directorist-active");
+ }
+ );
+ if ($(window).innerWidth() < 767) {
+ $('.directorist-user-dashboard__nav').addClass(
+ 'directorist-dashboard-nav-collapsed'
+ );
+ $('.directorist-user-dashboard__nav').addClass(
+ 'directorist-dashboard-nav-collapsed--fixed'
+ );
+ }
+
+ //dashboard nav dropdown
+ $('.directorist-tab__nav__link').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ if (
+ $(this).hasClass('atbd-dash-nav-dropdown')
+ ) {
+ // Slide toggle the sibling ul element
+ $(this).siblings('ul').slideToggle();
+ } else if (
+ !$(this).parents(
+ '.atbdp_tab_nav--has-child'
+ ).length > 0
+ ) {
+ // Slide up all the dropdown contents while clicked item is not inside dropdown
+ $('.atbd-dash-nav-dropdown')
+ .siblings('ul')
+ .slideUp();
+ }
+ }
+ );
+ if ($(window).innerWidth() < 1199) {
+ $(
+ '.directorist-tab__nav__link:not(.atbd-dash-nav-dropdown)'
+ ).on('click', function () {
+ $('.directorist-user-dashboard__nav').addClass(
+ 'directorist-dashboard-nav-collapsed'
+ );
+ $('.directorist-shade').removeClass(
+ 'directorist-active'
+ );
+ });
+ $('.directorist-user-dashboard__toggle__link').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ $('.directorist-shade').toggleClass(
+ 'directorist-active'
+ );
+ }
+ );
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/dashboard/dashboardTab.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/public/components/dashboard/dashboardTab.js ***!
\*******************************************************************/
-/***/ (function() {
-
-(function () {
- new DashTab('.directorist-tab');
-})();
+ /***/ function () {
+ (function () {
+ new DashTab('.directorist-tab');
+ })();
-/***/ }),
+ /***/
+ },
-/***/ "./assets/src/js/public/components/directoristAlert.js":
-/*!*************************************************************!*\
+ /***/ './assets/src/js/public/components/directoristAlert.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/directoristAlert.js ***!
\*************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_alert_executed === 'undefined') {
- window.directorist_alert_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* Directorist alert dismiss */
- var getUrl = window.location.href;
- var newUrl = getUrl.replace('notice=1', '');
- if ($('.directorist-alert__close') !== null) {
- $('.directorist-alert__close').each(function (i, e) {
- $(e).on('click', function (e) {
- e.preventDefault();
- history.pushState({}, null, newUrl);
- $(this).closest('.directorist-alert').remove();
- });
- });
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristDropdown.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_alert_executed === 'undefined'
+ ) {
+ window.directorist_alert_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* Directorist alert dismiss */
+ var getUrl = window.location.href;
+ var newUrl = getUrl.replace('notice=1', '');
+ if ($('.directorist-alert__close') !== null) {
+ $('.directorist-alert__close').each(
+ function (i, e) {
+ $(e).on('click', function (e) {
+ e.preventDefault();
+ history.pushState({}, null, newUrl);
+ $(this)
+ .closest('.directorist-alert')
+ .remove();
+ });
+ }
+ );
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristDropdown.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristDropdown.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_dropdown_executed === 'undefined') {
- window.directorist_dropdown_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.directorist-dropdown-select');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.directorist-dropdown-select-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- el.querySelector('.directorist-dropdown-select-items').classList.add('directorist-dropdown-select-show');
- } else {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'directorist-dropdown-select-toggle') {
- clickCount = 0;
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (el) {
- el.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
-
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.directorist-dropdown-select-toggle').textContent = e.target.textContent;
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // Dropdown
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-toggle', function (e) {
- e.preventDefault();
- $(this).siblings('.directorist-dropdown-option').toggle();
- });
-
- // Select Option after click
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-option ul li a', function (e) {
- e.preventDefault();
- var optionText = $(this).html();
- $(this).children('.directorist-dropdown-toggle__text').html(optionText);
- $(this).closest('.directorist-dropdown-option').siblings('.directorist-dropdown-toggle').children('.directorist-dropdown-toggle__text').html(optionText);
- $('.directorist-dropdown-option').hide();
- });
-
- // Hide Clicked Anywhere
- $(document).bind('click', function (e) {
- var clickedDOM = $(e.target);
- if (!clickedDOM.parents().hasClass('directorist-dropdown')) $('.directorist-dropdown-option').hide();
- });
-
- //atbd_dropdown
- $(document).on('click', '.atbd_dropdown', function (e) {
- if ($(this).attr('class') === 'atbd_dropdown') {
- e.preventDefault();
- $(this).siblings('.atbd_dropdown').removeClass('atbd_drop--active');
- $(this).toggleClass('atbd_drop--active');
- e.stopPropagation();
- }
- });
- $(document).on('click', function (e) {
- if ($(e.target).is('.atbd_dropdown, .atbd_drop--active') === false) {
- $('.atbd_dropdown').removeClass('atbd_drop--active');
- }
- });
- $('body').on('click', '.atbd_dropdown-toggle', function (e) {
- e.preventDefault();
- });
-
- // Directorist Dropdown
- $('body').on('click', '.directorist-dropdown-js .directorist-dropdown__toggle-js', function (e) {
- e.preventDefault();
- if (!$(this).siblings('.directorist-dropdown__links-js').is(':visible')) {
- $('.directorist-dropdown__links').hide();
- }
- $(this).siblings('.directorist-dropdown__links-js').toggle();
- });
- $('body').on('click', function (e) {
- if (!e.target.closest('.directorist-dropdown-js')) {
- $('.directorist-dropdown__links-js').hide();
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristFavorite.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_dropdown_executed ===
+ 'undefined'
+ ) {
+ window.directorist_dropdown_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown = document.querySelectorAll(
+ '.directorist-dropdown-select'
+ );
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ el.querySelector(
+ '.directorist-dropdown-select-items'
+ ).classList.add(
+ 'directorist-dropdown-select-show'
+ );
+ } else {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'directorist-dropdown-select-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).textContent =
+ e.target.textContent;
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ });
+ });
+ }
+
+ // Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .siblings('.directorist-dropdown-option')
+ .toggle();
+ }
+ );
+
+ // Select Option after click
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-option ul li a',
+ function (e) {
+ e.preventDefault();
+ var optionText = $(this).html();
+ $(this)
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $(this)
+ .closest('.directorist-dropdown-option')
+ .siblings('.directorist-dropdown-toggle')
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $('.directorist-dropdown-option').hide();
+ }
+ );
+
+ // Hide Clicked Anywhere
+ $(document).bind('click', function (e) {
+ var clickedDOM = $(e.target);
+ if (
+ !clickedDOM
+ .parents()
+ .hasClass('directorist-dropdown')
+ )
+ $('.directorist-dropdown-option').hide();
+ });
+
+ //atbd_dropdown
+ $(document).on('click', '.atbd_dropdown', function (e) {
+ if ($(this).attr('class') === 'atbd_dropdown') {
+ e.preventDefault();
+ $(this)
+ .siblings('.atbd_dropdown')
+ .removeClass('atbd_drop--active');
+ $(this).toggleClass('atbd_drop--active');
+ e.stopPropagation();
+ }
+ });
+ $(document).on('click', function (e) {
+ if (
+ $(e.target).is(
+ '.atbd_dropdown, .atbd_drop--active'
+ ) === false
+ ) {
+ $('.atbd_dropdown').removeClass(
+ 'atbd_drop--active'
+ );
+ }
+ });
+ $('body').on(
+ 'click',
+ '.atbd_dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ }
+ );
+
+ // Directorist Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown-js .directorist-dropdown__toggle-js',
+ function (e) {
+ e.preventDefault();
+ if (
+ !$(this)
+ .siblings(
+ '.directorist-dropdown__links-js'
+ )
+ .is(':visible')
+ ) {
+ $('.directorist-dropdown__links').hide();
+ }
+ $(this)
+ .siblings('.directorist-dropdown__links-js')
+ .toggle();
+ }
+ );
+ $('body').on('click', function (e) {
+ if (!e.target.closest('.directorist-dropdown-js')) {
+ $('.directorist-dropdown__links-js').hide();
+ }
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristFavorite.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristFavorite.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_favorite_executed === 'undefined') {
- window.directorist_favorite_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- // Add or Remove from favourites
- $('.directorist-action-bookmark').on('click', function (e) {
- e.preventDefault();
- var data = {
- action: 'atbdp_public_add_remove_favorites',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id'),
- label: $(this).data('label')
- };
- $.post(directorist.ajaxurl, data, function (response) {
- if (response) {
- $('.directorist-action-bookmark').html(response);
- }
- });
- });
- $('.directorist-favourite-remove-btn').each(function () {
- $(this).on('click', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajaxurl, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist_favourite_' + post_id);
- if ('false' === response) {
- staElement.remove();
- }
- });
- });
- });
- $('body').on('click', '.directorist-mark-as-favorite__btn', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- var fav_tooltip_success = '' + directorist.i18n_text.added_favourite + ' ';
- var fav_tooltip_warning = '' + directorist.i18n_text.please_login + ' ';
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajax_url, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist-fav_' + post_id);
- var data_id = staElement.attr('data-listing_id');
- if (response === 'login_required') {
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_warning);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- } else if ('false' === response) {
- staElement.removeClass('directorist-added-to-favorite');
- $('.directorist-favorite-tooltip span').remove();
- } else {
- if (data_id === post_id) {
- staElement.addClass('directorist-added-to-favorite');
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_success);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- }
- }
- });
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristSelect.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_favorite_executed ===
+ 'undefined'
+ ) {
+ window.directorist_favorite_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ // Add or Remove from favourites
+ $('.directorist-action-bookmark').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var data = {
+ action: 'atbdp_public_add_remove_favorites',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ label: $(this).data('label'),
+ };
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ if (response) {
+ $(
+ '.directorist-action-bookmark'
+ ).html(response);
+ }
+ }
+ );
+ }
+ );
+ $('.directorist-favourite-remove-btn').each(
+ function () {
+ $(this).on('click', function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist_favourite_' +
+ post_id
+ );
+ if ('false' === response) {
+ staElement.remove();
+ }
+ }
+ );
+ });
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-mark-as-favorite__btn',
+ function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ var fav_tooltip_success =
+ '' +
+ directorist.i18n_text.added_favourite +
+ ' ';
+ var fav_tooltip_warning =
+ '' +
+ directorist.i18n_text.please_login +
+ ' ';
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajax_url,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist-fav_' + post_id
+ );
+ var data_id =
+ staElement.attr('data-listing_id');
+ if (response === 'login_required') {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(fav_tooltip_warning);
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ } else if ('false' === response) {
+ staElement.removeClass(
+ 'directorist-added-to-favorite'
+ );
+ $(
+ '.directorist-favorite-tooltip span'
+ ).remove();
+ } else {
+ if (data_id === post_id) {
+ staElement.addClass(
+ 'directorist-added-to-favorite'
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(
+ fav_tooltip_success
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ }
+ }
+ }
+ );
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristSelect.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/directoristSelect.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_select_executed === 'undefined') {
- window.directorist_select_executed = true;
- } else {
- return;
- }
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.atbd-dropdown-toggle').textContent = item.textContent;
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // select data-status
- var atbdSelectData = document.querySelectorAll('.atbd-drop-select.with-sort');
- atbdSelectData.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- var atbd_dropdown = el.querySelector('.atbd-dropdown-toggle');
- var dropdown_item = item.getAttribute('data-status');
- item.addEventListener('click', function (e) {
- atbd_dropdown.setAttribute('data-status', "".concat(dropdown_item));
- });
- });
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/legacy-support.js":
-/*!***********************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_select_executed ===
+ 'undefined'
+ ) {
+ window.directorist_select_executed = true;
+ } else {
+ return;
+ }
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.atbd-dropdown-toggle'
+ ).textContent = item.textContent;
+ el.querySelectorAll(
+ '.atbd-dropdown-item'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ }
+ );
+ });
+ }
+
+ // select data-status
+ var atbdSelectData = document.querySelectorAll(
+ '.atbd-drop-select.with-sort'
+ );
+ atbdSelectData.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ var atbd_dropdown = el.querySelector(
+ '.atbd-dropdown-toggle'
+ );
+ var dropdown_item =
+ item.getAttribute('data-status');
+ item.addEventListener('click', function (e) {
+ atbd_dropdown.setAttribute(
+ 'data-status',
+ ''.concat(dropdown_item)
+ );
+ });
+ }
+ );
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/legacy-support.js':
+ /*!***********************************************************!*\
!*** ./assets/src/js/public/components/legacy-support.js ***!
\***********************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.atbd-dropdown');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.atbd-dropdown-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.atbd-dropdown-items').forEach(function (el) {
- el.classList.remove('atbd-show');
- });
- el.querySelector('.atbd-dropdown-items').classList.add('atbd-show');
- } else {
- document.querySelectorAll('.atbd-dropdown-items').forEach(function (el) {
- el.classList.remove('atbd-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'atbd-toggle') {
- clickCount = 0;
- document.querySelectorAll('.atbd-dropdown-items').forEach(function (el) {
- el.classList.remove('atbd-show');
- });
- }
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/preferenceForm.js":
-/*!***********************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown =
+ document.querySelectorAll('.atbd-dropdown');
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.atbd-dropdown-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.atbd-dropdown-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove('atbd-show');
+ });
+ el.querySelector(
+ '.atbd-dropdown-items'
+ ).classList.add('atbd-show');
+ } else {
+ document
+ .querySelectorAll(
+ '.atbd-dropdown-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove('atbd-show');
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'atbd-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll('.atbd-dropdown-items')
+ .forEach(function (el) {
+ el.classList.remove('atbd-show');
+ });
+ }
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/preferenceForm.js':
+ /*!***********************************************************!*\
!*** ./assets/src/js/public/components/preferenceForm.js ***!
\***********************************************************/
-/***/ (function() {
-
-(function ($) {
- if ($('#display_author_email').length) {
- $('#display_author_email').select2();
- }
- window.addEventListener('load', function () {
- var is_processing = false;
- $('#user_preferences').on('submit', function (e) {
- // submit the form to the ajax handler and then send a response from the database and then work accordingly and then after finishing the update profile then work on remove listing and also remove the review and rating form the custom table once the listing is deleted successfully.
- e.preventDefault();
- var submit_button = $('#update_user_preferences');
- submit_button.attr('disabled', true);
- submit_button.addClass('directorist-loader');
- if (is_processing) {
- submit_button.removeAttr('disabled');
- return;
- }
- var form_data = new FormData();
- var err_log = {};
-
- // ajax action
- form_data.append('action', 'update_user_preferences');
- form_data.append('directorist_nonce', directorist.directorist_nonce);
- var $form = $(this);
- var arrData = $form.serializeArray();
- $.each(arrData, function (index, elem) {
- var name = elem.name;
- var value = elem.value;
- form_data.append(name, value);
- });
- $.ajax({
- method: 'POST',
- processData: false,
- contentType: false,
- url: directorist.ajaxurl,
- data: form_data,
- success: function success(response) {
- submit_button.removeAttr('disabled');
- submit_button.removeClass('directorist-loader');
- if (response.success) {
- $('#directorist-preference-notice').html('' + response.data.message + ' ');
- } else {
- $('#directorist-preference-notice').html('' + response.data.message + ' ');
- }
- },
- error: function error(response) {
- submit_button.removeAttr('disabled');
- console.log(response);
- }
- });
- // remove notice after five second
- setTimeout(function () {
- $('#directorist-preference-notice .directorist-alert').remove();
- }, 5000);
-
- // prevent the from submitting
- return false;
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/profileForm.js":
-/*!********************************************************!*\
+ /***/ function () {
+ (function ($) {
+ if ($('#display_author_email').length) {
+ $('#display_author_email').select2();
+ }
+ window.addEventListener('load', function () {
+ var is_processing = false;
+ $('#user_preferences').on('submit', function (e) {
+ // submit the form to the ajax handler and then send a response from the database and then work accordingly and then after finishing the update profile then work on remove listing and also remove the review and rating form the custom table once the listing is deleted successfully.
+ e.preventDefault();
+ var submit_button = $('#update_user_preferences');
+ submit_button.attr('disabled', true);
+ submit_button.addClass('directorist-loader');
+ if (is_processing) {
+ submit_button.removeAttr('disabled');
+ return;
+ }
+ var form_data = new FormData();
+ var err_log = {};
+
+ // ajax action
+ form_data.append(
+ 'action',
+ 'update_user_preferences'
+ );
+ form_data.append(
+ 'directorist_nonce',
+ directorist.directorist_nonce
+ );
+ var $form = $(this);
+ var arrData = $form.serializeArray();
+ $.each(arrData, function (index, elem) {
+ var name = elem.name;
+ var value = elem.value;
+ form_data.append(name, value);
+ });
+ $.ajax({
+ method: 'POST',
+ processData: false,
+ contentType: false,
+ url: directorist.ajaxurl,
+ data: form_data,
+ success: function success(response) {
+ submit_button.removeAttr('disabled');
+ submit_button.removeClass(
+ 'directorist-loader'
+ );
+ if (response.success) {
+ $(
+ '#directorist-preference-notice'
+ ).html(
+ '' +
+ response.data.message +
+ ' '
+ );
+ } else {
+ $(
+ '#directorist-preference-notice'
+ ).html(
+ '' +
+ response.data.message +
+ ' '
+ );
+ }
+ },
+ error: function error(response) {
+ submit_button.removeAttr('disabled');
+ console.log(response);
+ },
+ });
+ // remove notice after five second
+ setTimeout(function () {
+ $(
+ '#directorist-preference-notice .directorist-alert'
+ ).remove();
+ }, 5000);
+
+ // prevent the from submitting
+ return false;
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/profileForm.js':
+ /*!********************************************************!*\
!*** ./assets/src/js/public/components/profileForm.js ***!
\********************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- var profileMediaUploader = null;
- if ($('.directorist-profile-uploader').length) {
- profileMediaUploader = new EzMediaUploader({
- containerClass: 'directorist-profile-uploader'
- });
- profileMediaUploader.init();
- }
- var is_processing = false;
- $('#user_profile_form').on('submit', function (e) {
- // submit the form to the ajax handler and then send a response from the database and then work accordingly and then after finishing the update profile then work on remove listing and also remove the review and rating form the custom table once the listing is deleted successfully.
- e.preventDefault();
- var submit_button = $('#update_user_profile');
- submit_button.attr('disabled', true);
- submit_button.addClass('directorist-loader');
- if (is_processing) {
- submit_button.removeAttr('disabled');
- return;
- }
- var form_data = new FormData();
- var err_log = {};
- var error_count;
-
- // ajax action
- form_data.append('action', 'update_user_profile');
- form_data.append('directorist_nonce', directorist.directorist_nonce);
- if (profileMediaUploader) {
- var hasValidFiles = profileMediaUploader.hasValidFiles();
- if (hasValidFiles) {
- //files
- var files = profileMediaUploader.getTheFiles();
- var filesMeta = profileMediaUploader.getFilesMeta();
- if (files.length) {
- for (var i = 0; i < files.length; i++) {
- form_data.append('profile_picture', files[i]);
- }
- }
- if (filesMeta.length) {
- for (var i = 0; i < filesMeta.length; i++) {
- var elm = filesMeta[i];
- for (var key in elm) {
- form_data.append('profile_picture_meta[' + i + '][' + key + ']', elm[key]);
- }
- }
- }
- } else {
- $('.directorist-form-submit__btn').removeClass('atbd_loading');
- err_log.user_profile_avater = {
- msg: 'Listing gallery has invalid files'
- };
- error_count++;
- }
- }
- var $form = $(this);
- var arrData = $form.serializeArray();
- $.each(arrData, function (index, elem) {
- var name = elem.name;
- var value = elem.value;
- form_data.append(name, value);
- });
- $.ajax({
- method: 'POST',
- processData: false,
- contentType: false,
- url: directorist.ajaxurl,
- data: form_data,
- success: function success(response) {
- submit_button.removeAttr('disabled');
- submit_button.removeClass('directorist-loader');
-
- // console.log(response);
-
- if (response.success) {
- $('#directorist-profile-notice').html('' + response.data + ' ');
-
- // Reload if password updated
- var newPass = form_data.get('user[new_pass]');
- if (typeof newPass == 'string' && newPass.length > 0) {
- location.reload();
- return false;
- }
- } else {
- $('#directorist-profile-notice').html('' + response.data + ' ');
- }
- },
- error: function error(response) {
- submit_button.removeAttr('disabled');
- console.log(response);
- }
- });
- // remove notice after five second
- setTimeout(function () {
- $('#directorist-profile-notice .directorist-alert').remove();
- }, 5000);
-
- // prevent the from submitting
- return false;
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/lib/dashTab.js":
-/*!*********************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ var profileMediaUploader = null;
+ if ($('.directorist-profile-uploader').length) {
+ profileMediaUploader = new EzMediaUploader({
+ containerClass: 'directorist-profile-uploader',
+ });
+ profileMediaUploader.init();
+ }
+ var is_processing = false;
+ $('#user_profile_form').on('submit', function (e) {
+ // submit the form to the ajax handler and then send a response from the database and then work accordingly and then after finishing the update profile then work on remove listing and also remove the review and rating form the custom table once the listing is deleted successfully.
+ e.preventDefault();
+ var submit_button = $('#update_user_profile');
+ submit_button.attr('disabled', true);
+ submit_button.addClass('directorist-loader');
+ if (is_processing) {
+ submit_button.removeAttr('disabled');
+ return;
+ }
+ var form_data = new FormData();
+ var err_log = {};
+ var error_count;
+
+ // ajax action
+ form_data.append('action', 'update_user_profile');
+ form_data.append(
+ 'directorist_nonce',
+ directorist.directorist_nonce
+ );
+ if (profileMediaUploader) {
+ var hasValidFiles =
+ profileMediaUploader.hasValidFiles();
+ if (hasValidFiles) {
+ //files
+ var files =
+ profileMediaUploader.getTheFiles();
+ var filesMeta =
+ profileMediaUploader.getFilesMeta();
+ if (files.length) {
+ for (var i = 0; i < files.length; i++) {
+ form_data.append(
+ 'profile_picture',
+ files[i]
+ );
+ }
+ }
+ if (filesMeta.length) {
+ for (
+ var i = 0;
+ i < filesMeta.length;
+ i++
+ ) {
+ var elm = filesMeta[i];
+ for (var key in elm) {
+ form_data.append(
+ 'profile_picture_meta[' +
+ i +
+ '][' +
+ key +
+ ']',
+ elm[key]
+ );
+ }
+ }
+ }
+ } else {
+ $(
+ '.directorist-form-submit__btn'
+ ).removeClass('atbd_loading');
+ err_log.user_profile_avater = {
+ msg: 'Listing gallery has invalid files',
+ };
+ error_count++;
+ }
+ }
+ var $form = $(this);
+ var arrData = $form.serializeArray();
+ $.each(arrData, function (index, elem) {
+ var name = elem.name;
+ var value = elem.value;
+ form_data.append(name, value);
+ });
+ $.ajax({
+ method: 'POST',
+ processData: false,
+ contentType: false,
+ url: directorist.ajaxurl,
+ data: form_data,
+ success: function success(response) {
+ submit_button.removeAttr('disabled');
+ submit_button.removeClass(
+ 'directorist-loader'
+ );
+
+ // console.log(response);
+
+ if (response.success) {
+ $('#directorist-profile-notice').html(
+ '' +
+ response.data +
+ ' '
+ );
+
+ // Reload if password updated
+ var newPass =
+ form_data.get('user[new_pass]');
+ if (
+ typeof newPass == 'string' &&
+ newPass.length > 0
+ ) {
+ location.reload();
+ return false;
+ }
+ } else {
+ $('#directorist-profile-notice').html(
+ '' +
+ response.data +
+ ' '
+ );
+ }
+ },
+ error: function error(response) {
+ submit_button.removeAttr('disabled');
+ console.log(response);
+ },
+ });
+ // remove notice after five second
+ setTimeout(function () {
+ $(
+ '#directorist-profile-notice .directorist-alert'
+ ).remove();
+ }, 5000);
+
+ // prevent the from submitting
+ return false;
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/lib/dashTab.js':
+ /*!*********************************************!*\
!*** ./assets/src/js/public/lib/dashTab.js ***!
\*********************************************/
-/***/ (function() {
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-/*
+ /***/ function () {
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ /*
Plugin: Dash Tab
Version: 1.0.0
License: MIT
*/
-(function () {
- this.DashTab = function (selector) {
- this.globalSetup = function () {
- if (window.isInitializedDashTab) {
- return;
- }
- window.isInitializedDashTab = true;
- this.activateNavLinkByURL();
- };
- this.activateNavLinkByURL = function () {
- var hash = window.location.hash;
- var queryStrings = null;
-
- // Split the URL into its components
- var urlParts = hash.split(/[?|&]/);
- if (urlParts.length > 1) {
- // Get Hash Link
- var hashLink = urlParts[0];
-
- // Get the search parameters
- queryStrings = JSON.parse(JSON.stringify(urlParts));
- queryStrings.splice(0, 1);
- queryStrings = queryStrings.filter(function (item) {
- return "".concat(item).length;
- });
- queryStrings = queryStrings.join('&');
- window.location.hash = hashLink;
- hash = window.location.hash;
- }
-
- // Activate Current Navigation Item
- var navLinks = document.querySelectorAll('.directorist-tab__nav__link');
- var _iterator = _createForOfIteratorHelper(navLinks),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var link = _step.value;
- var href = link.getAttribute('href');
- var target = link.getAttribute('target');
- if (href === hash || "#".concat(target) === hash || window.location.hash.match(new RegExp("^".concat(href, "$")))) {
- var parent = link.closest('.atbdp_tab_nav--has-child');
- if (parent) {
- var dropdownMenu = parent.querySelector('.atbd-dashboard-nav');
- if (dropdownMenu) {
- dropdownMenu.style.display = 'block';
- }
- }
- link.click();
- break;
- }
- }
-
- // Update Window History
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- if (queryStrings) {
- // Reconstruct the URL with the updated search parameters
- var newUrl = window.location.pathname + window.location.hash + '?' + queryStrings;
- window.history.replaceState(null, null, newUrl);
- }
- };
- this.navLinksSetup = function (selector) {
- var elements = document.querySelectorAll(selector);
- if (!elements.length) return;
- elements.forEach(function (el) {
- var links = el.querySelectorAll('.directorist-tab__nav__link:not(.atbd-dash-nav-dropdown)');
- links.forEach(function (link) {
- link.style.cursor = 'pointer';
- link.addEventListener('click', function (event) {
- event.preventDefault();
- event.stopPropagation();
- var ul = event.target.closest('.directorist-tab__nav'),
- main = ul.nextElementSibling,
- item_link = ul.querySelectorAll('.directorist-tab__nav__link'),
- section = main.querySelectorAll('.directorist-tab__pane');
-
- // Activate Navigation Panel
- item_link.forEach(function (link) {
- link.classList.remove('directorist-tab__nav__active');
- });
- var parentNavRef = event.target.getAttribute('data-parent-nav');
- if (parentNavRef) {
- var parentNav = document.querySelector(parentNavRef);
- if (parentNav) {
- parentNav.classList.add('directorist-tab__nav__active');
- }
- } else {
- var _event$target$closest;
- event.target.classList.add('directorist-tab__nav__active');
- var dropDownToggler = (_event$target$closest = event.target.closest('.atbdp_tab_nav--has-child')) === null || _event$target$closest === void 0 ? void 0 : _event$target$closest.querySelector('.atbd-dash-nav-dropdown');
- if (dropDownToggler && !dropDownToggler.classList.contains('directorist-tab__nav__active')) {
- dropDownToggler.classList.add('directorist-tab__nav__active');
- }
- }
-
- // Activate Content Panel
- section.forEach(function (sectionItem) {
- sectionItem.classList.remove('directorist-tab__pane--active');
- });
- var content_id = event.target.getAttribute('target');
- document.getElementById(content_id).classList.add('directorist-tab__pane--active');
-
- // Add Hash To Window Location
- var hashID = content_id;
- var link = event.target.getAttribute('href');
- if (link) {
- var matchLink = link.match(/#(.+)/);
- hashID = matchLink ? matchLink[1] : hashID;
- }
- var hasMatch = window.location.hash.match(new RegExp("^".concat(link, "$")));
- window.location.hash = hasMatch ? hasMatch[0] : '#' + hashID;
- var newHash = window.location.hash;
- var newUrl = window.location.pathname + newHash;
- window.history.replaceState(null, null, newUrl);
- });
- });
- });
- };
- if (document.querySelector(selector)) {
- this.navLinksSetup(selector);
- this.globalSetup();
- }
- };
-})();
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!***************************************************!*\
+ (function () {
+ this.DashTab = function (selector) {
+ this.globalSetup = function () {
+ if (window.isInitializedDashTab) {
+ return;
+ }
+ window.isInitializedDashTab = true;
+ this.activateNavLinkByURL();
+ };
+ this.activateNavLinkByURL = function () {
+ var hash = window.location.hash;
+ var queryStrings = null;
+
+ // Split the URL into its components
+ var urlParts = hash.split(/[?|&]/);
+ if (urlParts.length > 1) {
+ // Get Hash Link
+ var hashLink = urlParts[0];
+
+ // Get the search parameters
+ queryStrings = JSON.parse(
+ JSON.stringify(urlParts)
+ );
+ queryStrings.splice(0, 1);
+ queryStrings = queryStrings.filter(
+ function (item) {
+ return ''.concat(item).length;
+ }
+ );
+ queryStrings = queryStrings.join('&');
+ window.location.hash = hashLink;
+ hash = window.location.hash;
+ }
+
+ // Activate Current Navigation Item
+ var navLinks = document.querySelectorAll(
+ '.directorist-tab__nav__link'
+ );
+ var _iterator =
+ _createForOfIteratorHelper(navLinks),
+ _step;
+ try {
+ for (
+ _iterator.s();
+ !(_step = _iterator.n()).done;
+
+ ) {
+ var link = _step.value;
+ var href = link.getAttribute('href');
+ var target = link.getAttribute('target');
+ if (
+ href === hash ||
+ '#'.concat(target) === hash ||
+ window.location.hash.match(
+ new RegExp('^'.concat(href, '$'))
+ )
+ ) {
+ var parent = link.closest(
+ '.atbdp_tab_nav--has-child'
+ );
+ if (parent) {
+ var dropdownMenu =
+ parent.querySelector(
+ '.atbd-dashboard-nav'
+ );
+ if (dropdownMenu) {
+ dropdownMenu.style.display =
+ 'block';
+ }
+ }
+ link.click();
+ break;
+ }
+ }
+
+ // Update Window History
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ if (queryStrings) {
+ // Reconstruct the URL with the updated search parameters
+ var newUrl =
+ window.location.pathname +
+ window.location.hash +
+ '?' +
+ queryStrings;
+ window.history.replaceState(null, null, newUrl);
+ }
+ };
+ this.navLinksSetup = function (selector) {
+ var elements = document.querySelectorAll(selector);
+ if (!elements.length) return;
+ elements.forEach(function (el) {
+ var links = el.querySelectorAll(
+ '.directorist-tab__nav__link:not(.atbd-dash-nav-dropdown)'
+ );
+ links.forEach(function (link) {
+ link.style.cursor = 'pointer';
+ link.addEventListener(
+ 'click',
+ function (event) {
+ event.preventDefault();
+ event.stopPropagation();
+ var ul = event.target.closest(
+ '.directorist-tab__nav'
+ ),
+ main = ul.nextElementSibling,
+ item_link = ul.querySelectorAll(
+ '.directorist-tab__nav__link'
+ ),
+ section = main.querySelectorAll(
+ '.directorist-tab__pane'
+ );
+
+ // Activate Navigation Panel
+ item_link.forEach(function (link) {
+ link.classList.remove(
+ 'directorist-tab__nav__active'
+ );
+ });
+ var parentNavRef =
+ event.target.getAttribute(
+ 'data-parent-nav'
+ );
+ if (parentNavRef) {
+ var parentNav =
+ document.querySelector(
+ parentNavRef
+ );
+ if (parentNav) {
+ parentNav.classList.add(
+ 'directorist-tab__nav__active'
+ );
+ }
+ } else {
+ var _event$target$closest;
+ event.target.classList.add(
+ 'directorist-tab__nav__active'
+ );
+ var dropDownToggler =
+ (_event$target$closest =
+ event.target.closest(
+ '.atbdp_tab_nav--has-child'
+ )) === null ||
+ _event$target$closest ===
+ void 0
+ ? void 0
+ : _event$target$closest.querySelector(
+ '.atbd-dash-nav-dropdown'
+ );
+ if (
+ dropDownToggler &&
+ !dropDownToggler.classList.contains(
+ 'directorist-tab__nav__active'
+ )
+ ) {
+ dropDownToggler.classList.add(
+ 'directorist-tab__nav__active'
+ );
+ }
+ }
+
+ // Activate Content Panel
+ section.forEach(
+ function (sectionItem) {
+ sectionItem.classList.remove(
+ 'directorist-tab__pane--active'
+ );
+ }
+ );
+ var content_id =
+ event.target.getAttribute(
+ 'target'
+ );
+ document
+ .getElementById(content_id)
+ .classList.add(
+ 'directorist-tab__pane--active'
+ );
+
+ // Add Hash To Window Location
+ var hashID = content_id;
+ var link =
+ event.target.getAttribute(
+ 'href'
+ );
+ if (link) {
+ var matchLink =
+ link.match(/#(.+)/);
+ hashID = matchLink
+ ? matchLink[1]
+ : hashID;
+ }
+ var hasMatch =
+ window.location.hash.match(
+ new RegExp(
+ '^'.concat(link, '$')
+ )
+ );
+ window.location.hash = hasMatch
+ ? hasMatch[0]
+ : '#' + hashID;
+ var newHash = window.location.hash;
+ var newUrl =
+ window.location.pathname +
+ newHash;
+ window.history.replaceState(
+ null,
+ null,
+ newUrl
+ );
+ }
+ );
+ });
+ });
+ };
+ if (document.querySelector(selector)) {
+ this.navLinksSetup(selector);
+ this.globalSetup();
+ }
+ };
+ })();
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!***************************************************!*\
!*** ./assets/src/js/public/modules/dashboard.js ***!
\***************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _lib_dashTab__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/dashTab */ "./assets/src/js/public/lib/dashTab.js");
-/* harmony import */ var _lib_dashTab__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_lib_dashTab__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _components_dashboard_dashboardSidebar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/dashboard/dashboardSidebar */ "./assets/src/js/public/components/dashboard/dashboardSidebar.js");
-/* harmony import */ var _components_dashboard_dashboardSidebar__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_dashboard_dashboardSidebar__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _components_dashboard_dashboardTab__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/dashboard/dashboardTab */ "./assets/src/js/public/components/dashboard/dashboardTab.js");
-/* harmony import */ var _components_dashboard_dashboardTab__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_components_dashboard_dashboardTab__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _components_dashboard_dashboardListing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/dashboard/dashboardListing */ "./assets/src/js/public/components/dashboard/dashboardListing.js");
-/* harmony import */ var _components_dashboard_dashboardListing__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_components_dashboard_dashboardListing__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var _components_dashboard_dashBoardMoreBtn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/dashboard/dashBoardMoreBtn */ "./assets/src/js/public/components/dashboard/dashBoardMoreBtn.js");
-/* harmony import */ var _components_dashboard_dashboardResponsive__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/dashboard/dashboardResponsive */ "./assets/src/js/public/components/dashboard/dashboardResponsive.js");
-/* harmony import */ var _components_dashboard_dashboardResponsive__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_components_dashboard_dashboardResponsive__WEBPACK_IMPORTED_MODULE_5__);
-/* harmony import */ var _components_dashboard_dashboardAnnouncement__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/dashboard/dashboardAnnouncement */ "./assets/src/js/public/components/dashboard/dashboardAnnouncement.js");
-/* harmony import */ var _components_dashboard_dashboardAnnouncement__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_dashboard_dashboardAnnouncement__WEBPACK_IMPORTED_MODULE_6__);
-/* harmony import */ var _components_dashboard_dashboardBecomeAuthor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/dashboard/dashboardBecomeAuthor */ "./assets/src/js/public/components/dashboard/dashboardBecomeAuthor.js");
-/* harmony import */ var _components_dashboard_dashboardBecomeAuthor__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_components_dashboard_dashboardBecomeAuthor__WEBPACK_IMPORTED_MODULE_7__);
-/* harmony import */ var _components_profileForm__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/profileForm */ "./assets/src/js/public/components/profileForm.js");
-/* harmony import */ var _components_profileForm__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_components_profileForm__WEBPACK_IMPORTED_MODULE_8__);
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/directoristDropdown */ "./assets/src/js/public/components/directoristDropdown.js");
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__);
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/directoristSelect */ "./assets/src/js/public/components/directoristSelect.js");
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__);
-/* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../components/legacy-support */ "./assets/src/js/public/components/legacy-support.js");
-/* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_components_legacy_support__WEBPACK_IMPORTED_MODULE_11__);
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../components/directoristFavorite */ "./assets/src/js/public/components/directoristFavorite.js");
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_components_directoristFavorite__WEBPACK_IMPORTED_MODULE_12__);
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../components/directoristAlert */ "./assets/src/js/public/components/directoristAlert.js");
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_components_directoristAlert__WEBPACK_IMPORTED_MODULE_13__);
-/* harmony import */ var _components_preferenceForm__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../components/preferenceForm */ "./assets/src/js/public/components/preferenceForm.js");
-/* harmony import */ var _components_preferenceForm__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_components_preferenceForm__WEBPACK_IMPORTED_MODULE_14__);
-// Lib
-
-
-// Dashboard Js
-
-
-
-
-
-
-
-
-// General Components
-// import '../components/tab';
-
-
-
-
-
-
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=directorist-dashboard.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _lib_dashTab__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../lib/dashTab */ './assets/src/js/public/lib/dashTab.js'
+ );
+ /* harmony import */ var _lib_dashTab__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _lib_dashTab__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _components_dashboard_dashboardSidebar__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashboardSidebar */ './assets/src/js/public/components/dashboard/dashboardSidebar.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardSidebar__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_dashboard_dashboardSidebar__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _components_dashboard_dashboardTab__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashboardTab */ './assets/src/js/public/components/dashboard/dashboardTab.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardTab__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_dashboard_dashboardTab__WEBPACK_IMPORTED_MODULE_2__
+ );
+ /* harmony import */ var _components_dashboard_dashboardListing__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashboardListing */ './assets/src/js/public/components/dashboard/dashboardListing.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardListing__WEBPACK_IMPORTED_MODULE_3___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_dashboard_dashboardListing__WEBPACK_IMPORTED_MODULE_3__
+ );
+ /* harmony import */ var _components_dashboard_dashBoardMoreBtn__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashBoardMoreBtn */ './assets/src/js/public/components/dashboard/dashBoardMoreBtn.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardResponsive__WEBPACK_IMPORTED_MODULE_5__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashboardResponsive */ './assets/src/js/public/components/dashboard/dashboardResponsive.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardResponsive__WEBPACK_IMPORTED_MODULE_5___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_dashboard_dashboardResponsive__WEBPACK_IMPORTED_MODULE_5__
+ );
+ /* harmony import */ var _components_dashboard_dashboardAnnouncement__WEBPACK_IMPORTED_MODULE_6__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashboardAnnouncement */ './assets/src/js/public/components/dashboard/dashboardAnnouncement.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardAnnouncement__WEBPACK_IMPORTED_MODULE_6___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_dashboard_dashboardAnnouncement__WEBPACK_IMPORTED_MODULE_6__
+ );
+ /* harmony import */ var _components_dashboard_dashboardBecomeAuthor__WEBPACK_IMPORTED_MODULE_7__ =
+ __webpack_require__(
+ /*! ../components/dashboard/dashboardBecomeAuthor */ './assets/src/js/public/components/dashboard/dashboardBecomeAuthor.js'
+ );
+ /* harmony import */ var _components_dashboard_dashboardBecomeAuthor__WEBPACK_IMPORTED_MODULE_7___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_dashboard_dashboardBecomeAuthor__WEBPACK_IMPORTED_MODULE_7__
+ );
+ /* harmony import */ var _components_profileForm__WEBPACK_IMPORTED_MODULE_8__ =
+ __webpack_require__(
+ /*! ../components/profileForm */ './assets/src/js/public/components/profileForm.js'
+ );
+ /* harmony import */ var _components_profileForm__WEBPACK_IMPORTED_MODULE_8___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_profileForm__WEBPACK_IMPORTED_MODULE_8__
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__ =
+ __webpack_require__(
+ /*! ../components/directoristDropdown */ './assets/src/js/public/components/directoristDropdown.js'
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__ =
+ __webpack_require__(
+ /*! ../components/directoristSelect */ './assets/src/js/public/components/directoristSelect.js'
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__
+ );
+ /* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_11__ =
+ __webpack_require__(
+ /*! ../components/legacy-support */ './assets/src/js/public/components/legacy-support.js'
+ );
+ /* harmony import */ var _components_legacy_support__WEBPACK_IMPORTED_MODULE_11___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_legacy_support__WEBPACK_IMPORTED_MODULE_11__
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_12__ =
+ __webpack_require__(
+ /*! ../components/directoristFavorite */ './assets/src/js/public/components/directoristFavorite.js'
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_12___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_12__
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_13__ =
+ __webpack_require__(
+ /*! ../components/directoristAlert */ './assets/src/js/public/components/directoristAlert.js'
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_13___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristAlert__WEBPACK_IMPORTED_MODULE_13__
+ );
+ /* harmony import */ var _components_preferenceForm__WEBPACK_IMPORTED_MODULE_14__ =
+ __webpack_require__(
+ /*! ../components/preferenceForm */ './assets/src/js/public/components/preferenceForm.js'
+ );
+ /* harmony import */ var _components_preferenceForm__WEBPACK_IMPORTED_MODULE_14___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_preferenceForm__WEBPACK_IMPORTED_MODULE_14__
+ );
+ // Lib
+
+ // Dashboard Js
+
+ // General Components
+ // import '../components/tab';
+ })();
+ /******/
+})();
+//# sourceMappingURL=directorist-dashboard.js.map
diff --git a/assets/js/directorist-plupload.js b/assets/js/directorist-plupload.js
index b5a72e8c1..f55f04628 100644
--- a/assets/js/directorist-plupload.js
+++ b/assets/js/directorist-plupload.js
@@ -1,512 +1,849 @@
-/******/ (function() { // webpackBootstrap
-/******/ "use strict";
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ 'use strict';
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = " ");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ ' '
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ ''.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
-/***/ })
+ /***/
+ },
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
-!function() {
-/*!******************************************************!*\
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
+ !(function () {
+ /*!******************************************************!*\
!*** ./assets/src/js/global/directorist-plupload.js ***!
\******************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../lib/helper */ "./assets/src/js/lib/helper.js");
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./../lib/helper */ './assets/src/js/lib/helper.js'
+ );
-jQuery.fn.exists = function () {
- return jQuery(this).length > 0;
-};
-var atbdp_plupload_params = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('atbdp_plupload_params');
-var atbdp_params = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('atbdp_params');
-var $ = jQuery;
+ jQuery.fn.exists = function () {
+ return jQuery(this).length > 0;
+ };
+ var atbdp_plupload_params = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)(
+ 'atbdp_plupload_params'
+ );
+ var atbdp_params = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('atbdp_params');
+ var $ = jQuery;
-// Init
-if (atbdp_plupload_params) {
- jQuery(document).ready(init);
- window.addEventListener('directorist-reload-plupload', init);
-}
-function init() {
- atbdp_plupload_params = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('atbdp_plupload_params');
- atbdp_params = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('atbdp_params');
- if ($('.plupload-upload-uic').exists()) {
- var pluploadConfig, msgErr, post_id;
+ // Init
+ if (atbdp_plupload_params) {
+ jQuery(document).ready(init);
+ window.addEventListener('directorist-reload-plupload', init);
+ }
+ function init() {
+ atbdp_plupload_params = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)(
+ 'atbdp_plupload_params'
+ );
+ atbdp_params = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)(
+ 'atbdp_params'
+ );
+ if ($('.plupload-upload-uic').exists()) {
+ var pluploadConfig, msgErr, post_id;
- // set the post id
- if (jQuery("#atbdpectory-add-post input[name='ID']").length) {
- post_id = jQuery("#atbdpectory-add-post input[name='ID']").val(); // frontend
- } else {
- post_id = jQuery("#post input[name='post_ID']").val(); // backend
- }
- $('.plupload-upload-uic').each(function (ind, el) {
- var $this = $(this);
- var imgId = $this.attr('id').replace('plupload-upload-ui', '');
- var $errorHolder = jQuery('#' + imgId + 'upload-error');
- plu_show_thumbs(imgId);
- pluploadConfig = JSON.parse(atbdp_plupload_params.base_plupload_config);
- pluploadConfig['browse_button'] = imgId + pluploadConfig['browse_button'];
- pluploadConfig['container'] = imgId + pluploadConfig['container'];
- if (jQuery('#' + imgId + 'dropbox').length) {
- pluploadConfig['drop_element'] = imgId + 'dropbox';
- } // only add drop area if there is one
+ // set the post id
+ if (jQuery("#atbdpectory-add-post input[name='ID']").length) {
+ post_id = jQuery(
+ "#atbdpectory-add-post input[name='ID']"
+ ).val(); // frontend
+ } else {
+ post_id = jQuery("#post input[name='post_ID']").val(); // backend
+ }
+ $('.plupload-upload-uic').each(function (ind, el) {
+ var $this = $(this);
+ var imgId = $this
+ .attr('id')
+ .replace('plupload-upload-ui', '');
+ var $errorHolder = jQuery('#' + imgId + 'upload-error');
+ plu_show_thumbs(imgId);
+ pluploadConfig = JSON.parse(
+ atbdp_plupload_params.base_plupload_config
+ );
+ pluploadConfig['browse_button'] =
+ imgId + pluploadConfig['browse_button'];
+ pluploadConfig['container'] =
+ imgId + pluploadConfig['container'];
+ if (jQuery('#' + imgId + 'dropbox').length) {
+ pluploadConfig['drop_element'] = imgId + 'dropbox';
+ } // only add drop area if there is one
- pluploadConfig['file_data_name'] = imgId + pluploadConfig['file_data_name'];
- pluploadConfig['multipart_params']['imgid'] = imgId;
- pluploadConfig['multipart_params']['post_id'] = post_id;
- pluploadConfig['max_file_size'] = $('#' + imgId + '_file_size').val();
- if ($this.hasClass('plupload-upload-uic-multiple')) {
- pluploadConfig['multi_selection'] = true;
- }
- var allowed_exts = jQuery('#' + imgId + '_allowed_types').val();
- allowed_exts = allowed_exts && allowed_exts != '' ? allowed_exts : '';
- if (imgId == 'post_images' && typeof atbdp_params.atbdp_allowed_img_types != 'undefined' && atbdp_params.atbdp_allowed_img_types != '') {
- allowed_exts = atbdp_params.atbdp_allowed_img_types;
- }
- if (allowed_exts && allowed_exts != '') {
- var txt_all_files = typeof atbdp_params.txt_all_files != 'undefined' && atbdp_params.txt_all_files != '' ? atbdp_params.txt_all_files : 'Allowed files';
- pluploadConfig['filters'] = [{
- title: txt_all_files,
- extensions: allowed_exts
- }];
- }
- var uploader = new plupload.Uploader(pluploadConfig);
- uploader.bind('Init', function (up, params) {
- if (uploader.features.dragdrop) {
- var drop_id = imgId + 'dropbox';
- var target = jQuery('#' + drop_id);
- target.on('dragenter', function (event) {
- target.addClass('dragover');
- });
- target.on('dragleave', function (event) {
- target.removeClass('dragover');
- });
- target.on('drop', function () {
- target.removeClass('dragover');
- });
- }
- });
- uploader.init();
- uploader.bind('Error', function (up, files) {
- var errorMessage;
- $errorHolder.addClass('upload-error');
- if (files.code == -600) {
- if (typeof atbdp_params.err_max_file_size != 'undefined' && atbdp_params.err_max_file_size != '') {
- errorMessage = atbdp_params.err_max_file_size;
- } else {
- errorMessage = 'File size error : You tried to upload a file over %s';
- }
- errorMessage = errorMessage.replace('%s', $('#' + imgId + '_file_size').val());
- } else if (files.code == -601) {
- if (typeof atbdp_params.err_file_type != 'undefined' && atbdp_params.err_file_type != '') {
- errorMessage = atbdp_params.err_file_type;
- } else {
- errorMessage = 'File type error. Allowed file types: %s';
- }
- if (imgId == 'post_images') {
- var txtReplace = allowed_exts != '' ? '.' + allowed_exts.replace(/,/g, ', .') : '*';
- errorMessage = errorMessage.replace('%s', txtReplace);
- } else {
- errorMessage = errorMessage.replace('%s', jQuery('#' + imgId + '_allowed_types').attr('data-exts'));
- }
- } else {
- errorMessage = files.message;
- }
- $errorHolder.html(errorMessage);
- });
+ pluploadConfig['file_data_name'] =
+ imgId + pluploadConfig['file_data_name'];
+ pluploadConfig['multipart_params']['imgid'] = imgId;
+ pluploadConfig['multipart_params']['post_id'] = post_id;
+ pluploadConfig['max_file_size'] = $(
+ '#' + imgId + '_file_size'
+ ).val();
+ if ($this.hasClass('plupload-upload-uic-multiple')) {
+ pluploadConfig['multi_selection'] = true;
+ }
+ var allowed_exts = jQuery(
+ '#' + imgId + '_allowed_types'
+ ).val();
+ allowed_exts =
+ allowed_exts && allowed_exts != '' ? allowed_exts : '';
+ if (
+ imgId == 'post_images' &&
+ typeof atbdp_params.atbdp_allowed_img_types !=
+ 'undefined' &&
+ atbdp_params.atbdp_allowed_img_types != ''
+ ) {
+ allowed_exts = atbdp_params.atbdp_allowed_img_types;
+ }
+ if (allowed_exts && allowed_exts != '') {
+ var txt_all_files =
+ typeof atbdp_params.txt_all_files != 'undefined' &&
+ atbdp_params.txt_all_files != ''
+ ? atbdp_params.txt_all_files
+ : 'Allowed files';
+ pluploadConfig['filters'] = [
+ {
+ title: txt_all_files,
+ extensions: allowed_exts,
+ },
+ ];
+ }
+ var uploader = new plupload.Uploader(pluploadConfig);
+ uploader.bind('Init', function (up, params) {
+ if (uploader.features.dragdrop) {
+ var drop_id = imgId + 'dropbox';
+ var target = jQuery('#' + drop_id);
+ target.on('dragenter', function (event) {
+ target.addClass('dragover');
+ });
+ target.on('dragleave', function (event) {
+ target.removeClass('dragover');
+ });
+ target.on('drop', function () {
+ target.removeClass('dragover');
+ });
+ }
+ });
+ uploader.init();
+ uploader.bind('Error', function (up, files) {
+ var errorMessage;
+ $errorHolder.addClass('upload-error');
+ if (files.code == -600) {
+ if (
+ typeof atbdp_params.err_max_file_size !=
+ 'undefined' &&
+ atbdp_params.err_max_file_size != ''
+ ) {
+ errorMessage = atbdp_params.err_max_file_size;
+ } else {
+ errorMessage =
+ 'File size error : You tried to upload a file over %s';
+ }
+ errorMessage = errorMessage.replace(
+ '%s',
+ $('#' + imgId + '_file_size').val()
+ );
+ } else if (files.code == -601) {
+ if (
+ typeof atbdp_params.err_file_type !=
+ 'undefined' &&
+ atbdp_params.err_file_type != ''
+ ) {
+ errorMessage = atbdp_params.err_file_type;
+ } else {
+ errorMessage =
+ 'File type error. Allowed file types: %s';
+ }
+ if (imgId == 'post_images') {
+ var txtReplace =
+ allowed_exts != ''
+ ? '.' +
+ allowed_exts.replace(/,/g, ', .')
+ : '*';
+ errorMessage = errorMessage.replace(
+ '%s',
+ txtReplace
+ );
+ } else {
+ errorMessage = errorMessage.replace(
+ '%s',
+ jQuery('#' + imgId + '_allowed_types').attr(
+ 'data-exts'
+ )
+ );
+ }
+ } else {
+ errorMessage = files.message;
+ }
+ $errorHolder.html(errorMessage);
+ });
- //a file was added in the queue
- //totalImg = atbdp_plupload_params.totalImg;
- //limitImg = atbdp_plupload_params.image_limit;
- uploader.bind('FilesAdded', function (up, files) {
- var totalImg = parseInt(jQuery('#' + imgId + 'totImg').val());
- var limitImg = parseInt(jQuery('#' + imgId + 'image_limit').val());
- $errorHolder.html('').removeClass('upload-error');
- if (limitImg && $this.hasClass('plupload-upload-uic-multiple') && limitImg > 0) {
- if (totalImg >= limitImg && limitImg > 0) {
- while (up.files.length > 0) {
- up.removeFile(up.files[0]);
- } // remove images
+ //a file was added in the queue
+ //totalImg = atbdp_plupload_params.totalImg;
+ //limitImg = atbdp_plupload_params.image_limit;
+ uploader.bind('FilesAdded', function (up, files) {
+ var totalImg = parseInt(
+ jQuery('#' + imgId + 'totImg').val()
+ );
+ var limitImg = parseInt(
+ jQuery('#' + imgId + 'image_limit').val()
+ );
+ $errorHolder.html('').removeClass('upload-error');
+ if (
+ limitImg &&
+ $this.hasClass('plupload-upload-uic-multiple') &&
+ limitImg > 0
+ ) {
+ if (totalImg >= limitImg && limitImg > 0) {
+ while (up.files.length > 0) {
+ up.removeFile(up.files[0]);
+ } // remove images
- if (typeof atbdp_params.err_file_upload_limit != 'undefined' && atbdp_params.err_file_upload_limit != '') {
- msgErr = atbdp_params.err_file_upload_limit;
- } else {
- msgErr = 'You have reached your upload limit of %s files.';
- }
- msgErr = msgErr.replace('%s', limitImg);
- $errorHolder.addClass('upload-error').html(msgErr);
- return false;
- }
- if (up.files.length > limitImg && limitImg > 0) {
- while (up.files.length > 0) {
- up.removeFile(up.files[0]);
- } // remove images
+ if (
+ typeof atbdp_params.err_file_upload_limit !=
+ 'undefined' &&
+ atbdp_params.err_file_upload_limit != ''
+ ) {
+ msgErr = atbdp_params.err_file_upload_limit;
+ } else {
+ msgErr =
+ 'You have reached your upload limit of %s files.';
+ }
+ msgErr = msgErr.replace('%s', limitImg);
+ $errorHolder
+ .addClass('upload-error')
+ .html(msgErr);
+ return false;
+ }
+ if (up.files.length > limitImg && limitImg > 0) {
+ while (up.files.length > 0) {
+ up.removeFile(up.files[0]);
+ } // remove images
- if (typeof atbdp_params.err_pkg_upload_limit != 'undefined' && atbdp_params.err_pkg_upload_limit != '') {
- msgErr = atbdp_params.err_pkg_upload_limit;
- } else {
- msgErr = 'You may only upload %s files with this package, please try again.';
- }
- msgErr = msgErr.replace('%s', limitImg);
- $errorHolder.addClass('upload-error').html(msgErr);
- return false;
- }
- }
- $.each(files, function (i, file) {
- $this.find('.filelist').append('' + file.name + ' (
' + plupload.formatSize(0) + ' /' + plupload.formatSize(file.size) + ') ' + '
');
- });
- up.refresh();
- up.start();
- });
- uploader.bind('UploadProgress', function (up, file) {
- $('#' + file.id + ' .fileprogress').width(file.percent + '%');
- $('#' + file.id + ' span').html(plupload.formatSize(parseInt(file.size * file.percent / 100)));
- });
- var timer;
- var i = 0;
- var indexes = new Array();
- uploader.bind('FileUploaded', function (up, file, response) {
- response = JSON.parse(response['response']);
- if (!response.success) {
- $errorHolder.addClass('upload-error').html(response.data);
- return;
- }
+ if (
+ typeof atbdp_params.err_pkg_upload_limit !=
+ 'undefined' &&
+ atbdp_params.err_pkg_upload_limit != ''
+ ) {
+ msgErr = atbdp_params.err_pkg_upload_limit;
+ } else {
+ msgErr =
+ 'You may only upload %s files with this package, please try again.';
+ }
+ msgErr = msgErr.replace('%s', limitImg);
+ $errorHolder
+ .addClass('upload-error')
+ .html(msgErr);
+ return false;
+ }
+ }
+ $.each(files, function (i, file) {
+ $this
+ .find('.filelist')
+ .append(
+ '' +
+ file.name +
+ ' (
' +
+ plupload.formatSize(0) +
+ ' /' +
+ plupload.formatSize(file.size) +
+ ') ' +
+ '
'
+ );
+ });
+ up.refresh();
+ up.start();
+ });
+ uploader.bind('UploadProgress', function (up, file) {
+ $('#' + file.id + ' .fileprogress').width(
+ file.percent + '%'
+ );
+ $('#' + file.id + ' span').html(
+ plupload.formatSize(
+ parseInt((file.size * file.percent) / 100)
+ )
+ );
+ });
+ var timer;
+ var i = 0;
+ var indexes = new Array();
+ uploader.bind(
+ 'FileUploaded',
+ function (up, file, response) {
+ response = JSON.parse(response['response']);
+ if (!response.success) {
+ $errorHolder
+ .addClass('upload-error')
+ .html(response.data);
+ return;
+ }
- //up.removeFile(up.files[0]); // remove images
- var totalImg = parseInt(jQuery('#' + imgId + 'totImg').val());
- indexes[i] = up;
- i++;
- $('#' + file.id).fadeOut();
+ //up.removeFile(up.files[0]); // remove images
+ var totalImg = parseInt(
+ jQuery('#' + imgId + 'totImg').val()
+ );
+ indexes[i] = up;
+ i++;
+ $('#' + file.id).fadeOut();
- // add url to the hidden field
- if ($this.hasClass('plupload-upload-uic-multiple')) {
- totalImg++;
- jQuery('#' + imgId + 'totImg').val(totalImg);
- // multiple
- var v1 = $.trim($('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val());
- if (v1) {
- v1 = v1 + '::' + response.data;
- } else {
- v1 = response.data;
- }
- $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val(v1);
- //console.log(v1);
- } else {
- // single
- $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val(response.data + '');
- //console.log(response);
- }
- // show thumbs
- plu_show_thumbs(imgId);
- });
- Error;
- });
- }
-}
-function atbdp_esc_entities(str) {
- var entityMap = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": ''',
- '/': '/',
- '`': '`',
- '=': '='
- };
- return String(str).replace(/[&<>"'`=\/]/g, function (s) {
- return entityMap[s];
- });
-}
-function atbdp_remove_file_index(indexes) {
- for (var i = 0; i < indexes.length; i++) {
- if (indexes[i].files.length > 0) {
- indexes[i].removeFile(indexes[i].files[0]);
- }
- }
-}
-function plu_show_thumbs(imgId) {
- //console.log("plu_show_thumbs");
- var totalImg = parseInt(jQuery('#' + imgId + 'totImg').val());
- var limitImg = parseInt(jQuery('#' + imgId + 'image_limit').val());
- var $ = jQuery;
- var thumbsC = $('#' + imgId + 'plupload-thumbs');
- thumbsC.html('');
- // get urls
- var imagesS = $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val();
- var txtRemove = 'Remove';
- if (typeof atbdp_params.action_remove != 'undefined' && atbdp_params.action_remove != '') {
- txtRemove = atbdp_params.action_remove;
- }
- if (!imagesS) {
- return;
- }
- var images = imagesS.split('::');
- for (var i = 0; i < images.length; i++) {
- if (images[i] && images[i] != 'null') {
- var img_arr = images[i].split('|');
- var image_url = img_arr[0];
- var image_id = img_arr[1];
- var image_title = img_arr[2];
- var image_caption = img_arr[3];
- var image_title_html = '';
- var image_caption_html = '';
+ // add url to the hidden field
+ if (
+ $this.hasClass('plupload-upload-uic-multiple')
+ ) {
+ totalImg++;
+ jQuery('#' + imgId + 'totImg').val(totalImg);
+ // multiple
+ var v1 = $.trim(
+ $(
+ '#' + imgId,
+ $(
+ '#' + imgId + 'plupload-upload-ui'
+ ).parent()
+ ).val()
+ );
+ if (v1) {
+ v1 = v1 + '::' + response.data;
+ } else {
+ v1 = response.data;
+ }
+ $(
+ '#' + imgId,
+ $(
+ '#' + imgId + 'plupload-upload-ui'
+ ).parent()
+ ).val(v1);
+ //console.log(v1);
+ } else {
+ // single
+ $(
+ '#' + imgId,
+ $(
+ '#' + imgId + 'plupload-upload-ui'
+ ).parent()
+ ).val(response.data + '');
+ //console.log(response);
+ }
+ // show thumbs
+ plu_show_thumbs(imgId);
+ }
+ );
+ Error;
+ });
+ }
+ }
+ function atbdp_esc_entities(str) {
+ var entityMap = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": ''',
+ '/': '/',
+ '`': '`',
+ '=': '=',
+ };
+ return String(str).replace(/[&<>"'`=\/]/g, function (s) {
+ return entityMap[s];
+ });
+ }
+ function atbdp_remove_file_index(indexes) {
+ for (var i = 0; i < indexes.length; i++) {
+ if (indexes[i].files.length > 0) {
+ indexes[i].removeFile(indexes[i].files[0]);
+ }
+ }
+ }
+ function plu_show_thumbs(imgId) {
+ //console.log("plu_show_thumbs");
+ var totalImg = parseInt(jQuery('#' + imgId + 'totImg').val());
+ var limitImg = parseInt(jQuery('#' + imgId + 'image_limit').val());
+ var $ = jQuery;
+ var thumbsC = $('#' + imgId + 'plupload-thumbs');
+ thumbsC.html('');
+ // get urls
+ var imagesS = $(
+ '#' + imgId,
+ $('#' + imgId + 'plupload-upload-ui').parent()
+ ).val();
+ var txtRemove = 'Remove';
+ if (
+ typeof atbdp_params.action_remove != 'undefined' &&
+ atbdp_params.action_remove != ''
+ ) {
+ txtRemove = atbdp_params.action_remove;
+ }
+ if (!imagesS) {
+ return;
+ }
+ var images = imagesS.split('::');
+ for (var i = 0; i < images.length; i++) {
+ if (images[i] && images[i] != 'null') {
+ var img_arr = images[i].split('|');
+ var image_url = img_arr[0];
+ var image_id = img_arr[1];
+ var image_title = img_arr[2];
+ var image_caption = img_arr[3];
+ var image_title_html = '';
+ var image_caption_html = '';
- // fix undefined id
- if (typeof image_id === 'undefined') {
- image_id = '';
- }
- // fix undefined title
- if (typeof image_title === 'undefined') {
- image_title = '';
- }
- // fix undefined title
- if (typeof image_caption === 'undefined') {
- image_caption = '';
- }
+ // fix undefined id
+ if (typeof image_id === 'undefined') {
+ image_id = '';
+ }
+ // fix undefined title
+ if (typeof image_title === 'undefined') {
+ image_title = '';
+ }
+ // fix undefined title
+ if (typeof image_caption === 'undefined') {
+ image_caption = '';
+ }
- //Esc title and caption
- image_title = atbdp_esc_entities(image_title);
- image_caption = atbdp_esc_entities(image_caption);
- var file_ext = image_url.substring(image_url.lastIndexOf('.') + 1);
- file_ext = file_ext.split('?').shift(); // in case the image url has params
- if (file_ext) {
- file_ext = file_ext.toLowerCase();
- }
- var fileNameIndex = image_url.lastIndexOf('/') + 1;
- var dotIndex = image_url.lastIndexOf('.');
- if (dotIndex < fileNameIndex) {
- continue;
- }
- var file_name = image_url.substr(fileNameIndex, dotIndex < fileNameIndex ? loc.length : dotIndex);
- var file_display = '';
- var file_display_class = '';
- if (file_ext == 'jpg' || file_ext == 'jpe' || file_ext == 'jpeg' || file_ext == 'png' || file_ext == 'gif' || file_ext == 'bmp' || file_ext == 'ico') {
- file_display = ' ';
- if (!!image_title.trim()) {
- image_title_html = '' + image_title + ' ';
- }
- if (!!image_caption.trim()) {
- image_caption_html = '' + image_caption + ' ';
- }
- } else {
- var file_type_class = 'la-file';
- if (file_ext == 'pdf') {
- file_type_class = 'la-file-pdf-o';
- } else if (file_ext == 'zip' || file_ext == 'tar') {
- file_type_class = 'la-file-zip-o';
- } else if (file_ext == 'doc' || file_ext == 'odt') {
- file_type_class = 'la-file-word-0';
- } else if (file_ext == 'txt' || file_ext == 'text') {
- file_type_class = 'la-file-text-0';
- } else if (file_ext == 'csv' || file_ext == 'ods' || file_ext == 'ots') {
- file_type_class = 'la-file-excel-0';
- } else if (file_ext == 'avi' || file_ext == 'mp4' || file_ext == 'mov') {
- file_type_class = 'la-file-video-0';
- }
- file_display_class = 'file-thumb';
- file_display = ' ';
- }
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/trash-alt.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var thumb = $('' + image_title_html + file_display + image_caption_html + '
' + '' + iconHTML + ' ' + '
' + '
');
- thumbsC.append(thumb);
- thumb.find('.thumbremovelink').click(function () {
- //console.log("plu_show_thumbs-thumbremovelink");
- if (jQuery('#' + imgId + 'plupload-upload-ui').hasClass('plupload-upload-uic-multiple')) {
- totalImg--; // remove image from total
- jQuery('#' + imgId + 'totImg').val(totalImg);
- }
- jQuery('#' + imgId + 'upload-error').html('');
- jQuery('#' + imgId + 'upload-error').removeClass('upload-error');
- var ki = $(this).attr('id').replace('thumbremovelink' + imgId, '');
- ki = parseInt(ki);
- var kimages = [];
- imagesS = $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val();
- images = imagesS.split('::');
- for (var j = 0; j < images.length; j++) {
- if (j != ki) {
- kimages[kimages.length] = images[j];
- }
- }
- $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val(kimages.join('::'));
- //console.log("plu_show_thumbs-thumbremovelink-run");
- plu_show_thumbs(imgId);
- return false;
- });
- }
- }
- if (images.length > 1) {
- //console.log("plu_show_thumbs-sortable");
- thumbsC.sortable({
- update: function update(event, ui) {
- var kimages = [];
- thumbsC.find('.atbdp-file-info').each(function () {
- kimages[kimages.length] = $(this).data('src') + '|' + $(this).data('id') + '|' + $(this).data('title') + '|' + $(this).data('caption');
- $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val(kimages.join('::'));
- plu_show_thumbs(imgId);
- //console.log("plu_show_thumbs-sortable-run");
- });
- }
- });
- thumbsC.disableSelection();
- }
+ //Esc title and caption
+ image_title = atbdp_esc_entities(image_title);
+ image_caption = atbdp_esc_entities(image_caption);
+ var file_ext = image_url.substring(
+ image_url.lastIndexOf('.') + 1
+ );
+ file_ext = file_ext.split('?').shift(); // in case the image url has params
+ if (file_ext) {
+ file_ext = file_ext.toLowerCase();
+ }
+ var fileNameIndex = image_url.lastIndexOf('/') + 1;
+ var dotIndex = image_url.lastIndexOf('.');
+ if (dotIndex < fileNameIndex) {
+ continue;
+ }
+ var file_name = image_url.substr(
+ fileNameIndex,
+ dotIndex < fileNameIndex ? loc.length : dotIndex
+ );
+ var file_display = '';
+ var file_display_class = '';
+ if (
+ file_ext == 'jpg' ||
+ file_ext == 'jpe' ||
+ file_ext == 'jpeg' ||
+ file_ext == 'png' ||
+ file_ext == 'gif' ||
+ file_ext == 'bmp' ||
+ file_ext == 'ico'
+ ) {
+ file_display =
+ ' ';
+ if (!!image_title.trim()) {
+ image_title_html =
+ '' +
+ image_title +
+ ' ';
+ }
+ if (!!image_caption.trim()) {
+ image_caption_html =
+ '' +
+ image_caption +
+ ' ';
+ }
+ } else {
+ var file_type_class = 'la-file';
+ if (file_ext == 'pdf') {
+ file_type_class = 'la-file-pdf-o';
+ } else if (file_ext == 'zip' || file_ext == 'tar') {
+ file_type_class = 'la-file-zip-o';
+ } else if (file_ext == 'doc' || file_ext == 'odt') {
+ file_type_class = 'la-file-word-0';
+ } else if (file_ext == 'txt' || file_ext == 'text') {
+ file_type_class = 'la-file-text-0';
+ } else if (
+ file_ext == 'csv' ||
+ file_ext == 'ods' ||
+ file_ext == 'ots'
+ ) {
+ file_type_class = 'la-file-excel-0';
+ } else if (
+ file_ext == 'avi' ||
+ file_ext == 'mp4' ||
+ file_ext == 'mov'
+ ) {
+ file_type_class = 'la-file-video-0';
+ }
+ file_display_class = 'file-thumb';
+ file_display =
+ ' ';
+ }
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/trash-alt.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ var thumb = $(
+ '' +
+ image_title_html +
+ file_display +
+ image_caption_html +
+ '
' +
+ '' +
+ iconHTML +
+ ' ' +
+ '
' +
+ '
'
+ );
+ thumbsC.append(thumb);
+ thumb.find('.thumbremovelink').click(function () {
+ //console.log("plu_show_thumbs-thumbremovelink");
+ if (
+ jQuery('#' + imgId + 'plupload-upload-ui').hasClass(
+ 'plupload-upload-uic-multiple'
+ )
+ ) {
+ totalImg--; // remove image from total
+ jQuery('#' + imgId + 'totImg').val(totalImg);
+ }
+ jQuery('#' + imgId + 'upload-error').html('');
+ jQuery('#' + imgId + 'upload-error').removeClass(
+ 'upload-error'
+ );
+ var ki = $(this)
+ .attr('id')
+ .replace('thumbremovelink' + imgId, '');
+ ki = parseInt(ki);
+ var kimages = [];
+ imagesS = $(
+ '#' + imgId,
+ $('#' + imgId + 'plupload-upload-ui').parent()
+ ).val();
+ images = imagesS.split('::');
+ for (var j = 0; j < images.length; j++) {
+ if (j != ki) {
+ kimages[kimages.length] = images[j];
+ }
+ }
+ $(
+ '#' + imgId,
+ $('#' + imgId + 'plupload-upload-ui').parent()
+ ).val(kimages.join('::'));
+ //console.log("plu_show_thumbs-thumbremovelink-run");
+ plu_show_thumbs(imgId);
+ return false;
+ });
+ }
+ }
+ if (images.length > 1) {
+ //console.log("plu_show_thumbs-sortable");
+ thumbsC.sortable({
+ update: function update(event, ui) {
+ var kimages = [];
+ thumbsC.find('.atbdp-file-info').each(function () {
+ kimages[kimages.length] =
+ $(this).data('src') +
+ '|' +
+ $(this).data('id') +
+ '|' +
+ $(this).data('title') +
+ '|' +
+ $(this).data('caption');
+ $(
+ '#' + imgId,
+ $('#' + imgId + 'plupload-upload-ui').parent()
+ ).val(kimages.join('::'));
+ plu_show_thumbs(imgId);
+ //console.log("plu_show_thumbs-sortable-run");
+ });
+ },
+ });
+ thumbsC.disableSelection();
+ }
- // we need to run the basics here.
- //console.log("run basics");
+ // we need to run the basics here.
+ //console.log("run basics");
- var kimages = [];
- thumbsC.find('.atbdp-file-info').each(function () {
- kimages[kimages.length] = $(this).data('src') + '|' + $(this).data('id') + '|' + $(this).data('title') + '|' + $(this).data('caption');
- $('#' + imgId, $('#' + imgId + 'plupload-upload-ui').parent()).val(kimages.join('::'));
- });
-}
-function gd_edit_image_meta(input, order_id) {
- var imagesS = jQuery('#' + input.id, jQuery('#' + input.id + 'plupload-upload-ui').parent()).val();
- var images = imagesS.split('::');
- var img_arr = images[order_id].split('|');
- var image_title = img_arr[2];
- var image_caption = img_arr[3];
- var html = '';
- html = html + "" + atbdp_params.label_title + "
"; // title value
- html = html + "" + atbdp_params.label_caption + "
"; // caption value
- html = html + "" + atbdp_params.button_set + '
'; // caption value
- jQuery('#atbdp-image-meta-input').html(html);
- lity('#atbdp-image-meta-input');
-}
-function gd_set_image_meta(input_id, order_id) {
- //alert(order_id);
- var imagesS = jQuery('#' + input_id, jQuery('#' + input_id + 'plupload-upload-ui').parent()).val();
- var images = imagesS.split('::');
- var img_arr = images[order_id].split('|');
- var image_url = img_arr[0];
- var image_id = img_arr[1];
- var image_title = atbdp_esc_entities(jQuery('#atbdp-image-meta-title').val());
- var image_caption = atbdp_esc_entities(jQuery('#atbdp-image-meta-caption').val());
- images[order_id] = image_url + '|' + image_id + '|' + image_title + '|' + image_caption;
- imagesS = images.join('::');
- jQuery('#' + input_id, jQuery('#' + input_id + 'plupload-upload-ui').parent()).val(imagesS);
- plu_show_thumbs(input_id);
- jQuery('[data-lity-close]', window.parent.document).trigger('click');
-}
-}();
-/******/ })()
-;
-//# sourceMappingURL=directorist-plupload.js.map
\ No newline at end of file
+ var kimages = [];
+ thumbsC.find('.atbdp-file-info').each(function () {
+ kimages[kimages.length] =
+ $(this).data('src') +
+ '|' +
+ $(this).data('id') +
+ '|' +
+ $(this).data('title') +
+ '|' +
+ $(this).data('caption');
+ $(
+ '#' + imgId,
+ $('#' + imgId + 'plupload-upload-ui').parent()
+ ).val(kimages.join('::'));
+ });
+ }
+ function gd_edit_image_meta(input, order_id) {
+ var imagesS = jQuery(
+ '#' + input.id,
+ jQuery('#' + input.id + 'plupload-upload-ui').parent()
+ ).val();
+ var images = imagesS.split('::');
+ var img_arr = images[order_id].split('|');
+ var image_title = img_arr[2];
+ var image_caption = img_arr[3];
+ var html = '';
+ html =
+ html +
+ "" +
+ atbdp_params.label_title +
+ "
"; // title value
+ html =
+ html +
+ "" +
+ atbdp_params.label_caption +
+ "
"; // caption value
+ html =
+ html +
+ "" +
+ atbdp_params.button_set +
+ '
'; // caption value
+ jQuery('#atbdp-image-meta-input').html(html);
+ lity('#atbdp-image-meta-input');
+ }
+ function gd_set_image_meta(input_id, order_id) {
+ //alert(order_id);
+ var imagesS = jQuery(
+ '#' + input_id,
+ jQuery('#' + input_id + 'plupload-upload-ui').parent()
+ ).val();
+ var images = imagesS.split('::');
+ var img_arr = images[order_id].split('|');
+ var image_url = img_arr[0];
+ var image_id = img_arr[1];
+ var image_title = atbdp_esc_entities(
+ jQuery('#atbdp-image-meta-title').val()
+ );
+ var image_caption = atbdp_esc_entities(
+ jQuery('#atbdp-image-meta-caption').val()
+ );
+ images[order_id] =
+ image_url +
+ '|' +
+ image_id +
+ '|' +
+ image_title +
+ '|' +
+ image_caption;
+ imagesS = images.join('::');
+ jQuery(
+ '#' + input_id,
+ jQuery('#' + input_id + 'plupload-upload-ui').parent()
+ ).val(imagesS);
+ plu_show_thumbs(input_id);
+ jQuery('[data-lity-close]', window.parent.document).trigger(
+ 'click'
+ );
+ }
+ })();
+ /******/
+})();
+//# sourceMappingURL=directorist-plupload.js.map
diff --git a/assets/js/global-main.js b/assets/js/global-main.js
index c8336f204..824427541 100644
--- a/assets/js/global-main.js
+++ b/assets/js/global-main.js
@@ -1,1013 +1,1698 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/components/modal.js":
-/*!**************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/components/modal.js':
+ /*!**************************************************!*\
!*** ./assets/src/js/global/components/modal.js ***!
\**************************************************/
-/***/ (function() {
-
-var $ = jQuery;
-$(document).ready(function () {
- modalToggle();
-});
-function modalToggle() {
- $('.atbdp_recovery_pass').on('click', function (e) {
- e.preventDefault();
- $('#recover-pass-modal').slideToggle().show();
- });
-
- // Contact form [on modal closed]
- $('#atbdp-contact-modal').on('hidden.bs.modal', function (e) {
- $('#atbdp-contact-message').val('');
- $('#atbdp-contact-message-display').html('');
- });
-
- // Template Restructured
- // Modal
- var directoristModal = document.querySelector('.directorist-modal-js');
- $('body').on('click', '.directorist-btn-modal-js', function (e) {
- e.preventDefault();
- var data_target = $(this).attr('data-directorist_target');
- document.querySelector(".".concat(data_target)).classList.add('directorist-show');
- });
- $('body').on('click', '.directorist-modal-close-js', function (e) {
- e.preventDefault();
- $(this).closest('.directorist-modal-js').removeClass('directorist-show');
- });
- $(document).bind('click', function (e) {
- if (e.target == directoristModal) {
- directoristModal.classList.remove('directorist-show');
- }
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/select2-custom-control.js":
-/*!*******************************************************************!*\
+ /***/ function () {
+ var $ = jQuery;
+ $(document).ready(function () {
+ modalToggle();
+ });
+ function modalToggle() {
+ $('.atbdp_recovery_pass').on('click', function (e) {
+ e.preventDefault();
+ $('#recover-pass-modal').slideToggle().show();
+ });
+
+ // Contact form [on modal closed]
+ $('#atbdp-contact-modal').on(
+ 'hidden.bs.modal',
+ function (e) {
+ $('#atbdp-contact-message').val('');
+ $('#atbdp-contact-message-display').html('');
+ }
+ );
+
+ // Template Restructured
+ // Modal
+ var directoristModal = document.querySelector(
+ '.directorist-modal-js'
+ );
+ $('body').on(
+ 'click',
+ '.directorist-btn-modal-js',
+ function (e) {
+ e.preventDefault();
+ var data_target = $(this).attr(
+ 'data-directorist_target'
+ );
+ document
+ .querySelector('.'.concat(data_target))
+ .classList.add('directorist-show');
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-modal-close-js',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .closest('.directorist-modal-js')
+ .removeClass('directorist-show');
+ }
+ );
+ $(document).bind('click', function (e) {
+ if (e.target == directoristModal) {
+ directoristModal.classList.remove(
+ 'directorist-show'
+ );
+ }
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/select2-custom-control.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/global/components/select2-custom-control.js ***!
\*******************************************************************/
-/***/ (function() {
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-var $ = jQuery;
-window.addEventListener('load', waitAndInit);
-window.addEventListener('directorist-search-form-nav-tab-reloaded', waitAndInit);
-window.addEventListener('directorist-type-change', waitAndInit);
-window.addEventListener('directorist-instant-search-reloaded', waitAndInit);
-function waitAndInit() {
- setTimeout(init, 0);
-}
-
-// Initialize
-function init() {
- // Add custom dropdown toggle button
- selec2_add_custom_dropdown_toggle_button();
-
- // Add custom close button where needed
- selec2_add_custom_close_button_if_needed();
-
- // Add custom close button if field contains value on change
- $('.select2-hidden-accessible').on('change', function (e) {
- var value = $(this).children('option:selected').val();
- if (!value) {
- return;
- }
- selec2_add_custom_close_button($(this));
- var selectItems = this.parentElement.querySelectorAll('.select2-selection__choice');
- selectItems.forEach(function (item) {
- item.childNodes && item.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- item.title = modifiedString;
- }
- });
- });
- var customSelectItem = this.parentElement.querySelector('.select2-selection__rendered');
- customSelectItem.childNodes && customSelectItem.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- }
- });
- });
-}
-function selec2_add_custom_dropdown_toggle_button() {
- // Remove Default
- $('.select2-selection__arrow').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container('.select2-hidden-accessible');
- if (!addon_container) {
- return;
- }
- var dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
- if (!dropdown.length) {
- // Add Dropdown Toggle Button
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/chevron-down.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var dropdownHTML = "".concat(iconHTML, " ");
- addon_container.append(dropdownHTML);
- }
- var selec2_custom_dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
-
- // Toggle --is-open class
- $('.select2-hidden-accessible').on('select2:open', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.addClass('--is-open');
- });
- $('.select2-hidden-accessible').on('select2:close', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.removeClass('--is-open');
- var dropdownParent = $(this).closest('.directorist-search-field');
- var renderTitle = $(this).next().find('.select2-selection__rendered').attr('title');
-
- // Check if renderTitle is empty and remove the focus class if so
- if (!renderTitle) {
- dropdownParent.removeClass('input-is-focused');
- } else {
- dropdownParent.addClass('input-has-value');
- }
- });
-
- // Toggle Dropdown
- selec2_custom_dropdown.on('click', function (e) {
- var isOpen = $(this).hasClass('--is-open');
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- if (isOpen) {
- field.select2('close');
- } else {
- field.select2('open');
- }
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_add_custom_close_button_if_needed() {
- var select2_fields = $('.select2-hidden-accessible');
- if (!select2_fields && !select2_fields.length) {
- return;
- }
- var _iterator = _createForOfIteratorHelper(select2_fields),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var field = _step.value;
- var value = $(field).children('option:selected').val();
- if (!value) {
- continue;
- }
- selec2_add_custom_close_button(field);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-}
-function selec2_add_custom_close_button(field) {
- // Remove Default
- $('.select2-selection__clear').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove if already exists
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Add
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/times.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- addon_container.prepend("".concat(iconHTML, " "));
- var selec2_custom_close = addon_container.find('.directorist-select2-dropdown-close');
- selec2_custom_close.on('click', function (e) {
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- field.val(null).trigger('change');
- addon_container.find('.directorist-select2-dropdown-close').remove();
- selec2_adjust_space_for_addons();
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_remove_custom_close_button(field) {
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_get_addon_container(field) {
- var container = field ? $(field).next('.select2-container') : $('.select2-container');
- container = $(container).find('.directorist-select2-addons-area');
- if (!container.length) {
- $('.select2-container').append(' ');
- container = $('.select2-container').find('.directorist-select2-addons-area');
- }
- var container = field ? $(field).next('.select2-container') : null;
- if (!container) {
- return null;
- }
- var addonsArea = $(container).find('.directorist-select2-addons-area');
- if (!addonsArea.length) {
- container.append(' ');
- return container.find('.directorist-select2-addons-area');
- }
- return addonsArea;
-}
-function selec2_adjust_space_for_addons() {
- var container = $('.select2-container').find('.directorist-select2-addons-area');
- if (!container.length) {
- return;
- }
- var width = container.outerWidth();
- $('.select2-container').find('.select2-selection__rendered').css({
- 'padding-right': width + 'px'
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/setup-select2.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ var $ = jQuery;
+ window.addEventListener('load', waitAndInit);
+ window.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ waitAndInit
+ );
+ window.addEventListener('directorist-type-change', waitAndInit);
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ waitAndInit
+ );
+ function waitAndInit() {
+ setTimeout(init, 0);
+ }
+
+ // Initialize
+ function init() {
+ // Add custom dropdown toggle button
+ selec2_add_custom_dropdown_toggle_button();
+
+ // Add custom close button where needed
+ selec2_add_custom_close_button_if_needed();
+
+ // Add custom close button if field contains value on change
+ $('.select2-hidden-accessible').on('change', function (e) {
+ var value = $(this).children('option:selected').val();
+ if (!value) {
+ return;
+ }
+ selec2_add_custom_close_button($(this));
+ var selectItems = this.parentElement.querySelectorAll(
+ '.select2-selection__choice'
+ );
+ selectItems.forEach(function (item) {
+ item.childNodes &&
+ item.childNodes.forEach(function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ item.title = modifiedString;
+ }
+ });
+ });
+ var customSelectItem = this.parentElement.querySelector(
+ '.select2-selection__rendered'
+ );
+ customSelectItem.childNodes &&
+ customSelectItem.childNodes.forEach(
+ function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ }
+ }
+ );
+ });
+ }
+ function selec2_add_custom_dropdown_toggle_button() {
+ // Remove Default
+ $('.select2-selection__arrow').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(
+ '.select2-hidden-accessible'
+ );
+ if (!addon_container) {
+ return;
+ }
+ var dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+ if (!dropdown.length) {
+ // Add Dropdown Toggle Button
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/chevron-down.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ var dropdownHTML =
+ ''.concat(
+ iconHTML,
+ ' '
+ );
+ addon_container.append(dropdownHTML);
+ }
+ var selec2_custom_dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+
+ // Toggle --is-open class
+ $('.select2-hidden-accessible').on(
+ 'select2:open',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.addClass('--is-open');
+ }
+ );
+ $('.select2-hidden-accessible').on(
+ 'select2:close',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.removeClass('--is-open');
+ var dropdownParent = $(this).closest(
+ '.directorist-search-field'
+ );
+ var renderTitle = $(this)
+ .next()
+ .find('.select2-selection__rendered')
+ .attr('title');
+
+ // Check if renderTitle is empty and remove the focus class if so
+ if (!renderTitle) {
+ dropdownParent.removeClass('input-is-focused');
+ } else {
+ dropdownParent.addClass('input-has-value');
+ }
+ }
+ );
+
+ // Toggle Dropdown
+ selec2_custom_dropdown.on('click', function (e) {
+ var isOpen = $(this).hasClass('--is-open');
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ if (isOpen) {
+ field.select2('close');
+ } else {
+ field.select2('open');
+ }
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_add_custom_close_button_if_needed() {
+ var select2_fields = $('.select2-hidden-accessible');
+ if (!select2_fields && !select2_fields.length) {
+ return;
+ }
+ var _iterator = _createForOfIteratorHelper(select2_fields),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
+ var field = _step.value;
+ var value = $(field)
+ .children('option:selected')
+ .val();
+ if (!value) {
+ continue;
+ }
+ selec2_add_custom_close_button(field);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+ function selec2_add_custom_close_button(field) {
+ // Remove Default
+ $('.select2-selection__clear').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove if already exists
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Add
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/times.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ addon_container.prepend(
+ ''.concat(
+ iconHTML,
+ ' '
+ )
+ );
+ var selec2_custom_close = addon_container.find(
+ '.directorist-select2-dropdown-close'
+ );
+ selec2_custom_close.on('click', function (e) {
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ field.val(null).trigger('change');
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+ selec2_adjust_space_for_addons();
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_remove_custom_close_button(field) {
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_get_addon_container(field) {
+ var container = field
+ ? $(field).next('.select2-container')
+ : $('.select2-container');
+ container = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ $('.select2-container').append(
+ ' '
+ );
+ container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ var container = field
+ ? $(field).next('.select2-container')
+ : null;
+ if (!container) {
+ return null;
+ }
+ var addonsArea = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!addonsArea.length) {
+ container.append(
+ ' '
+ );
+ return container.find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ return addonsArea;
+ }
+ function selec2_adjust_space_for_addons() {
+ var container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ return;
+ }
+ var width = container.outerWidth();
+ $('.select2-container')
+ .find('.select2-selection__rendered')
+ .css({
+ 'padding-right': width + 'px',
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/setup-select2.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/global/components/setup-select2.js ***!
\**********************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_select2_custom_control__WEBPACK_IMPORTED_MODULE_2__);
-
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-var $ = jQuery;
-window.addEventListener('load', initSelect2);
-document.body.addEventListener('directorist-search-form-nav-tab-reloaded', initSelect2);
-document.body.addEventListener('directorist-reload-select2-fields', initSelect2);
-window.addEventListener('directorist-instant-search-reloaded', initSelect2);
-
-// Init Static Select 2 Fields
-function initSelect2() {
- var selectors = ['.directorist-select select', '#directorist-select-js',
- // Not found in any template
- '#directorist-search-category-js',
- // Not found in any template
- // '#directorist-select-st-s-js',
- // '#directorist-select-sn-s-js',
- // '#directorist-select-mn-e-js',
- // '#directorist-select-tu-e-js',
- // '#directorist-select-wd-s-js',
- // '#directorist-select-wd-e-js',
- // '#directorist-select-th-e-js',
- // '#directorist-select-fr-s-js',
- // '#directorist-select-fr-e-js',
- '.select-basic',
- // Not found in any template
- '#loc-type', '#cat-type', '#at_biz_dir-category', '.bdas-location-search',
- // Not found in any template
- '.bdas-category-search' // Not found in any template
- ];
- selectors.forEach(function (selector) {
- return (0,_lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(selector);
- });
- initMaybeLazyLoadedTaxonomySelect2();
-}
-
-// Init Select2 Ajax Fields
-function initMaybeLazyLoadedTaxonomySelect2() {
- var restBase = "".concat(directorist.rest_url, "directorist/v1");
- maybeLazyLoadCategories({
- selector: '.directorist-search-category select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadCategories({
- selector: '.directorist-form-categories-field select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-search-location select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-form-location-field select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadTags({
- selector: '.directorist-form-tag-field select',
- url: "".concat(restBase, "/listings/tags")
- });
-}
-function maybeLazyLoadCategories(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'categories'
- }), args));
-}
-function maybeLazyLoadLocations(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'locations'
- }), args));
-}
-function maybeLazyLoadTags(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'tags'
- }), args));
-}
-
-// maybeLazyLoadTaxonomyTermsSelect2
-function maybeLazyLoadTaxonomyTermsSelect2(args) {
- var defaults = {
- selector: '',
- url: '',
- taxonomy: 'tags'
- };
- args = _objectSpread(_objectSpread({}, defaults), args);
- if (!args.selector) {
- return;
- }
- var $el = $(args.selector);
- var $addListing = $el.closest('.directorist-add-listing-form');
- var canCreate = $el.data('allow_new');
- var maxLength = $el.data('max');
- var directoryId = 0;
- if (args.taxonomy !== 'tags') {
- var $searchForm = $el.closest('.directorist-search-form');
- var $archivePage = $el.closest('.directorist-archive-contents');
- var $directory = $addListing.find('input[name="directory_type"]');
- var $navListItem = null;
-
- // If search page
- if ($searchForm.length) {
- $navListItem = $searchForm.find('.directorist-listing-type-selection__link--current');
- }
- if ($archivePage.length) {
- $navListItem = $archivePage.find('.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link');
- }
- if ($navListItem && $navListItem.length) {
- directoryId = Number($navListItem.data('listing_type_id'));
- }
- if ($directory.length) {
- directoryId = $directory.val();
- }
- if (directoryId) {
- directoryId = Number(directoryId);
- }
- }
- var currentPage = 1;
- var select2Options = {
- allowClear: true,
- tags: canCreate,
- maximumSelectionLength: maxLength,
- width: '100%',
- escapeMarkup: function escapeMarkup(text) {
- return text;
- },
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
-
- // Fetch the data-icon attribute
- var iconURI = $(data.element).attr('data-icon');
-
- // Get the original text
- var originalText = data.text;
-
- // Match and count leading spaces
- var leadingSpaces = originalText.match(/^\s+/);
- var spaceCount = leadingSpaces ? leadingSpaces[0].length : 0;
-
- // Trim leading spaces from the original text
- originalText = originalText.trim();
-
- // Construct the icon element
- var iconElm = iconURI ? " ") : '';
-
- // Prepare the combined text (icon + text)
- var combinedText = iconElm + originalText;
-
- // Create the state container
- var $state = $('
');
-
- // Determine the level based on space count
- var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
- if (level > 1) {
- $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
- }
- $state.html(combinedText); // Set the combined content (icon + text)
-
- return $state;
- }
- };
- if (directorist.lazy_load_taxonomy_fields) {
- select2Options.ajax = {
- url: args.url,
- dataType: 'json',
- cache: true,
- delay: 250,
- data: function data(params) {
- currentPage = params.page || 1;
- var query = {
- page: currentPage,
- per_page: args.perPage,
- hide_empty: true
- };
-
- // Load empty terms on add listings.
- if ($addListing.length) {
- query.hide_empty = false;
- }
- if (params.term) {
- query.search = params.term;
- query.hide_empty = false;
- }
- if (directoryId) {
- query.directory = directoryId;
- }
- return query;
- },
- processResults: function processResults(data) {
- return {
- results: data.items,
- pagination: {
- more: data.paginationMore
- }
- };
- },
- transport: function transport(params, success, failure) {
- var $request = $.ajax(params);
- $request.then(function (data, textStatus, jqXHR) {
- var totalPage = Number(jqXHR.getResponseHeader('x-wp-totalpages'));
- var paginationMore = currentPage < totalPage;
- var items = data.map(function (item) {
- var text = item.name;
- if (!$addListing.length && params.data.search) {
- text = "".concat(item.name, " (").concat(item.count, ")");
- }
- return {
- id: item.id,
- text: text
- };
- });
- return {
- items: items,
- paginationMore: paginationMore
- };
- }).then(success);
- $request.fail(failure);
- return $request;
- }
- };
- }
- $el.length && $el.select2(select2Options);
- if (directorist.lazy_load_taxonomy_fields) {
- function setupSelectedItems($el, selectedId, selectedLabel) {
- if (!$el.length || !selectedId) {
- return;
- }
- var selectedIds = "".concat(selectedId).split(',');
- var selectedLabels = selectedLabel ? "".concat(selectedLabel).split(',') : [];
- selectedIds.forEach(function (id, index) {
- var label = selectedLabels.length >= index + 1 ? selectedLabels[index] : '';
- var option = new Option(label, id, true, true);
- $el.append(option);
- $el.trigger({
- type: 'select2:select',
- params: {
- data: {
- id: id,
- text: label
- }
- }
- });
- });
- }
- setupSelectedItems($el, $el.data('selected-id'), $el.data('selected-label'));
- }
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/tabs.js":
-/*!*************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__
+ );
+
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+
+ var $ = jQuery;
+ window.addEventListener('load', initSelect2);
+ document.body.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ initSelect2
+ );
+ document.body.addEventListener(
+ 'directorist-reload-select2-fields',
+ initSelect2
+ );
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ initSelect2
+ );
+
+ // Init Static Select 2 Fields
+ function initSelect2() {
+ var selectors = [
+ '.directorist-select select',
+ '#directorist-select-js',
+ // Not found in any template
+ '#directorist-search-category-js',
+ // Not found in any template
+ // '#directorist-select-st-s-js',
+ // '#directorist-select-sn-s-js',
+ // '#directorist-select-mn-e-js',
+ // '#directorist-select-tu-e-js',
+ // '#directorist-select-wd-s-js',
+ // '#directorist-select-wd-e-js',
+ // '#directorist-select-th-e-js',
+ // '#directorist-select-fr-s-js',
+ // '#directorist-select-fr-e-js',
+ '.select-basic',
+ // Not found in any template
+ '#loc-type',
+ '#cat-type',
+ '#at_biz_dir-category',
+ '.bdas-location-search',
+ // Not found in any template
+ '.bdas-category-search', // Not found in any template
+ ];
+ selectors.forEach(function (selector) {
+ return (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(
+ selector
+ );
+ });
+ initMaybeLazyLoadedTaxonomySelect2();
+ }
+
+ // Init Select2 Ajax Fields
+ function initMaybeLazyLoadedTaxonomySelect2() {
+ var restBase = ''.concat(
+ directorist.rest_url,
+ 'directorist/v1'
+ );
+ maybeLazyLoadCategories({
+ selector: '.directorist-search-category select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadCategories({
+ selector: '.directorist-form-categories-field select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-search-location select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-form-location-field select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadTags({
+ selector: '.directorist-form-tag-field select',
+ url: ''.concat(restBase, '/listings/tags'),
+ });
+ }
+ function maybeLazyLoadCategories(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'categories',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadLocations(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'locations',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadTags(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'tags',
+ }
+ ),
+ args
+ )
+ );
+ }
+
+ // maybeLazyLoadTaxonomyTermsSelect2
+ function maybeLazyLoadTaxonomyTermsSelect2(args) {
+ var defaults = {
+ selector: '',
+ url: '',
+ taxonomy: 'tags',
+ };
+ args = _objectSpread(_objectSpread({}, defaults), args);
+ if (!args.selector) {
+ return;
+ }
+ var $el = $(args.selector);
+ var $addListing = $el.closest(
+ '.directorist-add-listing-form'
+ );
+ var canCreate = $el.data('allow_new');
+ var maxLength = $el.data('max');
+ var directoryId = 0;
+ if (args.taxonomy !== 'tags') {
+ var $searchForm = $el.closest(
+ '.directorist-search-form'
+ );
+ var $archivePage = $el.closest(
+ '.directorist-archive-contents'
+ );
+ var $directory = $addListing.find(
+ 'input[name="directory_type"]'
+ );
+ var $navListItem = null;
+
+ // If search page
+ if ($searchForm.length) {
+ $navListItem = $searchForm.find(
+ '.directorist-listing-type-selection__link--current'
+ );
+ }
+ if ($archivePage.length) {
+ $navListItem = $archivePage.find(
+ '.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link'
+ );
+ }
+ if ($navListItem && $navListItem.length) {
+ directoryId = Number(
+ $navListItem.data('listing_type_id')
+ );
+ }
+ if ($directory.length) {
+ directoryId = $directory.val();
+ }
+ if (directoryId) {
+ directoryId = Number(directoryId);
+ }
+ }
+ var currentPage = 1;
+ var select2Options = {
+ allowClear: true,
+ tags: canCreate,
+ maximumSelectionLength: maxLength,
+ width: '100%',
+ escapeMarkup: function escapeMarkup(text) {
+ return text;
+ },
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+
+ // Fetch the data-icon attribute
+ var iconURI = $(data.element).attr('data-icon');
+
+ // Get the original text
+ var originalText = data.text;
+
+ // Match and count leading spaces
+ var leadingSpaces = originalText.match(/^\s+/);
+ var spaceCount = leadingSpaces
+ ? leadingSpaces[0].length
+ : 0;
+
+ // Trim leading spaces from the original text
+ originalText = originalText.trim();
+
+ // Construct the icon element
+ var iconElm = iconURI
+ ? ' '
+ )
+ : '';
+
+ // Prepare the combined text (icon + text)
+ var combinedText = iconElm + originalText;
+
+ // Create the state container
+ var $state = $(
+ '
'
+ );
+
+ // Determine the level based on space count
+ var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
+ if (level > 1) {
+ $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
+ }
+ $state.html(combinedText); // Set the combined content (icon + text)
+
+ return $state;
+ },
+ };
+ if (directorist.lazy_load_taxonomy_fields) {
+ select2Options.ajax = {
+ url: args.url,
+ dataType: 'json',
+ cache: true,
+ delay: 250,
+ data: function data(params) {
+ currentPage = params.page || 1;
+ var query = {
+ page: currentPage,
+ per_page: args.perPage,
+ hide_empty: true,
+ };
+
+ // Load empty terms on add listings.
+ if ($addListing.length) {
+ query.hide_empty = false;
+ }
+ if (params.term) {
+ query.search = params.term;
+ query.hide_empty = false;
+ }
+ if (directoryId) {
+ query.directory = directoryId;
+ }
+ return query;
+ },
+ processResults: function processResults(data) {
+ return {
+ results: data.items,
+ pagination: {
+ more: data.paginationMore,
+ },
+ };
+ },
+ transport: function transport(
+ params,
+ success,
+ failure
+ ) {
+ var $request = $.ajax(params);
+ $request
+ .then(function (data, textStatus, jqXHR) {
+ var totalPage = Number(
+ jqXHR.getResponseHeader(
+ 'x-wp-totalpages'
+ )
+ );
+ var paginationMore =
+ currentPage < totalPage;
+ var items = data.map(function (item) {
+ var text = item.name;
+ if (
+ !$addListing.length &&
+ params.data.search
+ ) {
+ text = ''
+ .concat(item.name, ' (')
+ .concat(item.count, ')');
+ }
+ return {
+ id: item.id,
+ text: text,
+ };
+ });
+ return {
+ items: items,
+ paginationMore: paginationMore,
+ };
+ })
+ .then(success);
+ $request.fail(failure);
+ return $request;
+ },
+ };
+ }
+ $el.length && $el.select2(select2Options);
+ if (directorist.lazy_load_taxonomy_fields) {
+ function setupSelectedItems(
+ $el,
+ selectedId,
+ selectedLabel
+ ) {
+ if (!$el.length || !selectedId) {
+ return;
+ }
+ var selectedIds = ''.concat(selectedId).split(',');
+ var selectedLabels = selectedLabel
+ ? ''.concat(selectedLabel).split(',')
+ : [];
+ selectedIds.forEach(function (id, index) {
+ var label =
+ selectedLabels.length >= index + 1
+ ? selectedLabels[index]
+ : '';
+ var option = new Option(label, id, true, true);
+ $el.append(option);
+ $el.trigger({
+ type: 'select2:select',
+ params: {
+ data: {
+ id: id,
+ text: label,
+ },
+ },
+ });
+ });
+ }
+ setupSelectedItems(
+ $el,
+ $el.data('selected-id'),
+ $el.data('selected-label')
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/tabs.js':
+ /*!*************************************************!*\
!*** ./assets/src/js/global/components/tabs.js ***!
\*************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
-
-document.addEventListener('load', init, false);
-function Tasks() {
- return {
- init: function init() {
- this.initToggleTabLinks();
- },
- initToggleTabLinks: function initToggleTabLinks() {
- var links = document.querySelectorAll('.directorist-toggle-tab');
- if (!links) {
- return;
- }
- var self = this;
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(links).forEach(function (item) {
- item.addEventListener('click', function (event) {
- self.handleToggleTabLinksEvent(item, event);
- });
- });
- },
- handleToggleTabLinksEvent: function handleToggleTabLinksEvent(item, event) {
- event.preventDefault();
- var navContainerClass = item.getAttribute('data-nav-container');
- var tabContainerClass = item.getAttribute('data-tab-container');
- var tabClass = item.getAttribute('data-tab');
- if (!navContainerClass || !tabContainerClass || !tabClass) {
- return;
- }
- var navContainer = item.closest('.' + navContainerClass);
- var tabContainer = document.querySelector('.' + tabContainerClass);
- if (!navContainer || !tabContainer) {
- return;
- }
- var tab = tabContainer.querySelector('.' + tabClass);
- if (!tab) {
- return;
- }
-
- // Remove Active Class
- var removeActiveClass = function removeActiveClass(item) {
- item.classList.remove('--is-active');
- };
-
- // Toggle Nav
- var activeNavItems = navContainer.querySelectorAll('.--is-active');
- if (activeNavItems) {
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(activeNavItems).forEach(removeActiveClass);
- }
- item.classList.add('--is-active');
-
- // Toggle Tab
- var activeTabItems = tabContainer.querySelectorAll('.--is-active');
- if (activeTabItems) {
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(activeTabItems).forEach(removeActiveClass);
- }
- tab.classList.add('--is-active');
-
- // Update Query Var
- var queryVarKey = item.getAttribute('data-query-var-key');
- var queryVarValue = item.getAttribute('data-query-var-value');
- if (!queryVarKey || !queryVarValue) {
- return;
- }
- this.addQueryParam(queryVarKey, queryVarValue);
- },
- addQueryParam: function addQueryParam(key, value) {
- var url = new URL(window.location.href);
- url.searchParams.set(key, value);
- window.history.pushState({}, '', url.toString());
- }
- };
-}
-function init() {
- var tasks = new Tasks();
- tasks.init();
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/utility.js":
-/*!****************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/toConsumableArray */ './node_modules/@babel/runtime/helpers/esm/toConsumableArray.js'
+ );
+
+ document.addEventListener('load', init, false);
+ function Tasks() {
+ return {
+ init: function init() {
+ this.initToggleTabLinks();
+ },
+ initToggleTabLinks: function initToggleTabLinks() {
+ var links = document.querySelectorAll(
+ '.directorist-toggle-tab'
+ );
+ if (!links) {
+ return;
+ }
+ var self = this;
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(links).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (event) {
+ self.handleToggleTabLinksEvent(
+ item,
+ event
+ );
+ }
+ );
+ });
+ },
+ handleToggleTabLinksEvent:
+ function handleToggleTabLinksEvent(item, event) {
+ event.preventDefault();
+ var navContainerClass =
+ item.getAttribute('data-nav-container');
+ var tabContainerClass =
+ item.getAttribute('data-tab-container');
+ var tabClass = item.getAttribute('data-tab');
+ if (
+ !navContainerClass ||
+ !tabContainerClass ||
+ !tabClass
+ ) {
+ return;
+ }
+ var navContainer = item.closest(
+ '.' + navContainerClass
+ );
+ var tabContainer = document.querySelector(
+ '.' + tabContainerClass
+ );
+ if (!navContainer || !tabContainer) {
+ return;
+ }
+ var tab = tabContainer.querySelector(
+ '.' + tabClass
+ );
+ if (!tab) {
+ return;
+ }
+
+ // Remove Active Class
+ var removeActiveClass =
+ function removeActiveClass(item) {
+ item.classList.remove('--is-active');
+ };
+
+ // Toggle Nav
+ var activeNavItems =
+ navContainer.querySelectorAll(
+ '.--is-active'
+ );
+ if (activeNavItems) {
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(activeNavItems).forEach(
+ removeActiveClass
+ );
+ }
+ item.classList.add('--is-active');
+
+ // Toggle Tab
+ var activeTabItems =
+ tabContainer.querySelectorAll(
+ '.--is-active'
+ );
+ if (activeTabItems) {
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(activeTabItems).forEach(
+ removeActiveClass
+ );
+ }
+ tab.classList.add('--is-active');
+
+ // Update Query Var
+ var queryVarKey =
+ item.getAttribute('data-query-var-key');
+ var queryVarValue = item.getAttribute(
+ 'data-query-var-value'
+ );
+ if (!queryVarKey || !queryVarValue) {
+ return;
+ }
+ this.addQueryParam(queryVarKey, queryVarValue);
+ },
+ addQueryParam: function addQueryParam(key, value) {
+ var url = new URL(window.location.href);
+ url.searchParams.set(key, value);
+ window.history.pushState({}, '', url.toString());
+ },
+ };
+ }
+ function init() {
+ var tasks = new Tasks();
+ tasks.init();
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/utility.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/global/components/utility.js ***!
\****************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- var $ = jQuery;
- document.querySelectorAll('.la-icon i').forEach(function (item) {
- className.push(item.getAttribute('class'));
- });
-
- // Handle Disabled Link Action
- $('.atbdp-disabled').on('click', function (e) {
- e.preventDefault();
- });
-
- // Toggle Modal
- $('.cptm-modal-toggle').on('click', function (e) {
- e.preventDefault();
- var target_class = $(this).data('target');
- $('.' + target_class).toggleClass('active');
- });
-
- // Change label on file select/change
- $('.cptm-file-field').on('change', function (e) {
- var target_id = $(this).attr('id');
- $('label[for=' + target_id + ']').text('Change');
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ var $ = jQuery;
+ document
+ .querySelectorAll('.la-icon i')
+ .forEach(function (item) {
+ className.push(item.getAttribute('class'));
+ });
+
+ // Handle Disabled Link Action
+ $('.atbdp-disabled').on('click', function (e) {
+ e.preventDefault();
+ });
+
+ // Toggle Modal
+ $('.cptm-modal-toggle').on('click', function (e) {
+ e.preventDefault();
+ var target_class = $(this).data('target');
+ $('.' + target_class).toggleClass('active');
+ });
+
+ // Change label on file select/change
+ $('.cptm-file-field').on('change', function (e) {
+ var target_id = $(this).attr('id');
+ $('label[for=' + target_id + ']').text('Change');
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = " ");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":
-/*!*********************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ ' '
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ ''.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js':
+ /*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; }
-/* harmony export */ });
-function _arrayLikeToArray(r, a) {
- (null == a || a > r.length) && (a = r.length);
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
- return n;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayLikeToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayWithoutHoles; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _arrayWithoutHoles(r) {
- if (Array.isArray(r)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayWithoutHoles;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _arrayWithoutHoles(r) {
+ if (Array.isArray(r))
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/defineProperty.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _defineProperty; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperty(e, r, t) {
- return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js":
-/*!********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _defineProperty;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperty(e, r, t) {
+ return (
+ (r = (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r)) in e
+ ? Object.defineProperty(e, r, {
+ value: t,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0,
+ })
+ : (e[r] = t),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/iterableToArray.js':
+ /*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***!
\********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _iterableToArray; }
-/* harmony export */ });
-function _iterableToArray(r) {
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _iterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _iterableToArray(r) {
+ if (
+ ('undefined' != typeof Symbol &&
+ null != r[Symbol.iterator]) ||
+ null != r['@@iterator']
+ )
+ return Array.from(r);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _nonIterableSpread; }
-/* harmony export */ });
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _nonIterableSpread;
+ },
+ /* harmony export */
+ }
+ );
+ function _nonIterableSpread() {
+ throw new TypeError(
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toConsumableArray.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _toConsumableArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js");
-/* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js");
-/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
-/* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js");
-
-
-
-
-function _toConsumableArray(r) {
- return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__["default"])();
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _toConsumableArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayWithoutHoles.js */ './node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js'
+ );
+ /* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./iterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/iterableToArray.js'
+ );
+ /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./unsupportedIterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js'
+ );
+ /* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./nonIterableSpread.js */ './node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js'
+ );
+
+ function _toConsumableArray(r) {
+ return (
+ (0,
+ _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r) ||
+ (0,
+ _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(r) ||
+ (0,
+ _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(r) ||
+ (0,
+ _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])()
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPrimitive; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-function toPrimitive(t, r) {
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPrimitive;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ function toPrimitive(t, r) {
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ t
+ ) ||
+ !t
+ )
+ return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || 'default');
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ )
+ return i;
+ throw new TypeError(
+ '@@toPrimitive must return a primitive value.'
+ );
+ }
+ return ('string' === r ? String : Number)(t);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPropertyKey; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");
-
-
-function toPropertyKey(t) {
- var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string");
- return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + "";
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPropertyKey;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./toPrimitive.js */ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js'
+ );
+
+ function toPropertyKey(t) {
+ var i = (0,
+ _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__['default'])(
+ t,
+ 'string'
+ );
+ return 'symbol' ==
+ (0, _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ ? i
+ : i + '';
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":
-/*!*******************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js':
+ /*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _unsupportedIterableToArray(r, a) {
- if (r) {
- if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a);
- var t = {}.toString.call(r).slice(8, -1);
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0;
- }
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!****************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _unsupportedIterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a)
+ : void 0
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!****************************************!*\
!*** ./assets/src/js/global/global.js ***!
\****************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/modal */ "./assets/src/js/global/components/modal.js");
-/* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_modal__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _components_setup_select2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/setup-select2 */ "./assets/src/js/global/components/setup-select2.js");
-/* harmony import */ var _components_tabs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/tabs */ "./assets/src/js/global/components/tabs.js");
-/* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/utility */ "./assets/src/js/global/components/utility.js");
-/* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_components_utility__WEBPACK_IMPORTED_MODULE_4__);
-
-
-
-
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=global-main.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./components/modal */ './assets/src/js/global/components/modal.js'
+ );
+ /* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_modal__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./components/select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _components_setup_select2__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./components/setup-select2 */ './assets/src/js/global/components/setup-select2.js'
+ );
+ /* harmony import */ var _components_tabs__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./components/tabs */ './assets/src/js/global/components/tabs.js'
+ );
+ /* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ./components/utility */ './assets/src/js/global/components/utility.js'
+ );
+ /* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_utility__WEBPACK_IMPORTED_MODULE_4__
+ );
+ })();
+ /******/
+})();
+//# sourceMappingURL=global-main.js.map
diff --git a/assets/js/global-markerclusterer.js b/assets/js/global-markerclusterer.js
index b44bb386f..882c97169 100644
--- a/assets/js/global-markerclusterer.js
+++ b/assets/js/global-markerclusterer.js
@@ -1,1268 +1,1442 @@
-/******/ (function() { // webpackBootstrap
-/******/ "use strict";
-/******/ var __webpack_modules__ = ({
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ 'use strict';
+ /******/ var __webpack_modules__ = {
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
-!function() {
-/*!*************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
+ !(function () {
+ /*!*************************************************************!*\
!*** ./assets/src/js/global/map-scripts/markerclusterer.js ***!
\*************************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-// ==ClosureCompiler==
-// @compilation_level ADVANCED_OPTIMIZATIONS
-// @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/maps/google_maps_api_v3_3.js
-// ==/ClosureCompiler==
-
-/**
- * @name MarkerClusterer for Google Maps v3
- * @version version 1.0
- * @author Luke Mahe
- * @fileoverview
- * The library creates and manages per-zoom-level clusters for large amounts of
- * markers.
- *
- * This is a v3 implementation of the
- * v2 MarkerClusterer .
- */
-
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * A Marker Clusterer that clusters markers.
- *
- * @param {google.maps.Map} map The Google map to attach to.
- * @param {Array.=} opt_markers Optional markers to add to
- * the cluster.
- * @param {Object=} opt_options support the following options:
- * 'gridSize': (number) The grid size of a cluster in pixels.
- * 'maxZoom': (number) The maximum zoom level that a marker can be part of a
- * cluster.
- * 'zoomOnClick': (boolean) Whether the default behaviour of clicking on a
- * cluster is to zoom into it.
- * 'averageCenter': (boolean) Wether the center of each cluster should be
- * the average of all markers in the cluster.
- * 'minimumClusterSize': (number) The minimum number of markers to be in a
- * cluster before the markers are hidden and a count
- * is shown.
- * 'styles': (object) An object that has style properties:
- * 'url': (string) The image url.
- * 'height': (number) The image height.
- * 'width': (number) The image width.
- * 'anchor': (Array) The anchor position of the label text.
- * 'textColor': (string) The text color.
- * 'textSize': (number) The text size.
- * 'backgroundPosition': (string) The position of the background x, y.
- * 'cssClass': (string) One or more CSS class for styling this marker.
- * @constructor
- * @extends google.maps.OverlayView
- */
-function MarkerClusterer(map, opt_markers, opt_options) {
- // MarkerClusterer implements google.maps.OverlayView interface. We use the
- // extend function to extend MarkerClusterer with google.maps.OverlayView
- // because it might not always be available when the code is defined so we
- // look for it at the last possible moment. If it doesn't exist now then
- // there is no point going ahead :)
- this.extend(MarkerClusterer, google.maps.OverlayView);
- this.map_ = map;
-
- /**
- * @type {Array.}
- * @private
- */
- this.markers_ = [];
-
- /**
- * @type {Array.}
- */
- this.clusters_ = [];
- this.sizes = [53, 56, 66, 78, 90];
-
- /**
- * @private
- */
- this.styles_ = [];
-
- /**
- * @private
- */
- this.cssClass_ = '';
-
- /**
- * @type {boolean}
- * @private
- */
- this.ready_ = false;
- var options = opt_options || {};
-
- /**
- * @type {number}
- * @private
- */
- this.gridSize_ = options['gridSize'] || 60;
-
- /**
- * @private
- */
- this.minClusterSize_ = options['minimumClusterSize'] || 2;
-
- /**
- * @type {?number}
- * @private
- */
- this.maxZoom_ = options['maxZoom'] || null;
- this.styles_ = options['styles'] || [];
- this.cssClass_ = options['cssClass'] || null;
-
- /**
- * @type {string}
- * @private
- */
- this.imagePath_ = options['imagePath'] || this.MARKER_CLUSTER_IMAGE_PATH_;
-
- /**
- * @type {string}
- * @private
- */
- this.imageExtension_ = options['imageExtension'] || this.MARKER_CLUSTER_IMAGE_EXTENSION_;
-
- /**
- * @type {boolean}
- * @private
- */
- this.zoomOnClick_ = true;
- if (options['zoomOnClick'] != undefined) {
- this.zoomOnClick_ = options['zoomOnClick'];
- }
-
- /**
- * @type {boolean}
- * @private
- */
- this.averageCenter_ = false;
- if (options['averageCenter'] != undefined) {
- this.averageCenter_ = options['averageCenter'];
- }
- this.setupStyles_();
- this.setMap(map);
-
- /**
- * @type {number}
- * @private
- */
- this.prevZoom_ = this.map_.getZoom();
-
- // Add the map event listeners
- var that = this;
- google.maps.event.addListener(this.map_, 'zoom_changed', function () {
- var zoom = that.map_.getZoom();
- if (that.prevZoom_ != zoom) {
- that.prevZoom_ = zoom;
- that.resetViewport();
- }
- });
- google.maps.event.addListener(this.map_, 'idle', function () {
- that.redraw();
- });
-
- // Finally, add the markers
- if (opt_markers && opt_markers.length) {
- this.addMarkers(opt_markers, false);
- }
-}
-
-/**
- * The marker cluster image path.
- *
- * @type {string}
- * @private
- */
-MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/' + 'images/m';
-
-/**
- * The marker cluster image path.
- *
- * @type {string}
- * @private
- */
-MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png';
-
-/**
- * Extends a objects prototype by anothers.
- *
- * @param {Object} obj1 The object to be extended.
- * @param {Object} obj2 The object to extend with.
- * @return {Object} The new extended object.
- * @ignore
- */
-MarkerClusterer.prototype.extend = function (obj1, obj2) {
- return function (object) {
- for (var property in object.prototype) {
- this.prototype[property] = object.prototype[property];
- }
- return this;
- }.apply(obj1, [obj2]);
-};
-
-/**
- * Implementaion of the interface method.
- * @ignore
- */
-MarkerClusterer.prototype.onAdd = function () {
- this.setReady_(true);
-};
-
-/**
- * Implementaion of the interface method.
- * @ignore
- */
-MarkerClusterer.prototype.draw = function () {};
-
-/**
- * Sets up the styles object.
- *
- * @private
- */
-MarkerClusterer.prototype.setupStyles_ = function () {
- if (this.styles_.length) {
- return;
- }
- for (var i = 0, size; size = this.sizes[i]; i++) {
- this.styles_.push({
- url: this.imagePath_ + (i + 1) + '.' + this.imageExtension_,
- height: size,
- width: size
- });
- }
-};
-
-/**
- * Fit the map to the bounds of the markers in the clusterer.
- */
-MarkerClusterer.prototype.fitMapToMarkers = function () {
- var markers = this.getMarkers();
- var bounds = new google.maps.LatLngBounds();
- for (var i = 0, marker; marker = markers[i]; i++) {
- bounds.extend(marker.getPosition());
- }
- this.map_.fitBounds(bounds);
-};
-
-/**
- * Sets the styles.
- *
- * @param {Object} styles The style to set.
- */
-MarkerClusterer.prototype.setStyles = function (styles) {
- this.styles_ = styles;
-};
-
-/**
- * Gets the styles.
- *
- * @return {Object} The styles object.
- */
-MarkerClusterer.prototype.getStyles = function () {
- return this.styles_;
-};
-
-/**
- * Whether zoom on click is set.
- *
- * @return {boolean} True if zoomOnClick_ is set.
- */
-MarkerClusterer.prototype.isZoomOnClick = function () {
- return this.zoomOnClick_;
-};
-
-/**
- * Whether average center is set.
- *
- * @return {boolean} True if averageCenter_ is set.
- */
-MarkerClusterer.prototype.isAverageCenter = function () {
- return this.averageCenter_;
-};
-
-/**
- * Returns the array of markers in the clusterer.
- *
- * @return {Array.} The markers.
- */
-MarkerClusterer.prototype.getMarkers = function () {
- return this.markers_;
-};
-
-/**
- * Returns the number of markers in the clusterer
- *
- * @return {Number} The number of markers.
- */
-MarkerClusterer.prototype.getTotalMarkers = function () {
- return this.markers_.length;
-};
-
-/**
- * Sets the max zoom for the clusterer.
- *
- * @param {number} maxZoom The max zoom level.
- */
-MarkerClusterer.prototype.setMaxZoom = function (maxZoom) {
- this.maxZoom_ = maxZoom;
-};
-
-/**
- * Gets the max zoom for the clusterer.
- *
- * @return {number} The max zoom level.
- */
-MarkerClusterer.prototype.getMaxZoom = function () {
- return this.maxZoom_;
-};
-
-/**
- * The function for calculating the cluster icon image.
- *
- * @param {Array.} markers The markers in the clusterer.
- * @param {number} numStyles The number of styles available.
- * @return {Object} A object properties: 'text' (string) and 'index' (number).
- * @private
- */
-MarkerClusterer.prototype.calculator_ = function (markers, numStyles) {
- var index = 0;
- var count = markers.length;
- var dv = count;
- while (dv !== 0) {
- dv = parseInt(dv / 10, 10);
- index++;
- }
- index = Math.min(index, numStyles);
- return {
- text: count,
- index: index
- };
-};
-
-/**
- * Set the calculator function.
- *
- * @param {function(Array, number)} calculator The function to set as the
- * calculator. The function should return a object properties:
- * 'text' (string) and 'index' (number).
- *
- */
-MarkerClusterer.prototype.setCalculator = function (calculator) {
- this.calculator_ = calculator;
-};
-
-/**
- * Get the calculator function.
- *
- * @return {function(Array, number)} the calculator function.
- */
-MarkerClusterer.prototype.getCalculator = function () {
- return this.calculator_;
-};
-
-/**
- * Add an array of markers to the clusterer.
- *
- * @param {Array.} markers The markers to add.
- * @param {boolean=} opt_nodraw Whether to redraw the clusters.
- */
-MarkerClusterer.prototype.addMarkers = function (markers, opt_nodraw) {
- for (var i = 0, marker; marker = markers[i]; i++) {
- this.pushMarkerTo_(marker);
- }
- if (!opt_nodraw) {
- this.redraw();
- }
-};
-
-/**
- * Pushes a marker to the clusterer.
- *
- * @param {google.maps.Marker} marker The marker to add.
- * @private
- */
-MarkerClusterer.prototype.pushMarkerTo_ = function (marker) {
- marker.isAdded = false;
- if (marker['draggable']) {
- // If the marker is draggable add a listener so we update the clusters on
- // the drag end.
- var that = this;
- google.maps.event.addListener(marker, 'dragend', function () {
- marker.isAdded = false;
- that.repaint();
- });
- }
- this.markers_.push(marker);
-};
-
-/**
- * Adds a marker to the clusterer and redraws if needed.
- *
- * @param {google.maps.Marker} marker The marker to add.
- * @param {boolean=} opt_nodraw Whether to redraw the clusters.
- */
-MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) {
- this.pushMarkerTo_(marker);
- if (!opt_nodraw) {
- this.redraw();
- }
-};
-
-/**
- * Removes a marker and returns true if removed, false if not
- *
- * @param {google.maps.Marker} marker The marker to remove
- * @return {boolean} Whether the marker was removed or not
- * @private
- */
-MarkerClusterer.prototype.removeMarker_ = function (marker) {
- var index = -1;
- if (this.markers_.indexOf) {
- index = this.markers_.indexOf(marker);
- } else {
- for (var i = 0, m; m = this.markers_[i]; i++) {
- if (m == marker) {
- index = i;
- break;
- }
- }
- }
- if (index == -1) {
- // Marker is not in our list of markers.
- return false;
- }
- marker.setMap(null);
- this.markers_.splice(index, 1);
- return true;
-};
-
-/**
- * Remove a marker from the cluster.
- *
- * @param {google.maps.Marker} marker The marker to remove.
- * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
- * @return {boolean} True if the marker was removed.
- */
-MarkerClusterer.prototype.removeMarker = function (marker, opt_nodraw) {
- var removed = this.removeMarker_(marker);
- if (!opt_nodraw && removed) {
- this.resetViewport();
- this.redraw();
- return true;
- } else {
- return false;
- }
-};
-
-/**
- * Removes an array of markers from the cluster.
- *
- * @param {Array.} markers The markers to remove.
- * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
- */
-MarkerClusterer.prototype.removeMarkers = function (markers, opt_nodraw) {
- var removed = false;
- for (var i = 0, marker; marker = markers[i]; i++) {
- var r = this.removeMarker_(marker);
- removed = removed || r;
- }
- if (!opt_nodraw && removed) {
- this.resetViewport();
- this.redraw();
- return true;
- }
-};
-
-/**
- * Sets the clusterer's ready state.
- *
- * @param {boolean} ready The state.
- * @private
- */
-MarkerClusterer.prototype.setReady_ = function (ready) {
- if (!this.ready_) {
- this.ready_ = ready;
- this.createClusters_();
- }
-};
-
-/**
- * Returns the number of clusters in the clusterer.
- *
- * @return {number} The number of clusters.
- */
-MarkerClusterer.prototype.getTotalClusters = function () {
- return this.clusters_.length;
-};
-
-/**
- * Returns the google map that the clusterer is associated with.
- *
- * @return {google.maps.Map} The map.
- */
-MarkerClusterer.prototype.getMap = function () {
- return this.map_;
-};
-
-/**
- * Sets the google map that the clusterer is associated with.
- *
- * @param {google.maps.Map} map The map.
- */
-MarkerClusterer.prototype.setMap = function (map) {
- this.map_ = map;
-};
-
-/**
- * Returns the size of the grid.
- *
- * @return {number} The grid size.
- */
-MarkerClusterer.prototype.getGridSize = function () {
- return this.gridSize_;
-};
-
-/**
- * Sets the size of the grid.
- *
- * @param {number} size The grid size.
- */
-MarkerClusterer.prototype.setGridSize = function (size) {
- this.gridSize_ = size;
-};
-
-/**
- * Returns the min cluster size.
- *
- * @return {number} The grid size.
- */
-MarkerClusterer.prototype.getMinClusterSize = function () {
- return this.minClusterSize_;
-};
-
-/**
- * Sets the min cluster size.
- *
- * @param {number} size The grid size.
- */
-MarkerClusterer.prototype.setMinClusterSize = function (size) {
- this.minClusterSize_ = size;
-};
-
-/**
- * Extends a bounds object by the grid size.
- *
- * @param {google.maps.LatLngBounds} bounds The bounds to extend.
- * @return {google.maps.LatLngBounds} The extended bounds.
- */
-MarkerClusterer.prototype.getExtendedBounds = function (bounds) {
- var projection = this.getProjection();
-
- // Turn the bounds into latlng.
- var tr = new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getNorthEast().lng());
- var bl = new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng());
-
- // Convert the points to pixels and the extend out by the grid size.
- var trPix = projection.fromLatLngToDivPixel(tr);
- trPix.x += this.gridSize_;
- trPix.y -= this.gridSize_;
- var blPix = projection.fromLatLngToDivPixel(bl);
- blPix.x -= this.gridSize_;
- blPix.y += this.gridSize_;
-
- // Convert the pixel points back to LatLng
- var ne = projection.fromDivPixelToLatLng(trPix);
- var sw = projection.fromDivPixelToLatLng(blPix);
-
- // Extend the bounds to contain the new bounds.
- bounds.extend(ne);
- bounds.extend(sw);
- return bounds;
-};
-
-/**
- * Determins if a marker is contained in a bounds.
- *
- * @param {google.maps.Marker} marker The marker to check.
- * @param {google.maps.LatLngBounds} bounds The bounds to check against.
- * @return {boolean} True if the marker is in the bounds.
- * @private
- */
-MarkerClusterer.prototype.isMarkerInBounds_ = function (marker, bounds) {
- return bounds.contains(marker.getPosition());
-};
-
-/**
- * Clears all clusters and markers from the clusterer.
- */
-MarkerClusterer.prototype.clearMarkers = function () {
- this.resetViewport(true);
-
- // Set the markers a empty array.
- this.markers_ = [];
-};
-
-/**
- * Clears all existing clusters and recreates them.
- * @param {boolean} opt_hide To also hide the marker.
- */
-MarkerClusterer.prototype.resetViewport = function (opt_hide) {
- // Remove all the clusters
- for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
- cluster.remove();
- }
-
- // Reset the markers to not be added and to be invisible.
- for (var i = 0, marker; marker = this.markers_[i]; i++) {
- marker.isAdded = false;
- if (opt_hide) {
- marker.setMap(null);
- }
- }
- this.clusters_ = [];
-};
-
-/**
- *
- */
-MarkerClusterer.prototype.repaint = function () {
- var oldClusters = this.clusters_.slice();
- this.clusters_.length = 0;
- this.resetViewport();
- this.redraw();
-
- // Remove the old clusters.
- // Do it in a timeout so the other clusters have been drawn first.
- window.setTimeout(function () {
- for (var i = 0, cluster; cluster = oldClusters[i]; i++) {
- cluster.remove();
- }
- }, 0);
-};
-
-/**
- * Redraws the clusters.
- */
-MarkerClusterer.prototype.redraw = function () {
- this.createClusters_();
-};
-
-/**
- * Calculates the distance between two latlng locations in km.
- * @see http://www.movable-type.co.uk/scripts/latlong.html
- *
- * @param {google.maps.LatLng} p1 The first lat lng point.
- * @param {google.maps.LatLng} p2 The second lat lng point.
- * @return {number} The distance between the two points in km.
- * @private
- */
-MarkerClusterer.prototype.distanceBetweenPoints_ = function (p1, p2) {
- if (!p1 || !p2) {
- return 0;
- }
- var R = 6371; // Radius of the Earth in km
- var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
- var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
- var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
- var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
- var d = R * c;
- return d;
-};
-
-/**
- * Add a marker to a cluster, or creates a new cluster.
- *
- * @param {google.maps.Marker} marker The marker to add.
- * @private
- */
-MarkerClusterer.prototype.addToClosestCluster_ = function (marker) {
- var distance = 40000; // Some large number
- var clusterToAddTo = null;
- var pos = marker.getPosition();
- for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
- var center = cluster.getCenter();
- if (center) {
- var d = this.distanceBetweenPoints_(center, marker.getPosition());
- if (d < distance) {
- distance = d;
- clusterToAddTo = cluster;
- }
- }
- }
- if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
- clusterToAddTo.addMarker(marker);
- } else {
- var cluster = new Cluster(this);
- cluster.addMarker(marker);
- this.clusters_.push(cluster);
- }
-};
-
-/**
- * Creates the clusters.
- *
- * @private
- */
-MarkerClusterer.prototype.createClusters_ = function () {
- if (!this.ready_) {
- return;
- }
-
- // Get our current map view bounds.
- // Create a new bounds object so we don't affect the map.
- var mapBounds = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(), this.map_.getBounds().getNorthEast());
- var bounds = this.getExtendedBounds(mapBounds);
- for (var i = 0, marker; marker = this.markers_[i]; i++) {
- if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {
- this.addToClosestCluster_(marker);
- }
- }
-};
-
-/**
- * A cluster that contains markers.
- *
- * @param {MarkerClusterer} markerClusterer The markerclusterer that this
- * cluster is associated with.
- * @constructor
- * @ignore
- */
-function Cluster(markerClusterer) {
- this.markerClusterer_ = markerClusterer;
- this.map_ = markerClusterer.getMap();
- this.gridSize_ = markerClusterer.getGridSize();
- this.minClusterSize_ = markerClusterer.getMinClusterSize();
- this.averageCenter_ = markerClusterer.isAverageCenter();
- this.center_ = null;
- this.markers_ = [];
- this.bounds_ = null;
- this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(), markerClusterer.getGridSize());
-}
-
-/**
- * Determins if a marker is already added to the cluster.
- *
- * @param {google.maps.Marker} marker The marker to check.
- * @return {boolean} True if the marker is already added.
- */
-Cluster.prototype.isMarkerAlreadyAdded = function (marker) {
- if (this.markers_.indexOf) {
- return this.markers_.indexOf(marker) != -1;
- } else {
- for (var i = 0, m; m = this.markers_[i]; i++) {
- if (m == marker) {
- return true;
- }
- }
- }
- return false;
-};
-
-/**
- * Add a marker the cluster.
- *
- * @param {google.maps.Marker} marker The marker to add.
- * @return {boolean} True if the marker was added.
- */
-Cluster.prototype.addMarker = function (marker) {
- if (this.isMarkerAlreadyAdded(marker)) {
- return false;
- }
- if (!this.center_) {
- this.center_ = marker.getPosition();
- this.calculateBounds_();
- } else {
- if (this.averageCenter_) {
- var l = this.markers_.length + 1;
- var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l;
- var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l;
- this.center_ = new google.maps.LatLng(lat, lng);
- this.calculateBounds_();
- }
- }
- marker.isAdded = true;
- this.markers_.push(marker);
- var len = this.markers_.length;
- if (len < this.minClusterSize_ && marker.getMap() != this.map_) {
- // Min cluster size not reached so show the marker.
- marker.setMap(this.map_);
- }
- if (len == this.minClusterSize_) {
- // Hide the markers that were showing.
- for (var i = 0; i < len; i++) {
- this.markers_[i].setMap(null);
- }
- }
- if (len >= this.minClusterSize_) {
- marker.setMap(null);
- }
- this.updateIcon();
- return true;
-};
-
-/**
- * Returns the marker clusterer that the cluster is associated with.
- *
- * @return {MarkerClusterer} The associated marker clusterer.
- */
-Cluster.prototype.getMarkerClusterer = function () {
- return this.markerClusterer_;
-};
-
-/**
- * Returns the bounds of the cluster.
- *
- * @return {google.maps.LatLngBounds} the cluster bounds.
- */
-Cluster.prototype.getBounds = function () {
- var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
- var markers = this.getMarkers();
- for (var i = 0, marker; marker = markers[i]; i++) {
- bounds.extend(marker.getPosition());
- }
- return bounds;
-};
-
-/**
- * Removes the cluster
- */
-Cluster.prototype.remove = function () {
- this.clusterIcon_.remove();
- this.markers_.length = 0;
- delete this.markers_;
-};
-
-/**
- * Returns the center of the cluster.
- *
- * @return {number} The cluster center.
- */
-Cluster.prototype.getSize = function () {
- return this.markers_.length;
-};
-
-/**
- * Returns the center of the cluster.
- *
- * @return {Array.} The cluster center.
- */
-Cluster.prototype.getMarkers = function () {
- return this.markers_;
-};
-
-/**
- * Returns the center of the cluster.
- *
- * @return {google.maps.LatLng} The cluster center.
- */
-Cluster.prototype.getCenter = function () {
- return this.center_;
-};
-
-/**
- * Calculated the extended bounds of the cluster with the grid.
- *
- * @private
- */
-Cluster.prototype.calculateBounds_ = function () {
- var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
- this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
-};
-
-/**
- * Determines if a marker lies in the clusters bounds.
- *
- * @param {google.maps.Marker} marker The marker to check.
- * @return {boolean} True if the marker lies in the bounds.
- */
-Cluster.prototype.isMarkerInClusterBounds = function (marker) {
- return this.bounds_.contains(marker.getPosition());
-};
-
-/**
- * Returns the map that the cluster is associated with.
- *
- * @return {google.maps.Map} The map.
- */
-Cluster.prototype.getMap = function () {
- return this.map_;
-};
-
-/**
- * Updates the cluster icon
- */
-Cluster.prototype.updateIcon = function () {
- var zoom = this.map_.getZoom();
- var mz = this.markerClusterer_.getMaxZoom();
- if (mz && zoom > mz) {
- // The zoom is greater than our max zoom so show all the markers in cluster.
- for (var i = 0, marker; marker = this.markers_[i]; i++) {
- marker.setMap(this.map_);
- }
- return;
- }
- if (this.markers_.length < this.minClusterSize_) {
- // Min cluster size not yet reached.
- this.clusterIcon_.hide();
- return;
- }
- var numStyles = this.markerClusterer_.getStyles().length;
- var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
- this.clusterIcon_.setCenter(this.center_);
- this.clusterIcon_.setSums(sums);
- this.clusterIcon_.show();
-};
-
-/**
- * A cluster icon
- *
- * @param {Cluster} cluster The cluster to be associated with.
- * @param {Object} styles An object that has style properties:
- * 'url': (string) The image url.
- * 'height': (number) The image height.
- * 'width': (number) The image width.
- * 'anchor': (Array) The anchor position of the label text.
- * 'textColor': (string) The text color.
- * 'textSize': (number) The text size.
- * 'backgroundPosition: (string) The background postition x, y.
- * @param {number=} opt_padding Optional padding to apply to the cluster icon.
- * @constructor
- * @extends google.maps.OverlayView
- * @ignore
- */
-function ClusterIcon(cluster, styles, opt_padding) {
- cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
- this.styles_ = styles;
- this.padding_ = opt_padding || 0;
- this.cluster_ = cluster;
- this.center_ = null;
- this.map_ = cluster.getMap();
- this.div_ = null;
- this.sums_ = null;
- this.visible_ = false;
- this.setMap(this.map_);
-}
-
-/**
- * Triggers the clusterclick event and zoom's if the option is set.
- */
-ClusterIcon.prototype.triggerClusterClick = function () {
- var markerClusterer = this.cluster_.getMarkerClusterer();
-
- // Trigger the clusterclick event.
- google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_);
- if (markerClusterer.isZoomOnClick()) {
- // Zoom into the cluster.
- this.map_.fitBounds(this.cluster_.getBounds());
- }
-};
-
-/**
- * Adding the cluster icon to the dom.
- * @ignore
- */
-ClusterIcon.prototype.onAdd = function () {
- this.div_ = document.createElement('DIV');
- if (this.visible_) {
- var pos = this.getPosFromLatLng_(this.center_);
- this.div_.style.cssText = this.createCss(pos);
- this.div_.innerHTML = this.sums_.text;
- var markerClusterer = this.cluster_.getMarkerClusterer();
- if (markerClusterer.cssClass_) {
- this.div_.className = markerClusterer.cssClass_;
- }
- }
- var panes = this.getPanes();
- panes.overlayMouseTarget.appendChild(this.div_);
- var that = this;
- google.maps.event.addDomListener(this.div_, 'click', function () {
- that.triggerClusterClick();
- });
-};
-
-/**
- * Returns the position to place the div dending on the latlng.
- *
- * @param {google.maps.LatLng} latlng The position in latlng.
- * @return {google.maps.Point} The position in pixels.
- * @private
- */
-ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) {
- var pos = this.getProjection().fromLatLngToDivPixel(latlng);
- pos.x -= parseInt(this.width_ / 2, 10);
- pos.y -= parseInt(this.height_ / 2, 10);
- return pos;
-};
-
-/**
- * Draw the icon.
- * @ignore
- */
-ClusterIcon.prototype.draw = function () {
- if (this.visible_) {
- var pos = this.getPosFromLatLng_(this.center_);
- this.div_.style.top = pos.y + 'px';
- this.div_.style.left = pos.x + 'px';
- }
-};
-
-/**
- * Hide the icon.
- */
-ClusterIcon.prototype.hide = function () {
- if (this.div_) {
- this.div_.style.display = 'none';
- }
- this.visible_ = false;
-};
-
-/**
- * Position and show the icon.
- */
-ClusterIcon.prototype.show = function () {
- if (this.div_) {
- var pos = this.getPosFromLatLng_(this.center_);
- this.div_.style.cssText = this.createCss(pos);
- this.div_.style.display = '';
- }
- this.visible_ = true;
-};
-
-/**
- * Remove the icon from the map
- */
-ClusterIcon.prototype.remove = function () {
- this.setMap(null);
-};
-
-/**
- * Implementation of the onRemove interface.
- * @ignore
- */
-ClusterIcon.prototype.onRemove = function () {
- if (this.div_ && this.div_.parentNode) {
- this.hide();
- this.div_.parentNode.removeChild(this.div_);
- this.div_ = null;
- }
-};
-
-/**
- * Set the sums of the icon.
- *
- * @param {Object} sums The sums containing:
- * 'text': (string) The text to display in the icon.
- * 'index': (number) The style index of the icon.
- */
-ClusterIcon.prototype.setSums = function (sums) {
- this.sums_ = sums;
- this.text_ = sums.text;
- this.index_ = sums.index;
- if (this.div_) {
- this.div_.innerHTML = sums.text;
- }
- this.useStyle();
-};
-
-/**
- * Sets the icon to the the styles.
- */
-ClusterIcon.prototype.useStyle = function () {
- var index = Math.max(0, this.sums_.index - 1);
- index = Math.min(this.styles_.length - 1, index);
- var style = this.styles_[index];
- this.url_ = style['url'];
- this.height_ = style['height'];
- this.width_ = style['width'];
- this.textColor_ = style['textColor'];
- this.anchor_ = style['anchor'];
- this.textSize_ = style['textSize'];
- this.backgroundPosition_ = style['backgroundPosition'];
-};
-
-/**
- * Sets the center of the icon.
- *
- * @param {google.maps.LatLng} center The latlng to set as the center.
- */
-ClusterIcon.prototype.setCenter = function (center) {
- this.center_ = center;
-};
-
-/**
- * Create the css text based on the position of the icon.
- *
- * @param {google.maps.Point} pos The position.
- * @return {string} The css style text.
- */
-ClusterIcon.prototype.createCss = function (pos) {
- var style = [];
- var markerClusterer = this.cluster_.getMarkerClusterer();
- if (!markerClusterer.cssClass_) {
- style.push('background-image:url(' + this.url_ + ');');
- var backgroundPosition = this.backgroundPosition_ ? this.backgroundPosition_ : '0 0';
- style.push('background-position:' + backgroundPosition + ';');
- if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(this.anchor_) === 'object') {
- if (typeof this.anchor_[0] === 'number' && this.anchor_[0] > 0 && this.anchor_[0] < this.height_) {
- style.push('height:' + (this.height_ - this.anchor_[0]) + 'px; padding-top:' + this.anchor_[0] + 'px;');
- } else {
- style.push('height:' + this.height_ + 'px; line-height:' + this.height_ + 'px;');
- }
- if (typeof this.anchor_[1] === 'number' && this.anchor_[1] > 0 && this.anchor_[1] < this.width_) {
- style.push('width:' + (this.width_ - this.anchor_[1]) + 'px; padding-left:' + this.anchor_[1] + 'px;');
- } else {
- style.push('width:' + this.width_ + 'px; text-align:center;');
- }
- } else {
- style.push('height:' + this.height_ + 'px; line-height:' + this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;');
- }
- var txtColor = this.textColor_ ? this.textColor_ : 'black';
- var txtSize = this.textSize_ ? this.textSize_ : 11;
- style.push('cursor:pointer; color:' + txtColor + '; position:absolute; font-size:' + txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
- } else {
- style.push('top:' + pos.y + 'px; left:' + pos.x + 'px;');
- }
- return style.join('');
-};
-
-// Export Symbols for Closure
-// If you are not going to compile with closure then you can remove the
-// code below.
-window['MarkerClusterer'] = MarkerClusterer;
-MarkerClusterer.prototype['addMarker'] = MarkerClusterer.prototype.addMarker;
-MarkerClusterer.prototype['addMarkers'] = MarkerClusterer.prototype.addMarkers;
-MarkerClusterer.prototype['clearMarkers'] = MarkerClusterer.prototype.clearMarkers;
-MarkerClusterer.prototype['fitMapToMarkers'] = MarkerClusterer.prototype.fitMapToMarkers;
-MarkerClusterer.prototype['getCalculator'] = MarkerClusterer.prototype.getCalculator;
-MarkerClusterer.prototype['getGridSize'] = MarkerClusterer.prototype.getGridSize;
-MarkerClusterer.prototype['getExtendedBounds'] = MarkerClusterer.prototype.getExtendedBounds;
-MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap;
-MarkerClusterer.prototype['getMarkers'] = MarkerClusterer.prototype.getMarkers;
-MarkerClusterer.prototype['getMaxZoom'] = MarkerClusterer.prototype.getMaxZoom;
-MarkerClusterer.prototype['getStyles'] = MarkerClusterer.prototype.getStyles;
-MarkerClusterer.prototype['getTotalClusters'] = MarkerClusterer.prototype.getTotalClusters;
-MarkerClusterer.prototype['getTotalMarkers'] = MarkerClusterer.prototype.getTotalMarkers;
-MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw;
-MarkerClusterer.prototype['removeMarker'] = MarkerClusterer.prototype.removeMarker;
-MarkerClusterer.prototype['removeMarkers'] = MarkerClusterer.prototype.removeMarkers;
-MarkerClusterer.prototype['resetViewport'] = MarkerClusterer.prototype.resetViewport;
-MarkerClusterer.prototype['repaint'] = MarkerClusterer.prototype.repaint;
-MarkerClusterer.prototype['setCalculator'] = MarkerClusterer.prototype.setCalculator;
-MarkerClusterer.prototype['setGridSize'] = MarkerClusterer.prototype.setGridSize;
-MarkerClusterer.prototype['setMaxZoom'] = MarkerClusterer.prototype.setMaxZoom;
-MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd;
-MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw;
-Cluster.prototype['getCenter'] = Cluster.prototype.getCenter;
-Cluster.prototype['getSize'] = Cluster.prototype.getSize;
-Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers;
-ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd;
-ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw;
-ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove;
-}();
-/******/ })()
-;
-//# sourceMappingURL=global-markerclusterer.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/typeof */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ // ==ClosureCompiler==
+ // @compilation_level ADVANCED_OPTIMIZATIONS
+ // @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/maps/google_maps_api_v3_3.js
+ // ==/ClosureCompiler==
+
+ /**
+ * @name MarkerClusterer for Google Maps v3
+ * @version version 1.0
+ * @author Luke Mahe
+ * @fileoverview
+ * The library creates and manages per-zoom-level clusters for large amounts of
+ * markers.
+ *
+ * This is a v3 implementation of the
+ * v2 MarkerClusterer .
+ */
+
+ /**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * A Marker Clusterer that clusters markers.
+ *
+ * @param {google.maps.Map} map The Google map to attach to.
+ * @param {Array.=} opt_markers Optional markers to add to
+ * the cluster.
+ * @param {Object=} opt_options support the following options:
+ * 'gridSize': (number) The grid size of a cluster in pixels.
+ * 'maxZoom': (number) The maximum zoom level that a marker can be part of a
+ * cluster.
+ * 'zoomOnClick': (boolean) Whether the default behaviour of clicking on a
+ * cluster is to zoom into it.
+ * 'averageCenter': (boolean) Wether the center of each cluster should be
+ * the average of all markers in the cluster.
+ * 'minimumClusterSize': (number) The minimum number of markers to be in a
+ * cluster before the markers are hidden and a count
+ * is shown.
+ * 'styles': (object) An object that has style properties:
+ * 'url': (string) The image url.
+ * 'height': (number) The image height.
+ * 'width': (number) The image width.
+ * 'anchor': (Array) The anchor position of the label text.
+ * 'textColor': (string) The text color.
+ * 'textSize': (number) The text size.
+ * 'backgroundPosition': (string) The position of the background x, y.
+ * 'cssClass': (string) One or more CSS class for styling this marker.
+ * @constructor
+ * @extends google.maps.OverlayView
+ */
+ function MarkerClusterer(map, opt_markers, opt_options) {
+ // MarkerClusterer implements google.maps.OverlayView interface. We use the
+ // extend function to extend MarkerClusterer with google.maps.OverlayView
+ // because it might not always be available when the code is defined so we
+ // look for it at the last possible moment. If it doesn't exist now then
+ // there is no point going ahead :)
+ this.extend(MarkerClusterer, google.maps.OverlayView);
+ this.map_ = map;
+
+ /**
+ * @type {Array.}
+ * @private
+ */
+ this.markers_ = [];
+
+ /**
+ * @type {Array.}
+ */
+ this.clusters_ = [];
+ this.sizes = [53, 56, 66, 78, 90];
+
+ /**
+ * @private
+ */
+ this.styles_ = [];
+
+ /**
+ * @private
+ */
+ this.cssClass_ = '';
+
+ /**
+ * @type {boolean}
+ * @private
+ */
+ this.ready_ = false;
+ var options = opt_options || {};
+
+ /**
+ * @type {number}
+ * @private
+ */
+ this.gridSize_ = options['gridSize'] || 60;
+
+ /**
+ * @private
+ */
+ this.minClusterSize_ = options['minimumClusterSize'] || 2;
+
+ /**
+ * @type {?number}
+ * @private
+ */
+ this.maxZoom_ = options['maxZoom'] || null;
+ this.styles_ = options['styles'] || [];
+ this.cssClass_ = options['cssClass'] || null;
+
+ /**
+ * @type {string}
+ * @private
+ */
+ this.imagePath_ =
+ options['imagePath'] || this.MARKER_CLUSTER_IMAGE_PATH_;
+
+ /**
+ * @type {string}
+ * @private
+ */
+ this.imageExtension_ =
+ options['imageExtension'] ||
+ this.MARKER_CLUSTER_IMAGE_EXTENSION_;
+
+ /**
+ * @type {boolean}
+ * @private
+ */
+ this.zoomOnClick_ = true;
+ if (options['zoomOnClick'] != undefined) {
+ this.zoomOnClick_ = options['zoomOnClick'];
+ }
+
+ /**
+ * @type {boolean}
+ * @private
+ */
+ this.averageCenter_ = false;
+ if (options['averageCenter'] != undefined) {
+ this.averageCenter_ = options['averageCenter'];
+ }
+ this.setupStyles_();
+ this.setMap(map);
+
+ /**
+ * @type {number}
+ * @private
+ */
+ this.prevZoom_ = this.map_.getZoom();
+
+ // Add the map event listeners
+ var that = this;
+ google.maps.event.addListener(
+ this.map_,
+ 'zoom_changed',
+ function () {
+ var zoom = that.map_.getZoom();
+ if (that.prevZoom_ != zoom) {
+ that.prevZoom_ = zoom;
+ that.resetViewport();
+ }
+ }
+ );
+ google.maps.event.addListener(this.map_, 'idle', function () {
+ that.redraw();
+ });
+
+ // Finally, add the markers
+ if (opt_markers && opt_markers.length) {
+ this.addMarkers(opt_markers, false);
+ }
+ }
+
+ /**
+ * The marker cluster image path.
+ *
+ * @type {string}
+ * @private
+ */
+ MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ =
+ 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/' +
+ 'images/m';
+
+ /**
+ * The marker cluster image path.
+ *
+ * @type {string}
+ * @private
+ */
+ MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png';
+
+ /**
+ * Extends a objects prototype by anothers.
+ *
+ * @param {Object} obj1 The object to be extended.
+ * @param {Object} obj2 The object to extend with.
+ * @return {Object} The new extended object.
+ * @ignore
+ */
+ MarkerClusterer.prototype.extend = function (obj1, obj2) {
+ return function (object) {
+ for (var property in object.prototype) {
+ this.prototype[property] = object.prototype[property];
+ }
+ return this;
+ }.apply(obj1, [obj2]);
+ };
+
+ /**
+ * Implementaion of the interface method.
+ * @ignore
+ */
+ MarkerClusterer.prototype.onAdd = function () {
+ this.setReady_(true);
+ };
+
+ /**
+ * Implementaion of the interface method.
+ * @ignore
+ */
+ MarkerClusterer.prototype.draw = function () {};
+
+ /**
+ * Sets up the styles object.
+ *
+ * @private
+ */
+ MarkerClusterer.prototype.setupStyles_ = function () {
+ if (this.styles_.length) {
+ return;
+ }
+ for (var i = 0, size; (size = this.sizes[i]); i++) {
+ this.styles_.push({
+ url: this.imagePath_ + (i + 1) + '.' + this.imageExtension_,
+ height: size,
+ width: size,
+ });
+ }
+ };
+
+ /**
+ * Fit the map to the bounds of the markers in the clusterer.
+ */
+ MarkerClusterer.prototype.fitMapToMarkers = function () {
+ var markers = this.getMarkers();
+ var bounds = new google.maps.LatLngBounds();
+ for (var i = 0, marker; (marker = markers[i]); i++) {
+ bounds.extend(marker.getPosition());
+ }
+ this.map_.fitBounds(bounds);
+ };
+
+ /**
+ * Sets the styles.
+ *
+ * @param {Object} styles The style to set.
+ */
+ MarkerClusterer.prototype.setStyles = function (styles) {
+ this.styles_ = styles;
+ };
+
+ /**
+ * Gets the styles.
+ *
+ * @return {Object} The styles object.
+ */
+ MarkerClusterer.prototype.getStyles = function () {
+ return this.styles_;
+ };
+
+ /**
+ * Whether zoom on click is set.
+ *
+ * @return {boolean} True if zoomOnClick_ is set.
+ */
+ MarkerClusterer.prototype.isZoomOnClick = function () {
+ return this.zoomOnClick_;
+ };
+
+ /**
+ * Whether average center is set.
+ *
+ * @return {boolean} True if averageCenter_ is set.
+ */
+ MarkerClusterer.prototype.isAverageCenter = function () {
+ return this.averageCenter_;
+ };
+
+ /**
+ * Returns the array of markers in the clusterer.
+ *
+ * @return {Array.} The markers.
+ */
+ MarkerClusterer.prototype.getMarkers = function () {
+ return this.markers_;
+ };
+
+ /**
+ * Returns the number of markers in the clusterer
+ *
+ * @return {Number} The number of markers.
+ */
+ MarkerClusterer.prototype.getTotalMarkers = function () {
+ return this.markers_.length;
+ };
+
+ /**
+ * Sets the max zoom for the clusterer.
+ *
+ * @param {number} maxZoom The max zoom level.
+ */
+ MarkerClusterer.prototype.setMaxZoom = function (maxZoom) {
+ this.maxZoom_ = maxZoom;
+ };
+
+ /**
+ * Gets the max zoom for the clusterer.
+ *
+ * @return {number} The max zoom level.
+ */
+ MarkerClusterer.prototype.getMaxZoom = function () {
+ return this.maxZoom_;
+ };
+
+ /**
+ * The function for calculating the cluster icon image.
+ *
+ * @param {Array.} markers The markers in the clusterer.
+ * @param {number} numStyles The number of styles available.
+ * @return {Object} A object properties: 'text' (string) and 'index' (number).
+ * @private
+ */
+ MarkerClusterer.prototype.calculator_ = function (markers, numStyles) {
+ var index = 0;
+ var count = markers.length;
+ var dv = count;
+ while (dv !== 0) {
+ dv = parseInt(dv / 10, 10);
+ index++;
+ }
+ index = Math.min(index, numStyles);
+ return {
+ text: count,
+ index: index,
+ };
+ };
+
+ /**
+ * Set the calculator function.
+ *
+ * @param {function(Array, number)} calculator The function to set as the
+ * calculator. The function should return a object properties:
+ * 'text' (string) and 'index' (number).
+ *
+ */
+ MarkerClusterer.prototype.setCalculator = function (calculator) {
+ this.calculator_ = calculator;
+ };
+
+ /**
+ * Get the calculator function.
+ *
+ * @return {function(Array, number)} the calculator function.
+ */
+ MarkerClusterer.prototype.getCalculator = function () {
+ return this.calculator_;
+ };
+
+ /**
+ * Add an array of markers to the clusterer.
+ *
+ * @param {Array.} markers The markers to add.
+ * @param {boolean=} opt_nodraw Whether to redraw the clusters.
+ */
+ MarkerClusterer.prototype.addMarkers = function (markers, opt_nodraw) {
+ for (var i = 0, marker; (marker = markers[i]); i++) {
+ this.pushMarkerTo_(marker);
+ }
+ if (!opt_nodraw) {
+ this.redraw();
+ }
+ };
+
+ /**
+ * Pushes a marker to the clusterer.
+ *
+ * @param {google.maps.Marker} marker The marker to add.
+ * @private
+ */
+ MarkerClusterer.prototype.pushMarkerTo_ = function (marker) {
+ marker.isAdded = false;
+ if (marker['draggable']) {
+ // If the marker is draggable add a listener so we update the clusters on
+ // the drag end.
+ var that = this;
+ google.maps.event.addListener(marker, 'dragend', function () {
+ marker.isAdded = false;
+ that.repaint();
+ });
+ }
+ this.markers_.push(marker);
+ };
+
+ /**
+ * Adds a marker to the clusterer and redraws if needed.
+ *
+ * @param {google.maps.Marker} marker The marker to add.
+ * @param {boolean=} opt_nodraw Whether to redraw the clusters.
+ */
+ MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) {
+ this.pushMarkerTo_(marker);
+ if (!opt_nodraw) {
+ this.redraw();
+ }
+ };
+
+ /**
+ * Removes a marker and returns true if removed, false if not
+ *
+ * @param {google.maps.Marker} marker The marker to remove
+ * @return {boolean} Whether the marker was removed or not
+ * @private
+ */
+ MarkerClusterer.prototype.removeMarker_ = function (marker) {
+ var index = -1;
+ if (this.markers_.indexOf) {
+ index = this.markers_.indexOf(marker);
+ } else {
+ for (var i = 0, m; (m = this.markers_[i]); i++) {
+ if (m == marker) {
+ index = i;
+ break;
+ }
+ }
+ }
+ if (index == -1) {
+ // Marker is not in our list of markers.
+ return false;
+ }
+ marker.setMap(null);
+ this.markers_.splice(index, 1);
+ return true;
+ };
+
+ /**
+ * Remove a marker from the cluster.
+ *
+ * @param {google.maps.Marker} marker The marker to remove.
+ * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
+ * @return {boolean} True if the marker was removed.
+ */
+ MarkerClusterer.prototype.removeMarker = function (marker, opt_nodraw) {
+ var removed = this.removeMarker_(marker);
+ if (!opt_nodraw && removed) {
+ this.resetViewport();
+ this.redraw();
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ /**
+ * Removes an array of markers from the cluster.
+ *
+ * @param {Array.} markers The markers to remove.
+ * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
+ */
+ MarkerClusterer.prototype.removeMarkers = function (
+ markers,
+ opt_nodraw
+ ) {
+ var removed = false;
+ for (var i = 0, marker; (marker = markers[i]); i++) {
+ var r = this.removeMarker_(marker);
+ removed = removed || r;
+ }
+ if (!opt_nodraw && removed) {
+ this.resetViewport();
+ this.redraw();
+ return true;
+ }
+ };
+
+ /**
+ * Sets the clusterer's ready state.
+ *
+ * @param {boolean} ready The state.
+ * @private
+ */
+ MarkerClusterer.prototype.setReady_ = function (ready) {
+ if (!this.ready_) {
+ this.ready_ = ready;
+ this.createClusters_();
+ }
+ };
+
+ /**
+ * Returns the number of clusters in the clusterer.
+ *
+ * @return {number} The number of clusters.
+ */
+ MarkerClusterer.prototype.getTotalClusters = function () {
+ return this.clusters_.length;
+ };
+
+ /**
+ * Returns the google map that the clusterer is associated with.
+ *
+ * @return {google.maps.Map} The map.
+ */
+ MarkerClusterer.prototype.getMap = function () {
+ return this.map_;
+ };
+
+ /**
+ * Sets the google map that the clusterer is associated with.
+ *
+ * @param {google.maps.Map} map The map.
+ */
+ MarkerClusterer.prototype.setMap = function (map) {
+ this.map_ = map;
+ };
+
+ /**
+ * Returns the size of the grid.
+ *
+ * @return {number} The grid size.
+ */
+ MarkerClusterer.prototype.getGridSize = function () {
+ return this.gridSize_;
+ };
+
+ /**
+ * Sets the size of the grid.
+ *
+ * @param {number} size The grid size.
+ */
+ MarkerClusterer.prototype.setGridSize = function (size) {
+ this.gridSize_ = size;
+ };
+
+ /**
+ * Returns the min cluster size.
+ *
+ * @return {number} The grid size.
+ */
+ MarkerClusterer.prototype.getMinClusterSize = function () {
+ return this.minClusterSize_;
+ };
+
+ /**
+ * Sets the min cluster size.
+ *
+ * @param {number} size The grid size.
+ */
+ MarkerClusterer.prototype.setMinClusterSize = function (size) {
+ this.minClusterSize_ = size;
+ };
+
+ /**
+ * Extends a bounds object by the grid size.
+ *
+ * @param {google.maps.LatLngBounds} bounds The bounds to extend.
+ * @return {google.maps.LatLngBounds} The extended bounds.
+ */
+ MarkerClusterer.prototype.getExtendedBounds = function (bounds) {
+ var projection = this.getProjection();
+
+ // Turn the bounds into latlng.
+ var tr = new google.maps.LatLng(
+ bounds.getNorthEast().lat(),
+ bounds.getNorthEast().lng()
+ );
+ var bl = new google.maps.LatLng(
+ bounds.getSouthWest().lat(),
+ bounds.getSouthWest().lng()
+ );
+
+ // Convert the points to pixels and the extend out by the grid size.
+ var trPix = projection.fromLatLngToDivPixel(tr);
+ trPix.x += this.gridSize_;
+ trPix.y -= this.gridSize_;
+ var blPix = projection.fromLatLngToDivPixel(bl);
+ blPix.x -= this.gridSize_;
+ blPix.y += this.gridSize_;
+
+ // Convert the pixel points back to LatLng
+ var ne = projection.fromDivPixelToLatLng(trPix);
+ var sw = projection.fromDivPixelToLatLng(blPix);
+
+ // Extend the bounds to contain the new bounds.
+ bounds.extend(ne);
+ bounds.extend(sw);
+ return bounds;
+ };
+
+ /**
+ * Determins if a marker is contained in a bounds.
+ *
+ * @param {google.maps.Marker} marker The marker to check.
+ * @param {google.maps.LatLngBounds} bounds The bounds to check against.
+ * @return {boolean} True if the marker is in the bounds.
+ * @private
+ */
+ MarkerClusterer.prototype.isMarkerInBounds_ = function (
+ marker,
+ bounds
+ ) {
+ return bounds.contains(marker.getPosition());
+ };
+
+ /**
+ * Clears all clusters and markers from the clusterer.
+ */
+ MarkerClusterer.prototype.clearMarkers = function () {
+ this.resetViewport(true);
+
+ // Set the markers a empty array.
+ this.markers_ = [];
+ };
+
+ /**
+ * Clears all existing clusters and recreates them.
+ * @param {boolean} opt_hide To also hide the marker.
+ */
+ MarkerClusterer.prototype.resetViewport = function (opt_hide) {
+ // Remove all the clusters
+ for (var i = 0, cluster; (cluster = this.clusters_[i]); i++) {
+ cluster.remove();
+ }
+
+ // Reset the markers to not be added and to be invisible.
+ for (var i = 0, marker; (marker = this.markers_[i]); i++) {
+ marker.isAdded = false;
+ if (opt_hide) {
+ marker.setMap(null);
+ }
+ }
+ this.clusters_ = [];
+ };
+
+ /**
+ *
+ */
+ MarkerClusterer.prototype.repaint = function () {
+ var oldClusters = this.clusters_.slice();
+ this.clusters_.length = 0;
+ this.resetViewport();
+ this.redraw();
+
+ // Remove the old clusters.
+ // Do it in a timeout so the other clusters have been drawn first.
+ window.setTimeout(function () {
+ for (var i = 0, cluster; (cluster = oldClusters[i]); i++) {
+ cluster.remove();
+ }
+ }, 0);
+ };
+
+ /**
+ * Redraws the clusters.
+ */
+ MarkerClusterer.prototype.redraw = function () {
+ this.createClusters_();
+ };
+
+ /**
+ * Calculates the distance between two latlng locations in km.
+ * @see http://www.movable-type.co.uk/scripts/latlong.html
+ *
+ * @param {google.maps.LatLng} p1 The first lat lng point.
+ * @param {google.maps.LatLng} p2 The second lat lng point.
+ * @return {number} The distance between the two points in km.
+ * @private
+ */
+ MarkerClusterer.prototype.distanceBetweenPoints_ = function (p1, p2) {
+ if (!p1 || !p2) {
+ return 0;
+ }
+ var R = 6371; // Radius of the Earth in km
+ var dLat = ((p2.lat() - p1.lat()) * Math.PI) / 180;
+ var dLon = ((p2.lng() - p1.lng()) * Math.PI) / 180;
+ var a =
+ Math.sin(dLat / 2) * Math.sin(dLat / 2) +
+ Math.cos((p1.lat() * Math.PI) / 180) *
+ Math.cos((p2.lat() * Math.PI) / 180) *
+ Math.sin(dLon / 2) *
+ Math.sin(dLon / 2);
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+ var d = R * c;
+ return d;
+ };
+
+ /**
+ * Add a marker to a cluster, or creates a new cluster.
+ *
+ * @param {google.maps.Marker} marker The marker to add.
+ * @private
+ */
+ MarkerClusterer.prototype.addToClosestCluster_ = function (marker) {
+ var distance = 40000; // Some large number
+ var clusterToAddTo = null;
+ var pos = marker.getPosition();
+ for (var i = 0, cluster; (cluster = this.clusters_[i]); i++) {
+ var center = cluster.getCenter();
+ if (center) {
+ var d = this.distanceBetweenPoints_(
+ center,
+ marker.getPosition()
+ );
+ if (d < distance) {
+ distance = d;
+ clusterToAddTo = cluster;
+ }
+ }
+ }
+ if (
+ clusterToAddTo &&
+ clusterToAddTo.isMarkerInClusterBounds(marker)
+ ) {
+ clusterToAddTo.addMarker(marker);
+ } else {
+ var cluster = new Cluster(this);
+ cluster.addMarker(marker);
+ this.clusters_.push(cluster);
+ }
+ };
+
+ /**
+ * Creates the clusters.
+ *
+ * @private
+ */
+ MarkerClusterer.prototype.createClusters_ = function () {
+ if (!this.ready_) {
+ return;
+ }
+
+ // Get our current map view bounds.
+ // Create a new bounds object so we don't affect the map.
+ var mapBounds = new google.maps.LatLngBounds(
+ this.map_.getBounds().getSouthWest(),
+ this.map_.getBounds().getNorthEast()
+ );
+ var bounds = this.getExtendedBounds(mapBounds);
+ for (var i = 0, marker; (marker = this.markers_[i]); i++) {
+ if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {
+ this.addToClosestCluster_(marker);
+ }
+ }
+ };
+
+ /**
+ * A cluster that contains markers.
+ *
+ * @param {MarkerClusterer} markerClusterer The markerclusterer that this
+ * cluster is associated with.
+ * @constructor
+ * @ignore
+ */
+ function Cluster(markerClusterer) {
+ this.markerClusterer_ = markerClusterer;
+ this.map_ = markerClusterer.getMap();
+ this.gridSize_ = markerClusterer.getGridSize();
+ this.minClusterSize_ = markerClusterer.getMinClusterSize();
+ this.averageCenter_ = markerClusterer.isAverageCenter();
+ this.center_ = null;
+ this.markers_ = [];
+ this.bounds_ = null;
+ this.clusterIcon_ = new ClusterIcon(
+ this,
+ markerClusterer.getStyles(),
+ markerClusterer.getGridSize()
+ );
+ }
+
+ /**
+ * Determins if a marker is already added to the cluster.
+ *
+ * @param {google.maps.Marker} marker The marker to check.
+ * @return {boolean} True if the marker is already added.
+ */
+ Cluster.prototype.isMarkerAlreadyAdded = function (marker) {
+ if (this.markers_.indexOf) {
+ return this.markers_.indexOf(marker) != -1;
+ } else {
+ for (var i = 0, m; (m = this.markers_[i]); i++) {
+ if (m == marker) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ /**
+ * Add a marker the cluster.
+ *
+ * @param {google.maps.Marker} marker The marker to add.
+ * @return {boolean} True if the marker was added.
+ */
+ Cluster.prototype.addMarker = function (marker) {
+ if (this.isMarkerAlreadyAdded(marker)) {
+ return false;
+ }
+ if (!this.center_) {
+ this.center_ = marker.getPosition();
+ this.calculateBounds_();
+ } else {
+ if (this.averageCenter_) {
+ var l = this.markers_.length + 1;
+ var lat =
+ (this.center_.lat() * (l - 1) +
+ marker.getPosition().lat()) /
+ l;
+ var lng =
+ (this.center_.lng() * (l - 1) +
+ marker.getPosition().lng()) /
+ l;
+ this.center_ = new google.maps.LatLng(lat, lng);
+ this.calculateBounds_();
+ }
+ }
+ marker.isAdded = true;
+ this.markers_.push(marker);
+ var len = this.markers_.length;
+ if (len < this.minClusterSize_ && marker.getMap() != this.map_) {
+ // Min cluster size not reached so show the marker.
+ marker.setMap(this.map_);
+ }
+ if (len == this.minClusterSize_) {
+ // Hide the markers that were showing.
+ for (var i = 0; i < len; i++) {
+ this.markers_[i].setMap(null);
+ }
+ }
+ if (len >= this.minClusterSize_) {
+ marker.setMap(null);
+ }
+ this.updateIcon();
+ return true;
+ };
+
+ /**
+ * Returns the marker clusterer that the cluster is associated with.
+ *
+ * @return {MarkerClusterer} The associated marker clusterer.
+ */
+ Cluster.prototype.getMarkerClusterer = function () {
+ return this.markerClusterer_;
+ };
+
+ /**
+ * Returns the bounds of the cluster.
+ *
+ * @return {google.maps.LatLngBounds} the cluster bounds.
+ */
+ Cluster.prototype.getBounds = function () {
+ var bounds = new google.maps.LatLngBounds(
+ this.center_,
+ this.center_
+ );
+ var markers = this.getMarkers();
+ for (var i = 0, marker; (marker = markers[i]); i++) {
+ bounds.extend(marker.getPosition());
+ }
+ return bounds;
+ };
+
+ /**
+ * Removes the cluster
+ */
+ Cluster.prototype.remove = function () {
+ this.clusterIcon_.remove();
+ this.markers_.length = 0;
+ delete this.markers_;
+ };
+
+ /**
+ * Returns the center of the cluster.
+ *
+ * @return {number} The cluster center.
+ */
+ Cluster.prototype.getSize = function () {
+ return this.markers_.length;
+ };
+
+ /**
+ * Returns the center of the cluster.
+ *
+ * @return {Array.} The cluster center.
+ */
+ Cluster.prototype.getMarkers = function () {
+ return this.markers_;
+ };
+
+ /**
+ * Returns the center of the cluster.
+ *
+ * @return {google.maps.LatLng} The cluster center.
+ */
+ Cluster.prototype.getCenter = function () {
+ return this.center_;
+ };
+
+ /**
+ * Calculated the extended bounds of the cluster with the grid.
+ *
+ * @private
+ */
+ Cluster.prototype.calculateBounds_ = function () {
+ var bounds = new google.maps.LatLngBounds(
+ this.center_,
+ this.center_
+ );
+ this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
+ };
+
+ /**
+ * Determines if a marker lies in the clusters bounds.
+ *
+ * @param {google.maps.Marker} marker The marker to check.
+ * @return {boolean} True if the marker lies in the bounds.
+ */
+ Cluster.prototype.isMarkerInClusterBounds = function (marker) {
+ return this.bounds_.contains(marker.getPosition());
+ };
+
+ /**
+ * Returns the map that the cluster is associated with.
+ *
+ * @return {google.maps.Map} The map.
+ */
+ Cluster.prototype.getMap = function () {
+ return this.map_;
+ };
+
+ /**
+ * Updates the cluster icon
+ */
+ Cluster.prototype.updateIcon = function () {
+ var zoom = this.map_.getZoom();
+ var mz = this.markerClusterer_.getMaxZoom();
+ if (mz && zoom > mz) {
+ // The zoom is greater than our max zoom so show all the markers in cluster.
+ for (var i = 0, marker; (marker = this.markers_[i]); i++) {
+ marker.setMap(this.map_);
+ }
+ return;
+ }
+ if (this.markers_.length < this.minClusterSize_) {
+ // Min cluster size not yet reached.
+ this.clusterIcon_.hide();
+ return;
+ }
+ var numStyles = this.markerClusterer_.getStyles().length;
+ var sums = this.markerClusterer_.getCalculator()(
+ this.markers_,
+ numStyles
+ );
+ this.clusterIcon_.setCenter(this.center_);
+ this.clusterIcon_.setSums(sums);
+ this.clusterIcon_.show();
+ };
+
+ /**
+ * A cluster icon
+ *
+ * @param {Cluster} cluster The cluster to be associated with.
+ * @param {Object} styles An object that has style properties:
+ * 'url': (string) The image url.
+ * 'height': (number) The image height.
+ * 'width': (number) The image width.
+ * 'anchor': (Array) The anchor position of the label text.
+ * 'textColor': (string) The text color.
+ * 'textSize': (number) The text size.
+ * 'backgroundPosition: (string) The background postition x, y.
+ * @param {number=} opt_padding Optional padding to apply to the cluster icon.
+ * @constructor
+ * @extends google.maps.OverlayView
+ * @ignore
+ */
+ function ClusterIcon(cluster, styles, opt_padding) {
+ cluster
+ .getMarkerClusterer()
+ .extend(ClusterIcon, google.maps.OverlayView);
+ this.styles_ = styles;
+ this.padding_ = opt_padding || 0;
+ this.cluster_ = cluster;
+ this.center_ = null;
+ this.map_ = cluster.getMap();
+ this.div_ = null;
+ this.sums_ = null;
+ this.visible_ = false;
+ this.setMap(this.map_);
+ }
+
+ /**
+ * Triggers the clusterclick event and zoom's if the option is set.
+ */
+ ClusterIcon.prototype.triggerClusterClick = function () {
+ var markerClusterer = this.cluster_.getMarkerClusterer();
+
+ // Trigger the clusterclick event.
+ google.maps.event.trigger(
+ markerClusterer,
+ 'clusterclick',
+ this.cluster_
+ );
+ if (markerClusterer.isZoomOnClick()) {
+ // Zoom into the cluster.
+ this.map_.fitBounds(this.cluster_.getBounds());
+ }
+ };
+
+ /**
+ * Adding the cluster icon to the dom.
+ * @ignore
+ */
+ ClusterIcon.prototype.onAdd = function () {
+ this.div_ = document.createElement('DIV');
+ if (this.visible_) {
+ var pos = this.getPosFromLatLng_(this.center_);
+ this.div_.style.cssText = this.createCss(pos);
+ this.div_.innerHTML = this.sums_.text;
+ var markerClusterer = this.cluster_.getMarkerClusterer();
+ if (markerClusterer.cssClass_) {
+ this.div_.className = markerClusterer.cssClass_;
+ }
+ }
+ var panes = this.getPanes();
+ panes.overlayMouseTarget.appendChild(this.div_);
+ var that = this;
+ google.maps.event.addDomListener(this.div_, 'click', function () {
+ that.triggerClusterClick();
+ });
+ };
+
+ /**
+ * Returns the position to place the div dending on the latlng.
+ *
+ * @param {google.maps.LatLng} latlng The position in latlng.
+ * @return {google.maps.Point} The position in pixels.
+ * @private
+ */
+ ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) {
+ var pos = this.getProjection().fromLatLngToDivPixel(latlng);
+ pos.x -= parseInt(this.width_ / 2, 10);
+ pos.y -= parseInt(this.height_ / 2, 10);
+ return pos;
+ };
+
+ /**
+ * Draw the icon.
+ * @ignore
+ */
+ ClusterIcon.prototype.draw = function () {
+ if (this.visible_) {
+ var pos = this.getPosFromLatLng_(this.center_);
+ this.div_.style.top = pos.y + 'px';
+ this.div_.style.left = pos.x + 'px';
+ }
+ };
+
+ /**
+ * Hide the icon.
+ */
+ ClusterIcon.prototype.hide = function () {
+ if (this.div_) {
+ this.div_.style.display = 'none';
+ }
+ this.visible_ = false;
+ };
+
+ /**
+ * Position and show the icon.
+ */
+ ClusterIcon.prototype.show = function () {
+ if (this.div_) {
+ var pos = this.getPosFromLatLng_(this.center_);
+ this.div_.style.cssText = this.createCss(pos);
+ this.div_.style.display = '';
+ }
+ this.visible_ = true;
+ };
+
+ /**
+ * Remove the icon from the map
+ */
+ ClusterIcon.prototype.remove = function () {
+ this.setMap(null);
+ };
+
+ /**
+ * Implementation of the onRemove interface.
+ * @ignore
+ */
+ ClusterIcon.prototype.onRemove = function () {
+ if (this.div_ && this.div_.parentNode) {
+ this.hide();
+ this.div_.parentNode.removeChild(this.div_);
+ this.div_ = null;
+ }
+ };
+
+ /**
+ * Set the sums of the icon.
+ *
+ * @param {Object} sums The sums containing:
+ * 'text': (string) The text to display in the icon.
+ * 'index': (number) The style index of the icon.
+ */
+ ClusterIcon.prototype.setSums = function (sums) {
+ this.sums_ = sums;
+ this.text_ = sums.text;
+ this.index_ = sums.index;
+ if (this.div_) {
+ this.div_.innerHTML = sums.text;
+ }
+ this.useStyle();
+ };
+
+ /**
+ * Sets the icon to the the styles.
+ */
+ ClusterIcon.prototype.useStyle = function () {
+ var index = Math.max(0, this.sums_.index - 1);
+ index = Math.min(this.styles_.length - 1, index);
+ var style = this.styles_[index];
+ this.url_ = style['url'];
+ this.height_ = style['height'];
+ this.width_ = style['width'];
+ this.textColor_ = style['textColor'];
+ this.anchor_ = style['anchor'];
+ this.textSize_ = style['textSize'];
+ this.backgroundPosition_ = style['backgroundPosition'];
+ };
+
+ /**
+ * Sets the center of the icon.
+ *
+ * @param {google.maps.LatLng} center The latlng to set as the center.
+ */
+ ClusterIcon.prototype.setCenter = function (center) {
+ this.center_ = center;
+ };
+
+ /**
+ * Create the css text based on the position of the icon.
+ *
+ * @param {google.maps.Point} pos The position.
+ * @return {string} The css style text.
+ */
+ ClusterIcon.prototype.createCss = function (pos) {
+ var style = [];
+ var markerClusterer = this.cluster_.getMarkerClusterer();
+ if (!markerClusterer.cssClass_) {
+ style.push('background-image:url(' + this.url_ + ');');
+ var backgroundPosition = this.backgroundPosition_
+ ? this.backgroundPosition_
+ : '0 0';
+ style.push('background-position:' + backgroundPosition + ';');
+ if (
+ (0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this.anchor_) === 'object'
+ ) {
+ if (
+ typeof this.anchor_[0] === 'number' &&
+ this.anchor_[0] > 0 &&
+ this.anchor_[0] < this.height_
+ ) {
+ style.push(
+ 'height:' +
+ (this.height_ - this.anchor_[0]) +
+ 'px; padding-top:' +
+ this.anchor_[0] +
+ 'px;'
+ );
+ } else {
+ style.push(
+ 'height:' +
+ this.height_ +
+ 'px; line-height:' +
+ this.height_ +
+ 'px;'
+ );
+ }
+ if (
+ typeof this.anchor_[1] === 'number' &&
+ this.anchor_[1] > 0 &&
+ this.anchor_[1] < this.width_
+ ) {
+ style.push(
+ 'width:' +
+ (this.width_ - this.anchor_[1]) +
+ 'px; padding-left:' +
+ this.anchor_[1] +
+ 'px;'
+ );
+ } else {
+ style.push(
+ 'width:' + this.width_ + 'px; text-align:center;'
+ );
+ }
+ } else {
+ style.push(
+ 'height:' +
+ this.height_ +
+ 'px; line-height:' +
+ this.height_ +
+ 'px; width:' +
+ this.width_ +
+ 'px; text-align:center;'
+ );
+ }
+ var txtColor = this.textColor_ ? this.textColor_ : 'black';
+ var txtSize = this.textSize_ ? this.textSize_ : 11;
+ style.push(
+ 'cursor:pointer; color:' +
+ txtColor +
+ '; position:absolute; font-size:' +
+ txtSize +
+ 'px; font-family:Arial,sans-serif; font-weight:bold'
+ );
+ } else {
+ style.push('top:' + pos.y + 'px; left:' + pos.x + 'px;');
+ }
+ return style.join('');
+ };
+
+ // Export Symbols for Closure
+ // If you are not going to compile with closure then you can remove the
+ // code below.
+ window['MarkerClusterer'] = MarkerClusterer;
+ MarkerClusterer.prototype['addMarker'] =
+ MarkerClusterer.prototype.addMarker;
+ MarkerClusterer.prototype['addMarkers'] =
+ MarkerClusterer.prototype.addMarkers;
+ MarkerClusterer.prototype['clearMarkers'] =
+ MarkerClusterer.prototype.clearMarkers;
+ MarkerClusterer.prototype['fitMapToMarkers'] =
+ MarkerClusterer.prototype.fitMapToMarkers;
+ MarkerClusterer.prototype['getCalculator'] =
+ MarkerClusterer.prototype.getCalculator;
+ MarkerClusterer.prototype['getGridSize'] =
+ MarkerClusterer.prototype.getGridSize;
+ MarkerClusterer.prototype['getExtendedBounds'] =
+ MarkerClusterer.prototype.getExtendedBounds;
+ MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap;
+ MarkerClusterer.prototype['getMarkers'] =
+ MarkerClusterer.prototype.getMarkers;
+ MarkerClusterer.prototype['getMaxZoom'] =
+ MarkerClusterer.prototype.getMaxZoom;
+ MarkerClusterer.prototype['getStyles'] =
+ MarkerClusterer.prototype.getStyles;
+ MarkerClusterer.prototype['getTotalClusters'] =
+ MarkerClusterer.prototype.getTotalClusters;
+ MarkerClusterer.prototype['getTotalMarkers'] =
+ MarkerClusterer.prototype.getTotalMarkers;
+ MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw;
+ MarkerClusterer.prototype['removeMarker'] =
+ MarkerClusterer.prototype.removeMarker;
+ MarkerClusterer.prototype['removeMarkers'] =
+ MarkerClusterer.prototype.removeMarkers;
+ MarkerClusterer.prototype['resetViewport'] =
+ MarkerClusterer.prototype.resetViewport;
+ MarkerClusterer.prototype['repaint'] =
+ MarkerClusterer.prototype.repaint;
+ MarkerClusterer.prototype['setCalculator'] =
+ MarkerClusterer.prototype.setCalculator;
+ MarkerClusterer.prototype['setGridSize'] =
+ MarkerClusterer.prototype.setGridSize;
+ MarkerClusterer.prototype['setMaxZoom'] =
+ MarkerClusterer.prototype.setMaxZoom;
+ MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd;
+ MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw;
+ Cluster.prototype['getCenter'] = Cluster.prototype.getCenter;
+ Cluster.prototype['getSize'] = Cluster.prototype.getSize;
+ Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers;
+ ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd;
+ ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw;
+ ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove;
+ })();
+ /******/
+})();
+//# sourceMappingURL=global-markerclusterer.js.map
diff --git a/assets/js/google-map.js b/assets/js/google-map.js
index cba290543..ce8f63101 100644
--- a/assets/js/google-map.js
+++ b/assets/js/google-map.js
@@ -1,1142 +1,1610 @@
-/******/ (function() { // webpackBootstrap
-/******/ "use strict";
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/map-scripts/add-listing/google-map.js":
-/*!********************************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ 'use strict';
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/map-scripts/add-listing/google-map.js':
+ /*!********************************************************************!*\
!*** ./assets/src/js/global/map-scripts/add-listing/google-map.js ***!
\********************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ initAddListingMap: function() { return /* binding */ initAddListingMap; }
-/* harmony export */ });
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* Add listing google map */
-
-
-var $ = jQuery;
-
-// Add Listing Map Initialize
-function initAddListingMap() {
- if (typeof google === 'undefined' || !google.maps || !google.maps.Geocoder) {
- return;
- }
- if ($('#gmap').length) {
- var localized_data = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('map_data');
-
- // initialize all vars here to avoid hoisting related misunderstanding.
- var map;
- var autocomplete;
- var address_input;
- var markers;
- var $manual_lat;
- var $manual_lng;
- var saved_lat_lng;
-
- // Localized Data
- var loc_default_latitude = parseFloat(localized_data.default_latitude);
- var loc_default_longitude = parseFloat(localized_data.default_longitude);
- var loc_manual_lat = parseFloat(localized_data.manual_lat);
- var loc_manual_lng = parseFloat(localized_data.manual_lng);
- var loc_map_zoom_level = parseInt(localized_data.map_zoom_level);
- var searchIcon = " ";
- var markerShape = document.createElement('div');
- markerShape.className = 'atbd_map_shape';
- markerShape.innerHTML = searchIcon;
- loc_manual_lat = isNaN(loc_manual_lat) ? loc_default_latitude : loc_manual_lat;
- loc_manual_lng = isNaN(loc_manual_lng) ? loc_default_longitude : loc_manual_lng;
- $manual_lat = $('#manual_lat');
- $manual_lng = $('#manual_lng');
- saved_lat_lng = {
- lat: loc_manual_lat,
- lng: loc_manual_lng
- };
-
- // default is London city
- markers = [],
- // initialize the array to keep track all the marker
- address_input = document.getElementById('address');
- if (address_input !== null) {
- address_input.addEventListener('focus', geolocate);
- }
- var geocoder = new google.maps.Geocoder();
-
- // This function will help to get the current location of the user
- function markerDragInit(marker) {
- marker.addListener('dragend', function (event) {
- // Get exact coordinates from the marker position
- var exactLat = event.latLng.lat();
- var exactLng = event.latLng.lng();
-
- // Set the exact coordinates to input fields (no geocoding transformation)
- $manual_lat.val(exactLat);
- $manual_lng.val(exactLng);
-
- // Optional: Update address field with reverse geocoding for display only
- // This doesn't affect the stored coordinates
- geocodeAddressForDisplay(geocoder, exactLat, exactLng);
- });
- }
-
- // Helper function to format address by removing plus code and using address components
- function formatAddress(result) {
- if (!result || !result.address_components) {
- return '';
- }
-
- // Check if first element contains plus code (has '+' character)
- var components = result.address_components;
- if (components.length > 0 && components[0].long_name && components[0].long_name.includes('+')) {
- components = components.slice(1);
- }
-
- // Join long_names with commas
- return components.map(function (c) {
- return c.long_name;
- }).join(', ');
- }
-
- // Function to geocode address for display purposes only (doesn't modify coordinates)
- function geocodeAddressForDisplay(geocoder, lat, lng) {
- var latLng = new google.maps.LatLng(lat, lng);
- var opt = {
- location: latLng
- };
- geocoder.geocode(opt, function (results, status) {
- if (status === 'OK' && results[0]) {
- // Clean the address by removing plus code prefix if present
- var cleanedAddress = formatAddress(results[0]);
- address_input.value = cleanedAddress;
- }
- });
- }
-
- // this function will work on sites that uses SSL, it applies to Chrome especially, other browsers may allow location sharing without securing.
- function geolocate() {
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(function (position) {
- var geolocation = {
- lat: position.coords.latitude,
- lng: position.coords.longitude
- };
- var circle = new google.maps.Circle({
- center: geolocation,
- radius: position.coords.accuracy
- });
- autocomplete.setBounds(circle.getBounds());
- });
- }
- }
- function initAutocomplete() {
- // Create the autocomplete object, restricting the search to geographical
- var opt = {
- types: ['geocode'],
- componentRestrictions: {
- country: directorist.restricted_countries
- }
- };
- var options = directorist.countryRestriction ? opt : {
- types: []
- };
-
- // location types.
- autocomplete = new google.maps.places.Autocomplete(address_input, options);
-
- // When the user selects an address from the dropdown, populate the necessary input fields and draw a marker
- autocomplete.addListener('place_changed', fillInAddress);
- }
- function fillInAddress() {
- // Get the place details from the autocomplete object.
- var place = autocomplete.getPlace();
-
- // set the value of input field to save them to the database
- $manual_lat.val(place.geometry.location.lat());
- $manual_lng.val(place.geometry.location.lng());
- map.setCenter(place.geometry.location);
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: place.geometry.location,
- gmpDraggable: true,
- content: markerShape,
- title: localized_data.marker_title
- });
-
- // Delete Previous Marker
- deleteMarker();
-
- // add the marker to the markers array to keep track of it, so that we can show/hide/delete them all later.
- markers.push(marker);
- markerDragInit(marker);
- }
- initAutocomplete(); // start google map place auto complete API call
-
- // Map Initialize
- function initMap() {
- /* Create new map instance */
- map = new google.maps.Map(document.getElementById('gmap'), {
- zoom: loc_map_zoom_level,
- center: saved_lat_lng,
- mapId: 'add_listing_map'
- });
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: saved_lat_lng,
- gmpDraggable: true,
- content: markerShape,
- title: localized_data.marker_title
- });
- markers.push(marker);
- document.getElementById('generate_admin_map').addEventListener('click', function (e) {
- e.preventDefault();
- geocodeAddress(geocoder, map);
- });
-
- // This event listener calls addMarker() when the map is clicked.
- marker.addListener('click', function (event) {
- deleteMarker(); // at first remove previous marker and then set new marker;
-
- // Get exact coordinates from the click position
- var exactLat = event.latLng.lat();
- var exactLng = event.latLng.lng();
-
- // Set the exact coordinates to input fields (no geocoding transformation)
- $manual_lat.val(exactLat);
- $manual_lng.val(exactLng);
-
- // Optional: Update address field with reverse geocoding for display only
- geocodeAddressForDisplay(geocoder, exactLat, exactLng);
-
- // add the marker to the given map.
- addMarker(event.latLng, map);
- });
- markerDragInit(marker);
- }
-
- /*
- * Geocode and address using google map javascript api and then populate the input fields for storing lat and long
- * */
-
- function geocodeAddress(geocoder, resultsMap) {
- var lat = parseFloat(document.getElementById('manual_lat').value);
- var lng = parseFloat(document.getElementById('manual_lng').value);
- var latLng = new google.maps.LatLng(lat, lng);
- var opt = {
- location: latLng
- };
- geocoder.geocode(opt, function (results, status) {
- if (status === 'OK') {
- // Keep the original exact coordinates (don't modify them)
- $manual_lat.val(lat);
- $manual_lng.val(lng);
-
- // Center map on the exact coordinates
- resultsMap.setCenter(latLng);
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: resultsMap,
- position: latLng,
- // Use original coordinates
- gmpDraggable: true,
- content: markerShape,
- title: localized_data.marker_title
- });
- deleteMarker();
- // add the marker to the markers array to keep track of it, so that we can show/hide/delete them all later.
- markers.push(marker);
-
- // Clean the address by removing plus code prefix if present
- var cleanedAddress = formatAddress(results[0]);
- address_input.value = cleanedAddress;
- markerDragInit(marker);
- } else {
- alert(localized_data.geocode_error_msg + status);
- }
- });
- }
- initMap();
-
- // adding features of creating marker manually on the map on add listing page.
- /* var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ initAddListingMap: function () {
+ return /* binding */ initAddListingMap;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./../../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* Add listing google map */
+
+ var $ = jQuery;
+
+ // Add Listing Map Initialize
+ function initAddListingMap() {
+ if (
+ typeof google === 'undefined' ||
+ !google.maps ||
+ !google.maps.Geocoder
+ ) {
+ return;
+ }
+ if ($('#gmap').length) {
+ var localized_data = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)(
+ 'map_data'
+ );
+
+ // initialize all vars here to avoid hoisting related misunderstanding.
+ var map;
+ var autocomplete;
+ var address_input;
+ var markers;
+ var $manual_lat;
+ var $manual_lng;
+ var saved_lat_lng;
+
+ // Localized Data
+ var loc_default_latitude = parseFloat(
+ localized_data.default_latitude
+ );
+ var loc_default_longitude = parseFloat(
+ localized_data.default_longitude
+ );
+ var loc_manual_lat = parseFloat(
+ localized_data.manual_lat
+ );
+ var loc_manual_lng = parseFloat(
+ localized_data.manual_lng
+ );
+ var loc_map_zoom_level = parseInt(
+ localized_data.map_zoom_level
+ );
+ var searchIcon =
+ ' ';
+ var markerShape = document.createElement('div');
+ markerShape.className = 'atbd_map_shape';
+ markerShape.innerHTML = searchIcon;
+ loc_manual_lat = isNaN(loc_manual_lat)
+ ? loc_default_latitude
+ : loc_manual_lat;
+ loc_manual_lng = isNaN(loc_manual_lng)
+ ? loc_default_longitude
+ : loc_manual_lng;
+ $manual_lat = $('#manual_lat');
+ $manual_lng = $('#manual_lng');
+ saved_lat_lng = {
+ lat: loc_manual_lat,
+ lng: loc_manual_lng,
+ };
+
+ // default is London city
+ ((markers = []),
+ // initialize the array to keep track all the marker
+ (address_input =
+ document.getElementById('address')));
+ if (address_input !== null) {
+ address_input.addEventListener('focus', geolocate);
+ }
+ var geocoder = new google.maps.Geocoder();
+
+ // This function will help to get the current location of the user
+ function markerDragInit(marker) {
+ marker.addListener('dragend', function (event) {
+ // Get exact coordinates from the marker position
+ var exactLat = event.latLng.lat();
+ var exactLng = event.latLng.lng();
+
+ // Set the exact coordinates to input fields (no geocoding transformation)
+ $manual_lat.val(exactLat);
+ $manual_lng.val(exactLng);
+
+ // Optional: Update address field with reverse geocoding for display only
+ // This doesn't affect the stored coordinates
+ geocodeAddressForDisplay(
+ geocoder,
+ exactLat,
+ exactLng
+ );
+ });
+ }
+
+ // Helper function to format address by removing plus code and using address components
+ function formatAddress(result) {
+ if (!result || !result.address_components) {
+ return '';
+ }
+
+ // Check if first element contains plus code (has '+' character)
+ var components = result.address_components;
+ if (
+ components.length > 0 &&
+ components[0].long_name &&
+ components[0].long_name.includes('+')
+ ) {
+ components = components.slice(1);
+ }
+
+ // Join long_names with commas
+ return components
+ .map(function (c) {
+ return c.long_name;
+ })
+ .join(', ');
+ }
+
+ // Function to geocode address for display purposes only (doesn't modify coordinates)
+ function geocodeAddressForDisplay(geocoder, lat, lng) {
+ var latLng = new google.maps.LatLng(lat, lng);
+ var opt = {
+ location: latLng,
+ };
+ geocoder.geocode(opt, function (results, status) {
+ if (status === 'OK' && results[0]) {
+ // Clean the address by removing plus code prefix if present
+ var cleanedAddress = formatAddress(
+ results[0]
+ );
+ address_input.value = cleanedAddress;
+ }
+ });
+ }
+
+ // this function will work on sites that uses SSL, it applies to Chrome especially, other browsers may allow location sharing without securing.
+ function geolocate() {
+ if (navigator.geolocation) {
+ navigator.geolocation.getCurrentPosition(
+ function (position) {
+ var geolocation = {
+ lat: position.coords.latitude,
+ lng: position.coords.longitude,
+ };
+ var circle = new google.maps.Circle({
+ center: geolocation,
+ radius: position.coords.accuracy,
+ });
+ autocomplete.setBounds(
+ circle.getBounds()
+ );
+ }
+ );
+ }
+ }
+ function initAutocomplete() {
+ // Create the autocomplete object, restricting the search to geographical
+ var opt = {
+ types: ['geocode'],
+ componentRestrictions: {
+ country: directorist.restricted_countries,
+ },
+ };
+ var options = directorist.countryRestriction
+ ? opt
+ : {
+ types: [],
+ };
+
+ // location types.
+ autocomplete = new google.maps.places.Autocomplete(
+ address_input,
+ options
+ );
+
+ // When the user selects an address from the dropdown, populate the necessary input fields and draw a marker
+ autocomplete.addListener(
+ 'place_changed',
+ fillInAddress
+ );
+ }
+ function fillInAddress() {
+ // Get the place details from the autocomplete object.
+ var place = autocomplete.getPlace();
+
+ // set the value of input field to save them to the database
+ $manual_lat.val(place.geometry.location.lat());
+ $manual_lng.val(place.geometry.location.lng());
+ map.setCenter(place.geometry.location);
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement({
+ map: map,
+ position: place.geometry.location,
+ gmpDraggable: true,
+ content: markerShape,
+ title: localized_data.marker_title,
+ });
+
+ // Delete Previous Marker
+ deleteMarker();
+
+ // add the marker to the markers array to keep track of it, so that we can show/hide/delete them all later.
+ markers.push(marker);
+ markerDragInit(marker);
+ }
+ initAutocomplete(); // start google map place auto complete API call
+
+ // Map Initialize
+ function initMap() {
+ /* Create new map instance */
+ map = new google.maps.Map(
+ document.getElementById('gmap'),
+ {
+ zoom: loc_map_zoom_level,
+ center: saved_lat_lng,
+ mapId: 'add_listing_map',
+ }
+ );
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement({
+ map: map,
+ position: saved_lat_lng,
+ gmpDraggable: true,
+ content: markerShape,
+ title: localized_data.marker_title,
+ });
+ markers.push(marker);
+ document
+ .getElementById('generate_admin_map')
+ .addEventListener('click', function (e) {
+ e.preventDefault();
+ geocodeAddress(geocoder, map);
+ });
+
+ // This event listener calls addMarker() when the map is clicked.
+ marker.addListener('click', function (event) {
+ deleteMarker(); // at first remove previous marker and then set new marker;
+
+ // Get exact coordinates from the click position
+ var exactLat = event.latLng.lat();
+ var exactLng = event.latLng.lng();
+
+ // Set the exact coordinates to input fields (no geocoding transformation)
+ $manual_lat.val(exactLat);
+ $manual_lng.val(exactLng);
+
+ // Optional: Update address field with reverse geocoding for display only
+ geocodeAddressForDisplay(
+ geocoder,
+ exactLat,
+ exactLng
+ );
+
+ // add the marker to the given map.
+ addMarker(event.latLng, map);
+ });
+ markerDragInit(marker);
+ }
+
+ /*
+ * Geocode and address using google map javascript api and then populate the input fields for storing lat and long
+ * */
+
+ function geocodeAddress(geocoder, resultsMap) {
+ var lat = parseFloat(
+ document.getElementById('manual_lat').value
+ );
+ var lng = parseFloat(
+ document.getElementById('manual_lng').value
+ );
+ var latLng = new google.maps.LatLng(lat, lng);
+ var opt = {
+ location: latLng,
+ };
+ geocoder.geocode(opt, function (results, status) {
+ if (status === 'OK') {
+ // Keep the original exact coordinates (don't modify them)
+ $manual_lat.val(lat);
+ $manual_lng.val(lng);
+
+ // Center map on the exact coordinates
+ resultsMap.setCenter(latLng);
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement(
+ {
+ map: resultsMap,
+ position: latLng,
+ // Use original coordinates
+ gmpDraggable: true,
+ content: markerShape,
+ title: localized_data.marker_title,
+ }
+ );
+ deleteMarker();
+ // add the marker to the markers array to keep track of it, so that we can show/hide/delete them all later.
+ markers.push(marker);
+
+ // Clean the address by removing plus code prefix if present
+ var cleanedAddress = formatAddress(
+ results[0]
+ );
+ address_input.value = cleanedAddress;
+ markerDragInit(marker);
+ } else {
+ alert(
+ localized_data.geocode_error_msg +
+ status
+ );
+ }
+ });
+ }
+ initMap();
+
+ // adding features of creating marker manually on the map on add listing page.
+ /* var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var labelIndex = 0; */
- // Adds a marker to the map.
- function addMarker(location, map) {
- // Add the marker at the clicked location, and add the next-available label;
-
- // from the array of alphabetical characters.
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: location,
- gmpDraggable: true,
- content: markerShape,
- title: localized_data.marker_title
- });
-
- // add the marker to the markers array to keep track of it, so that we can show/hide/delete them all later.
- markers.push(marker);
- markerDragInit(marker);
- }
-
- // Delete Marker
- $('#delete_marker').on('click', function (e) {
- e.preventDefault();
- deleteMarker();
- });
- function deleteMarker() {
- for (var i = 0; i < markers.length; i++) {
- markers[i].setMap(null);
- }
- markers = [];
- }
- }
-}
-$(document).ready(function () {
- initAddListingMap();
-});
-
-// Add Listing Map on Elementor EditMode
-$(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initAddListingMap();
- }
- }, 3000);
-});
-$('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initAddListingMap();
- }
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/global/map-scripts/single-listing/google-map-widget.js":
-/*!******************************************************************************!*\
+ // Adds a marker to the map.
+ function addMarker(location, map) {
+ // Add the marker at the clicked location, and add the next-available label;
+
+ // from the array of alphabetical characters.
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement({
+ map: map,
+ position: location,
+ gmpDraggable: true,
+ content: markerShape,
+ title: localized_data.marker_title,
+ });
+
+ // add the marker to the markers array to keep track of it, so that we can show/hide/delete them all later.
+ markers.push(marker);
+ markerDragInit(marker);
+ }
+
+ // Delete Marker
+ $('#delete_marker').on('click', function (e) {
+ e.preventDefault();
+ deleteMarker();
+ });
+ function deleteMarker() {
+ for (var i = 0; i < markers.length; i++) {
+ markers[i].setMap(null);
+ }
+ markers = [];
+ }
+ }
+ }
+ $(document).ready(function () {
+ initAddListingMap();
+ });
+
+ // Add Listing Map on Elementor EditMode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initAddListingMap();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initAddListingMap();
+ }
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/map-scripts/single-listing/google-map-widget.js':
+ /*!******************************************************************************!*\
!*** ./assets/src/js/global/map-scripts/single-listing/google-map-widget.js ***!
\******************************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ initSingleMapWidget: function() { return /* binding */ initSingleMapWidget; }
-/* harmony export */ });
-/* Widget google map */
-var $ = jQuery;
-
-// Single Listing Map Initialize
-function initSingleMapWidget() {
- if (typeof google === 'undefined' || !google.maps || !google.maps.Marker || !google.maps.OverlayView) {
- return;
- }
- if ($('#gmap-widget').length) {
- var searchIcon = " ";
- var markerShape = document.createElement('div');
- markerShape.className = 'atbd_map_shape';
- markerShape.innerHTML = searchIcon;
- var inherits = function inherits(childCtor, parentCtor) {
- /** @constructor */
- function tempCtor() {}
- tempCtor.prototype = parentCtor.prototype;
- childCtor.superClass_ = parentCtor.prototype;
- childCtor.prototype = new tempCtor();
- childCtor.prototype.constructor = childCtor;
- };
- function Marker(options) {
- google.maps.Marker.apply(this, arguments);
- if (options.map_icon_label) {
- this.MarkerLabel = new MarkerLabel({
- map: this.map,
- marker: this,
- text: options.map_icon_label
- });
- this.MarkerLabel.bindTo('position', this, 'position');
- }
- }
-
- // Apply the inheritance
- inherits(Marker, google.maps.Marker);
-
- // Custom Marker SetMap
- Marker.prototype.setMap = function () {
- google.maps.Marker.prototype.setMap.apply(this, arguments);
- this.MarkerLabel && this.MarkerLabel.setMap.apply(this.MarkerLabel, arguments);
- };
-
- // Marker Label Overlay
- var MarkerLabel = function MarkerLabel(options) {
- var self = this;
- this.setValues(options);
-
- // Create the label container
- this.div = document.createElement('div');
- this.div.className = 'map-icon-label';
-
- // Trigger the marker click handler if clicking on the label
- google.maps.event.addListener(this.div, 'click', function (e) {
- e.stopPropagation && e.stopPropagation();
- google.maps.event.trigger(self.marker, 'click');
- });
- };
-
- // Create MarkerLabel Object
- MarkerLabel.prototype = new google.maps.OverlayView();
-
- // Marker Label onAdd
- MarkerLabel.prototype.onAdd = function () {
- var pane = this.getPanes().overlayImage.appendChild(this.div);
- var self = this;
- this.listeners = [google.maps.event.addListener(this, 'position_changed', function () {
- self.draw();
- }), google.maps.event.addListener(this, 'text_changed', function () {
- self.draw();
- }), google.maps.event.addListener(this, 'zindex_changed', function () {
- self.draw();
- })];
- };
-
- // Marker Label onRemove
- MarkerLabel.prototype.onRemove = function () {
- this.div.parentNode.removeChild(this.div);
- for (var i = 0, I = this.listeners.length; i < I; ++i) {
- google.maps.event.removeListener(this.listeners[i]);
- }
- };
-
- // Implement draw
- MarkerLabel.prototype.draw = function () {
- var projection = this.getProjection();
- var position = projection.fromLatLngToDivPixel(this.get('position'));
- var div = this.div;
- this.div.innerHTML = this.get('text').toString();
- div.style.zIndex = this.get('zIndex'); // Allow label to overlay marker
- div.style.position = 'absolute';
- div.style.display = 'block';
- div.style.left = position.x - div.offsetWidth / 2 + 'px';
- div.style.top = position.y - div.offsetHeight + 'px';
- };
-
- // initialize all vars here to avoid hoisting related misunderstanding.
- var map, info_window, saved_lat_lng;
-
- // Localized Data
- var map_container = localized_data_widget.map_container_id ? localized_data_widget.map_container_id : 'gmap';
- var loc_default_latitude = parseFloat(localized_data_widget.default_latitude);
- var loc_default_longitude = parseFloat(localized_data_widget.default_longitude);
- var loc_manual_lat = parseFloat(localized_data_widget.manual_lat);
- var loc_manual_lng = parseFloat(localized_data_widget.manual_lng);
- var loc_map_zoom_level = parseInt(localized_data_widget.map_zoom_level);
- var display_map_info = localized_data_widget.display_map_info;
- var info_content = mapData.info_content;
- loc_manual_lat = isNaN(loc_manual_lat) ? loc_default_latitude : loc_manual_lat;
- loc_manual_lng = isNaN(loc_manual_lng) ? loc_default_longitude : loc_manual_lng;
- $manual_lat = $('#manual_lat');
- $manual_lng = $('#manual_lng');
- saved_lat_lng = {
- lat: loc_manual_lat,
- lng: loc_manual_lng
- };
-
- // create an info window for map
- if (display_map_info) {
- info_window = new google.maps.InfoWindow({
- content: info_content,
- maxWidth: 400 /*Add configuration for max width*/
- });
- }
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: saved_lat_lng,
- content: markerShape
- });
-
- // create an info window for map
- marker.addListener('click', function () {
- if (display_map_info) {
- display_map_info = false;
- } else {
- info_window.close();
- display_map_info = true;
- }
- });
- function initMap() {
- /* Create new map instance*/
- map = new google.maps.Map(document.getElementById(map_container), {
- zoom: loc_map_zoom_level,
- center: saved_lat_lng,
- mapId: 'single_listing_map_widget'
- });
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: saved_lat_lng,
- content: markerShape
- });
- if (display_map_info) {
- marker.addListener('click', function () {
- if (info_window.getMap()) {
- info_window.close(); // If already open, close it
- } else {
- info_window.open(map, marker); // Otherwise, open it
- }
- });
- }
- }
- $(document).ready(function () {
- initMap();
- //Convert address tags to google map links -
- $('address').each(function () {
- var link = "" + $(this).text() + ' ';
- $(this).html(link);
- });
- });
- }
-}
-$(document).ready(function () {
- initSingleMapWidget();
-});
-
-// Single Listing Map on Elementor EditMode
-$(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initSingleMapWidget();
- }
- }, 3000);
-});
-$('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initSingleMapWidget();
- }
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/global/map-scripts/single-listing/google-map.js":
-/*!***********************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ initSingleMapWidget: function () {
+ return /* binding */ initSingleMapWidget;
+ },
+ /* harmony export */
+ }
+ );
+ /* Widget google map */
+ var $ = jQuery;
+
+ // Single Listing Map Initialize
+ function initSingleMapWidget() {
+ if (
+ typeof google === 'undefined' ||
+ !google.maps ||
+ !google.maps.Marker ||
+ !google.maps.OverlayView
+ ) {
+ return;
+ }
+ if ($('#gmap-widget').length) {
+ var searchIcon =
+ ' ';
+ var markerShape = document.createElement('div');
+ markerShape.className = 'atbd_map_shape';
+ markerShape.innerHTML = searchIcon;
+ var inherits = function inherits(
+ childCtor,
+ parentCtor
+ ) {
+ /** @constructor */
+ function tempCtor() {}
+ tempCtor.prototype = parentCtor.prototype;
+ childCtor.superClass_ = parentCtor.prototype;
+ childCtor.prototype = new tempCtor();
+ childCtor.prototype.constructor = childCtor;
+ };
+ function Marker(options) {
+ google.maps.Marker.apply(this, arguments);
+ if (options.map_icon_label) {
+ this.MarkerLabel = new MarkerLabel({
+ map: this.map,
+ marker: this,
+ text: options.map_icon_label,
+ });
+ this.MarkerLabel.bindTo(
+ 'position',
+ this,
+ 'position'
+ );
+ }
+ }
+
+ // Apply the inheritance
+ inherits(Marker, google.maps.Marker);
+
+ // Custom Marker SetMap
+ Marker.prototype.setMap = function () {
+ google.maps.Marker.prototype.setMap.apply(
+ this,
+ arguments
+ );
+ this.MarkerLabel &&
+ this.MarkerLabel.setMap.apply(
+ this.MarkerLabel,
+ arguments
+ );
+ };
+
+ // Marker Label Overlay
+ var MarkerLabel = function MarkerLabel(options) {
+ var self = this;
+ this.setValues(options);
+
+ // Create the label container
+ this.div = document.createElement('div');
+ this.div.className = 'map-icon-label';
+
+ // Trigger the marker click handler if clicking on the label
+ google.maps.event.addListener(
+ this.div,
+ 'click',
+ function (e) {
+ e.stopPropagation && e.stopPropagation();
+ google.maps.event.trigger(
+ self.marker,
+ 'click'
+ );
+ }
+ );
+ };
+
+ // Create MarkerLabel Object
+ MarkerLabel.prototype = new google.maps.OverlayView();
+
+ // Marker Label onAdd
+ MarkerLabel.prototype.onAdd = function () {
+ var pane = this.getPanes().overlayImage.appendChild(
+ this.div
+ );
+ var self = this;
+ this.listeners = [
+ google.maps.event.addListener(
+ this,
+ 'position_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ google.maps.event.addListener(
+ this,
+ 'text_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ google.maps.event.addListener(
+ this,
+ 'zindex_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ ];
+ };
+
+ // Marker Label onRemove
+ MarkerLabel.prototype.onRemove = function () {
+ this.div.parentNode.removeChild(this.div);
+ for (
+ var i = 0, I = this.listeners.length;
+ i < I;
+ ++i
+ ) {
+ google.maps.event.removeListener(
+ this.listeners[i]
+ );
+ }
+ };
+
+ // Implement draw
+ MarkerLabel.prototype.draw = function () {
+ var projection = this.getProjection();
+ var position = projection.fromLatLngToDivPixel(
+ this.get('position')
+ );
+ var div = this.div;
+ this.div.innerHTML = this.get('text').toString();
+ div.style.zIndex = this.get('zIndex'); // Allow label to overlay marker
+ div.style.position = 'absolute';
+ div.style.display = 'block';
+ div.style.left =
+ position.x - div.offsetWidth / 2 + 'px';
+ div.style.top =
+ position.y - div.offsetHeight + 'px';
+ };
+
+ // initialize all vars here to avoid hoisting related misunderstanding.
+ var map, info_window, saved_lat_lng;
+
+ // Localized Data
+ var map_container =
+ localized_data_widget.map_container_id
+ ? localized_data_widget.map_container_id
+ : 'gmap';
+ var loc_default_latitude = parseFloat(
+ localized_data_widget.default_latitude
+ );
+ var loc_default_longitude = parseFloat(
+ localized_data_widget.default_longitude
+ );
+ var loc_manual_lat = parseFloat(
+ localized_data_widget.manual_lat
+ );
+ var loc_manual_lng = parseFloat(
+ localized_data_widget.manual_lng
+ );
+ var loc_map_zoom_level = parseInt(
+ localized_data_widget.map_zoom_level
+ );
+ var display_map_info =
+ localized_data_widget.display_map_info;
+ var info_content = mapData.info_content;
+ loc_manual_lat = isNaN(loc_manual_lat)
+ ? loc_default_latitude
+ : loc_manual_lat;
+ loc_manual_lng = isNaN(loc_manual_lng)
+ ? loc_default_longitude
+ : loc_manual_lng;
+ $manual_lat = $('#manual_lat');
+ $manual_lng = $('#manual_lng');
+ saved_lat_lng = {
+ lat: loc_manual_lat,
+ lng: loc_manual_lng,
+ };
+
+ // create an info window for map
+ if (display_map_info) {
+ info_window = new google.maps.InfoWindow({
+ content: info_content,
+ maxWidth: 400 /*Add configuration for max width*/,
+ });
+ }
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement({
+ map: map,
+ position: saved_lat_lng,
+ content: markerShape,
+ });
+
+ // create an info window for map
+ marker.addListener('click', function () {
+ if (display_map_info) {
+ display_map_info = false;
+ } else {
+ info_window.close();
+ display_map_info = true;
+ }
+ });
+ function initMap() {
+ /* Create new map instance*/
+ map = new google.maps.Map(
+ document.getElementById(map_container),
+ {
+ zoom: loc_map_zoom_level,
+ center: saved_lat_lng,
+ mapId: 'single_listing_map_widget',
+ }
+ );
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement({
+ map: map,
+ position: saved_lat_lng,
+ content: markerShape,
+ });
+ if (display_map_info) {
+ marker.addListener('click', function () {
+ if (info_window.getMap()) {
+ info_window.close(); // If already open, close it
+ } else {
+ info_window.open(map, marker); // Otherwise, open it
+ }
+ });
+ }
+ }
+ $(document).ready(function () {
+ initMap();
+ //Convert address tags to google map links -
+ $('address').each(function () {
+ var link =
+ "" +
+ $(this).text() +
+ ' ';
+ $(this).html(link);
+ });
+ });
+ }
+ }
+ $(document).ready(function () {
+ initSingleMapWidget();
+ });
+
+ // Single Listing Map on Elementor EditMode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initSingleMapWidget();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initSingleMapWidget();
+ }
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/map-scripts/single-listing/google-map.js':
+ /*!***********************************************************************!*\
!*** ./assets/src/js/global/map-scripts/single-listing/google-map.js ***!
\***********************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ initSingleMap: function() { return /* binding */ initSingleMap; }
-/* harmony export */ });
-/* Single listing google map */
-var $ = jQuery;
-
-// Single Listing Map Initialize
-function initSingleMap() {
- if (typeof google === 'undefined' || !google.maps || !google.maps.Marker || !google.maps.OverlayView || !google.maps.marker.AdvancedMarkerElement) {
- return;
- }
- if ($('.directorist-single-map').length) {
- document.querySelectorAll('.directorist-single-map').forEach(function (mapElm) {
- var searchIcon = " ";
- var markerShape = document.createElement('div');
- markerShape.className = 'atbd_map_shape';
- markerShape.innerHTML = searchIcon;
- function Marker(options) {
- google.maps.Marker.apply(this, arguments); // Properly call parent constructor
-
- if (options.map_icon_label) {
- this.MarkerLabel = new MarkerLabel({
- map: this.getMap(),
- marker: this,
- text: options.map_icon_label
- });
- this.MarkerLabel.bindTo('position', this, 'position');
- }
- }
-
- // Ensure Marker extends google.maps.Marker
- Marker.prototype = Object.create(google.maps.Marker.prototype);
- Marker.prototype.constructor = Marker;
-
- // Custom Marker setMap method
- Marker.prototype.setMap = function (map) {
- google.maps.Marker.prototype.setMap.call(this, map);
- if (this.MarkerLabel) {
- this.MarkerLabel.setMap(map);
- }
- };
-
- // Marker Label Overlay
- function MarkerLabel(options) {
- this.setValues(options);
- this.div = document.createElement('div');
- this.div.className = 'map-icon-label';
-
- // Ensure marker click event works
- var self = this;
- google.maps.event.addDomListener(this.div, 'click', function (e) {
- if (e.stopPropagation) e.stopPropagation();
- google.maps.event.trigger(self.marker, 'click');
- });
- }
-
- // Ensure Google Maps API is loaded before extending OverlayView
- MarkerLabel.prototype = Object.create(google.maps.OverlayView.prototype);
- MarkerLabel.prototype.constructor = MarkerLabel;
-
- // onAdd method
- MarkerLabel.prototype.onAdd = function () {
- var pane = this.getPanes();
- if (pane) {
- pane.overlayImage.appendChild(this.div);
- }
- var self = this;
- this.listeners = [google.maps.event.addListener(this, 'position_changed', function () {
- self.draw();
- }), google.maps.event.addListener(this, 'text_changed', function () {
- self.draw();
- }), google.maps.event.addListener(this, 'zindex_changed', function () {
- self.draw();
- })];
- };
-
- // onRemove method
- MarkerLabel.prototype.onRemove = function () {
- if (this.div.parentNode) {
- this.div.parentNode.removeChild(this.div);
- }
- for (var i = 0; i < this.listeners.length; i++) {
- google.maps.event.removeListener(this.listeners[i]);
- }
- };
-
- // draw method
- MarkerLabel.prototype.draw = function () {
- var projection = this.getProjection();
- if (!projection) return; // Ensure projection is available
-
- var position = projection.fromLatLngToDivPixel(this.get('position'));
- if (!position) return;
- var div = this.div;
- div.innerHTML = this.get('text') || '';
- div.style.zIndex = this.get('zIndex') || '0';
- div.style.position = 'absolute';
- div.style.display = 'block';
- div.style.left = position.x - div.offsetWidth / 2 + 'px';
- div.style.top = position.y - div.offsetHeight + 'px';
- };
-
- // initialize all vars here to avoid hoisting related misunderstanding.
- var map, info_window, saved_lat_lng;
-
- // Localized Data
- var mapData = JSON.parse(mapElm.getAttribute('data-map'));
- var loc_default_latitude = parseFloat(mapData.default_latitude);
- var loc_default_longitude = parseFloat(mapData.default_longitude);
- var loc_manual_lat = parseFloat(mapData.manual_lat);
- var loc_manual_lng = parseFloat(mapData.manual_lng);
- var loc_map_zoom_level = parseInt(mapData.map_zoom_level);
- var display_map_info = mapData.display_map_info;
- var info_content = mapData.info_content;
- loc_manual_lat = isNaN(loc_manual_lat) ? loc_default_latitude : loc_manual_lat;
- loc_manual_lng = isNaN(loc_manual_lng) ? loc_default_longitude : loc_manual_lng;
- saved_lat_lng = {
- lat: loc_manual_lat,
- lng: loc_manual_lng
- };
-
- // create an info window for map
- if (display_map_info) {
- info_window = new google.maps.InfoWindow({
- content: info_content,
- maxWidth: 400 /*Add configuration for max width*/
- });
- }
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: saved_lat_lng,
- content: markerShape
- });
-
- // create an info window for map
- marker.addListener('click', function () {
- if (display_map_info) {
- display_map_info = false;
- } else {
- info_window.close();
- display_map_info = true;
- }
- });
- function initMap() {
- /* Create new map instance*/
- map = new google.maps.Map(mapElm, {
- zoom: loc_map_zoom_level,
- center: saved_lat_lng,
- mapId: 'single_listing_map'
- });
- var marker = new google.maps.marker.AdvancedMarkerElement({
- map: map,
- position: saved_lat_lng,
- content: markerShape
- });
- if (display_map_info) {
- marker.addListener('click', function () {
- if (info_window.getMap()) {
- info_window.close(); // If already open, close it
- } else {
- info_window.open(map, marker); // Otherwise, open it
- }
- });
- }
- }
- initMap();
- //Convert address tags to google map links -
- $('address').each(function () {
- var link = "" + $(this).text() + ' ';
- $(this).html(link);
- });
- });
- }
-}
-$(document).ready(function () {
- initSingleMap();
-});
-
-// Single Listing Map on Elementor EditMode
-$(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initSingleMap();
- }
- }, 3000);
-});
-$('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initSingleMap();
- }
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ initSingleMap: function () {
+ return /* binding */ initSingleMap;
+ },
+ /* harmony export */
+ }
+ );
+ /* Single listing google map */
+ var $ = jQuery;
+
+ // Single Listing Map Initialize
+ function initSingleMap() {
+ if (
+ typeof google === 'undefined' ||
+ !google.maps ||
+ !google.maps.Marker ||
+ !google.maps.OverlayView ||
+ !google.maps.marker.AdvancedMarkerElement
+ ) {
+ return;
+ }
+ if ($('.directorist-single-map').length) {
+ document
+ .querySelectorAll('.directorist-single-map')
+ .forEach(function (mapElm) {
+ var searchIcon =
+ ' ';
+ var markerShape = document.createElement('div');
+ markerShape.className = 'atbd_map_shape';
+ markerShape.innerHTML = searchIcon;
+ function Marker(options) {
+ google.maps.Marker.apply(this, arguments); // Properly call parent constructor
+
+ if (options.map_icon_label) {
+ this.MarkerLabel = new MarkerLabel({
+ map: this.getMap(),
+ marker: this,
+ text: options.map_icon_label,
+ });
+ this.MarkerLabel.bindTo(
+ 'position',
+ this,
+ 'position'
+ );
+ }
+ }
+
+ // Ensure Marker extends google.maps.Marker
+ Marker.prototype = Object.create(
+ google.maps.Marker.prototype
+ );
+ Marker.prototype.constructor = Marker;
+
+ // Custom Marker setMap method
+ Marker.prototype.setMap = function (map) {
+ google.maps.Marker.prototype.setMap.call(
+ this,
+ map
+ );
+ if (this.MarkerLabel) {
+ this.MarkerLabel.setMap(map);
+ }
+ };
+
+ // Marker Label Overlay
+ function MarkerLabel(options) {
+ this.setValues(options);
+ this.div = document.createElement('div');
+ this.div.className = 'map-icon-label';
+
+ // Ensure marker click event works
+ var self = this;
+ google.maps.event.addDomListener(
+ this.div,
+ 'click',
+ function (e) {
+ if (e.stopPropagation)
+ e.stopPropagation();
+ google.maps.event.trigger(
+ self.marker,
+ 'click'
+ );
+ }
+ );
+ }
+
+ // Ensure Google Maps API is loaded before extending OverlayView
+ MarkerLabel.prototype = Object.create(
+ google.maps.OverlayView.prototype
+ );
+ MarkerLabel.prototype.constructor = MarkerLabel;
+
+ // onAdd method
+ MarkerLabel.prototype.onAdd = function () {
+ var pane = this.getPanes();
+ if (pane) {
+ pane.overlayImage.appendChild(this.div);
+ }
+ var self = this;
+ this.listeners = [
+ google.maps.event.addListener(
+ this,
+ 'position_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ google.maps.event.addListener(
+ this,
+ 'text_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ google.maps.event.addListener(
+ this,
+ 'zindex_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ ];
+ };
+
+ // onRemove method
+ MarkerLabel.prototype.onRemove = function () {
+ if (this.div.parentNode) {
+ this.div.parentNode.removeChild(
+ this.div
+ );
+ }
+ for (
+ var i = 0;
+ i < this.listeners.length;
+ i++
+ ) {
+ google.maps.event.removeListener(
+ this.listeners[i]
+ );
+ }
+ };
+
+ // draw method
+ MarkerLabel.prototype.draw = function () {
+ var projection = this.getProjection();
+ if (!projection) return; // Ensure projection is available
+
+ var position =
+ projection.fromLatLngToDivPixel(
+ this.get('position')
+ );
+ if (!position) return;
+ var div = this.div;
+ div.innerHTML = this.get('text') || '';
+ div.style.zIndex =
+ this.get('zIndex') || '0';
+ div.style.position = 'absolute';
+ div.style.display = 'block';
+ div.style.left =
+ position.x - div.offsetWidth / 2 + 'px';
+ div.style.top =
+ position.y - div.offsetHeight + 'px';
+ };
+
+ // initialize all vars here to avoid hoisting related misunderstanding.
+ var map, info_window, saved_lat_lng;
+
+ // Localized Data
+ var mapData = JSON.parse(
+ mapElm.getAttribute('data-map')
+ );
+ var loc_default_latitude = parseFloat(
+ mapData.default_latitude
+ );
+ var loc_default_longitude = parseFloat(
+ mapData.default_longitude
+ );
+ var loc_manual_lat = parseFloat(
+ mapData.manual_lat
+ );
+ var loc_manual_lng = parseFloat(
+ mapData.manual_lng
+ );
+ var loc_map_zoom_level = parseInt(
+ mapData.map_zoom_level
+ );
+ var display_map_info = mapData.display_map_info;
+ var info_content = mapData.info_content;
+ loc_manual_lat = isNaN(loc_manual_lat)
+ ? loc_default_latitude
+ : loc_manual_lat;
+ loc_manual_lng = isNaN(loc_manual_lng)
+ ? loc_default_longitude
+ : loc_manual_lng;
+ saved_lat_lng = {
+ lat: loc_manual_lat,
+ lng: loc_manual_lng,
+ };
+
+ // create an info window for map
+ if (display_map_info) {
+ info_window = new google.maps.InfoWindow({
+ content: info_content,
+ maxWidth: 400 /*Add configuration for max width*/,
+ });
+ }
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement(
+ {
+ map: map,
+ position: saved_lat_lng,
+ content: markerShape,
+ }
+ );
+
+ // create an info window for map
+ marker.addListener('click', function () {
+ if (display_map_info) {
+ display_map_info = false;
+ } else {
+ info_window.close();
+ display_map_info = true;
+ }
+ });
+ function initMap() {
+ /* Create new map instance*/
+ map = new google.maps.Map(mapElm, {
+ zoom: loc_map_zoom_level,
+ center: saved_lat_lng,
+ mapId: 'single_listing_map',
+ });
+ var marker =
+ new google.maps.marker.AdvancedMarkerElement(
+ {
+ map: map,
+ position: saved_lat_lng,
+ content: markerShape,
+ }
+ );
+ if (display_map_info) {
+ marker.addListener(
+ 'click',
+ function () {
+ if (info_window.getMap()) {
+ info_window.close(); // If already open, close it
+ } else {
+ info_window.open(
+ map,
+ marker
+ ); // Otherwise, open it
+ }
+ }
+ );
+ }
+ }
+ initMap();
+ //Convert address tags to google map links -
+ $('address').each(function () {
+ var link =
+ "" +
+ $(this).text() +
+ ' ';
+ $(this).html(link);
+ });
+ });
+ }
+ }
+ $(document).ready(function () {
+ initSingleMap();
+ });
+
+ // Single Listing Map on Elementor EditMode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initSingleMap();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initSingleMap();
+ }
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = " ");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
-!function() {
-/*!******************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ ' '
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ ''.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
+ !(function () {
+ /*!******************************************************!*\
!*** ./assets/src/js/global/map-scripts/map-view.js ***!
\******************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* harmony import */ var _add_listing_google_map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./add-listing/google-map */ "./assets/src/js/global/map-scripts/add-listing/google-map.js");
-/* harmony import */ var _single_listing_google_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./single-listing/google-map */ "./assets/src/js/global/map-scripts/single-listing/google-map.js");
-/* harmony import */ var _single_listing_google_map_widget__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./single-listing/google-map-widget */ "./assets/src/js/global/map-scripts/single-listing/google-map-widget.js");
-
-
-
-
-(function () {
- window.addEventListener('load', initMap);
- window.addEventListener('directorist-reload-listings-map-archive', initMap);
- function initMap() {
- var mapData = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)('atbdp_map');
-
- // Define Marker Shapes
- var MAP_PIN = 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z';
- var inherits = function inherits(childCtor, parentCtor) {
- /** @constructor */
- function tempCtor() {}
- tempCtor.prototype = parentCtor.prototype;
- childCtor.superClass_ = parentCtor.prototype;
- childCtor.prototype = new tempCtor();
- childCtor.prototype.constructor = childCtor;
- };
- function Marker(options) {
- google.maps.Marker.apply(this, arguments);
- if (options.map_icon_label) {
- this.MarkerLabel = new MarkerLabel({
- map: this.map,
- marker: this,
- text: options.map_icon_label
- });
- this.MarkerLabel.bindTo('position', this, 'position');
- }
- }
-
- // Apply the inheritance
- inherits(Marker, google.maps.Marker);
-
- // Custom Marker SetMap
- Marker.prototype.setMap = function () {
- google.maps.Marker.prototype.setMap.apply(this, arguments);
- this.MarkerLabel && this.MarkerLabel.setMap.apply(this.MarkerLabel, arguments);
- };
-
- // Marker Label Overlay
- var MarkerLabel = function MarkerLabel(options) {
- var self = this;
- this.setValues(options);
-
- // Create the label container
- this.div = document.createElement('div');
- this.div.className = 'map-icon-label';
-
- // Trigger the marker click handler if clicking on the label
- google.maps.event.addListener(this.div, 'click', function (e) {
- e.stopPropagation && e.stopPropagation();
- google.maps.event.trigger(self.marker, 'click');
- });
- };
-
- // Create MarkerLabel Object
- MarkerLabel.prototype = new google.maps.OverlayView();
-
- // Marker Label onAdd
- MarkerLabel.prototype.onAdd = function () {
- var pane = this.getPanes().overlayImage.appendChild(this.div);
- var self = this;
- this.listeners = [google.maps.event.addListener(this, 'position_changed', function () {
- self.draw();
- }), google.maps.event.addListener(this, 'text_changed', function () {
- self.draw();
- }), google.maps.event.addListener(this, 'zindex_changed', function () {
- self.draw();
- })];
- };
-
- // Marker Label onRemove
- MarkerLabel.prototype.onRemove = function () {
- this.div.parentNode.removeChild(this.div);
- for (var i = 0, I = this.listeners.length; i < I; ++i) {
- google.maps.event.removeListener(this.listeners[i]);
- }
- };
-
- // Implement draw
- MarkerLabel.prototype.draw = function () {
- var projection = this.getProjection();
- var position = projection.fromLatLngToDivPixel(this.get('position'));
- var div = this.div;
- this.div.innerHTML = this.get('text').toString();
- div.style.zIndex = this.get('zIndex'); // Allow label to overlay marker
- div.style.position = 'absolute';
- div.style.display = 'block';
- div.style.left = "".concat(position.x - div.offsetWidth / 2, "px");
- div.style.top = "".concat(position.y - div.offsetHeight, "px");
- };
- (function ($) {
- // map view
- /**
- * Render a Google Map onto the selected jQuery element.
- *
- * @since 5.0.0
- */
- var at_icon = [];
-
- /* Use Default lat/lng in listings map view */
- var defCordEnabled = mapData.use_def_lat_long;
- function atbdp_rander_map($el) {
- $el.addClass('atbdp-map-loaded');
-
- // var
- var $markers = $el.find('.marker');
-
- // vars
- var args = {
- zoom: parseInt(mapData.zoom),
- center: new google.maps.LatLng(0, 0),
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- zoomControl: true,
- scrollwheel: false,
- gestureHandling: 'cooperative',
- averageCenter: true,
- scrollWheelZoom: 'center'
- };
-
- // create map
- var map = new google.maps.Map($el[0], args);
-
- // add a markers reference
- map.markers = [];
-
- // set map type
- map.type = $el.data('type');
- var infowindow = new google.maps.InfoWindow({
- content: ''
- });
- // add markers
- $markers.each(function () {
- atbdp_add_marker($(this), map, infowindow);
- });
- var cord = {
- lat: Number(mapData.default_latitude) ? Number(mapData.default_latitude) : true ? defCordEnabled : 0,
- lng: Number(mapData.default_longitude) ? Number(mapData.default_longitude) : true ? defCordEnabled : 0
- };
- if ($markers.length) {
- cord.lat = defCordEnabled ? Number(mapData.default_latitude) : Number($markers[0].getAttribute('data-latitude'));
- cord.lng = defCordEnabled ? Number(mapData.default_longitude) : Number($markers[0].getAttribute('data-longitude'));
- }
-
- // center map
- atbdp_center_map(map, cord);
- var mcOptions = new MarkerClusterer(map, [], {
- imagePath: mapData.plugin_url + 'assets/images/m'
- });
- mcOptions.setStyles(mcOptions.getStyles().map(function (style) {
- style.textColor = '#fff';
- return style;
- }));
- if (map.type === 'markerclusterer') {
- //const markerCluster = new MarkerClusterer(map, map.markers, mcOptions);
- mcOptions.addMarkers(map.markers);
- }
- }
-
- /**
- * Add a marker to the selected Google Map.
- *
- * @since 1.0.0
- */
- function atbdp_add_marker($marker, map, infowindow) {
- // var
- var latlng = new google.maps.LatLng($marker.data('latitude'), $marker.data('longitude'));
- // check to see if any of the existing markers match the latlng of the new marker
- if (map.markers.length) {
- for (var i = 0; i < map.markers.length; i++) {
- var existing_marker = map.markers[i];
- var pos = existing_marker.getPosition();
-
- // if a marker already exists in the same position as this marker
- if (latlng.equals(pos)) {
- // update the position of the coincident marker by applying a small multipler to its coordinates
- var latitude = latlng.lat() + (Math.random() - 0.5) / 1500; // * (Math.random() * (max - min) + min);
- var longitude = latlng.lng() + (Math.random() - 0.5) / 1500; // * (Math.random() * (max - min) + min);
- latlng = new google.maps.LatLng(latitude, longitude);
- }
- }
- }
- var icon = JSON.parse($marker.data('icon'));
- var marker = new Marker({
- position: latlng,
- map: map,
- icon: {
- path: MAP_PIN,
- fillColor: 'transparent',
- fillOpacity: 1,
- strokeColor: '',
- strokeWeight: 0
- },
- map_icon_label: icon !== undefined && "".concat(icon, "
")
- });
-
- // add to array
- map.markers.push(marker);
- // if marker contains HTML, add it to an infoWindow
- if ($marker.html()) {
- // show info window when marker is clicked
- google.maps.event.addListener(marker, 'click', function () {
- if (mapData.disable_info_window === 'no') {
- var marker_childrens = $($marker).children();
- if (marker_childrens.length) {
- var marker_content = marker_childrens[0];
- $(marker_content).toggleClass('map-info-wrapper--show');
- }
- infowindow.setContent($marker.html());
- infowindow.open(map, marker);
- }
- });
- }
- }
-
- /**
- * Center the map, showing all markers attached to this map.
- *
- * @since 1.0.0
- */
-
- function atbdp_center_map(map, cord) {
- map.setCenter(cord);
- map.setZoom(parseInt(mapData.zoom));
- }
- function setup_info_window() {
- var abc = document.querySelectorAll('div');
- abc.forEach(function (el, index) {
- if (el.innerText === 'atgm_marker') {
- el.innerText = ' ';
- el.innerHTML = "".concat(at_icon, " ");
- }
- // ${$marker.data('icon')}
- });
- document.querySelectorAll('div').forEach(function (el1, index) {
- if (el1.style.backgroundImage.split('/').pop() === 'm1.png")') {
- el1.addEventListener('click', function () {
- setInterval(function () {
- var abc = document.querySelectorAll('div');
- abc.forEach(function (el, index) {
- if (el.innerText === 'atgm_marker') {
- el.innerText = ' ';
- el.innerHTML = "".concat(at_icon, " ");
- }
- });
- }, 100);
- });
- }
- });
- }
- function setup_map() {
- // render map in the custom post
- $('.atbdp-map').each(function () {
- atbdp_rander_map($(this));
- });
- }
- setup_map();
- setup_info_window();
- $(document).ready(function () {
- $('body').find('.map-info-wrapper').addClass('map-info-wrapper--show');
- });
- })(jQuery);
- }
- var $ = jQuery;
-
- /* Elementor Edit Mode */
- $(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initMap();
- }
- }, 3000);
- });
-
- // Elementor EditMode
- $('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initMap();
- }
- });
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* harmony import */ var _add_listing_google_map__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./add-listing/google-map */ './assets/src/js/global/map-scripts/add-listing/google-map.js'
+ );
+ /* harmony import */ var _single_listing_google_map__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./single-listing/google-map */ './assets/src/js/global/map-scripts/single-listing/google-map.js'
+ );
+ /* harmony import */ var _single_listing_google_map_widget__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./single-listing/google-map-widget */ './assets/src/js/global/map-scripts/single-listing/google-map-widget.js'
+ );
+
+ (function () {
+ window.addEventListener('load', initMap);
+ window.addEventListener(
+ 'directorist-reload-listings-map-archive',
+ initMap
+ );
+ function initMap() {
+ var mapData = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_0__.get_dom_data)(
+ 'atbdp_map'
+ );
+
+ // Define Marker Shapes
+ var MAP_PIN =
+ 'M0-48c-9.8 0-17.7 7.8-17.7 17.4 0 15.5 17.7 30.6 17.7 30.6s17.7-15.4 17.7-30.6c0-9.6-7.9-17.4-17.7-17.4z';
+ var inherits = function inherits(childCtor, parentCtor) {
+ /** @constructor */
+ function tempCtor() {}
+ tempCtor.prototype = parentCtor.prototype;
+ childCtor.superClass_ = parentCtor.prototype;
+ childCtor.prototype = new tempCtor();
+ childCtor.prototype.constructor = childCtor;
+ };
+ function Marker(options) {
+ google.maps.Marker.apply(this, arguments);
+ if (options.map_icon_label) {
+ this.MarkerLabel = new MarkerLabel({
+ map: this.map,
+ marker: this,
+ text: options.map_icon_label,
+ });
+ this.MarkerLabel.bindTo('position', this, 'position');
+ }
+ }
+
+ // Apply the inheritance
+ inherits(Marker, google.maps.Marker);
+
+ // Custom Marker SetMap
+ Marker.prototype.setMap = function () {
+ google.maps.Marker.prototype.setMap.apply(this, arguments);
+ this.MarkerLabel &&
+ this.MarkerLabel.setMap.apply(
+ this.MarkerLabel,
+ arguments
+ );
+ };
+
+ // Marker Label Overlay
+ var MarkerLabel = function MarkerLabel(options) {
+ var self = this;
+ this.setValues(options);
+
+ // Create the label container
+ this.div = document.createElement('div');
+ this.div.className = 'map-icon-label';
+
+ // Trigger the marker click handler if clicking on the label
+ google.maps.event.addListener(
+ this.div,
+ 'click',
+ function (e) {
+ e.stopPropagation && e.stopPropagation();
+ google.maps.event.trigger(self.marker, 'click');
+ }
+ );
+ };
+
+ // Create MarkerLabel Object
+ MarkerLabel.prototype = new google.maps.OverlayView();
+
+ // Marker Label onAdd
+ MarkerLabel.prototype.onAdd = function () {
+ var pane = this.getPanes().overlayImage.appendChild(
+ this.div
+ );
+ var self = this;
+ this.listeners = [
+ google.maps.event.addListener(
+ this,
+ 'position_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ google.maps.event.addListener(
+ this,
+ 'text_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ google.maps.event.addListener(
+ this,
+ 'zindex_changed',
+ function () {
+ self.draw();
+ }
+ ),
+ ];
+ };
+
+ // Marker Label onRemove
+ MarkerLabel.prototype.onRemove = function () {
+ this.div.parentNode.removeChild(this.div);
+ for (var i = 0, I = this.listeners.length; i < I; ++i) {
+ google.maps.event.removeListener(this.listeners[i]);
+ }
+ };
+
+ // Implement draw
+ MarkerLabel.prototype.draw = function () {
+ var projection = this.getProjection();
+ var position = projection.fromLatLngToDivPixel(
+ this.get('position')
+ );
+ var div = this.div;
+ this.div.innerHTML = this.get('text').toString();
+ div.style.zIndex = this.get('zIndex'); // Allow label to overlay marker
+ div.style.position = 'absolute';
+ div.style.display = 'block';
+ div.style.left = ''.concat(
+ position.x - div.offsetWidth / 2,
+ 'px'
+ );
+ div.style.top = ''.concat(
+ position.y - div.offsetHeight,
+ 'px'
+ );
+ };
+ (function ($) {
+ // map view
+ /**
+ * Render a Google Map onto the selected jQuery element.
+ *
+ * @since 5.0.0
+ */
+ var at_icon = [];
+
+ /* Use Default lat/lng in listings map view */
+ var defCordEnabled = mapData.use_def_lat_long;
+ function atbdp_rander_map($el) {
+ $el.addClass('atbdp-map-loaded');
+
+ // var
+ var $markers = $el.find('.marker');
+
+ // vars
+ var args = {
+ zoom: parseInt(mapData.zoom),
+ center: new google.maps.LatLng(0, 0),
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
+ zoomControl: true,
+ scrollwheel: false,
+ gestureHandling: 'cooperative',
+ averageCenter: true,
+ scrollWheelZoom: 'center',
+ };
+
+ // create map
+ var map = new google.maps.Map($el[0], args);
+
+ // add a markers reference
+ map.markers = [];
+
+ // set map type
+ map.type = $el.data('type');
+ var infowindow = new google.maps.InfoWindow({
+ content: '',
+ });
+ // add markers
+ $markers.each(function () {
+ atbdp_add_marker($(this), map, infowindow);
+ });
+ var cord = {
+ lat: Number(mapData.default_latitude)
+ ? Number(mapData.default_latitude)
+ : true
+ ? defCordEnabled
+ : 0,
+ lng: Number(mapData.default_longitude)
+ ? Number(mapData.default_longitude)
+ : true
+ ? defCordEnabled
+ : 0,
+ };
+ if ($markers.length) {
+ cord.lat = defCordEnabled
+ ? Number(mapData.default_latitude)
+ : Number(
+ $markers[0].getAttribute(
+ 'data-latitude'
+ )
+ );
+ cord.lng = defCordEnabled
+ ? Number(mapData.default_longitude)
+ : Number(
+ $markers[0].getAttribute(
+ 'data-longitude'
+ )
+ );
+ }
+
+ // center map
+ atbdp_center_map(map, cord);
+ var mcOptions = new MarkerClusterer(map, [], {
+ imagePath: mapData.plugin_url + 'assets/images/m',
+ });
+ mcOptions.setStyles(
+ mcOptions.getStyles().map(function (style) {
+ style.textColor = '#fff';
+ return style;
+ })
+ );
+ if (map.type === 'markerclusterer') {
+ //const markerCluster = new MarkerClusterer(map, map.markers, mcOptions);
+ mcOptions.addMarkers(map.markers);
+ }
+ }
+
+ /**
+ * Add a marker to the selected Google Map.
+ *
+ * @since 1.0.0
+ */
+ function atbdp_add_marker($marker, map, infowindow) {
+ // var
+ var latlng = new google.maps.LatLng(
+ $marker.data('latitude'),
+ $marker.data('longitude')
+ );
+ // check to see if any of the existing markers match the latlng of the new marker
+ if (map.markers.length) {
+ for (var i = 0; i < map.markers.length; i++) {
+ var existing_marker = map.markers[i];
+ var pos = existing_marker.getPosition();
+
+ // if a marker already exists in the same position as this marker
+ if (latlng.equals(pos)) {
+ // update the position of the coincident marker by applying a small multipler to its coordinates
+ var latitude =
+ latlng.lat() +
+ (Math.random() - 0.5) / 1500; // * (Math.random() * (max - min) + min);
+ var longitude =
+ latlng.lng() +
+ (Math.random() - 0.5) / 1500; // * (Math.random() * (max - min) + min);
+ latlng = new google.maps.LatLng(
+ latitude,
+ longitude
+ );
+ }
+ }
+ }
+ var icon = JSON.parse($marker.data('icon'));
+ var marker = new Marker({
+ position: latlng,
+ map: map,
+ icon: {
+ path: MAP_PIN,
+ fillColor: 'transparent',
+ fillOpacity: 1,
+ strokeColor: '',
+ strokeWeight: 0,
+ },
+ map_icon_label:
+ icon !== undefined &&
+ ''.concat(
+ icon,
+ '
'
+ ),
+ });
+
+ // add to array
+ map.markers.push(marker);
+ // if marker contains HTML, add it to an infoWindow
+ if ($marker.html()) {
+ // show info window when marker is clicked
+ google.maps.event.addListener(
+ marker,
+ 'click',
+ function () {
+ if (mapData.disable_info_window === 'no') {
+ var marker_childrens =
+ $($marker).children();
+ if (marker_childrens.length) {
+ var marker_content =
+ marker_childrens[0];
+ $(marker_content).toggleClass(
+ 'map-info-wrapper--show'
+ );
+ }
+ infowindow.setContent($marker.html());
+ infowindow.open(map, marker);
+ }
+ }
+ );
+ }
+ }
+
+ /**
+ * Center the map, showing all markers attached to this map.
+ *
+ * @since 1.0.0
+ */
+
+ function atbdp_center_map(map, cord) {
+ map.setCenter(cord);
+ map.setZoom(parseInt(mapData.zoom));
+ }
+ function setup_info_window() {
+ var abc = document.querySelectorAll('div');
+ abc.forEach(function (el, index) {
+ if (el.innerText === 'atgm_marker') {
+ el.innerText = ' ';
+ el.innerHTML =
+ ''.concat(
+ at_icon,
+ ' '
+ );
+ }
+ // ${$marker.data('icon')}
+ });
+ document
+ .querySelectorAll('div')
+ .forEach(function (el1, index) {
+ if (
+ el1.style.backgroundImage
+ .split('/')
+ .pop() === 'm1.png")'
+ ) {
+ el1.addEventListener('click', function () {
+ setInterval(function () {
+ var abc =
+ document.querySelectorAll(
+ 'div'
+ );
+ abc.forEach(function (el, index) {
+ if (
+ el.innerText ===
+ 'atgm_marker'
+ ) {
+ el.innerText = ' ';
+ el.innerHTML =
+ ''.concat(
+ at_icon,
+ ' '
+ );
+ }
+ });
+ }, 100);
+ });
+ }
+ });
+ }
+ function setup_map() {
+ // render map in the custom post
+ $('.atbdp-map').each(function () {
+ atbdp_rander_map($(this));
+ });
+ }
+ setup_map();
+ setup_info_window();
+ $(document).ready(function () {
+ $('body')
+ .find('.map-info-wrapper')
+ .addClass('map-info-wrapper--show');
+ });
+ })(jQuery);
+ }
+ var $ = jQuery;
+
+ /* Elementor Edit Mode */
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initMap();
+ }
+ }, 3000);
+ });
+
+ // Elementor EditMode
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initMap();
+ }
+ });
+ })();
+ window.directoristLoadGoogleMap = function () {
+ if (
+ typeof google === 'undefined' ||
+ !google.maps ||
+ !google.maps.Map
+ ) {
+ return;
+ } else {
+ (0,
+ _single_listing_google_map__WEBPACK_IMPORTED_MODULE_2__.initSingleMap)();
+ (0,
+ _add_listing_google_map__WEBPACK_IMPORTED_MODULE_1__.initAddListingMap)();
+ (0,
+ _single_listing_google_map_widget__WEBPACK_IMPORTED_MODULE_3__.initSingleMapWidget)();
+ }
+ };
+ })();
+ /******/
})();
-window.directoristLoadGoogleMap = function () {
- if (typeof google === 'undefined' || !google.maps || !google.maps.Map) {
- return;
- } else {
- (0,_single_listing_google_map__WEBPACK_IMPORTED_MODULE_2__.initSingleMap)();
- (0,_add_listing_google_map__WEBPACK_IMPORTED_MODULE_1__.initAddListingMap)();
- (0,_single_listing_google_map_widget__WEBPACK_IMPORTED_MODULE_3__.initSingleMapWidget)();
- }
-};
-}();
-/******/ })()
-;
-//# sourceMappingURL=google-map.js.map
\ No newline at end of file
+//# sourceMappingURL=google-map.js.map
diff --git a/assets/js/openstreet-map.js b/assets/js/openstreet-map.js
index 4877f652b..4427839be 100644
--- a/assets/js/openstreet-map.js
+++ b/assets/js/openstreet-map.js
@@ -1,681 +1,1023 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/components/debounce.js":
-/*!*****************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/components/debounce.js':
+ /*!*****************************************************!*\
!*** ./assets/src/js/global/components/debounce.js ***!
\*****************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ debounce; }
-/* harmony export */ });
-function debounce(func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/map-scripts/add-listing/openstreet-map.js":
-/*!************************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ debounce;
+ },
+ /* harmony export */
+ }
+ );
+ function debounce(func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function later() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/map-scripts/add-listing/openstreet-map.js':
+ /*!************************************************************************!*\
!*** ./assets/src/js/global/map-scripts/add-listing/openstreet-map.js ***!
\************************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../components/debounce */ "./assets/src/js/global/components/debounce.js");
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* Add listing OSMap */
-
-
-
-(function ($) {
- // Add focus class to the parent field of .directorist-location-js
- function addFocusClass(location) {
- // Get the parent field of .directorist-location-js
- var parentField = location.closest('.directorist-search-field');
-
- // Add the 'input-is-focused' class if not already present
- if (parentField && !parentField.hasClass('input-is-focused')) {
- parentField.addClass('input-is-focused');
- }
- }
-
- // Add Listing Map Initialize
- function initAddListingMap() {
- var mapData = (0,_lib_helper__WEBPACK_IMPORTED_MODULE_1__.get_dom_data)('map_data');
-
- // Localized Data
- var loc_default_latitude = parseFloat(mapData.default_latitude);
- var loc_default_longitude = parseFloat(mapData.default_longitude);
- var loc_manual_lat = parseFloat(mapData.manual_lat);
- var loc_manual_lng = parseFloat(mapData.manual_lng);
- var loc_map_zoom_level = parseInt(mapData.map_zoom_level);
- var loc_map_icon = mapData.map_icon;
- loc_manual_lat = isNaN(loc_manual_lat) ? loc_default_latitude : loc_manual_lat;
- loc_manual_lng = isNaN(loc_manual_lng) ? loc_default_longitude : loc_manual_lng;
- function mapLeaflet(lat, lon) {
- // @todo @kowsar / remove later. fix js error
- if ($('#gmap').length == 0) {
- return;
- }
- var fontAwesomeIcon = L.divIcon({
- html: "".concat(loc_map_icon, "
"),
- iconSize: [20, 20],
- className: 'myDivIcon'
- });
- var mymap = L.map('gmap').setView([lat, lon], loc_map_zoom_level);
-
- // Create draggable marker
- var marker = L.marker([lat, lon], {
- icon: fontAwesomeIcon,
- draggable: true
- }).addTo(mymap);
-
- // Trigger AJAX request when marker is dropped
- marker.on('dragend', function (e) {
- var position = marker.getLatLng();
- $('#manual_lat').val(position.lat);
- $('#manual_lng').val(position.lng);
-
- // Make AJAX request after the drag ends (marker drop)
- $.ajax({
- url: "https://nominatim.openstreetmap.org/reverse?format=json&lon=".concat(position.lng, "&lat=").concat(position.lat),
- type: 'GET',
- data: {},
- success: function success(data) {
- $('.directorist-location-js').val(data.display_name);
- addFocusClass($('.directorist-location-js'));
- },
- error: function error() {
- $('.directorist-location-js').val('Location not found');
- addFocusClass($('.directorist-location-js'));
- }
- });
- });
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '© OpenStreetMap contributors'
- }).addTo(mymap);
- function toggleFullscreen() {
- var mapContainer = document.getElementById('gmap');
- var fullScreenEnable = document.querySelector('#gmap_full_screen_button .fullscreen-enable');
- var fullScreenDisable = document.querySelector('#gmap_full_screen_button .fullscreen-disable');
- if (!document.fullscreenElement && !document.webkitFullscreenElement) {
- if (mapContainer.requestFullscreen) {
- mapContainer.requestFullscreen();
- fullScreenEnable.style.display = 'none';
- fullScreenDisable.style.display = 'block';
- } else if (mapContainer.webkitRequestFullscreen) {
- mapContainer.webkitRequestFullscreen();
- }
- } else {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- fullScreenDisable.style.display = 'none';
- fullScreenEnable.style.display = 'block';
- } else if (document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- }
- }
- }
- $('body').on('click', '#gmap_full_screen_button', function (event) {
- event.preventDefault();
- toggleFullscreen();
- });
- }
- $('.directorist-location-js').each(function (id, elm) {
- var result_container = $(elm).siblings('.address_result');
- $(elm).on('keyup', (0,_components_debounce__WEBPACK_IMPORTED_MODULE_0__["default"])(function (event) {
- event.preventDefault();
- var blockedKeyCodes = [16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 91, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 144, 145];
-
- // Return early when blocked key is pressed.
- if (blockedKeyCodes.includes(event.keyCode)) {
- return;
- }
- var locationAddressField = $(this).parent('.directorist-form-address-field');
- var search = $(elm).val();
- if (search.length < 3) {
- result_container.css({
- display: 'none'
- });
- } else {
- locationAddressField.addClass('atbdp-form-fade');
- result_container.css({
- display: 'block'
- });
- $.ajax({
- url: "https://nominatim.openstreetmap.org/?q=%27+".concat(search, "+%27&format=json"),
- type: 'GET',
- data: {},
- success: function success(data) {
- var res = '';
- for (var i = 0; i < data.length; i++) {
- res += "").concat(data[i].display_name, " ");
- }
- result_container.find('ul').html(res);
- if (res.length) {
- result_container.show();
- } else {
- result_container.hide();
- }
- locationAddressField.removeClass('atbdp-form-fade');
- }
- });
- }
- }, 750));
- });
- var lat = loc_manual_lat,
- lon = loc_manual_lng;
- mapLeaflet(lat, lon);
-
- // Add Map on Add Listing Multistep
- $('body').on('click', '.multistep-wizard__btn', function (event) {
- if (document.getElementById('osm')) {
- document.getElementById('osm').innerHTML = "
";
- mapLeaflet(lat, lon);
- }
- });
- $('body').on('click', '.directorist-form-address-field .address_result ul li a', function (event) {
- if (document.getElementById('osm')) {
- document.getElementById('osm').innerHTML = "
";
- }
- event.preventDefault();
- var text = $(this).text(),
- lat = $(this).data('lat'),
- lon = $(this).data('lon');
- $('#manual_lat').val(lat);
- $('#manual_lng').val(lon);
- $(this).closest('.address_result').siblings('.directorist-location-js').val(text);
- $('.address_result').css({
- display: 'none'
- });
- mapLeaflet(lat, lon);
- });
- $('body').on('click', '.location-names ul li a', function (event) {
- event.preventDefault();
- var text = $(this).text();
- $(this).closest('.address_result').siblings('.directorist-location-js').val(text);
- $('.address_result').css({
- display: 'none'
- });
- });
- $('body').on('click', '#generate_admin_map', function (event) {
- event.preventDefault();
- document.getElementById('osm').innerHTML = "
";
- mapLeaflet($('#manual_lat').val(), $('#manual_lng').val());
- });
-
- // Popup controller by keyboard
- var index = 0;
- $('.directorist-location-js').on('keyup', function (event) {
- event.preventDefault();
- var length = $('#directorist.atbd_wrapper .address_result ul li a').length;
- if (event.keyCode === 40) {
- index++;
- if (index > length) {
- index = 0;
- }
- } else if (event.keyCode === 38) {
- index--;
- if (index < 0) {
- index = length;
- }
- }
- if ($('#directorist.atbd_wrapper .address_result ul li a').length > 0) {
- $('#directorist.atbd_wrapper .address_result ul li a').removeClass('active');
- $($('#directorist.atbd_wrapper .address_result ul li a')[index]).addClass('active');
- if (event.keyCode === 13) {
- $($('#directorist.atbd_wrapper .address_result ul li a')[index]).click();
- event.preventDefault();
- index = 0;
- return false;
- }
- }
- });
- }
- $(document).ready(function () {
- initAddListingMap();
- });
-
- // Add Listing Map on Elementor EditMode
- $(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initAddListingMap();
- }
- }, 3000);
- });
- $('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initAddListingMap();
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/global/map-scripts/single-listing/openstreet-map-widget.js":
-/*!**********************************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_debounce__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../../components/debounce */ './assets/src/js/global/components/debounce.js'
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* Add listing OSMap */
+
+ (function ($) {
+ // Add focus class to the parent field of .directorist-location-js
+ function addFocusClass(location) {
+ // Get the parent field of .directorist-location-js
+ var parentField = location.closest(
+ '.directorist-search-field'
+ );
+
+ // Add the 'input-is-focused' class if not already present
+ if (
+ parentField &&
+ !parentField.hasClass('input-is-focused')
+ ) {
+ parentField.addClass('input-is-focused');
+ }
+ }
+
+ // Add Listing Map Initialize
+ function initAddListingMap() {
+ var mapData = (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_1__.get_dom_data)(
+ 'map_data'
+ );
+
+ // Localized Data
+ var loc_default_latitude = parseFloat(
+ mapData.default_latitude
+ );
+ var loc_default_longitude = parseFloat(
+ mapData.default_longitude
+ );
+ var loc_manual_lat = parseFloat(mapData.manual_lat);
+ var loc_manual_lng = parseFloat(mapData.manual_lng);
+ var loc_map_zoom_level = parseInt(
+ mapData.map_zoom_level
+ );
+ var loc_map_icon = mapData.map_icon;
+ loc_manual_lat = isNaN(loc_manual_lat)
+ ? loc_default_latitude
+ : loc_manual_lat;
+ loc_manual_lng = isNaN(loc_manual_lng)
+ ? loc_default_longitude
+ : loc_manual_lng;
+ function mapLeaflet(lat, lon) {
+ // @todo @kowsar / remove later. fix js error
+ if ($('#gmap').length == 0) {
+ return;
+ }
+ var fontAwesomeIcon = L.divIcon({
+ html: ''.concat(
+ loc_map_icon,
+ '
'
+ ),
+ iconSize: [20, 20],
+ className: 'myDivIcon',
+ });
+ var mymap = L.map('gmap').setView(
+ [lat, lon],
+ loc_map_zoom_level
+ );
+
+ // Create draggable marker
+ var marker = L.marker([lat, lon], {
+ icon: fontAwesomeIcon,
+ draggable: true,
+ }).addTo(mymap);
+
+ // Trigger AJAX request when marker is dropped
+ marker.on('dragend', function (e) {
+ var position = marker.getLatLng();
+ $('#manual_lat').val(position.lat);
+ $('#manual_lng').val(position.lng);
+
+ // Make AJAX request after the drag ends (marker drop)
+ $.ajax({
+ url: 'https://nominatim.openstreetmap.org/reverse?format=json&lon='
+ .concat(position.lng, '&lat=')
+ .concat(position.lat),
+ type: 'GET',
+ data: {},
+ success: function success(data) {
+ $('.directorist-location-js').val(
+ data.display_name
+ );
+ addFocusClass(
+ $('.directorist-location-js')
+ );
+ },
+ error: function error() {
+ $('.directorist-location-js').val(
+ 'Location not found'
+ );
+ addFocusClass(
+ $('.directorist-location-js')
+ );
+ },
+ });
+ });
+ L.tileLayer(
+ 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
+ {
+ attribution:
+ '© OpenStreetMap contributors',
+ }
+ ).addTo(mymap);
+ function toggleFullscreen() {
+ var mapContainer =
+ document.getElementById('gmap');
+ var fullScreenEnable = document.querySelector(
+ '#gmap_full_screen_button .fullscreen-enable'
+ );
+ var fullScreenDisable = document.querySelector(
+ '#gmap_full_screen_button .fullscreen-disable'
+ );
+ if (
+ !document.fullscreenElement &&
+ !document.webkitFullscreenElement
+ ) {
+ if (mapContainer.requestFullscreen) {
+ mapContainer.requestFullscreen();
+ fullScreenEnable.style.display = 'none';
+ fullScreenDisable.style.display =
+ 'block';
+ } else if (
+ mapContainer.webkitRequestFullscreen
+ ) {
+ mapContainer.webkitRequestFullscreen();
+ }
+ } else {
+ if (document.exitFullscreen) {
+ document.exitFullscreen();
+ fullScreenDisable.style.display =
+ 'none';
+ fullScreenEnable.style.display =
+ 'block';
+ } else if (document.webkitExitFullscreen) {
+ document.webkitExitFullscreen();
+ }
+ }
+ }
+ $('body').on(
+ 'click',
+ '#gmap_full_screen_button',
+ function (event) {
+ event.preventDefault();
+ toggleFullscreen();
+ }
+ );
+ }
+ $('.directorist-location-js').each(function (id, elm) {
+ var result_container =
+ $(elm).siblings('.address_result');
+ $(elm).on(
+ 'keyup',
+ (0,
+ _components_debounce__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(function (event) {
+ event.preventDefault();
+ var blockedKeyCodes = [
+ 16, 17, 18, 19, 20, 27, 33, 34, 35, 36,
+ 37, 38, 39, 40, 45, 91, 93, 112, 113,
+ 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 144, 145,
+ ];
+
+ // Return early when blocked key is pressed.
+ if (
+ blockedKeyCodes.includes(event.keyCode)
+ ) {
+ return;
+ }
+ var locationAddressField = $(this).parent(
+ '.directorist-form-address-field'
+ );
+ var search = $(elm).val();
+ if (search.length < 3) {
+ result_container.css({
+ display: 'none',
+ });
+ } else {
+ locationAddressField.addClass(
+ 'atbdp-form-fade'
+ );
+ result_container.css({
+ display: 'block',
+ });
+ $.ajax({
+ url: 'https://nominatim.openstreetmap.org/?q=%27+'.concat(
+ search,
+ '+%27&format=json'
+ ),
+ type: 'GET',
+ data: {},
+ success: function success(data) {
+ var res = '';
+ for (
+ var i = 0;
+ i < data.length;
+ i++
+ ) {
+ res +=
+ ''
+ )
+ .concat(
+ data[i]
+ .display_name,
+ ' '
+ );
+ }
+ result_container
+ .find('ul')
+ .html(res);
+ if (res.length) {
+ result_container.show();
+ } else {
+ result_container.hide();
+ }
+ locationAddressField.removeClass(
+ 'atbdp-form-fade'
+ );
+ },
+ });
+ }
+ }, 750)
+ );
+ });
+ var lat = loc_manual_lat,
+ lon = loc_manual_lng;
+ mapLeaflet(lat, lon);
+
+ // Add Map on Add Listing Multistep
+ $('body').on(
+ 'click',
+ '.multistep-wizard__btn',
+ function (event) {
+ if (document.getElementById('osm')) {
+ document.getElementById('osm').innerHTML =
+ "
";
+ mapLeaflet(lat, lon);
+ }
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-form-address-field .address_result ul li a',
+ function (event) {
+ if (document.getElementById('osm')) {
+ document.getElementById('osm').innerHTML =
+ "
";
+ }
+ event.preventDefault();
+ var text = $(this).text(),
+ lat = $(this).data('lat'),
+ lon = $(this).data('lon');
+ $('#manual_lat').val(lat);
+ $('#manual_lng').val(lon);
+ $(this)
+ .closest('.address_result')
+ .siblings('.directorist-location-js')
+ .val(text);
+ $('.address_result').css({
+ display: 'none',
+ });
+ mapLeaflet(lat, lon);
+ }
+ );
+ $('body').on(
+ 'click',
+ '.location-names ul li a',
+ function (event) {
+ event.preventDefault();
+ var text = $(this).text();
+ $(this)
+ .closest('.address_result')
+ .siblings('.directorist-location-js')
+ .val(text);
+ $('.address_result').css({
+ display: 'none',
+ });
+ }
+ );
+ $('body').on(
+ 'click',
+ '#generate_admin_map',
+ function (event) {
+ event.preventDefault();
+ document.getElementById('osm').innerHTML =
+ "
";
+ mapLeaflet(
+ $('#manual_lat').val(),
+ $('#manual_lng').val()
+ );
+ }
+ );
+
+ // Popup controller by keyboard
+ var index = 0;
+ $('.directorist-location-js').on(
+ 'keyup',
+ function (event) {
+ event.preventDefault();
+ var length = $(
+ '#directorist.atbd_wrapper .address_result ul li a'
+ ).length;
+ if (event.keyCode === 40) {
+ index++;
+ if (index > length) {
+ index = 0;
+ }
+ } else if (event.keyCode === 38) {
+ index--;
+ if (index < 0) {
+ index = length;
+ }
+ }
+ if (
+ $(
+ '#directorist.atbd_wrapper .address_result ul li a'
+ ).length > 0
+ ) {
+ $(
+ '#directorist.atbd_wrapper .address_result ul li a'
+ ).removeClass('active');
+ $(
+ $(
+ '#directorist.atbd_wrapper .address_result ul li a'
+ )[index]
+ ).addClass('active');
+ if (event.keyCode === 13) {
+ $(
+ $(
+ '#directorist.atbd_wrapper .address_result ul li a'
+ )[index]
+ ).click();
+ event.preventDefault();
+ index = 0;
+ return false;
+ }
+ }
+ }
+ );
+ }
+ $(document).ready(function () {
+ initAddListingMap();
+ });
+
+ // Add Listing Map on Elementor EditMode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initAddListingMap();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initAddListingMap();
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/map-scripts/single-listing/openstreet-map-widget.js':
+ /*!**********************************************************************************!*\
!*** ./assets/src/js/global/map-scripts/single-listing/openstreet-map-widget.js ***!
\**********************************************************************************/
-/***/ (function() {
-
-/* Widget OSMap */
-
-(function ($) {
- // Single Listing Map Initialize
- function initSingleMap() {
- // Localized Data
- if ($('#gmap-widget').length) {
- var map_container = localized_data_widget.map_container_id ? localized_data_widget.map_container_id : 'gmap';
- var loc_default_latitude = parseFloat(localized_data_widget.default_latitude);
- var loc_default_longitude = parseFloat(localized_data_widget.default_longitude);
- var loc_manual_lat = parseFloat(localized_data_widget.manual_lat);
- var loc_manual_lng = parseFloat(localized_data_widget.manual_lng);
- var loc_map_zoom_level = parseInt(localized_data_widget.map_zoom_level);
- var _localized_data_widge = localized_data_widget,
- display_map_info = _localized_data_widge.display_map_info;
- var _localized_data_widge2 = localized_data_widget,
- cat_icon = _localized_data_widge2.cat_icon;
- var _localized_data_widge3 = localized_data_widget,
- info_content = _localized_data_widge3.info_content;
- loc_manual_lat = isNaN(loc_manual_lat) ? loc_default_latitude : loc_manual_lat;
- loc_manual_lng = isNaN(loc_manual_lng) ? loc_default_longitude : loc_manual_lng;
- $manual_lat = $('#manual_lat');
- $manual_lng = $('#manual_lng');
- saved_lat_lng = {
- lat: loc_manual_lat,
- lng: loc_manual_lng
- };
- function mapLeaflet(lat, lon) {
- var fontAwesomeIcon = L.divIcon({
- html: "".concat(cat_icon, "
"),
- iconSize: [20, 20],
- className: 'myDivIcon'
- });
- var mymap = L.map(map_container).setView([lat, lon], loc_map_zoom_level);
- if (display_map_info) {
- L.marker([lat, lon], {
- icon: fontAwesomeIcon
- }).addTo(mymap).bindPopup(info_content);
- } else {
- L.marker([lat, lon], {
- icon: fontAwesomeIcon
- }).addTo(mymap);
- }
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '© OpenStreetMap contributors'
- }).addTo(mymap);
- }
- mapLeaflet(loc_manual_lat, loc_manual_lng);
- }
- }
- jQuery(document).ready(function () {
- initSingleMap();
- });
-
- // Single Listing Map on Elementor EditMode
- $(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initSingleMap();
- }
- }, 3000);
- });
- $('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initSingleMap();
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/global/map-scripts/single-listing/openstreet-map.js":
-/*!***************************************************************************!*\
+ /***/ function () {
+ /* Widget OSMap */
+
+ (function ($) {
+ // Single Listing Map Initialize
+ function initSingleMap() {
+ // Localized Data
+ if ($('#gmap-widget').length) {
+ var map_container =
+ localized_data_widget.map_container_id
+ ? localized_data_widget.map_container_id
+ : 'gmap';
+ var loc_default_latitude = parseFloat(
+ localized_data_widget.default_latitude
+ );
+ var loc_default_longitude = parseFloat(
+ localized_data_widget.default_longitude
+ );
+ var loc_manual_lat = parseFloat(
+ localized_data_widget.manual_lat
+ );
+ var loc_manual_lng = parseFloat(
+ localized_data_widget.manual_lng
+ );
+ var loc_map_zoom_level = parseInt(
+ localized_data_widget.map_zoom_level
+ );
+ var _localized_data_widge = localized_data_widget,
+ display_map_info =
+ _localized_data_widge.display_map_info;
+ var _localized_data_widge2 = localized_data_widget,
+ cat_icon = _localized_data_widge2.cat_icon;
+ var _localized_data_widge3 = localized_data_widget,
+ info_content =
+ _localized_data_widge3.info_content;
+ loc_manual_lat = isNaN(loc_manual_lat)
+ ? loc_default_latitude
+ : loc_manual_lat;
+ loc_manual_lng = isNaN(loc_manual_lng)
+ ? loc_default_longitude
+ : loc_manual_lng;
+ $manual_lat = $('#manual_lat');
+ $manual_lng = $('#manual_lng');
+ saved_lat_lng = {
+ lat: loc_manual_lat,
+ lng: loc_manual_lng,
+ };
+ function mapLeaflet(lat, lon) {
+ var fontAwesomeIcon = L.divIcon({
+ html: ''.concat(
+ cat_icon,
+ '
'
+ ),
+ iconSize: [20, 20],
+ className: 'myDivIcon',
+ });
+ var mymap = L.map(map_container).setView(
+ [lat, lon],
+ loc_map_zoom_level
+ );
+ if (display_map_info) {
+ L.marker([lat, lon], {
+ icon: fontAwesomeIcon,
+ })
+ .addTo(mymap)
+ .bindPopup(info_content);
+ } else {
+ L.marker([lat, lon], {
+ icon: fontAwesomeIcon,
+ }).addTo(mymap);
+ }
+ L.tileLayer(
+ 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
+ {
+ attribution:
+ '© OpenStreetMap contributors',
+ }
+ ).addTo(mymap);
+ }
+ mapLeaflet(loc_manual_lat, loc_manual_lng);
+ }
+ }
+ jQuery(document).ready(function () {
+ initSingleMap();
+ });
+
+ // Single Listing Map on Elementor EditMode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initSingleMap();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initSingleMap();
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/map-scripts/single-listing/openstreet-map.js':
+ /*!***************************************************************************!*\
!*** ./assets/src/js/global/map-scripts/single-listing/openstreet-map.js ***!
\***************************************************************************/
-/***/ (function() {
-
-/* Single listing OSMap */
-
-(function ($) {
- // Single Listing Map Initialize
- function initSingleMap() {
- // Localized Data
- if ($('.directorist-single-map').length) {
- document.querySelectorAll('.directorist-single-map').forEach(function (mapElm) {
- var mapData = JSON.parse(mapElm.getAttribute('data-map'));
- var loc_default_latitude = parseFloat(mapData.default_latitude);
- var loc_default_longitude = parseFloat(mapData.default_longitude);
- var loc_manual_lat = parseFloat(mapData.manual_lat);
- var loc_manual_lng = parseFloat(mapData.manual_lng);
- var loc_map_zoom_level = parseInt(mapData.map_zoom_level);
- var display_map_info = mapData.display_map_info;
- var cat_icon = mapData.cat_icon;
- var info_content = mapData.info_content;
- loc_manual_lat = isNaN(loc_manual_lat) ? loc_default_latitude : loc_manual_lat;
- loc_manual_lng = isNaN(loc_manual_lng) ? loc_default_longitude : loc_manual_lng;
- $manual_lat = $('#manual_lat');
- $manual_lng = $('#manual_lng');
- saved_lat_lng = {
- lat: loc_manual_lat,
- lng: loc_manual_lng
- };
- function mapLeaflet(lat, lon) {
- var fontAwesomeIcon = L.divIcon({
- html: "".concat(cat_icon, "
"),
- iconSize: [20, 20],
- className: 'myDivIcon'
- });
- var mymap = L.map(mapElm, {
- scrollWheelZoom: false
- }).setView([lat, lon], loc_map_zoom_level);
- if (display_map_info) {
- L.marker([lat, lon], {
- icon: fontAwesomeIcon
- }).addTo(mymap).bindPopup(info_content);
- } else {
- L.marker([lat, lon], {
- icon: fontAwesomeIcon
- }).addTo(mymap);
- }
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '© OpenStreetMap contributors'
- }).addTo(mymap);
- }
- mapLeaflet(loc_manual_lat, loc_manual_lng);
- });
- }
- }
- jQuery(document).ready(function () {
- initSingleMap();
- });
-
- // Single Listing Map on Elementor EditMode
- $(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initSingleMap();
- }
- }, 3000);
- });
- $('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initSingleMap();
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function () {
+ /* Single listing OSMap */
+
+ (function ($) {
+ // Single Listing Map Initialize
+ function initSingleMap() {
+ // Localized Data
+ if ($('.directorist-single-map').length) {
+ document
+ .querySelectorAll('.directorist-single-map')
+ .forEach(function (mapElm) {
+ var mapData = JSON.parse(
+ mapElm.getAttribute('data-map')
+ );
+ var loc_default_latitude = parseFloat(
+ mapData.default_latitude
+ );
+ var loc_default_longitude = parseFloat(
+ mapData.default_longitude
+ );
+ var loc_manual_lat = parseFloat(
+ mapData.manual_lat
+ );
+ var loc_manual_lng = parseFloat(
+ mapData.manual_lng
+ );
+ var loc_map_zoom_level = parseInt(
+ mapData.map_zoom_level
+ );
+ var display_map_info =
+ mapData.display_map_info;
+ var cat_icon = mapData.cat_icon;
+ var info_content = mapData.info_content;
+ loc_manual_lat = isNaN(loc_manual_lat)
+ ? loc_default_latitude
+ : loc_manual_lat;
+ loc_manual_lng = isNaN(loc_manual_lng)
+ ? loc_default_longitude
+ : loc_manual_lng;
+ $manual_lat = $('#manual_lat');
+ $manual_lng = $('#manual_lng');
+ saved_lat_lng = {
+ lat: loc_manual_lat,
+ lng: loc_manual_lng,
+ };
+ function mapLeaflet(lat, lon) {
+ var fontAwesomeIcon = L.divIcon({
+ html: ''.concat(
+ cat_icon,
+ '
'
+ ),
+ iconSize: [20, 20],
+ className: 'myDivIcon',
+ });
+ var mymap = L.map(mapElm, {
+ scrollWheelZoom: false,
+ }).setView(
+ [lat, lon],
+ loc_map_zoom_level
+ );
+ if (display_map_info) {
+ L.marker([lat, lon], {
+ icon: fontAwesomeIcon,
+ })
+ .addTo(mymap)
+ .bindPopup(info_content);
+ } else {
+ L.marker([lat, lon], {
+ icon: fontAwesomeIcon,
+ }).addTo(mymap);
+ }
+ L.tileLayer(
+ 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
+ {
+ attribution:
+ '© OpenStreetMap contributors',
+ }
+ ).addTo(mymap);
+ }
+ mapLeaflet(loc_manual_lat, loc_manual_lng);
+ });
+ }
+ }
+ jQuery(document).ready(function () {
+ initSingleMap();
+ });
+
+ // Single Listing Map on Elementor EditMode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initSingleMap();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initSingleMap();
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = " ");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ ' '
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ ''.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!************************************************************!*\
!*** ./assets/src/js/global/map-scripts/openstreet-map.js ***!
\************************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _add_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./add-listing/openstreet-map */ "./assets/src/js/global/map-scripts/add-listing/openstreet-map.js");
-/* harmony import */ var _single_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./single-listing/openstreet-map */ "./assets/src/js/global/map-scripts/single-listing/openstreet-map.js");
-/* harmony import */ var _single_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_single_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _single_listing_openstreet_map_widget__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./single-listing/openstreet-map-widget */ "./assets/src/js/global/map-scripts/single-listing/openstreet-map-widget.js");
-/* harmony import */ var _single_listing_openstreet_map_widget__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_single_listing_openstreet_map_widget__WEBPACK_IMPORTED_MODULE_2__);
-(function () {
- // DOM Mutation observer
- var targetNode = document.querySelector('.directorist-archive-contents');
- if (targetNode) {
- function initObserver() {
- var observer = new MutationObserver(initMap);
- targetNode && observer.observe(targetNode, {
- childList: true
- });
- }
- window.addEventListener('load', initObserver);
- }
- window.addEventListener('load', initMap);
- window.addEventListener('directorist-reload-listings-map-archive', initMap);
-
- // Map Initialize
- function initMap() {
- var $ = jQuery;
- var mapData;
- $('#map').length ? mapData = JSON.parse($('#map').attr('data-options')) : '';
- function setup_map() {
- bundle1.fillPlaceholders();
- var localVersion = bundle1.getLibVersion('leaflet.featuregroup.subgroup', 'local');
- if (localVersion) {
- localVersion.checkAssetsAvailability(true).then(function () {
- mapData !== undefined ? load() : '';
- }).catch(function () {
- var version102 = bundle1.getLibVersion('leaflet.featuregroup.subgroup', '1.0.2');
- if (version102) {
- version102.defaultVersion = true;
- }
- mapData !== undefined ? load() : '';
- });
- } else {
- mapData !== undefined ? load() : '';
- }
- }
- function load() {
- var url = window.location.href;
- var urlParts = URI.parse(url);
- var queryStringParts = URI.parseQuery(urlParts.query);
- var list = bundle1.getAndSelectVersionsAssetsList(queryStringParts);
- list.push({
- type: 'script',
- path: mapData.openstreet_script
- });
- loadJsCss.list(list, {
- delayScripts: 500 // Load scripts after stylesheets, delayed by this duration (in ms).
- });
- function toggleFullscreen() {
- var mapContainer = document.getElementById('map');
- var fullScreenEnable = document.querySelector('#gmap_full_screen_button .fullscreen-enable');
- var fullScreenDisable = document.querySelector('#gmap_full_screen_button .fullscreen-disable');
- if (!document.fullscreenElement && !document.webkitFullscreenElement) {
- if (mapContainer.requestFullscreen) {
- mapContainer.requestFullscreen();
- fullScreenEnable.style.display = 'none';
- fullScreenDisable.style.display = 'block';
- } else if (mapContainer.webkitRequestFullscreen) {
- mapContainer.webkitRequestFullscreen();
- }
- } else {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- fullScreenDisable.style.display = 'none';
- fullScreenEnable.style.display = 'block';
- } else if (document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- }
- }
- }
- $('body').on('click', '#gmap_full_screen_button', function (event) {
- event.preventDefault();
- toggleFullscreen();
- });
- }
- setup_map();
- }
- var $ = jQuery;
-
- // Map on Elementor Edit Mode
- $(window).on('elementor/frontend/init', function () {
- setTimeout(function () {
- if ($('body').hasClass('elementor-editor-active')) {
- initMap();
- }
- }, 3000);
- });
- $('body').on('click', function (e) {
- if ($('body').hasClass('elementor-editor-active') && e.target.nodeName !== 'A' && e.target.nodeName !== 'BUTTON') {
- initMap();
- }
- });
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _add_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./add-listing/openstreet-map */ './assets/src/js/global/map-scripts/add-listing/openstreet-map.js'
+ );
+ /* harmony import */ var _single_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./single-listing/openstreet-map */ './assets/src/js/global/map-scripts/single-listing/openstreet-map.js'
+ );
+ /* harmony import */ var _single_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _single_listing_openstreet_map__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _single_listing_openstreet_map_widget__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./single-listing/openstreet-map-widget */ './assets/src/js/global/map-scripts/single-listing/openstreet-map-widget.js'
+ );
+ /* harmony import */ var _single_listing_openstreet_map_widget__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _single_listing_openstreet_map_widget__WEBPACK_IMPORTED_MODULE_2__
+ );
+ (function () {
+ // DOM Mutation observer
+ var targetNode = document.querySelector(
+ '.directorist-archive-contents'
+ );
+ if (targetNode) {
+ function initObserver() {
+ var observer = new MutationObserver(initMap);
+ targetNode &&
+ observer.observe(targetNode, {
+ childList: true,
+ });
+ }
+ window.addEventListener('load', initObserver);
+ }
+ window.addEventListener('load', initMap);
+ window.addEventListener(
+ 'directorist-reload-listings-map-archive',
+ initMap
+ );
+
+ // Map Initialize
+ function initMap() {
+ var $ = jQuery;
+ var mapData;
+ $('#map').length
+ ? (mapData = JSON.parse($('#map').attr('data-options')))
+ : '';
+ function setup_map() {
+ bundle1.fillPlaceholders();
+ var localVersion = bundle1.getLibVersion(
+ 'leaflet.featuregroup.subgroup',
+ 'local'
+ );
+ if (localVersion) {
+ localVersion
+ .checkAssetsAvailability(true)
+ .then(function () {
+ mapData !== undefined ? load() : '';
+ })
+ .catch(function () {
+ var version102 = bundle1.getLibVersion(
+ 'leaflet.featuregroup.subgroup',
+ '1.0.2'
+ );
+ if (version102) {
+ version102.defaultVersion = true;
+ }
+ mapData !== undefined ? load() : '';
+ });
+ } else {
+ mapData !== undefined ? load() : '';
+ }
+ }
+ function load() {
+ var url = window.location.href;
+ var urlParts = URI.parse(url);
+ var queryStringParts = URI.parseQuery(urlParts.query);
+ var list =
+ bundle1.getAndSelectVersionsAssetsList(
+ queryStringParts
+ );
+ list.push({
+ type: 'script',
+ path: mapData.openstreet_script,
+ });
+ loadJsCss.list(list, {
+ delayScripts: 500, // Load scripts after stylesheets, delayed by this duration (in ms).
+ });
+ function toggleFullscreen() {
+ var mapContainer = document.getElementById('map');
+ var fullScreenEnable = document.querySelector(
+ '#gmap_full_screen_button .fullscreen-enable'
+ );
+ var fullScreenDisable = document.querySelector(
+ '#gmap_full_screen_button .fullscreen-disable'
+ );
+ if (
+ !document.fullscreenElement &&
+ !document.webkitFullscreenElement
+ ) {
+ if (mapContainer.requestFullscreen) {
+ mapContainer.requestFullscreen();
+ fullScreenEnable.style.display = 'none';
+ fullScreenDisable.style.display = 'block';
+ } else if (mapContainer.webkitRequestFullscreen) {
+ mapContainer.webkitRequestFullscreen();
+ }
+ } else {
+ if (document.exitFullscreen) {
+ document.exitFullscreen();
+ fullScreenDisable.style.display = 'none';
+ fullScreenEnable.style.display = 'block';
+ } else if (document.webkitExitFullscreen) {
+ document.webkitExitFullscreen();
+ }
+ }
+ }
+ $('body').on(
+ 'click',
+ '#gmap_full_screen_button',
+ function (event) {
+ event.preventDefault();
+ toggleFullscreen();
+ }
+ );
+ }
+ setup_map();
+ }
+ var $ = jQuery;
+
+ // Map on Elementor Edit Mode
+ $(window).on('elementor/frontend/init', function () {
+ setTimeout(function () {
+ if ($('body').hasClass('elementor-editor-active')) {
+ initMap();
+ }
+ }, 3000);
+ });
+ $('body').on('click', function (e) {
+ if (
+ $('body').hasClass('elementor-editor-active') &&
+ e.target.nodeName !== 'A' &&
+ e.target.nodeName !== 'BUTTON'
+ ) {
+ initMap();
+ }
+ });
+ })();
+
+ /* Add listing OSMap */
+
+ /* Single listing OSMap */
+
+ /* Widget OSMap */
+ })();
+ /******/
})();
-
-/* Add listing OSMap */
-
-
-/* Single listing OSMap */
-
-
-/* Widget OSMap */
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=openstreet-map.js.map
\ No newline at end of file
+//# sourceMappingURL=openstreet-map.js.map
diff --git a/assets/js/public-main.js b/assets/js/public-main.js
index e09016353..82e5363ab 100644
--- a/assets/js/public-main.js
+++ b/assets/js/public-main.js
@@ -1,1074 +1,1770 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/components/modal.js":
-/*!**************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/components/modal.js':
+ /*!**************************************************!*\
!*** ./assets/src/js/global/components/modal.js ***!
\**************************************************/
-/***/ (function() {
-
-var $ = jQuery;
-$(document).ready(function () {
- modalToggle();
-});
-function modalToggle() {
- $('.atbdp_recovery_pass').on('click', function (e) {
- e.preventDefault();
- $('#recover-pass-modal').slideToggle().show();
- });
-
- // Contact form [on modal closed]
- $('#atbdp-contact-modal').on('hidden.bs.modal', function (e) {
- $('#atbdp-contact-message').val('');
- $('#atbdp-contact-message-display').html('');
- });
-
- // Template Restructured
- // Modal
- var directoristModal = document.querySelector('.directorist-modal-js');
- $('body').on('click', '.directorist-btn-modal-js', function (e) {
- e.preventDefault();
- var data_target = $(this).attr('data-directorist_target');
- document.querySelector(".".concat(data_target)).classList.add('directorist-show');
- });
- $('body').on('click', '.directorist-modal-close-js', function (e) {
- e.preventDefault();
- $(this).closest('.directorist-modal-js').removeClass('directorist-show');
- });
- $(document).bind('click', function (e) {
- if (e.target == directoristModal) {
- directoristModal.classList.remove('directorist-show');
- }
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/select2-custom-control.js":
-/*!*******************************************************************!*\
+ /***/ function () {
+ var $ = jQuery;
+ $(document).ready(function () {
+ modalToggle();
+ });
+ function modalToggle() {
+ $('.atbdp_recovery_pass').on('click', function (e) {
+ e.preventDefault();
+ $('#recover-pass-modal').slideToggle().show();
+ });
+
+ // Contact form [on modal closed]
+ $('#atbdp-contact-modal').on(
+ 'hidden.bs.modal',
+ function (e) {
+ $('#atbdp-contact-message').val('');
+ $('#atbdp-contact-message-display').html('');
+ }
+ );
+
+ // Template Restructured
+ // Modal
+ var directoristModal = document.querySelector(
+ '.directorist-modal-js'
+ );
+ $('body').on(
+ 'click',
+ '.directorist-btn-modal-js',
+ function (e) {
+ e.preventDefault();
+ var data_target = $(this).attr(
+ 'data-directorist_target'
+ );
+ document
+ .querySelector('.'.concat(data_target))
+ .classList.add('directorist-show');
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-modal-close-js',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .closest('.directorist-modal-js')
+ .removeClass('directorist-show');
+ }
+ );
+ $(document).bind('click', function (e) {
+ if (e.target == directoristModal) {
+ directoristModal.classList.remove(
+ 'directorist-show'
+ );
+ }
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/select2-custom-control.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/global/components/select2-custom-control.js ***!
\*******************************************************************/
-/***/ (function() {
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-var $ = jQuery;
-window.addEventListener('load', waitAndInit);
-window.addEventListener('directorist-search-form-nav-tab-reloaded', waitAndInit);
-window.addEventListener('directorist-type-change', waitAndInit);
-window.addEventListener('directorist-instant-search-reloaded', waitAndInit);
-function waitAndInit() {
- setTimeout(init, 0);
-}
-
-// Initialize
-function init() {
- // Add custom dropdown toggle button
- selec2_add_custom_dropdown_toggle_button();
-
- // Add custom close button where needed
- selec2_add_custom_close_button_if_needed();
-
- // Add custom close button if field contains value on change
- $('.select2-hidden-accessible').on('change', function (e) {
- var value = $(this).children('option:selected').val();
- if (!value) {
- return;
- }
- selec2_add_custom_close_button($(this));
- var selectItems = this.parentElement.querySelectorAll('.select2-selection__choice');
- selectItems.forEach(function (item) {
- item.childNodes && item.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- item.title = modifiedString;
- }
- });
- });
- var customSelectItem = this.parentElement.querySelector('.select2-selection__rendered');
- customSelectItem.childNodes && customSelectItem.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- }
- });
- });
-}
-function selec2_add_custom_dropdown_toggle_button() {
- // Remove Default
- $('.select2-selection__arrow').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container('.select2-hidden-accessible');
- if (!addon_container) {
- return;
- }
- var dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
- if (!dropdown.length) {
- // Add Dropdown Toggle Button
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/chevron-down.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var dropdownHTML = "".concat(iconHTML, " ");
- addon_container.append(dropdownHTML);
- }
- var selec2_custom_dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
-
- // Toggle --is-open class
- $('.select2-hidden-accessible').on('select2:open', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.addClass('--is-open');
- });
- $('.select2-hidden-accessible').on('select2:close', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.removeClass('--is-open');
- var dropdownParent = $(this).closest('.directorist-search-field');
- var renderTitle = $(this).next().find('.select2-selection__rendered').attr('title');
-
- // Check if renderTitle is empty and remove the focus class if so
- if (!renderTitle) {
- dropdownParent.removeClass('input-is-focused');
- } else {
- dropdownParent.addClass('input-has-value');
- }
- });
-
- // Toggle Dropdown
- selec2_custom_dropdown.on('click', function (e) {
- var isOpen = $(this).hasClass('--is-open');
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- if (isOpen) {
- field.select2('close');
- } else {
- field.select2('open');
- }
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_add_custom_close_button_if_needed() {
- var select2_fields = $('.select2-hidden-accessible');
- if (!select2_fields && !select2_fields.length) {
- return;
- }
- var _iterator = _createForOfIteratorHelper(select2_fields),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var field = _step.value;
- var value = $(field).children('option:selected').val();
- if (!value) {
- continue;
- }
- selec2_add_custom_close_button(field);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-}
-function selec2_add_custom_close_button(field) {
- // Remove Default
- $('.select2-selection__clear').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove if already exists
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Add
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/times.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- addon_container.prepend("".concat(iconHTML, " "));
- var selec2_custom_close = addon_container.find('.directorist-select2-dropdown-close');
- selec2_custom_close.on('click', function (e) {
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- field.val(null).trigger('change');
- addon_container.find('.directorist-select2-dropdown-close').remove();
- selec2_adjust_space_for_addons();
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_remove_custom_close_button(field) {
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_get_addon_container(field) {
- var container = field ? $(field).next('.select2-container') : $('.select2-container');
- container = $(container).find('.directorist-select2-addons-area');
- if (!container.length) {
- $('.select2-container').append(' ');
- container = $('.select2-container').find('.directorist-select2-addons-area');
- }
- var container = field ? $(field).next('.select2-container') : null;
- if (!container) {
- return null;
- }
- var addonsArea = $(container).find('.directorist-select2-addons-area');
- if (!addonsArea.length) {
- container.append(' ');
- return container.find('.directorist-select2-addons-area');
- }
- return addonsArea;
-}
-function selec2_adjust_space_for_addons() {
- var container = $('.select2-container').find('.directorist-select2-addons-area');
- if (!container.length) {
- return;
- }
- var width = container.outerWidth();
- $('.select2-container').find('.select2-selection__rendered').css({
- 'padding-right': width + 'px'
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/setup-select2.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ var $ = jQuery;
+ window.addEventListener('load', waitAndInit);
+ window.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ waitAndInit
+ );
+ window.addEventListener('directorist-type-change', waitAndInit);
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ waitAndInit
+ );
+ function waitAndInit() {
+ setTimeout(init, 0);
+ }
+
+ // Initialize
+ function init() {
+ // Add custom dropdown toggle button
+ selec2_add_custom_dropdown_toggle_button();
+
+ // Add custom close button where needed
+ selec2_add_custom_close_button_if_needed();
+
+ // Add custom close button if field contains value on change
+ $('.select2-hidden-accessible').on('change', function (e) {
+ var value = $(this).children('option:selected').val();
+ if (!value) {
+ return;
+ }
+ selec2_add_custom_close_button($(this));
+ var selectItems = this.parentElement.querySelectorAll(
+ '.select2-selection__choice'
+ );
+ selectItems.forEach(function (item) {
+ item.childNodes &&
+ item.childNodes.forEach(function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ item.title = modifiedString;
+ }
+ });
+ });
+ var customSelectItem = this.parentElement.querySelector(
+ '.select2-selection__rendered'
+ );
+ customSelectItem.childNodes &&
+ customSelectItem.childNodes.forEach(
+ function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ }
+ }
+ );
+ });
+ }
+ function selec2_add_custom_dropdown_toggle_button() {
+ // Remove Default
+ $('.select2-selection__arrow').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(
+ '.select2-hidden-accessible'
+ );
+ if (!addon_container) {
+ return;
+ }
+ var dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+ if (!dropdown.length) {
+ // Add Dropdown Toggle Button
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/chevron-down.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ var dropdownHTML =
+ ''.concat(
+ iconHTML,
+ ' '
+ );
+ addon_container.append(dropdownHTML);
+ }
+ var selec2_custom_dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+
+ // Toggle --is-open class
+ $('.select2-hidden-accessible').on(
+ 'select2:open',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.addClass('--is-open');
+ }
+ );
+ $('.select2-hidden-accessible').on(
+ 'select2:close',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.removeClass('--is-open');
+ var dropdownParent = $(this).closest(
+ '.directorist-search-field'
+ );
+ var renderTitle = $(this)
+ .next()
+ .find('.select2-selection__rendered')
+ .attr('title');
+
+ // Check if renderTitle is empty and remove the focus class if so
+ if (!renderTitle) {
+ dropdownParent.removeClass('input-is-focused');
+ } else {
+ dropdownParent.addClass('input-has-value');
+ }
+ }
+ );
+
+ // Toggle Dropdown
+ selec2_custom_dropdown.on('click', function (e) {
+ var isOpen = $(this).hasClass('--is-open');
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ if (isOpen) {
+ field.select2('close');
+ } else {
+ field.select2('open');
+ }
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_add_custom_close_button_if_needed() {
+ var select2_fields = $('.select2-hidden-accessible');
+ if (!select2_fields && !select2_fields.length) {
+ return;
+ }
+ var _iterator = _createForOfIteratorHelper(select2_fields),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
+ var field = _step.value;
+ var value = $(field)
+ .children('option:selected')
+ .val();
+ if (!value) {
+ continue;
+ }
+ selec2_add_custom_close_button(field);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+ function selec2_add_custom_close_button(field) {
+ // Remove Default
+ $('.select2-selection__clear').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove if already exists
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Add
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/times.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ addon_container.prepend(
+ ''.concat(
+ iconHTML,
+ ' '
+ )
+ );
+ var selec2_custom_close = addon_container.find(
+ '.directorist-select2-dropdown-close'
+ );
+ selec2_custom_close.on('click', function (e) {
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ field.val(null).trigger('change');
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+ selec2_adjust_space_for_addons();
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_remove_custom_close_button(field) {
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_get_addon_container(field) {
+ var container = field
+ ? $(field).next('.select2-container')
+ : $('.select2-container');
+ container = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ $('.select2-container').append(
+ ' '
+ );
+ container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ var container = field
+ ? $(field).next('.select2-container')
+ : null;
+ if (!container) {
+ return null;
+ }
+ var addonsArea = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!addonsArea.length) {
+ container.append(
+ ' '
+ );
+ return container.find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ return addonsArea;
+ }
+ function selec2_adjust_space_for_addons() {
+ var container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ return;
+ }
+ var width = container.outerWidth();
+ $('.select2-container')
+ .find('.select2-selection__rendered')
+ .css({
+ 'padding-right': width + 'px',
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/setup-select2.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/global/components/setup-select2.js ***!
\**********************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_select2_custom_control__WEBPACK_IMPORTED_MODULE_2__);
-
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-var $ = jQuery;
-window.addEventListener('load', initSelect2);
-document.body.addEventListener('directorist-search-form-nav-tab-reloaded', initSelect2);
-document.body.addEventListener('directorist-reload-select2-fields', initSelect2);
-window.addEventListener('directorist-instant-search-reloaded', initSelect2);
-
-// Init Static Select 2 Fields
-function initSelect2() {
- var selectors = ['.directorist-select select', '#directorist-select-js',
- // Not found in any template
- '#directorist-search-category-js',
- // Not found in any template
- // '#directorist-select-st-s-js',
- // '#directorist-select-sn-s-js',
- // '#directorist-select-mn-e-js',
- // '#directorist-select-tu-e-js',
- // '#directorist-select-wd-s-js',
- // '#directorist-select-wd-e-js',
- // '#directorist-select-th-e-js',
- // '#directorist-select-fr-s-js',
- // '#directorist-select-fr-e-js',
- '.select-basic',
- // Not found in any template
- '#loc-type', '#cat-type', '#at_biz_dir-category', '.bdas-location-search',
- // Not found in any template
- '.bdas-category-search' // Not found in any template
- ];
- selectors.forEach(function (selector) {
- return (0,_lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(selector);
- });
- initMaybeLazyLoadedTaxonomySelect2();
-}
-
-// Init Select2 Ajax Fields
-function initMaybeLazyLoadedTaxonomySelect2() {
- var restBase = "".concat(directorist.rest_url, "directorist/v1");
- maybeLazyLoadCategories({
- selector: '.directorist-search-category select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadCategories({
- selector: '.directorist-form-categories-field select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-search-location select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-form-location-field select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadTags({
- selector: '.directorist-form-tag-field select',
- url: "".concat(restBase, "/listings/tags")
- });
-}
-function maybeLazyLoadCategories(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'categories'
- }), args));
-}
-function maybeLazyLoadLocations(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'locations'
- }), args));
-}
-function maybeLazyLoadTags(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'tags'
- }), args));
-}
-
-// maybeLazyLoadTaxonomyTermsSelect2
-function maybeLazyLoadTaxonomyTermsSelect2(args) {
- var defaults = {
- selector: '',
- url: '',
- taxonomy: 'tags'
- };
- args = _objectSpread(_objectSpread({}, defaults), args);
- if (!args.selector) {
- return;
- }
- var $el = $(args.selector);
- var $addListing = $el.closest('.directorist-add-listing-form');
- var canCreate = $el.data('allow_new');
- var maxLength = $el.data('max');
- var directoryId = 0;
- if (args.taxonomy !== 'tags') {
- var $searchForm = $el.closest('.directorist-search-form');
- var $archivePage = $el.closest('.directorist-archive-contents');
- var $directory = $addListing.find('input[name="directory_type"]');
- var $navListItem = null;
-
- // If search page
- if ($searchForm.length) {
- $navListItem = $searchForm.find('.directorist-listing-type-selection__link--current');
- }
- if ($archivePage.length) {
- $navListItem = $archivePage.find('.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link');
- }
- if ($navListItem && $navListItem.length) {
- directoryId = Number($navListItem.data('listing_type_id'));
- }
- if ($directory.length) {
- directoryId = $directory.val();
- }
- if (directoryId) {
- directoryId = Number(directoryId);
- }
- }
- var currentPage = 1;
- var select2Options = {
- allowClear: true,
- tags: canCreate,
- maximumSelectionLength: maxLength,
- width: '100%',
- escapeMarkup: function escapeMarkup(text) {
- return text;
- },
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
-
- // Fetch the data-icon attribute
- var iconURI = $(data.element).attr('data-icon');
-
- // Get the original text
- var originalText = data.text;
-
- // Match and count leading spaces
- var leadingSpaces = originalText.match(/^\s+/);
- var spaceCount = leadingSpaces ? leadingSpaces[0].length : 0;
-
- // Trim leading spaces from the original text
- originalText = originalText.trim();
-
- // Construct the icon element
- var iconElm = iconURI ? " ") : '';
-
- // Prepare the combined text (icon + text)
- var combinedText = iconElm + originalText;
-
- // Create the state container
- var $state = $('
');
-
- // Determine the level based on space count
- var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
- if (level > 1) {
- $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
- }
- $state.html(combinedText); // Set the combined content (icon + text)
-
- return $state;
- }
- };
- if (directorist.lazy_load_taxonomy_fields) {
- select2Options.ajax = {
- url: args.url,
- dataType: 'json',
- cache: true,
- delay: 250,
- data: function data(params) {
- currentPage = params.page || 1;
- var query = {
- page: currentPage,
- per_page: args.perPage,
- hide_empty: true
- };
-
- // Load empty terms on add listings.
- if ($addListing.length) {
- query.hide_empty = false;
- }
- if (params.term) {
- query.search = params.term;
- query.hide_empty = false;
- }
- if (directoryId) {
- query.directory = directoryId;
- }
- return query;
- },
- processResults: function processResults(data) {
- return {
- results: data.items,
- pagination: {
- more: data.paginationMore
- }
- };
- },
- transport: function transport(params, success, failure) {
- var $request = $.ajax(params);
- $request.then(function (data, textStatus, jqXHR) {
- var totalPage = Number(jqXHR.getResponseHeader('x-wp-totalpages'));
- var paginationMore = currentPage < totalPage;
- var items = data.map(function (item) {
- var text = item.name;
- if (!$addListing.length && params.data.search) {
- text = "".concat(item.name, " (").concat(item.count, ")");
- }
- return {
- id: item.id,
- text: text
- };
- });
- return {
- items: items,
- paginationMore: paginationMore
- };
- }).then(success);
- $request.fail(failure);
- return $request;
- }
- };
- }
- $el.length && $el.select2(select2Options);
- if (directorist.lazy_load_taxonomy_fields) {
- function setupSelectedItems($el, selectedId, selectedLabel) {
- if (!$el.length || !selectedId) {
- return;
- }
- var selectedIds = "".concat(selectedId).split(',');
- var selectedLabels = selectedLabel ? "".concat(selectedLabel).split(',') : [];
- selectedIds.forEach(function (id, index) {
- var label = selectedLabels.length >= index + 1 ? selectedLabels[index] : '';
- var option = new Option(label, id, true, true);
- $el.append(option);
- $el.trigger({
- type: 'select2:select',
- params: {
- data: {
- id: id,
- text: label
- }
- }
- });
- });
- }
- setupSelectedItems($el, $el.data('selected-id'), $el.data('selected-label'));
- }
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/tabs.js":
-/*!*************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__
+ );
+
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+
+ var $ = jQuery;
+ window.addEventListener('load', initSelect2);
+ document.body.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ initSelect2
+ );
+ document.body.addEventListener(
+ 'directorist-reload-select2-fields',
+ initSelect2
+ );
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ initSelect2
+ );
+
+ // Init Static Select 2 Fields
+ function initSelect2() {
+ var selectors = [
+ '.directorist-select select',
+ '#directorist-select-js',
+ // Not found in any template
+ '#directorist-search-category-js',
+ // Not found in any template
+ // '#directorist-select-st-s-js',
+ // '#directorist-select-sn-s-js',
+ // '#directorist-select-mn-e-js',
+ // '#directorist-select-tu-e-js',
+ // '#directorist-select-wd-s-js',
+ // '#directorist-select-wd-e-js',
+ // '#directorist-select-th-e-js',
+ // '#directorist-select-fr-s-js',
+ // '#directorist-select-fr-e-js',
+ '.select-basic',
+ // Not found in any template
+ '#loc-type',
+ '#cat-type',
+ '#at_biz_dir-category',
+ '.bdas-location-search',
+ // Not found in any template
+ '.bdas-category-search', // Not found in any template
+ ];
+ selectors.forEach(function (selector) {
+ return (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(
+ selector
+ );
+ });
+ initMaybeLazyLoadedTaxonomySelect2();
+ }
+
+ // Init Select2 Ajax Fields
+ function initMaybeLazyLoadedTaxonomySelect2() {
+ var restBase = ''.concat(
+ directorist.rest_url,
+ 'directorist/v1'
+ );
+ maybeLazyLoadCategories({
+ selector: '.directorist-search-category select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadCategories({
+ selector: '.directorist-form-categories-field select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-search-location select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-form-location-field select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadTags({
+ selector: '.directorist-form-tag-field select',
+ url: ''.concat(restBase, '/listings/tags'),
+ });
+ }
+ function maybeLazyLoadCategories(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'categories',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadLocations(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'locations',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadTags(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'tags',
+ }
+ ),
+ args
+ )
+ );
+ }
+
+ // maybeLazyLoadTaxonomyTermsSelect2
+ function maybeLazyLoadTaxonomyTermsSelect2(args) {
+ var defaults = {
+ selector: '',
+ url: '',
+ taxonomy: 'tags',
+ };
+ args = _objectSpread(_objectSpread({}, defaults), args);
+ if (!args.selector) {
+ return;
+ }
+ var $el = $(args.selector);
+ var $addListing = $el.closest(
+ '.directorist-add-listing-form'
+ );
+ var canCreate = $el.data('allow_new');
+ var maxLength = $el.data('max');
+ var directoryId = 0;
+ if (args.taxonomy !== 'tags') {
+ var $searchForm = $el.closest(
+ '.directorist-search-form'
+ );
+ var $archivePage = $el.closest(
+ '.directorist-archive-contents'
+ );
+ var $directory = $addListing.find(
+ 'input[name="directory_type"]'
+ );
+ var $navListItem = null;
+
+ // If search page
+ if ($searchForm.length) {
+ $navListItem = $searchForm.find(
+ '.directorist-listing-type-selection__link--current'
+ );
+ }
+ if ($archivePage.length) {
+ $navListItem = $archivePage.find(
+ '.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link'
+ );
+ }
+ if ($navListItem && $navListItem.length) {
+ directoryId = Number(
+ $navListItem.data('listing_type_id')
+ );
+ }
+ if ($directory.length) {
+ directoryId = $directory.val();
+ }
+ if (directoryId) {
+ directoryId = Number(directoryId);
+ }
+ }
+ var currentPage = 1;
+ var select2Options = {
+ allowClear: true,
+ tags: canCreate,
+ maximumSelectionLength: maxLength,
+ width: '100%',
+ escapeMarkup: function escapeMarkup(text) {
+ return text;
+ },
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+
+ // Fetch the data-icon attribute
+ var iconURI = $(data.element).attr('data-icon');
+
+ // Get the original text
+ var originalText = data.text;
+
+ // Match and count leading spaces
+ var leadingSpaces = originalText.match(/^\s+/);
+ var spaceCount = leadingSpaces
+ ? leadingSpaces[0].length
+ : 0;
+
+ // Trim leading spaces from the original text
+ originalText = originalText.trim();
+
+ // Construct the icon element
+ var iconElm = iconURI
+ ? ' '
+ )
+ : '';
+
+ // Prepare the combined text (icon + text)
+ var combinedText = iconElm + originalText;
+
+ // Create the state container
+ var $state = $(
+ '
'
+ );
+
+ // Determine the level based on space count
+ var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
+ if (level > 1) {
+ $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
+ }
+ $state.html(combinedText); // Set the combined content (icon + text)
+
+ return $state;
+ },
+ };
+ if (directorist.lazy_load_taxonomy_fields) {
+ select2Options.ajax = {
+ url: args.url,
+ dataType: 'json',
+ cache: true,
+ delay: 250,
+ data: function data(params) {
+ currentPage = params.page || 1;
+ var query = {
+ page: currentPage,
+ per_page: args.perPage,
+ hide_empty: true,
+ };
+
+ // Load empty terms on add listings.
+ if ($addListing.length) {
+ query.hide_empty = false;
+ }
+ if (params.term) {
+ query.search = params.term;
+ query.hide_empty = false;
+ }
+ if (directoryId) {
+ query.directory = directoryId;
+ }
+ return query;
+ },
+ processResults: function processResults(data) {
+ return {
+ results: data.items,
+ pagination: {
+ more: data.paginationMore,
+ },
+ };
+ },
+ transport: function transport(
+ params,
+ success,
+ failure
+ ) {
+ var $request = $.ajax(params);
+ $request
+ .then(function (data, textStatus, jqXHR) {
+ var totalPage = Number(
+ jqXHR.getResponseHeader(
+ 'x-wp-totalpages'
+ )
+ );
+ var paginationMore =
+ currentPage < totalPage;
+ var items = data.map(function (item) {
+ var text = item.name;
+ if (
+ !$addListing.length &&
+ params.data.search
+ ) {
+ text = ''
+ .concat(item.name, ' (')
+ .concat(item.count, ')');
+ }
+ return {
+ id: item.id,
+ text: text,
+ };
+ });
+ return {
+ items: items,
+ paginationMore: paginationMore,
+ };
+ })
+ .then(success);
+ $request.fail(failure);
+ return $request;
+ },
+ };
+ }
+ $el.length && $el.select2(select2Options);
+ if (directorist.lazy_load_taxonomy_fields) {
+ function setupSelectedItems(
+ $el,
+ selectedId,
+ selectedLabel
+ ) {
+ if (!$el.length || !selectedId) {
+ return;
+ }
+ var selectedIds = ''.concat(selectedId).split(',');
+ var selectedLabels = selectedLabel
+ ? ''.concat(selectedLabel).split(',')
+ : [];
+ selectedIds.forEach(function (id, index) {
+ var label =
+ selectedLabels.length >= index + 1
+ ? selectedLabels[index]
+ : '';
+ var option = new Option(label, id, true, true);
+ $el.append(option);
+ $el.trigger({
+ type: 'select2:select',
+ params: {
+ data: {
+ id: id,
+ text: label,
+ },
+ },
+ });
+ });
+ }
+ setupSelectedItems(
+ $el,
+ $el.data('selected-id'),
+ $el.data('selected-label')
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/tabs.js':
+ /*!*************************************************!*\
!*** ./assets/src/js/global/components/tabs.js ***!
\*************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
-
-document.addEventListener('load', init, false);
-function Tasks() {
- return {
- init: function init() {
- this.initToggleTabLinks();
- },
- initToggleTabLinks: function initToggleTabLinks() {
- var links = document.querySelectorAll('.directorist-toggle-tab');
- if (!links) {
- return;
- }
- var self = this;
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(links).forEach(function (item) {
- item.addEventListener('click', function (event) {
- self.handleToggleTabLinksEvent(item, event);
- });
- });
- },
- handleToggleTabLinksEvent: function handleToggleTabLinksEvent(item, event) {
- event.preventDefault();
- var navContainerClass = item.getAttribute('data-nav-container');
- var tabContainerClass = item.getAttribute('data-tab-container');
- var tabClass = item.getAttribute('data-tab');
- if (!navContainerClass || !tabContainerClass || !tabClass) {
- return;
- }
- var navContainer = item.closest('.' + navContainerClass);
- var tabContainer = document.querySelector('.' + tabContainerClass);
- if (!navContainer || !tabContainer) {
- return;
- }
- var tab = tabContainer.querySelector('.' + tabClass);
- if (!tab) {
- return;
- }
-
- // Remove Active Class
- var removeActiveClass = function removeActiveClass(item) {
- item.classList.remove('--is-active');
- };
-
- // Toggle Nav
- var activeNavItems = navContainer.querySelectorAll('.--is-active');
- if (activeNavItems) {
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(activeNavItems).forEach(removeActiveClass);
- }
- item.classList.add('--is-active');
-
- // Toggle Tab
- var activeTabItems = tabContainer.querySelectorAll('.--is-active');
- if (activeTabItems) {
- (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(activeTabItems).forEach(removeActiveClass);
- }
- tab.classList.add('--is-active');
-
- // Update Query Var
- var queryVarKey = item.getAttribute('data-query-var-key');
- var queryVarValue = item.getAttribute('data-query-var-value');
- if (!queryVarKey || !queryVarValue) {
- return;
- }
- this.addQueryParam(queryVarKey, queryVarValue);
- },
- addQueryParam: function addQueryParam(key, value) {
- var url = new URL(window.location.href);
- url.searchParams.set(key, value);
- window.history.pushState({}, '', url.toString());
- }
- };
-}
-function init() {
- var tasks = new Tasks();
- tasks.init();
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/utility.js":
-/*!****************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/toConsumableArray */ './node_modules/@babel/runtime/helpers/esm/toConsumableArray.js'
+ );
+
+ document.addEventListener('load', init, false);
+ function Tasks() {
+ return {
+ init: function init() {
+ this.initToggleTabLinks();
+ },
+ initToggleTabLinks: function initToggleTabLinks() {
+ var links = document.querySelectorAll(
+ '.directorist-toggle-tab'
+ );
+ if (!links) {
+ return;
+ }
+ var self = this;
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(links).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (event) {
+ self.handleToggleTabLinksEvent(
+ item,
+ event
+ );
+ }
+ );
+ });
+ },
+ handleToggleTabLinksEvent:
+ function handleToggleTabLinksEvent(item, event) {
+ event.preventDefault();
+ var navContainerClass =
+ item.getAttribute('data-nav-container');
+ var tabContainerClass =
+ item.getAttribute('data-tab-container');
+ var tabClass = item.getAttribute('data-tab');
+ if (
+ !navContainerClass ||
+ !tabContainerClass ||
+ !tabClass
+ ) {
+ return;
+ }
+ var navContainer = item.closest(
+ '.' + navContainerClass
+ );
+ var tabContainer = document.querySelector(
+ '.' + tabContainerClass
+ );
+ if (!navContainer || !tabContainer) {
+ return;
+ }
+ var tab = tabContainer.querySelector(
+ '.' + tabClass
+ );
+ if (!tab) {
+ return;
+ }
+
+ // Remove Active Class
+ var removeActiveClass =
+ function removeActiveClass(item) {
+ item.classList.remove('--is-active');
+ };
+
+ // Toggle Nav
+ var activeNavItems =
+ navContainer.querySelectorAll(
+ '.--is-active'
+ );
+ if (activeNavItems) {
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(activeNavItems).forEach(
+ removeActiveClass
+ );
+ }
+ item.classList.add('--is-active');
+
+ // Toggle Tab
+ var activeTabItems =
+ tabContainer.querySelectorAll(
+ '.--is-active'
+ );
+ if (activeTabItems) {
+ (0,
+ _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(activeTabItems).forEach(
+ removeActiveClass
+ );
+ }
+ tab.classList.add('--is-active');
+
+ // Update Query Var
+ var queryVarKey =
+ item.getAttribute('data-query-var-key');
+ var queryVarValue = item.getAttribute(
+ 'data-query-var-value'
+ );
+ if (!queryVarKey || !queryVarValue) {
+ return;
+ }
+ this.addQueryParam(queryVarKey, queryVarValue);
+ },
+ addQueryParam: function addQueryParam(key, value) {
+ var url = new URL(window.location.href);
+ url.searchParams.set(key, value);
+ window.history.pushState({}, '', url.toString());
+ },
+ };
+ }
+ function init() {
+ var tasks = new Tasks();
+ tasks.init();
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/utility.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/global/components/utility.js ***!
\****************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- var $ = jQuery;
- document.querySelectorAll('.la-icon i').forEach(function (item) {
- className.push(item.getAttribute('class'));
- });
-
- // Handle Disabled Link Action
- $('.atbdp-disabled').on('click', function (e) {
- e.preventDefault();
- });
-
- // Toggle Modal
- $('.cptm-modal-toggle').on('click', function (e) {
- e.preventDefault();
- var target_class = $(this).data('target');
- $('.' + target_class).toggleClass('active');
- });
-
- // Change label on file select/change
- $('.cptm-file-field').on('change', function (e) {
- var target_id = $(this).attr('id');
- $('label[for=' + target_id + ']').text('Change');
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/global/global.js":
-/*!****************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ var $ = jQuery;
+ document
+ .querySelectorAll('.la-icon i')
+ .forEach(function (item) {
+ className.push(item.getAttribute('class'));
+ });
+
+ // Handle Disabled Link Action
+ $('.atbdp-disabled').on('click', function (e) {
+ e.preventDefault();
+ });
+
+ // Toggle Modal
+ $('.cptm-modal-toggle').on('click', function (e) {
+ e.preventDefault();
+ var target_class = $(this).data('target');
+ $('.' + target_class).toggleClass('active');
+ });
+
+ // Change label on file select/change
+ $('.cptm-file-field').on('change', function (e) {
+ var target_id = $(this).attr('id');
+ $('label[for=' + target_id + ']').text('Change');
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/global.js':
+ /*!****************************************!*\
!*** ./assets/src/js/global/global.js ***!
\****************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/modal */ "./assets/src/js/global/components/modal.js");
-/* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_modal__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__);
-/* harmony import */ var _components_setup_select2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/setup-select2 */ "./assets/src/js/global/components/setup-select2.js");
-/* harmony import */ var _components_tabs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/tabs */ "./assets/src/js/global/components/tabs.js");
-/* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/utility */ "./assets/src/js/global/components/utility.js");
-/* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_components_utility__WEBPACK_IMPORTED_MODULE_4__);
-
-
-
-
-
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./components/modal */ './assets/src/js/global/components/modal.js'
+ );
+ /* harmony import */ var _components_modal__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_modal__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./components/select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_select2_custom_control__WEBPACK_IMPORTED_MODULE_1__
+ );
+ /* harmony import */ var _components_setup_select2__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./components/setup-select2 */ './assets/src/js/global/components/setup-select2.js'
+ );
+ /* harmony import */ var _components_tabs__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./components/tabs */ './assets/src/js/global/components/tabs.js'
+ );
+ /* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ./components/utility */ './assets/src/js/global/components/utility.js'
+ );
+ /* harmony import */ var _components_utility__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_utility__WEBPACK_IMPORTED_MODULE_4__
+ );
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = " ");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ }),
-
-/***/ "./assets/src/scss/layout/public/main-style.scss":
-/*!*******************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ ' '
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ ''.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/scss/layout/public/main-style.scss':
+ /*!*******************************************************!*\
!*** ./assets/src/scss/layout/public/main-style.scss ***!
\*******************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":
-/*!*********************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ // extracted by mini-css-extract-plugin
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js':
+ /*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; }
-/* harmony export */ });
-function _arrayLikeToArray(r, a) {
- (null == a || a > r.length) && (a = r.length);
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
- return n;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayLikeToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayWithoutHoles; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _arrayWithoutHoles(r) {
- if (Array.isArray(r)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayWithoutHoles;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _arrayWithoutHoles(r) {
+ if (Array.isArray(r))
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/defineProperty.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _defineProperty; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperty(e, r, t) {
- return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js":
-/*!********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _defineProperty;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperty(e, r, t) {
+ return (
+ (r = (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r)) in e
+ ? Object.defineProperty(e, r, {
+ value: t,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0,
+ })
+ : (e[r] = t),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/iterableToArray.js':
+ /*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***!
\********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _iterableToArray; }
-/* harmony export */ });
-function _iterableToArray(r) {
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _iterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _iterableToArray(r) {
+ if (
+ ('undefined' != typeof Symbol &&
+ null != r[Symbol.iterator]) ||
+ null != r['@@iterator']
+ )
+ return Array.from(r);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _nonIterableSpread; }
-/* harmony export */ });
-function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js":
-/*!**********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _nonIterableSpread;
+ },
+ /* harmony export */
+ }
+ );
+ function _nonIterableSpread() {
+ throw new TypeError(
+ 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toConsumableArray.js':
+ /*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***!
\**********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _toConsumableArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js");
-/* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js");
-/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
-/* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js");
-
-
-
-
-function _toConsumableArray(r) {
- return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__["default"])();
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _toConsumableArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayWithoutHoles.js */ './node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js'
+ );
+ /* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./iterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/iterableToArray.js'
+ );
+ /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./unsupportedIterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js'
+ );
+ /* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./nonIterableSpread.js */ './node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js'
+ );
+
+ function _toConsumableArray(r) {
+ return (
+ (0,
+ _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r) ||
+ (0,
+ _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(r) ||
+ (0,
+ _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(r) ||
+ (0,
+ _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])()
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPrimitive; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-function toPrimitive(t, r) {
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPrimitive;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ function toPrimitive(t, r) {
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ t
+ ) ||
+ !t
+ )
+ return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || 'default');
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ )
+ return i;
+ throw new TypeError(
+ '@@toPrimitive must return a primitive value.'
+ );
+ }
+ return ('string' === r ? String : Number)(t);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPropertyKey; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");
-
-
-function toPropertyKey(t) {
- var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string");
- return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + "";
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPropertyKey;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./toPrimitive.js */ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js'
+ );
+
+ function toPropertyKey(t) {
+ var i = (0,
+ _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__['default'])(
+ t,
+ 'string'
+ );
+ return 'symbol' ==
+ (0, _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ ? i
+ : i + '';
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":
-/*!*******************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js':
+ /*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _unsupportedIterableToArray(r, a) {
- if (r) {
- if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a);
- var t = {}.toString.call(r).slice(8, -1);
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0;
- }
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!**************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _unsupportedIterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a)
+ : void 0
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!**************************************!*\
!*** ./assets/src/js/public/main.js ***!
\**************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _scss_layout_public_main_style_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../scss/layout/public/main-style.scss */ "./assets/src/scss/layout/public/main-style.scss");
-/* harmony import */ var _global_global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../global/global */ "./assets/src/js/global/global.js");
-/*
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _scss_layout_public_main_style_scss__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./../../scss/layout/public/main-style.scss */ './assets/src/scss/layout/public/main-style.scss'
+ );
+ /* harmony import */ var _global_global__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../global/global */ './assets/src/js/global/global.js'
+ );
+ /*
File: Main.js
Plugin: Directorist – Business Directory & Classified Listings WordPress Plugin
Author: wpWax
Author URI: www.wpwax.com
*/
-// console.log( directorist_options )
-// Styles
-
-
-
-// Single Listing Page
-// import './components/single-listing-page/slider';
-
-// General Components
-// import './components/general';
-// import './components/helpers';
-// import './components/review';
-// import './components/directoristSorting';
-// import './components/directoristAlert';
-// import './components/pureScriptTab';
-// import './components/profileForm';
-// import './components/gridResponsive';
-// import './components/formValidation';
-// import './components/directoristFavorite';
-// import './components/login';
-// import './components/tab';
-// import './components/directoristDropdown';
-// import './components/directoristSelect';
-// import './components/categoryLocation';
-// import './components/legacy-support';
-// import './components/author';
-
-// Booking
-// import './components/booking';
-}();
-/******/ })()
-;
-//# sourceMappingURL=public-main.js.map
\ No newline at end of file
+ // console.log( directorist_options )
+ // Styles
+
+ // Single Listing Page
+ // import './components/single-listing-page/slider';
+
+ // General Components
+ // import './components/general';
+ // import './components/helpers';
+ // import './components/review';
+ // import './components/directoristSorting';
+ // import './components/directoristAlert';
+ // import './components/pureScriptTab';
+ // import './components/profileForm';
+ // import './components/gridResponsive';
+ // import './components/formValidation';
+ // import './components/directoristFavorite';
+ // import './components/login';
+ // import './components/tab';
+ // import './components/directoristDropdown';
+ // import './components/directoristSelect';
+ // import './components/categoryLocation';
+ // import './components/legacy-support';
+ // import './components/author';
+
+ // Booking
+ // import './components/booking';
+ })();
+ /******/
+})();
+//# sourceMappingURL=public-main.js.map
diff --git a/assets/js/range-slider.js b/assets/js/range-slider.js
index 3f818adfe..7e523593d 100644
--- a/assets/js/range-slider.js
+++ b/assets/js/range-slider.js
@@ -1,563 +1,726 @@
-/******/ (function() { // webpackBootstrap
-/******/ "use strict";
-/******/ var __webpack_modules__ = ({
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ 'use strict';
+ /******/ var __webpack_modules__ = {
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
-/***/ })
+ /***/
+ },
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/amd options */
-/******/ !function() {
-/******/ __webpack_require__.amdO = {};
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
-!function() {
-/*!**********************************************!*\
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/amd options */
+ /******/ !(function () {
+ /******/ __webpack_require__.amdO = {};
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
+ !(function () {
+ /*!**********************************************!*\
!*** ./assets/src/js/public/range-slider.js ***!
\**********************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/typeof */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
-// Directorist Custom Range Slider with Multiple Handlers
-(function (global, factory) {
- if ((typeof exports === "undefined" ? "undefined" : (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(exports)) === 'object' && "object" !== 'undefined') {
- factory(exports);
- } else if (typeof define === 'function' && __webpack_require__.amdO) {
- define(['exports'], factory);
- } else {
- global = typeof globalThis !== 'undefined' ? globalThis : global || self;
- factory(global.directoristCustomRangeSlider = {});
- }
-})(undefined, function (exports) {
- 'use strict';
+ // Directorist Custom Range Slider with Multiple Handlers
+ (function (global, factory) {
+ if (
+ (typeof exports === 'undefined'
+ ? 'undefined'
+ : (0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(exports)) === 'object' &&
+ 'object' !== 'undefined'
+ ) {
+ factory(exports);
+ } else if (
+ typeof define === 'function' &&
+ __webpack_require__.amdO
+ ) {
+ define(['exports'], factory);
+ } else {
+ global =
+ typeof globalThis !== 'undefined'
+ ? globalThis
+ : global || self;
+ factory((global.directoristCustomRangeSlider = {}));
+ }
+ })(undefined, function (exports) {
+ 'use strict';
- exports.PipsMode = {
- Range: 'range',
- Steps: 'steps',
- Positions: 'positions',
- Count: 'count',
- Values: 'values'
- };
- exports.PipsType = {
- None: -1,
- NoValue: 0,
- LargeValue: 1,
- SmallValue: 2
- };
+ exports.PipsMode = {
+ Range: 'range',
+ Steps: 'steps',
+ Positions: 'positions',
+ Count: 'count',
+ Values: 'values',
+ };
+ exports.PipsType = {
+ None: -1,
+ NoValue: 0,
+ LargeValue: 1,
+ SmallValue: 2,
+ };
- //RTL
- var isRTL = directorist.rtl === 'true';
- var direction;
- if (isRTL) {
- direction = 'right';
- } else {
- direction = 'left';
- }
- function isValidFormatter(entry) {
- return isValidPartialFormatter(entry) && typeof entry.from === 'function';
- }
- function isValidPartialFormatter(entry) {
- // partial formatters only need a to function and not a from function
- return (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(entry) === 'object' && typeof entry.to === 'function';
- }
- function removeElement(el) {
- el.parentElement.removeChild(el);
- }
- function isSet(value) {
- return value !== null && value !== undefined;
- }
- // Bindable version
- function preventDefault(e) {
- e.preventDefault();
- }
- // Removes duplicates from an array.
- function unique(array) {
- return array.filter(function (a) {
- return !this[a] ? this[a] = true : false;
- }, {});
- }
- // Round a value to the closest 'to'.
- function closest(value, to) {
- return Math.round(value / to) * to;
- }
- // Current position of an element relative to the document.
- function offset(elem, orientation) {
- var rect = elem.getBoundingClientRect();
- var doc = elem.ownerDocument;
- var docElem = doc.documentElement;
- var pageOffset = getPageOffset(doc);
- // getBoundingClientRect contains left scroll in Chrome on Android.
- // I haven't found a feature detection that proves this. Worst case
- // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.
- if (/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)) {
- pageOffset.x = 0;
- }
- return orientation ? rect.top + pageOffset.y - docElem.clientTop : rect.left + pageOffset.x - docElem.clientLeft;
- }
- // Checks whether a value is numerical.
- function isNumeric(a) {
- return typeof a === 'number' && !isNaN(a) && isFinite(a);
- }
- // Sets a class and removes it after [duration] ms.
- function addClassFor(element, className, duration) {
- if (duration > 0) {
- addClass(element, className);
- setTimeout(function () {
- removeClass(element, className);
- }, duration);
- }
- }
- // Limits a value to 0 - 100
- function limit(a) {
- return Math.max(Math.min(a, 100), 0);
- }
- // Wraps a variable as an array, if it isn't one yet.
- // Note that an input array is returned by reference!
- function asArray(a) {
- return Array.isArray(a) ? a : [a];
- }
- // Counts decimals
- function countDecimals(numStr) {
- numStr = String(numStr);
- var pieces = numStr.split('.');
- return pieces.length > 1 ? pieces[1].length : 0;
- }
- // add_class
- function addClass(el, className) {
- if (el.classList && !/\s/.test(className)) {
- el.classList.add(className);
- } else {
- el.className += ' ' + className;
- }
- }
- // remove_class
- function removeClass(el, className) {
- if (el.classList && !/\s/.test(className)) {
- el.classList.remove(className);
- } else {
- el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
- }
- }
- // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/
- function hasClass(el, className) {
- return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className);
- }
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes
- function getPageOffset(doc) {
- var supportPageOffset = window.scrollX !== undefined;
- var isCSS1Compat = (doc.compatMode || '') === 'CSS1Compat';
- var x = supportPageOffset ? window.scrollX : isCSS1Compat ? doc.documentElement.scrollLeft : doc.body.scrollLeft;
- var y = supportPageOffset ? window.scrollY : isCSS1Compat ? doc.documentElement.scrollTop : doc.body.scrollTop;
- return {
- x: x,
- y: y
- };
- }
- // we provide a function to compute constants instead
- // of accessing window.* as soon as the module needs it
- // so that we do not compute anything if not needed
- function getActions() {
- // Determine the events to bind. IE11 implements pointerEvents without
- // a prefix, which breaks compatibility with the IE10 implementation.
- return window.navigator.pointerEnabled ? {
- start: 'pointerdown',
- move: 'pointermove',
- end: 'pointerup'
- } : window.navigator.msPointerEnabled ? {
- start: 'MSPointerDown',
- move: 'MSPointerMove',
- end: 'MSPointerUp'
- } : {
- start: 'mousedown touchstart',
- move: 'mousemove touchmove',
- end: 'mouseup touchend'
- };
- }
- // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
- // Issue #785
- function getSupportsPassive() {
- var supportsPassive = false;
- /* eslint-disable */
- try {
- var opts = Object.defineProperty({}, 'passive', {
- get: function get() {
- supportsPassive = true;
- }
- });
- // @ts-ignore
- window.addEventListener('test', null, opts);
- } catch (e) {}
- /* eslint-enable */
- return supportsPassive;
- }
- function getSupportsTouchActionNone() {
- return window.CSS && CSS.supports && CSS.supports('touch-action', 'none');
- }
- //endregion
- //region Range Calculation
- // Determine the size of a sub-range in relation to a full range.
- function subRangeRatio(pa, pb) {
- return 100 / (pb - pa);
- }
- // (percentage) How many percent is this value of this range?
- function fromPercentage(range, value, startRange) {
- return value * 100 / (range[startRange + 1] - range[startRange]);
- }
- // (percentage) Where is this value on this range?
- function toPercentage(range, value) {
- return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0], 0);
- }
- // (value) How much is this percentage on this range?
- function isPercentage(range, value) {
- return value * (range[1] - range[0]) / 100 + range[0];
- }
- function getJ(value, arr) {
- var j = 1;
- while (value >= arr[j]) {
- j += 1;
- }
- return j;
- }
- // (percentage) Input a value, find where, on a scale of 0-100, it applies.
- function toStepping(xVal, xPct, value) {
- if (value >= xVal.slice(-1)[0]) {
- return 100;
- }
- var j = getJ(value, xVal);
- var va = xVal[j - 1];
- var vb = xVal[j];
- var pa = xPct[j - 1];
- var pb = xPct[j];
- return pa + toPercentage([va, vb], value) / subRangeRatio(pa, pb);
- }
- // (value) Input a percentage, find where it is on the specified range.
- function fromStepping(xVal, xPct, value) {
- // There is no range group that fits 100
- if (value >= 100) {
- return xVal.slice(-1)[0];
- }
- var j = getJ(value, xPct);
- var va = xVal[j - 1];
- var vb = xVal[j];
- var pa = xPct[j - 1];
- var pb = xPct[j];
- return isPercentage([va, vb], (value - pa) * subRangeRatio(pa, pb));
- }
- // (percentage) Get the step that applies at a certain value.
- function getStep(xPct, xSteps, snap, value) {
- if (value === 100) {
- return value;
- }
- var j = getJ(value, xPct);
- var a = xPct[j - 1];
- var b = xPct[j];
- // If 'snap' is set, steps are used as fixed points on the slider.
- if (snap) {
- // Find the closest position, a or b.
- if (value - a > (b - a) / 2) {
- return b;
- }
- return a;
- }
- if (!xSteps[j - 1]) {
- return value;
- }
- return xPct[j - 1] + closest(value - xPct[j - 1], xSteps[j - 1]);
- }
- //endregion
- //region Spectrum
- var Spectrum = /** @class */function () {
- function Spectrum(entry, snap, singleStep) {
- this.xPct = [];
- this.xVal = [];
- this.xSteps = [];
- this.xNumSteps = [];
- this.xHighestCompleteStep = [];
- this.xSteps = [singleStep || false];
- this.xNumSteps = [false];
- this.snap = snap;
- var index;
- var ordered = [];
- // Map the object keys to an array.
- Object.keys(entry).forEach(function (index) {
- ordered.push([asArray(entry[index]), index]);
- });
- // Sort all entries by value (numeric sort).
- ordered.sort(function (a, b) {
- return a[0][0] - b[0][0];
- });
- // Convert all entries to subranges.
- for (index = 0; index < ordered.length; index++) {
- this.handleEntryPoint(ordered[index][1], ordered[index][0]);
- }
- // Store the actual step values.
- // xSteps is sorted in the same order as xPct and xVal.
- this.xNumSteps = this.xSteps.slice(0);
- // Convert all numeric steps to the percentage of the subrange they represent.
- for (index = 0; index < this.xNumSteps.length; index++) {
- this.handleStepPoint(index, this.xNumSteps[index]);
- }
- }
- Spectrum.prototype.getDistance = function (value) {
- var distances = [];
- for (var index = 0; index < this.xNumSteps.length - 1; index++) {
- distances[index] = fromPercentage(this.xVal, value, index);
- }
- return distances;
- };
- // Calculate the percentual distance over the whole scale of ranges.
- // direction: 0 = backwards / 1 = forwards
- Spectrum.prototype.getAbsoluteDistance = function (value, distances, direction) {
- var xPct_index = 0;
- // Calculate range where to start calculation
- if (value < this.xPct[this.xPct.length - 1]) {
- while (value > this.xPct[xPct_index + 1]) {
- xPct_index++;
- }
- } else if (value === this.xPct[this.xPct.length - 1]) {
- xPct_index = this.xPct.length - 2;
- }
- // If looking backwards and the value is exactly at a range separator then look one range further
- if (!direction && value === this.xPct[xPct_index + 1]) {
- xPct_index++;
- }
- if (distances === null) {
- distances = [];
- }
- var start_factor;
- var rest_factor = 1;
- var rest_rel_distance = distances[xPct_index];
- var range_pct = 0;
- var rel_range_distance = 0;
- var abs_distance_counter = 0;
- var range_counter = 0;
- // Calculate what part of the start range the value is
- if (direction) {
- start_factor = (value - this.xPct[xPct_index]) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
- } else {
- start_factor = (this.xPct[xPct_index + 1] - value) / (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
- }
- // Do until the complete distance across ranges is calculated
- while (rest_rel_distance > 0) {
- // Calculate the percentage of total range
- range_pct = this.xPct[xPct_index + 1 + range_counter] - this.xPct[xPct_index + range_counter];
- // Detect if the margin, padding or limit is larger then the current range and calculate
- if (distances[xPct_index + range_counter] * rest_factor + 100 - start_factor * 100 > 100) {
- // If larger then take the percentual distance of the whole range
- rel_range_distance = range_pct * start_factor;
- // Rest factor of relative percentual distance still to be calculated
- rest_factor = (rest_rel_distance - 100 * start_factor) / distances[xPct_index + range_counter];
- // Set start factor to 1 as for next range it does not apply.
- start_factor = 1;
- } else {
- // If smaller or equal then take the percentual distance of the calculate percentual part of that range
- rel_range_distance = distances[xPct_index + range_counter] * range_pct / 100 * rest_factor;
- // No rest left as the rest fits in current range
- rest_factor = 0;
- }
- if (direction) {
- abs_distance_counter = abs_distance_counter - rel_range_distance;
- // Limit range to first range when distance becomes outside of minimum range
- if (this.xPct.length + range_counter >= 1) {
- range_counter--;
- }
- } else {
- abs_distance_counter = abs_distance_counter + rel_range_distance;
- // Limit range to last range when distance becomes outside of maximum range
- if (this.xPct.length - range_counter >= 1) {
- range_counter++;
- }
- }
- // Rest of relative percentual distance still to be calculated
- rest_rel_distance = distances[xPct_index + range_counter] * rest_factor;
- }
- return value + abs_distance_counter;
- };
- Spectrum.prototype.toStepping = function (value) {
- value = toStepping(this.xVal, this.xPct, value);
- return value;
- };
- Spectrum.prototype.fromStepping = function (value) {
- return fromStepping(this.xVal, this.xPct, value);
- };
- Spectrum.prototype.getStep = function (value) {
- value = getStep(this.xPct, this.xSteps, this.snap, value);
- return value;
- };
- Spectrum.prototype.getDefaultStep = function (value, isDown, size) {
- var j = getJ(value, this.xPct);
- // When at the top or stepping down, look at the previous sub-range
- if (value === 100 || isDown && value === this.xPct[j - 1]) {
- j = Math.max(j - 1, 1);
- }
- return (this.xVal[j] - this.xVal[j - 1]) / size;
- };
- Spectrum.prototype.getNearbySteps = function (value) {
- var j = getJ(value, this.xPct);
- return {
- stepBefore: {
- startValue: this.xVal[j - 2],
- step: this.xNumSteps[j - 2],
- highestStep: this.xHighestCompleteStep[j - 2]
- },
- thisStep: {
- startValue: this.xVal[j - 1],
- step: this.xNumSteps[j - 1],
- highestStep: this.xHighestCompleteStep[j - 1]
- },
- stepAfter: {
- startValue: this.xVal[j],
- step: this.xNumSteps[j],
- highestStep: this.xHighestCompleteStep[j]
- }
- };
- };
- Spectrum.prototype.countStepDecimals = function () {
- var stepDecimals = this.xNumSteps.map(countDecimals);
- return Math.max.apply(null, stepDecimals);
- };
- Spectrum.prototype.hasNoSize = function () {
- return this.xVal[0] === this.xVal[this.xVal.length - 1];
- };
- // Outside testing
- Spectrum.prototype.convert = function (value) {
- return this.getStep(this.toStepping(value));
- };
- Spectrum.prototype.handleEntryPoint = function (index, value) {
- var percentage;
- // Covert min/max syntax to 0 and 100.
- if (index === 'min') {
- percentage = 0;
- } else if (index === 'max') {
- percentage = 100;
- } else {
- percentage = parseFloat(index);
- }
- // Check for correct input.
- if (!isNumeric(percentage) || !isNumeric(value[0])) {
- throw new Error("directoristCustomRangeSlider: 'range' value isn't numeric.");
- }
- // Store values.
- this.xPct.push(percentage);
- this.xVal.push(value[0]);
- var value1 = Number(value[1]);
- // NaN will evaluate to false too, but to keep
- // logging clear, set step explicitly. Make sure
- // not to override the 'step' setting with false.
- if (!percentage) {
- if (!isNaN(value1)) {
- this.xSteps[0] = value1;
- }
- } else {
- this.xSteps.push(isNaN(value1) ? false : value1);
- }
- this.xHighestCompleteStep.push(0);
- };
- Spectrum.prototype.handleStepPoint = function (i, n) {
- // Ignore 'false' stepping.
- if (!n) {
- return;
- }
- // Step over zero-length ranges (#948);
- if (this.xVal[i] === this.xVal[i + 1]) {
- this.xSteps[i] = this.xHighestCompleteStep[i] = this.xVal[i];
- return;
- }
- // Factor to range ratio
- this.xSteps[i] = fromPercentage([this.xVal[i], this.xVal[i + 1]], n, 0) / subRangeRatio(this.xPct[i], this.xPct[i + 1]);
- var totalSteps = (this.xVal[i + 1] - this.xVal[i]) / this.xNumSteps[i];
- var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1);
- var step = this.xVal[i] + this.xNumSteps[i] * highestStep;
- this.xHighestCompleteStep[i] = step;
- };
- return Spectrum;
- }();
- //endregion
- //region Options
- /* Every input option is tested and parsed. This will prevent
+ //RTL
+ var isRTL = directorist.rtl === 'true';
+ var direction;
+ if (isRTL) {
+ direction = 'right';
+ } else {
+ direction = 'left';
+ }
+ function isValidFormatter(entry) {
+ return (
+ isValidPartialFormatter(entry) &&
+ typeof entry.from === 'function'
+ );
+ }
+ function isValidPartialFormatter(entry) {
+ // partial formatters only need a to function and not a from function
+ return (
+ (0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(entry) === 'object' && typeof entry.to === 'function'
+ );
+ }
+ function removeElement(el) {
+ el.parentElement.removeChild(el);
+ }
+ function isSet(value) {
+ return value !== null && value !== undefined;
+ }
+ // Bindable version
+ function preventDefault(e) {
+ e.preventDefault();
+ }
+ // Removes duplicates from an array.
+ function unique(array) {
+ return array.filter(function (a) {
+ return !this[a] ? (this[a] = true) : false;
+ }, {});
+ }
+ // Round a value to the closest 'to'.
+ function closest(value, to) {
+ return Math.round(value / to) * to;
+ }
+ // Current position of an element relative to the document.
+ function offset(elem, orientation) {
+ var rect = elem.getBoundingClientRect();
+ var doc = elem.ownerDocument;
+ var docElem = doc.documentElement;
+ var pageOffset = getPageOffset(doc);
+ // getBoundingClientRect contains left scroll in Chrome on Android.
+ // I haven't found a feature detection that proves this. Worst case
+ // scenario on mis-match: the 'tap' feature on horizontal sliders breaks.
+ if (/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)) {
+ pageOffset.x = 0;
+ }
+ return orientation
+ ? rect.top + pageOffset.y - docElem.clientTop
+ : rect.left + pageOffset.x - docElem.clientLeft;
+ }
+ // Checks whether a value is numerical.
+ function isNumeric(a) {
+ return typeof a === 'number' && !isNaN(a) && isFinite(a);
+ }
+ // Sets a class and removes it after [duration] ms.
+ function addClassFor(element, className, duration) {
+ if (duration > 0) {
+ addClass(element, className);
+ setTimeout(function () {
+ removeClass(element, className);
+ }, duration);
+ }
+ }
+ // Limits a value to 0 - 100
+ function limit(a) {
+ return Math.max(Math.min(a, 100), 0);
+ }
+ // Wraps a variable as an array, if it isn't one yet.
+ // Note that an input array is returned by reference!
+ function asArray(a) {
+ return Array.isArray(a) ? a : [a];
+ }
+ // Counts decimals
+ function countDecimals(numStr) {
+ numStr = String(numStr);
+ var pieces = numStr.split('.');
+ return pieces.length > 1 ? pieces[1].length : 0;
+ }
+ // add_class
+ function addClass(el, className) {
+ if (el.classList && !/\s/.test(className)) {
+ el.classList.add(className);
+ } else {
+ el.className += ' ' + className;
+ }
+ }
+ // remove_class
+ function removeClass(el, className) {
+ if (el.classList && !/\s/.test(className)) {
+ el.classList.remove(className);
+ } else {
+ el.className = el.className.replace(
+ new RegExp(
+ '(^|\\b)' +
+ className.split(' ').join('|') +
+ '(\\b|$)',
+ 'gi'
+ ),
+ ' '
+ );
+ }
+ }
+ // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/
+ function hasClass(el, className) {
+ return el.classList
+ ? el.classList.contains(className)
+ : new RegExp('\\b' + className + '\\b').test(el.className);
+ }
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes
+ function getPageOffset(doc) {
+ var supportPageOffset = window.scrollX !== undefined;
+ var isCSS1Compat = (doc.compatMode || '') === 'CSS1Compat';
+ var x = supportPageOffset
+ ? window.scrollX
+ : isCSS1Compat
+ ? doc.documentElement.scrollLeft
+ : doc.body.scrollLeft;
+ var y = supportPageOffset
+ ? window.scrollY
+ : isCSS1Compat
+ ? doc.documentElement.scrollTop
+ : doc.body.scrollTop;
+ return {
+ x: x,
+ y: y,
+ };
+ }
+ // we provide a function to compute constants instead
+ // of accessing window.* as soon as the module needs it
+ // so that we do not compute anything if not needed
+ function getActions() {
+ // Determine the events to bind. IE11 implements pointerEvents without
+ // a prefix, which breaks compatibility with the IE10 implementation.
+ return window.navigator.pointerEnabled
+ ? {
+ start: 'pointerdown',
+ move: 'pointermove',
+ end: 'pointerup',
+ }
+ : window.navigator.msPointerEnabled
+ ? {
+ start: 'MSPointerDown',
+ move: 'MSPointerMove',
+ end: 'MSPointerUp',
+ }
+ : {
+ start: 'mousedown touchstart',
+ move: 'mousemove touchmove',
+ end: 'mouseup touchend',
+ };
+ }
+ // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
+ // Issue #785
+ function getSupportsPassive() {
+ var supportsPassive = false;
+ /* eslint-disable */
+ try {
+ var opts = Object.defineProperty({}, 'passive', {
+ get: function get() {
+ supportsPassive = true;
+ },
+ });
+ // @ts-ignore
+ window.addEventListener('test', null, opts);
+ } catch (e) {}
+ /* eslint-enable */
+ return supportsPassive;
+ }
+ function getSupportsTouchActionNone() {
+ return (
+ window.CSS &&
+ CSS.supports &&
+ CSS.supports('touch-action', 'none')
+ );
+ }
+ //endregion
+ //region Range Calculation
+ // Determine the size of a sub-range in relation to a full range.
+ function subRangeRatio(pa, pb) {
+ return 100 / (pb - pa);
+ }
+ // (percentage) How many percent is this value of this range?
+ function fromPercentage(range, value, startRange) {
+ return (
+ (value * 100) / (range[startRange + 1] - range[startRange])
+ );
+ }
+ // (percentage) Where is this value on this range?
+ function toPercentage(range, value) {
+ return fromPercentage(
+ range,
+ range[0] < 0
+ ? value + Math.abs(range[0])
+ : value - range[0],
+ 0
+ );
+ }
+ // (value) How much is this percentage on this range?
+ function isPercentage(range, value) {
+ return (value * (range[1] - range[0])) / 100 + range[0];
+ }
+ function getJ(value, arr) {
+ var j = 1;
+ while (value >= arr[j]) {
+ j += 1;
+ }
+ return j;
+ }
+ // (percentage) Input a value, find where, on a scale of 0-100, it applies.
+ function toStepping(xVal, xPct, value) {
+ if (value >= xVal.slice(-1)[0]) {
+ return 100;
+ }
+ var j = getJ(value, xVal);
+ var va = xVal[j - 1];
+ var vb = xVal[j];
+ var pa = xPct[j - 1];
+ var pb = xPct[j];
+ return (
+ pa + toPercentage([va, vb], value) / subRangeRatio(pa, pb)
+ );
+ }
+ // (value) Input a percentage, find where it is on the specified range.
+ function fromStepping(xVal, xPct, value) {
+ // There is no range group that fits 100
+ if (value >= 100) {
+ return xVal.slice(-1)[0];
+ }
+ var j = getJ(value, xPct);
+ var va = xVal[j - 1];
+ var vb = xVal[j];
+ var pa = xPct[j - 1];
+ var pb = xPct[j];
+ return isPercentage(
+ [va, vb],
+ (value - pa) * subRangeRatio(pa, pb)
+ );
+ }
+ // (percentage) Get the step that applies at a certain value.
+ function getStep(xPct, xSteps, snap, value) {
+ if (value === 100) {
+ return value;
+ }
+ var j = getJ(value, xPct);
+ var a = xPct[j - 1];
+ var b = xPct[j];
+ // If 'snap' is set, steps are used as fixed points on the slider.
+ if (snap) {
+ // Find the closest position, a or b.
+ if (value - a > (b - a) / 2) {
+ return b;
+ }
+ return a;
+ }
+ if (!xSteps[j - 1]) {
+ return value;
+ }
+ return (
+ xPct[j - 1] + closest(value - xPct[j - 1], xSteps[j - 1])
+ );
+ }
+ //endregion
+ //region Spectrum
+ var Spectrum = /** @class */ (function () {
+ function Spectrum(entry, snap, singleStep) {
+ this.xPct = [];
+ this.xVal = [];
+ this.xSteps = [];
+ this.xNumSteps = [];
+ this.xHighestCompleteStep = [];
+ this.xSteps = [singleStep || false];
+ this.xNumSteps = [false];
+ this.snap = snap;
+ var index;
+ var ordered = [];
+ // Map the object keys to an array.
+ Object.keys(entry).forEach(function (index) {
+ ordered.push([asArray(entry[index]), index]);
+ });
+ // Sort all entries by value (numeric sort).
+ ordered.sort(function (a, b) {
+ return a[0][0] - b[0][0];
+ });
+ // Convert all entries to subranges.
+ for (index = 0; index < ordered.length; index++) {
+ this.handleEntryPoint(
+ ordered[index][1],
+ ordered[index][0]
+ );
+ }
+ // Store the actual step values.
+ // xSteps is sorted in the same order as xPct and xVal.
+ this.xNumSteps = this.xSteps.slice(0);
+ // Convert all numeric steps to the percentage of the subrange they represent.
+ for (index = 0; index < this.xNumSteps.length; index++) {
+ this.handleStepPoint(index, this.xNumSteps[index]);
+ }
+ }
+ Spectrum.prototype.getDistance = function (value) {
+ var distances = [];
+ for (
+ var index = 0;
+ index < this.xNumSteps.length - 1;
+ index++
+ ) {
+ distances[index] = fromPercentage(
+ this.xVal,
+ value,
+ index
+ );
+ }
+ return distances;
+ };
+ // Calculate the percentual distance over the whole scale of ranges.
+ // direction: 0 = backwards / 1 = forwards
+ Spectrum.prototype.getAbsoluteDistance = function (
+ value,
+ distances,
+ direction
+ ) {
+ var xPct_index = 0;
+ // Calculate range where to start calculation
+ if (value < this.xPct[this.xPct.length - 1]) {
+ while (value > this.xPct[xPct_index + 1]) {
+ xPct_index++;
+ }
+ } else if (value === this.xPct[this.xPct.length - 1]) {
+ xPct_index = this.xPct.length - 2;
+ }
+ // If looking backwards and the value is exactly at a range separator then look one range further
+ if (!direction && value === this.xPct[xPct_index + 1]) {
+ xPct_index++;
+ }
+ if (distances === null) {
+ distances = [];
+ }
+ var start_factor;
+ var rest_factor = 1;
+ var rest_rel_distance = distances[xPct_index];
+ var range_pct = 0;
+ var rel_range_distance = 0;
+ var abs_distance_counter = 0;
+ var range_counter = 0;
+ // Calculate what part of the start range the value is
+ if (direction) {
+ start_factor =
+ (value - this.xPct[xPct_index]) /
+ (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
+ } else {
+ start_factor =
+ (this.xPct[xPct_index + 1] - value) /
+ (this.xPct[xPct_index + 1] - this.xPct[xPct_index]);
+ }
+ // Do until the complete distance across ranges is calculated
+ while (rest_rel_distance > 0) {
+ // Calculate the percentage of total range
+ range_pct =
+ this.xPct[xPct_index + 1 + range_counter] -
+ this.xPct[xPct_index + range_counter];
+ // Detect if the margin, padding or limit is larger then the current range and calculate
+ if (
+ distances[xPct_index + range_counter] *
+ rest_factor +
+ 100 -
+ start_factor * 100 >
+ 100
+ ) {
+ // If larger then take the percentual distance of the whole range
+ rel_range_distance = range_pct * start_factor;
+ // Rest factor of relative percentual distance still to be calculated
+ rest_factor =
+ (rest_rel_distance - 100 * start_factor) /
+ distances[xPct_index + range_counter];
+ // Set start factor to 1 as for next range it does not apply.
+ start_factor = 1;
+ } else {
+ // If smaller or equal then take the percentual distance of the calculate percentual part of that range
+ rel_range_distance =
+ ((distances[xPct_index + range_counter] *
+ range_pct) /
+ 100) *
+ rest_factor;
+ // No rest left as the rest fits in current range
+ rest_factor = 0;
+ }
+ if (direction) {
+ abs_distance_counter =
+ abs_distance_counter - rel_range_distance;
+ // Limit range to first range when distance becomes outside of minimum range
+ if (this.xPct.length + range_counter >= 1) {
+ range_counter--;
+ }
+ } else {
+ abs_distance_counter =
+ abs_distance_counter + rel_range_distance;
+ // Limit range to last range when distance becomes outside of maximum range
+ if (this.xPct.length - range_counter >= 1) {
+ range_counter++;
+ }
+ }
+ // Rest of relative percentual distance still to be calculated
+ rest_rel_distance =
+ distances[xPct_index + range_counter] * rest_factor;
+ }
+ return value + abs_distance_counter;
+ };
+ Spectrum.prototype.toStepping = function (value) {
+ value = toStepping(this.xVal, this.xPct, value);
+ return value;
+ };
+ Spectrum.prototype.fromStepping = function (value) {
+ return fromStepping(this.xVal, this.xPct, value);
+ };
+ Spectrum.prototype.getStep = function (value) {
+ value = getStep(this.xPct, this.xSteps, this.snap, value);
+ return value;
+ };
+ Spectrum.prototype.getDefaultStep = function (
+ value,
+ isDown,
+ size
+ ) {
+ var j = getJ(value, this.xPct);
+ // When at the top or stepping down, look at the previous sub-range
+ if (
+ value === 100 ||
+ (isDown && value === this.xPct[j - 1])
+ ) {
+ j = Math.max(j - 1, 1);
+ }
+ return (this.xVal[j] - this.xVal[j - 1]) / size;
+ };
+ Spectrum.prototype.getNearbySteps = function (value) {
+ var j = getJ(value, this.xPct);
+ return {
+ stepBefore: {
+ startValue: this.xVal[j - 2],
+ step: this.xNumSteps[j - 2],
+ highestStep: this.xHighestCompleteStep[j - 2],
+ },
+ thisStep: {
+ startValue: this.xVal[j - 1],
+ step: this.xNumSteps[j - 1],
+ highestStep: this.xHighestCompleteStep[j - 1],
+ },
+ stepAfter: {
+ startValue: this.xVal[j],
+ step: this.xNumSteps[j],
+ highestStep: this.xHighestCompleteStep[j],
+ },
+ };
+ };
+ Spectrum.prototype.countStepDecimals = function () {
+ var stepDecimals = this.xNumSteps.map(countDecimals);
+ return Math.max.apply(null, stepDecimals);
+ };
+ Spectrum.prototype.hasNoSize = function () {
+ return this.xVal[0] === this.xVal[this.xVal.length - 1];
+ };
+ // Outside testing
+ Spectrum.prototype.convert = function (value) {
+ return this.getStep(this.toStepping(value));
+ };
+ Spectrum.prototype.handleEntryPoint = function (index, value) {
+ var percentage;
+ // Covert min/max syntax to 0 and 100.
+ if (index === 'min') {
+ percentage = 0;
+ } else if (index === 'max') {
+ percentage = 100;
+ } else {
+ percentage = parseFloat(index);
+ }
+ // Check for correct input.
+ if (!isNumeric(percentage) || !isNumeric(value[0])) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'range' value isn't numeric."
+ );
+ }
+ // Store values.
+ this.xPct.push(percentage);
+ this.xVal.push(value[0]);
+ var value1 = Number(value[1]);
+ // NaN will evaluate to false too, but to keep
+ // logging clear, set step explicitly. Make sure
+ // not to override the 'step' setting with false.
+ if (!percentage) {
+ if (!isNaN(value1)) {
+ this.xSteps[0] = value1;
+ }
+ } else {
+ this.xSteps.push(isNaN(value1) ? false : value1);
+ }
+ this.xHighestCompleteStep.push(0);
+ };
+ Spectrum.prototype.handleStepPoint = function (i, n) {
+ // Ignore 'false' stepping.
+ if (!n) {
+ return;
+ }
+ // Step over zero-length ranges (#948);
+ if (this.xVal[i] === this.xVal[i + 1]) {
+ this.xSteps[i] = this.xHighestCompleteStep[i] =
+ this.xVal[i];
+ return;
+ }
+ // Factor to range ratio
+ this.xSteps[i] =
+ fromPercentage([this.xVal[i], this.xVal[i + 1]], n, 0) /
+ subRangeRatio(this.xPct[i], this.xPct[i + 1]);
+ var totalSteps =
+ (this.xVal[i + 1] - this.xVal[i]) / this.xNumSteps[i];
+ var highestStep = Math.ceil(
+ Number(totalSteps.toFixed(3)) - 1
+ );
+ var step = this.xVal[i] + this.xNumSteps[i] * highestStep;
+ this.xHighestCompleteStep[i] = step;
+ };
+ return Spectrum;
+ })();
+ //endregion
+ //region Options
+ /* Every input option is tested and parsed. This will prevent
endless validation in internal methods. These tests are
structured with an item for every option available. An
option can be marked as required by setting the 'r' flag.
@@ -568,1830 +731,2413 @@ __webpack_require__.r(__webpack_exports__);
The testing function returns false when an error is detected,
or true when everything is OK. It can also modify the option
object, to make sure all values can be correctly looped elsewhere. */
- //region Defaults
- var defaultFormatter = {
- to: function to(value) {
- return value === undefined ? '' : value.toFixed(2);
- },
- from: Number
- };
- var cssClasses = {
- target: 'target',
- base: 'base',
- origin: 'origin',
- handle: 'handle',
- handleLower: 'handle-lower',
- handleUpper: 'handle-upper',
- touchArea: 'touch-area',
- horizontal: 'horizontal',
- vertical: 'vertical',
- background: 'background',
- connect: 'connect',
- connects: 'connects',
- ltr: 'ltr',
- rtl: 'rtl',
- textDirectionLtr: 'txt-dir-ltr',
- textDirectionRtl: 'txt-dir-rtl',
- draggable: 'draggable',
- drag: 'state-drag',
- tap: 'state-tap',
- active: 'active',
- tooltip: 'tooltip',
- pips: 'pips',
- pipsHorizontal: 'pips-horizontal',
- pipsVertical: 'pips-vertical',
- marker: 'marker',
- markerHorizontal: 'marker-horizontal',
- markerVertical: 'marker-vertical',
- markerNormal: 'marker-normal',
- markerLarge: 'marker-large',
- markerSub: 'marker-sub',
- value: 'value',
- valueHorizontal: 'value-horizontal',
- valueVertical: 'value-vertical',
- valueNormal: 'value-normal',
- valueLarge: 'value-large',
- valueSub: 'value-sub'
- };
- // Namespaces of internal event listeners
- var INTERNAL_EVENT_NS = {
- tooltips: '.__tooltips',
- aria: '.__aria'
- };
- //endregion
- function customRangeStep(parsed, entry) {
- if (!isNumeric(entry)) {
- throw new Error("directoristCustomRangeSlider: 'step' is not numeric.");
- }
- // The step option can still be used to set stepping
- // for linear sliders. Overwritten if set in 'range'.
- parsed.singleStep = entry;
- }
- function customRangeKeyboardPageMultiplier(parsed, entry) {
- if (!isNumeric(entry)) {
- throw new Error("directoristCustomRangeSlider: 'keyboardPageMultiplier' is not numeric.");
- }
- parsed.keyboardPageMultiplier = entry;
- }
- function customRangeKeyboardMultiplier(parsed, entry) {
- if (!isNumeric(entry)) {
- throw new Error("directoristCustomRangeSlider: 'keyboardMultiplier' is not numeric.");
- }
- parsed.keyboardMultiplier = entry;
- }
- function customRangeKeyboardDefaultStep(parsed, entry) {
- if (!isNumeric(entry)) {
- throw new Error("directoristCustomRangeSlider: 'keyboardDefaultStep' is not numeric.");
- }
- parsed.keyboardDefaultStep = entry;
- }
- function customRangeRange(parsed, entry) {
- // Filter incorrect input.
- if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(entry) !== 'object' || Array.isArray(entry)) {
- throw new Error("directoristCustomRangeSlider: 'range' is not an object.");
- }
- // Catch missing start or end.
- if (entry.min === undefined || entry.max === undefined) {
- throw new Error("directoristCustomRangeSlider: Missing 'min' or 'max' in 'range'.");
- }
- parsed.spectrum = new Spectrum(entry, parsed.snap || false, parsed.singleStep);
- }
- function customRangeStart(parsed, entry) {
- entry = asArray(entry);
- // Validate input. Values aren't tested, as the public .val method
- // will always provide a valid location.
- if (!Array.isArray(entry) || !entry.length) {
- throw new Error("directoristCustomRangeSlider: 'start' option is incorrect.");
- }
- // Store the number of handles.
- parsed.handles = entry.length;
- // When the slider is initialized, the .val method will
- // be called with the start options.
- parsed.start = entry;
- }
- function customRangeSnap(parsed, entry) {
- if (typeof entry !== 'boolean') {
- throw new Error("directoristCustomRangeSlider: 'snap' option must be a boolean.");
- }
- // Enforce 100% stepping within subranges.
- parsed.snap = entry;
- }
- function customRangeAnimate(parsed, entry) {
- if (typeof entry !== 'boolean') {
- throw new Error("directoristCustomRangeSlider: 'animate' option must be a boolean.");
- }
- // Enforce 100% stepping within subranges.
- parsed.animate = entry;
- }
- function customRangeAnimationDuration(parsed, entry) {
- if (typeof entry !== 'number') {
- throw new Error("directoristCustomRangeSlider: 'animationDuration' option must be a number.");
- }
- parsed.animationDuration = entry;
- }
- function customRangeConnect(parsed, entry) {
- var connect = [false];
- var i;
- // Map legacy options
- if (entry === 'lower') {
- entry = [true, false];
- } else if (entry === 'upper') {
- entry = [false, true];
- }
- // Handle boolean options
- if (entry === true || entry === false) {
- for (i = 1; i < parsed.handles; i++) {
- connect.push(entry);
- }
- connect.push(false);
- }
- // Reject invalid input
- else if (!Array.isArray(entry) || !entry.length || entry.length !== parsed.handles + 1) {
- throw new Error("directoristCustomRangeSlider: 'connect' option doesn't match handle count.");
- } else {
- connect = entry;
- }
- parsed.connect = connect;
- }
- function customRangeOrientation(parsed, entry) {
- // Set orientation to an a numerical value for easy
- // array selection.
- switch (entry) {
- case 'horizontal':
- parsed.ort = 0;
- break;
- case 'vertical':
- parsed.ort = 1;
- break;
- default:
- throw new Error("directoristCustomRangeSlider: 'orientation' option is invalid.");
- }
- }
- function customRangeMargin(parsed, entry) {
- if (!isNumeric(entry)) {
- throw new Error("directoristCustomRangeSlider: 'margin' option must be numeric.");
- }
- // Issue #582
- if (entry === 0) {
- return;
- }
- parsed.margin = parsed.spectrum.getDistance(entry);
- }
- function customRangeLimit(parsed, entry) {
- if (!isNumeric(entry)) {
- throw new Error("directoristCustomRangeSlider: 'limit' option must be numeric.");
- }
- parsed.limit = parsed.spectrum.getDistance(entry);
- if (!parsed.limit || parsed.handles < 2) {
- throw new Error("directoristCustomRangeSlider: 'limit' option is only supported on linear sliders with 2 or more handles.");
- }
- }
- function customRangePadding(parsed, entry) {
- var index;
- if (!isNumeric(entry) && !Array.isArray(entry)) {
- throw new Error("directoristCustomRangeSlider: 'padding' option must be numeric or array of exactly 2 numbers.");
- }
- if (Array.isArray(entry) && !(entry.length === 2 || isNumeric(entry[0]) || isNumeric(entry[1]))) {
- throw new Error("directoristCustomRangeSlider: 'padding' option must be numeric or array of exactly 2 numbers.");
- }
- if (entry === 0) {
- return;
- }
- if (!Array.isArray(entry)) {
- entry = [entry, entry];
- }
- // 'getDistance' returns false for invalid values.
- parsed.padding = [parsed.spectrum.getDistance(entry[0]), parsed.spectrum.getDistance(entry[1])];
- for (index = 0; index < parsed.spectrum.xNumSteps.length - 1; index++) {
- // last "range" can't contain step size as it is purely an endpoint.
- if (parsed.padding[0][index] < 0 || parsed.padding[1][index] < 0) {
- throw new Error("directoristCustomRangeSlider: 'padding' option must be a positive number(s).");
- }
- }
- var totalPadding = entry[0] + entry[1];
- var firstValue = parsed.spectrum.xVal[0];
- var lastValue = parsed.spectrum.xVal[parsed.spectrum.xVal.length - 1];
- if (totalPadding / (lastValue - firstValue) > 1) {
- throw new Error("directoristCustomRangeSlider: 'padding' option must not exceed 100% of the range.");
- }
- }
- function customRangeDirection(parsed, entry) {
- // Set direction as a numerical value for easy parsing.
- // Invert connection for RTL sliders, so that the proper
- // handles get the connect/background classes.
- switch (entry) {
- case 'ltr':
- parsed.dir = 0;
- break;
- case 'rtl':
- parsed.dir = 1;
- break;
- default:
- throw new Error("directoristCustomRangeSlider: 'direction' option was not recognized.");
- }
- }
- function customRangeBehaviour(parsed, entry) {
- // Make sure the input is a string.
- if (typeof entry !== 'string') {
- throw new Error("directoristCustomRangeSlider: 'behaviour' must be a string containing options.");
- }
- // Check if the string contains any keywords.
- // None are required.
- var tap = entry.indexOf('tap') >= 0;
- var drag = entry.indexOf('drag') >= 0;
- var fixed = entry.indexOf('fixed') >= 0;
- var snap = entry.indexOf('snap') >= 0;
- var hover = entry.indexOf('hover') >= 0;
- var unconstrained = entry.indexOf('unconstrained') >= 0;
- var dragAll = entry.indexOf('drag-all') >= 0;
- var smoothSteps = entry.indexOf('smooth-steps') >= 0;
- if (fixed) {
- if (parsed.handles !== 2) {
- throw new Error("directoristCustomRangeSlider: 'fixed' behaviour must be used with 2 handles");
- }
- // Use margin to enforce fixed state
- customRangeMargin(parsed, parsed.start[1] - parsed.start[0]);
- }
- if (unconstrained && (parsed.margin || parsed.limit)) {
- throw new Error("directoristCustomRangeSlider: 'unconstrained' behaviour cannot be used with margin or limit");
- }
- parsed.events = {
- tap: tap || snap,
- drag: drag,
- dragAll: dragAll,
- smoothSteps: smoothSteps,
- fixed: fixed,
- snap: snap,
- hover: hover,
- unconstrained: unconstrained
- };
- }
- function customRangeTooltips(parsed, entry) {
- if (entry === false) {
- return;
- }
- if (entry === true || isValidPartialFormatter(entry)) {
- parsed.tooltips = [];
- for (var i = 0; i < parsed.handles; i++) {
- parsed.tooltips.push(entry);
- }
- } else {
- entry = asArray(entry);
- if (entry.length !== parsed.handles) {
- throw new Error('directoristCustomRangeSlider: must pass a formatter for all handles.');
- }
- entry.forEach(function (formatter) {
- if (typeof formatter !== 'boolean' && !isValidPartialFormatter(formatter)) {
- throw new Error("directoristCustomRangeSlider: 'tooltips' must be passed a formatter or 'false'.");
- }
- });
- parsed.tooltips = entry;
- }
- }
- function customRangeHandleAttributes(parsed, entry) {
- if (entry.length !== parsed.handles) {
- throw new Error('directoristCustomRangeSlider: must pass a attributes for all handles.');
- }
- parsed.handleAttributes = entry;
- }
- function customRangeAriaFormat(parsed, entry) {
- if (!isValidPartialFormatter(entry)) {
- throw new Error("directoristCustomRangeSlider: 'ariaFormat' requires 'to' method.");
- }
- parsed.ariaFormat = entry;
- }
- function customRangeFormat(parsed, entry) {
- if (!isValidFormatter(entry)) {
- throw new Error("directoristCustomRangeSlider: 'format' requires 'to' and 'from' methods.");
- }
- parsed.format = entry;
- }
- function customRangeKeyboardSupport(parsed, entry) {
- if (typeof entry !== 'boolean') {
- throw new Error("directoristCustomRangeSlider: 'keyboardSupport' option must be a boolean.");
- }
- parsed.keyboardSupport = entry;
- }
- function customRangeDocumentElement(parsed, entry) {
- // This is an advanced option. Passed values are used without validation.
- parsed.documentElement = entry;
- }
- function customRangeCssPrefix(parsed, entry) {
- if (typeof entry !== 'string' && entry !== false) {
- throw new Error("directoristCustomRangeSlider: 'cssPrefix' must be a string or `false`.");
- }
- parsed.cssPrefix = entry;
- }
- function customRangeCssClasses(parsed, entry) {
- if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(entry) !== 'object') {
- throw new Error("directoristCustomRangeSlider: 'cssClasses' must be an object.");
- }
- if (typeof parsed.cssPrefix === 'string') {
- parsed.cssClasses = {};
- Object.keys(entry).forEach(function (key) {
- parsed.cssClasses[key] = parsed.cssPrefix + entry[key];
- });
- } else {
- parsed.cssClasses = entry;
- }
- }
- // Test all developer settings and parse to assumption-safe values.
- function customRangeOptions(options) {
- // To prove a fix for #537, freeze options here.
- // If the object is modified, an error will be thrown.
- // Object.freeze(options);
- var parsed = {
- margin: null,
- limit: null,
- padding: null,
- animate: true,
- animationDuration: 300,
- ariaFormat: defaultFormatter,
- format: defaultFormatter
- };
- // Tests are executed in the order they are presented here.
- var customRanges = {
- step: {
- r: false,
- t: customRangeStep
- },
- keyboardPageMultiplier: {
- r: false,
- t: customRangeKeyboardPageMultiplier
- },
- keyboardMultiplier: {
- r: false,
- t: customRangeKeyboardMultiplier
- },
- keyboardDefaultStep: {
- r: false,
- t: customRangeKeyboardDefaultStep
- },
- start: {
- r: true,
- t: customRangeStart
- },
- connect: {
- r: true,
- t: customRangeConnect
- },
- direction: {
- r: true,
- t: customRangeDirection
- },
- snap: {
- r: false,
- t: customRangeSnap
- },
- animate: {
- r: false,
- t: customRangeAnimate
- },
- animationDuration: {
- r: false,
- t: customRangeAnimationDuration
- },
- range: {
- r: true,
- t: customRangeRange
- },
- orientation: {
- r: false,
- t: customRangeOrientation
- },
- margin: {
- r: false,
- t: customRangeMargin
- },
- limit: {
- r: false,
- t: customRangeLimit
- },
- padding: {
- r: false,
- t: customRangePadding
- },
- behaviour: {
- r: true,
- t: customRangeBehaviour
- },
- ariaFormat: {
- r: false,
- t: customRangeAriaFormat
- },
- format: {
- r: false,
- t: customRangeFormat
- },
- tooltips: {
- r: false,
- t: customRangeTooltips
- },
- keyboardSupport: {
- r: true,
- t: customRangeKeyboardSupport
- },
- documentElement: {
- r: false,
- t: customRangeDocumentElement
- },
- cssPrefix: {
- r: true,
- t: customRangeCssPrefix
- },
- cssClasses: {
- r: true,
- t: customRangeCssClasses
- },
- handleAttributes: {
- r: false,
- t: customRangeHandleAttributes
- }
- };
- var defaults = {
- connect: false,
- direction: 'ltr',
- behaviour: 'tap',
- orientation: 'horizontal',
- keyboardSupport: true,
- cssPrefix: 'directorist-custom-range-slider-',
- cssClasses: cssClasses,
- keyboardPageMultiplier: 5,
- keyboardMultiplier: 1,
- keyboardDefaultStep: 10
- };
- // AriaFormat defaults to regular format, if any.
- if (options.format && !options.ariaFormat) {
- options.ariaFormat = options.format;
- }
- // Run all options through a testing mechanism to ensure correct
- // input. It should be noted that options might get modified to
- // be handled properly. E.g. wrapping integers in arrays.
- Object.keys(customRanges).forEach(function (name) {
- // If the option isn't set, but it is required, throw an error.
- if (!isSet(options[name]) && defaults[name] === undefined) {
- if (customRanges[name].r) {
- throw new Error("directoristCustomRangeSlider: '" + name + "' is required.");
- }
- return;
- }
- customRanges[name].t(parsed, !isSet(options[name]) ? defaults[name] : options[name]);
- });
- // Forward pips options
- parsed.pips = options.pips;
- // All recent browsers accept unprefixed transform.
- // We need -ms- for IE9 and -webkit- for older Android;
- // Assume use of -webkit- if unprefixed and -ms- are not supported.
- // https://caniuse.com/#feat=transforms2d
- var d = document.createElement('div');
- var msPrefix = d.style.msTransform !== undefined;
- var noPrefix = d.style.transform !== undefined;
- parsed.transformRule = noPrefix ? 'transform' : msPrefix ? 'msTransform' : 'webkitTransform';
- // Pips don't move, so we can place them using left/top.
- var styles = [['left', 'top'], ['right', 'bottom']];
- parsed.style = styles[parsed.dir][parsed.ort];
- return parsed;
- }
- //endregion
- function scope(target, options, originalOptions) {
- var actions = getActions();
- var supportsTouchActionNone = getSupportsTouchActionNone();
- var supportsPassive = supportsTouchActionNone && getSupportsPassive();
- // All variables local to 'scope' are prefixed with 'scope_'
- // Slider DOM Nodes
- var scope_Target = target;
- var scope_Base;
- var scope_Handles;
- var scope_Connects;
- var scope_Pips;
- var scope_Tooltips;
- // Slider state values
- var scope_Spectrum = options.spectrum;
- var scope_Values = [];
- var scope_Locations = [];
- var scope_HandleNumbers = [];
- var scope_ActiveHandlesCount = 0;
- var scope_Events = {};
- // Document Nodes
- var scope_Document = target.ownerDocument;
- var scope_DocumentElement = options.documentElement || scope_Document.documentElement;
- var scope_Body = scope_Document.body;
- // For horizontal sliders in standard ltr documents,
- // make .directorist-custom-range-slider-origin overflow to the left so the document doesn't scroll.
- var scope_DirOffset = scope_Document.dir === 'rtl' || options.ort === 1 ? 0 : 100;
- // Creates a node, adds it to target, returns the new node.
- function addNodeTo(addTarget, className) {
- var div = scope_Document.createElement('div');
- if (className) {
- addClass(div, className);
- }
- addTarget.appendChild(div);
- return div;
- }
- // Append a origin to the base
- function addOrigin(base, handleNumber) {
- var origin = addNodeTo(base, options.cssClasses.origin);
- var handle = addNodeTo(origin, options.cssClasses.handle);
- addNodeTo(handle, options.cssClasses.touchArea);
- handle.setAttribute('data-handle', String(handleNumber));
- if (options.keyboardSupport) {
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
- // 0 = focusable and reachable
- handle.setAttribute('tabindex', '0');
- handle.addEventListener('keydown', function (event) {
- return eventKeydown(event, handleNumber);
- });
- }
- if (options.handleAttributes !== undefined) {
- var attributes_1 = options.handleAttributes[handleNumber];
- Object.keys(attributes_1).forEach(function (attribute) {
- handle.setAttribute(attribute, attributes_1[attribute]);
- });
- }
- handle.setAttribute('role', 'slider');
- handle.setAttribute('aria-orientation', options.ort ? 'vertical' : 'horizontal');
- if (handleNumber === 0) {
- addClass(handle, options.cssClasses.handleLower);
- } else if (handleNumber === options.handles - 1) {
- addClass(handle, options.cssClasses.handleUpper);
- }
- origin.handle = handle;
- return origin;
- }
- // Insert nodes for connect elements
- function addConnect(base, add) {
- if (!add) {
- return false;
- }
- return addNodeTo(base, options.cssClasses.connect);
- }
- // Add handles to the slider base.
- function addElements(connectOptions, base) {
- var connectBase = addNodeTo(base, options.cssClasses.connects);
- scope_Handles = [];
- scope_Connects = [];
- scope_Connects.push(addConnect(connectBase, connectOptions[0]));
- // [::::O====O====O====]
- // connectOptions = [0, 1, 1, 1]
- for (var i = 0; i < options.handles; i++) {
- // Keep a list of all added handles.
- scope_Handles.push(addOrigin(base, i));
- scope_HandleNumbers[i] = i;
- scope_Connects.push(addConnect(connectBase, connectOptions[i + 1]));
- }
- }
- // Initialize a single slider.
- function addSlider(addTarget) {
- // Apply classes and data to the target.
- addClass(addTarget, options.cssClasses.target);
- if (options.dir === 0) {
- addClass(addTarget, options.cssClasses.ltr);
- } else {
- addClass(addTarget, options.cssClasses.rtl);
- }
- if (options.ort === 0) {
- addClass(addTarget, options.cssClasses.horizontal);
- } else {
- addClass(addTarget, options.cssClasses.vertical);
- }
- var textDirection = getComputedStyle(addTarget).direction;
- if (textDirection === 'rtl') {
- addClass(addTarget, options.cssClasses.textDirectionRtl);
- } else {
- addClass(addTarget, options.cssClasses.textDirectionLtr);
- }
- return addNodeTo(addTarget, options.cssClasses.base);
- }
- function addTooltip(handle, handleNumber) {
- if (!options.tooltips || !options.tooltips[handleNumber]) {
- return false;
- }
- return addNodeTo(handle.firstChild, options.cssClasses.tooltip);
- }
- function isSliderDisabled() {
- return scope_Target.hasAttribute('disabled');
- }
- // Disable the slider dragging if any handle is disabled
- function isHandleDisabled(handleNumber) {
- var handleOrigin = scope_Handles[handleNumber];
- return handleOrigin.hasAttribute('disabled');
- }
- function disable(handleNumber) {
- if (handleNumber !== null && handleNumber !== undefined) {
- scope_Handles[handleNumber].setAttribute('disabled', '');
- scope_Handles[handleNumber].handle.removeAttribute('tabindex');
- } else {
- scope_Target.setAttribute('disabled', '');
- scope_Handles.forEach(function (handle) {
- handle.handle.removeAttribute('tabindex');
- });
- }
- }
- function enable(handleNumber) {
- if (handleNumber !== null && handleNumber !== undefined) {
- scope_Handles[handleNumber].removeAttribute('disabled');
- scope_Handles[handleNumber].handle.setAttribute('tabindex', '0');
- } else {
- scope_Target.removeAttribute('disabled');
- scope_Handles.forEach(function (handle) {
- handle.removeAttribute('disabled');
- handle.handle.setAttribute('tabindex', '0');
- });
- }
- }
- function removeTooltips() {
- if (scope_Tooltips) {
- removeEvent('update' + INTERNAL_EVENT_NS.tooltips);
- scope_Tooltips.forEach(function (tooltip) {
- if (tooltip) {
- removeElement(tooltip);
- }
- });
- scope_Tooltips = null;
- }
- }
- // The tooltips option is a shorthand for using the 'update' event.
- function tooltips() {
- removeTooltips();
- // Tooltips are added with options.tooltips in original order.
- scope_Tooltips = scope_Handles.map(addTooltip);
- bindEvent('update' + INTERNAL_EVENT_NS.tooltips, function (values, handleNumber, unencoded) {
- if (!scope_Tooltips || !options.tooltips) {
- return;
- }
- if (scope_Tooltips[handleNumber] === false) {
- return;
- }
- var formattedValue = values[handleNumber];
- if (options.tooltips[handleNumber] !== true) {
- formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
- }
- scope_Tooltips[handleNumber].innerHTML = formattedValue;
- });
- }
- function aria() {
- removeEvent('update' + INTERNAL_EVENT_NS.aria);
- bindEvent('update' + INTERNAL_EVENT_NS.aria, function (values, handleNumber, unencoded, tap, positions) {
- // Update Aria Values for all handles, as a change in one changes min and max values for the next.
- scope_HandleNumbers.forEach(function (index) {
- var handle = scope_Handles[index];
- var min = checkHandlePosition(scope_Locations, index, 0, true, true, true);
- var max = checkHandlePosition(scope_Locations, index, 100, true, true, true);
- var now = positions[index];
- // Formatted value for display
- var text = String(options.ariaFormat.to(unencoded[index]));
- // Map to slider range values
- min = scope_Spectrum.fromStepping(min).toFixed(1);
- max = scope_Spectrum.fromStepping(max).toFixed(1);
- now = scope_Spectrum.fromStepping(now).toFixed(1);
- handle.children[0].setAttribute('aria-valuemin', min);
- handle.children[0].setAttribute('aria-valuemax', max);
- handle.children[0].setAttribute('aria-valuenow', now);
- handle.children[0].setAttribute('aria-valuetext', text);
- });
- });
- }
- function getGroup(pips) {
- // Use the range.
- if (pips.mode === exports.PipsMode.Range || pips.mode === exports.PipsMode.Steps) {
- return scope_Spectrum.xVal;
- }
- if (pips.mode === exports.PipsMode.Count) {
- if (pips.values < 2) {
- throw new Error("directoristCustomRangeSlider: 'values' (>= 2) required for mode 'count'.");
- }
- // Divide 0 - 100 in 'count' parts.
- var interval = pips.values - 1;
- var spread = 100 / interval;
- var values = [];
- // List these parts and have them handled as 'positions'.
- while (interval--) {
- values[interval] = interval * spread;
- }
- values.push(100);
- return mapToRange(values, pips.stepped);
- }
- if (pips.mode === exports.PipsMode.Positions) {
- // Map all percentages to on-range values.
- return mapToRange(pips.values, pips.stepped);
- }
- if (pips.mode === exports.PipsMode.Values) {
- // If the value must be stepped, it needs to be converted to a percentage first.
- if (pips.stepped) {
- return pips.values.map(function (value) {
- // Convert to percentage, apply step, return to value.
- return scope_Spectrum.fromStepping(scope_Spectrum.getStep(scope_Spectrum.toStepping(value)));
- });
- }
- // Otherwise, we can simply use the values.
- return pips.values;
- }
- return []; // pips.mode = never
- }
- function mapToRange(values, stepped) {
- return values.map(function (value) {
- return scope_Spectrum.fromStepping(stepped ? scope_Spectrum.getStep(value) : value);
- });
- }
- function generateSpread(pips) {
- function safeIncrement(value, increment) {
- // Avoid floating point variance by dropping the smallest decimal places.
- return Number((value + increment).toFixed(7));
- }
- var group = getGroup(pips);
- var indexes = {};
- var firstInRange = scope_Spectrum.xVal[0];
- var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length - 1];
- var ignoreFirst = false;
- var ignoreLast = false;
- var prevPct = 0;
- // Create a copy of the group, sort it and filter away all duplicates.
- group = unique(group.slice().sort(function (a, b) {
- return a - b;
- }));
- // Make sure the range starts with the first element.
- if (group[0] !== firstInRange) {
- group.unshift(firstInRange);
- ignoreFirst = true;
- }
- // Likewise for the last one.
- if (group[group.length - 1] !== lastInRange) {
- group.push(lastInRange);
- ignoreLast = true;
- }
- group.forEach(function (current, index) {
- // Get the current step and the lower + upper positions.
- var step;
- var i;
- var q;
- var low = current;
- var high = group[index + 1];
- var newPct;
- var pctDifference;
- var pctPos;
- var type;
- var steps;
- var realSteps;
- var stepSize;
- var isSteps = pips.mode === exports.PipsMode.Steps;
- // When using 'steps' mode, use the provided steps.
- // Otherwise, we'll step on to the next subrange.
- if (isSteps) {
- step = scope_Spectrum.xNumSteps[index];
- }
- // Default to a 'full' step.
- if (!step) {
- step = high - low;
- }
- // If high is undefined we are at the last subrange. Make sure it iterates once (#1088)
- if (high === undefined) {
- high = low;
- }
- // Make sure step isn't 0, which would cause an infinite loop (#654)
- step = Math.max(step, 0.0000001);
- // Find all steps in the subrange.
- for (i = low; i <= high; i = safeIncrement(i, step)) {
- // Get the percentage value for the current step,
- // calculate the size for the subrange.
- newPct = scope_Spectrum.toStepping(i);
- pctDifference = newPct - prevPct;
- steps = pctDifference / (pips.density || 1);
- realSteps = Math.round(steps);
- // This ratio represents the amount of percentage-space a point indicates.
- // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-divided.
- // Round the percentage offset to an even number, then divide by two
- // to spread the offset on both sides of the range.
- stepSize = pctDifference / realSteps;
- // Divide all points evenly, adding the correct number to this subrange.
- // Run up to <= so that 100% gets a point, event if ignoreLast is set.
- for (q = 1; q <= realSteps; q += 1) {
- // The ratio between the rounded value and the actual size might be ~1% off.
- // Correct the percentage offset by the number of points
- // per subrange. density = 1 will result in 100 points on the
- // full range, 2 for 50, 4 for 25, etc.
- pctPos = prevPct + q * stepSize;
- indexes[pctPos.toFixed(5)] = [scope_Spectrum.fromStepping(pctPos), 0];
- }
- // Determine the point type.
- type = group.indexOf(i) > -1 ? exports.PipsType.LargeValue : isSteps ? exports.PipsType.SmallValue : exports.PipsType.NoValue;
- // Enforce the 'ignoreFirst' option by overwriting the type for 0.
- if (!index && ignoreFirst && i !== high) {
- type = 0;
- }
- if (!(i === high && ignoreLast)) {
- // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.
- indexes[newPct.toFixed(5)] = [i, type];
- }
- // Update the percentage count.
- prevPct = newPct;
- }
- });
- return indexes;
- }
- function addMarking(spread, filterFunc, formatter) {
- var _a, _b;
- var element = scope_Document.createElement('div');
- var valueSizeClasses = (_a = {}, _a[exports.PipsType.None] = '', _a[exports.PipsType.NoValue] = options.cssClasses.valueNormal, _a[exports.PipsType.LargeValue] = options.cssClasses.valueLarge, _a[exports.PipsType.SmallValue] = options.cssClasses.valueSub, _a);
- var markerSizeClasses = (_b = {}, _b[exports.PipsType.None] = '', _b[exports.PipsType.NoValue] = options.cssClasses.markerNormal, _b[exports.PipsType.LargeValue] = options.cssClasses.markerLarge, _b[exports.PipsType.SmallValue] = options.cssClasses.markerSub, _b);
- var valueOrientationClasses = [options.cssClasses.valueHorizontal, options.cssClasses.valueVertical];
- var markerOrientationClasses = [options.cssClasses.markerHorizontal, options.cssClasses.markerVertical];
- addClass(element, options.cssClasses.pips);
- addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical);
- function getClasses(type, source) {
- var a = source === options.cssClasses.value;
- var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses;
- var sizeClasses = a ? valueSizeClasses : markerSizeClasses;
- return source + ' ' + orientationClasses[options.ort] + ' ' + sizeClasses[type];
- }
- function addSpread(offset, value, type) {
- // Apply the filter function, if it is set.
- type = filterFunc ? filterFunc(value, type) : type;
- if (type === exports.PipsType.None) {
- return;
- }
- // Add a marker for every point
- var node = addNodeTo(element, false);
- node.className = getClasses(type, options.cssClasses.marker);
- node.style[options.style] = offset + '%';
- // Values are only appended for points marked '1' or '2'.
- if (type > exports.PipsType.NoValue) {
- node = addNodeTo(element, false);
- node.className = getClasses(type, options.cssClasses.value);
- node.setAttribute('data-value', String(value));
- node.style[options.style] = offset + '%';
- node.innerHTML = String(formatter.to(value));
- }
- }
- // Append all points.
- Object.keys(spread).forEach(function (offset) {
- addSpread(offset, spread[offset][0], spread[offset][1]);
- });
- return element;
- }
- function removePips() {
- if (scope_Pips) {
- removeElement(scope_Pips);
- scope_Pips = null;
- }
- }
- function pips(pips) {
- // Fix #669
- removePips();
- var spread = generateSpread(pips);
- var filter = pips.filter;
- var format = pips.format || {
- to: function to(value) {
- return String(Math.round(value));
- }
- };
- scope_Pips = scope_Target.appendChild(addMarking(spread, filter, format));
- return scope_Pips;
- }
- // Shorthand for base dimensions.
- function baseSize() {
- var rect = scope_Base.getBoundingClientRect();
- var alt = 'offset' + ['Width', 'Height'][options.ort];
- return options.ort === 0 ? rect.width || scope_Base[alt] : rect.height || scope_Base[alt];
- }
- // Handler for attaching events trough a proxy.
- function attachEvent(events, element, callback, data) {
- // This function can be used to 'filter' events to the slider.
- // element is a node, not a nodeList
- var method = function method(event) {
- var e = fixEvent(event, data.pageOffset, data.target || element);
- // fixEvent returns false if this event has a different target
- // when handling (multi-) touch events;
- if (!e) {
- return false;
- }
- // doNotReject is passed by all end events to make sure released touches
- // are not rejected, leaving the slider "stuck" to the cursor;
- if (isSliderDisabled() && !data.doNotReject) {
- return false;
- }
- // Stop if an active 'tap' transition is taking place.
- if (hasClass(scope_Target, options.cssClasses.tap) && !data.doNotReject) {
- return false;
- }
- // Ignore right or middle clicks on start #454
- if (events === actions.start && e.buttons !== undefined && e.buttons > 1) {
- return false;
- }
- // Ignore right or middle clicks on start #454
- if (data.hover && e.buttons) {
- return false;
- }
- // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS.
- // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support
- // touch-action: manipulation, but that allows panning, which breaks
- // sliders after zooming/on non-responsive pages.
- // See: https://bugs.webkit.org/show_bug.cgi?id=133112
- if (!supportsPassive) {
- e.preventDefault();
- }
- e.calcPoint = e.points[options.ort];
- // Call the event handler with the event [ and additional data ].
- callback(e, data);
- return;
- };
- var methods = [];
- // Bind a closure on the target for every event type.
- events.split(' ').forEach(function (eventName) {
- element.addEventListener(eventName, method, supportsPassive ? {
- passive: true
- } : false);
- methods.push([eventName, method]);
- });
- return methods;
- }
- // Provide a clean event with standardized offset values.
- function fixEvent(e, pageOffset, eventTarget) {
- // Filter the event to register the type, which can be
- // touch, mouse or pointer. Offset changes need to be
- // made on an event specific basis.
- var touch = e.type.indexOf('touch') === 0;
- var mouse = e.type.indexOf('mouse') === 0;
- var pointer = e.type.indexOf('pointer') === 0;
- var x = 0;
- var y = 0;
- // IE10 implemented pointer events with a prefix;
- if (e.type.indexOf('MSPointer') === 0) {
- pointer = true;
- }
- // Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
- // the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore
- // events that have no touches or buttons associated with them. (#1057, #1079, #1095)
- if (e.type === 'mousedown' && !e.buttons && !e.touches) {
- return false;
- }
- // The only thing one handle should be concerned about is the touches that originated on top of it.
- if (touch) {
- // Returns true if a touch originated on the target.
- var isTouchOnTarget = function isTouchOnTarget(checkTouch) {
- var target = checkTouch.target;
- return target === eventTarget || eventTarget.contains(target) || e.composed && e.composedPath().shift() === eventTarget;
- };
- // In the case of touchstart events, we need to make sure there is still no more than one
- // touch on the target so we look amongst all touches.
- if (e.type === 'touchstart') {
- var targetTouches = Array.prototype.filter.call(e.touches, isTouchOnTarget);
- // Do not support more than one touch per handle.
- if (targetTouches.length > 1) {
- return false;
- }
- x = targetTouches[0].pageX;
- y = targetTouches[0].pageY;
- } else {
- // In the other cases, find on changedTouches is enough.
- var targetTouch = Array.prototype.find.call(e.changedTouches, isTouchOnTarget);
- // Cancel if the target touch has not moved.
- if (!targetTouch) {
- return false;
- }
- x = targetTouch.pageX;
- y = targetTouch.pageY;
- }
- }
- pageOffset = pageOffset || getPageOffset(scope_Document);
- if (mouse || pointer) {
- x = e.clientX + pageOffset.x;
- y = e.clientY + pageOffset.y;
- }
- e.pageOffset = pageOffset;
- e.points = [x, y];
- e.cursor = mouse || pointer; // Fix #435
- return e;
- }
- // Translate a coordinate in the document to a percentage on the slider
- function calcPointToPercentage(calcPoint) {
- var location = calcPoint - offset(scope_Base, options.ort);
- var proposal = location * 100 / baseSize();
- // Clamp proposal between 0% and 100%
- // Out-of-bound coordinates may occur when .directorist-custom-range-slider-base pseudo-elements
- // are used (e.g. contained handles feature)
- proposal = limit(proposal);
- return options.dir ? 100 - proposal : proposal;
- }
- // Find handle closest to a certain percentage on the slider
- function getClosestHandle(clickedPosition) {
- var smallestDifference = 100;
- var handleNumber = false;
- scope_Handles.forEach(function (handle, index) {
- // Disabled handles are ignored
- if (isHandleDisabled(index)) {
- return;
- }
- var handlePosition = scope_Locations[index];
- var differenceWithThisHandle = Math.abs(handlePosition - clickedPosition);
- // Initial state
- var clickAtEdge = differenceWithThisHandle === 100 && smallestDifference === 100;
- // Difference with this handle is smaller than the previously checked handle
- var isCloser = differenceWithThisHandle < smallestDifference;
- var isCloserAfter = differenceWithThisHandle <= smallestDifference && clickedPosition > handlePosition;
- if (isCloser || isCloserAfter || clickAtEdge) {
- handleNumber = index;
- smallestDifference = differenceWithThisHandle;
- }
- });
- return handleNumber;
- }
- // Fire 'end' when a mouse or pen leaves the document.
- function documentLeave(event, data) {
- if (event.type === 'mouseout' && event.target.nodeName === 'HTML' && event.relatedTarget === null) {
- eventEnd(event, data);
- }
- }
- // Handle movement on document for handle and range drag.
- function eventMove(event, data) {
- // Fix #498
- // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).
- // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero
- // IE9 has .buttons and .which zero on mousemove.
- // Firefox breaks the spec MDN defines.
- if (navigator.appVersion.indexOf('MSIE 9') === -1 && event.buttons === 0 && data.buttonsProperty !== 0) {
- return eventEnd(event, data);
- }
- // Check if we are moving up or down
- var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);
- // Convert the movement into a percentage of the slider width/height
- var proposal = movement * 100 / data.baseSize;
- moveHandles(movement > 0, proposal, data.locations, data.handleNumbers, data.connect);
- }
- // Unbind move events on document, call callbacks.
- function eventEnd(event, data) {
- // The handle is no longer active, so remove the class.
- if (data.handle) {
- removeClass(data.handle, options.cssClasses.active);
- scope_ActiveHandlesCount -= 1;
- }
- // Unbind the move and end events, which are added on 'start'.
- data.listeners.forEach(function (c) {
- scope_DocumentElement.removeEventListener(c[0], c[1]);
- });
- if (scope_ActiveHandlesCount === 0) {
- // Remove dragging class.
- removeClass(scope_Target, options.cssClasses.drag);
- setZindex();
- // Remove cursor styles and text-selection events bound to the body.
- if (event.cursor) {
- scope_Body.style.cursor = '';
- scope_Body.removeEventListener('selectstart', preventDefault);
- }
- }
- if (options.events.smoothSteps) {
- data.handleNumbers.forEach(function (handleNumber) {
- setHandle(handleNumber, scope_Locations[handleNumber], true, true, false, false);
- });
- data.handleNumbers.forEach(function (handleNumber) {
- fireEvent('update', handleNumber);
- });
- }
- data.handleNumbers.forEach(function (handleNumber) {
- fireEvent('change', handleNumber);
- fireEvent('set', handleNumber);
- fireEvent('end', handleNumber);
- });
- }
- // Bind move events on document.
- function eventStart(event, data) {
- // Ignore event if any handle is disabled
- if (data.handleNumbers.some(isHandleDisabled)) {
- return;
- }
- var handle;
- if (data.handleNumbers.length === 1) {
- var handleOrigin = scope_Handles[data.handleNumbers[0]];
- handle = handleOrigin.children[0];
- scope_ActiveHandlesCount += 1;
- // Mark the handle as 'active' so it can be styled.
- addClass(handle, options.cssClasses.active);
- }
- // A drag should never propagate up to the 'tap' event.
- event.stopPropagation();
- // Record the event listeners.
- var listeners = [];
- // Attach the move and end events.
- var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, {
- // The event target has changed so we need to propagate the original one so that we keep
- // relying on it to extract target touches.
- target: event.target,
- handle: handle,
- connect: data.connect,
- listeners: listeners,
- startCalcPoint: event.calcPoint,
- baseSize: baseSize(),
- pageOffset: event.pageOffset,
- handleNumbers: data.handleNumbers,
- buttonsProperty: event.buttons,
- locations: scope_Locations.slice()
- });
- var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, {
- target: event.target,
- handle: handle,
- listeners: listeners,
- doNotReject: true,
- handleNumbers: data.handleNumbers
- });
- var outEvent = attachEvent('mouseout', scope_DocumentElement, documentLeave, {
- target: event.target,
- handle: handle,
- listeners: listeners,
- doNotReject: true,
- handleNumbers: data.handleNumbers
- });
- // We want to make sure we pushed the listeners in the listener list rather than creating
- // a new one as it has already been passed to the event handlers.
- listeners.push.apply(listeners, moveEvent.concat(endEvent, outEvent));
- // Text selection isn't an issue on touch devices,
- // so adding cursor styles can be skipped.
- if (event.cursor) {
- // Prevent the 'I' cursor and extend the range-drag cursor.
- scope_Body.style.cursor = getComputedStyle(event.target).cursor;
- // Mark the target with a dragging state.
- if (scope_Handles.length > 1) {
- addClass(scope_Target, options.cssClasses.drag);
- }
- // Prevent text selection when dragging the handles.
- // In directoristCustomRangeSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move,
- // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52,
- // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there.
- // The 'cursor' flag is false.
- // See: http://caniuse.com/#search=selectstart
- scope_Body.addEventListener('selectstart', preventDefault, false);
- }
- data.handleNumbers.forEach(function (handleNumber) {
- fireEvent('start', handleNumber);
- });
- }
- // Move closest handle to tapped location.
- function eventTap(event) {
- // The tap event shouldn't propagate up
- event.stopPropagation();
- var proposal = calcPointToPercentage(event.calcPoint);
- var handleNumber = getClosestHandle(proposal);
- // Tackle the case that all handles are 'disabled'.
- if (handleNumber === false) {
- return;
- }
- // Flag the slider as it is now in a transitional state.
- // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that.
- if (!options.events.snap) {
- addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);
- }
- setHandle(handleNumber, proposal, true, true);
- setZindex();
- fireEvent('slide', handleNumber, true);
- fireEvent('update', handleNumber, true);
- if (!options.events.snap) {
- fireEvent('change', handleNumber, true);
- fireEvent('set', handleNumber, true);
- } else {
- eventStart(event, {
- handleNumbers: [handleNumber]
- });
- }
- }
- // Fires a 'hover' event for a hovered mouse/pen position.
- function eventHover(event) {
- var proposal = calcPointToPercentage(event.calcPoint);
- var to = scope_Spectrum.getStep(proposal);
- var value = scope_Spectrum.fromStepping(to);
- Object.keys(scope_Events).forEach(function (targetEvent) {
- if ('hover' === targetEvent.split('.')[0]) {
- scope_Events[targetEvent].forEach(function (callback) {
- callback.call(scope_Self, value);
- });
- }
- });
- }
- // Handles keydown on focused handles
- // Don't move the document when pressing arrow keys on focused handles
- function eventKeydown(event, handleNumber) {
- if (isSliderDisabled() || isHandleDisabled(handleNumber)) {
- return false;
- }
- var horizontalKeys = ['Left', 'Right'];
- var verticalKeys = ['Down', 'Up'];
- var largeStepKeys = ['PageDown', 'PageUp'];
- var edgeKeys = ['Home', 'End'];
- if (options.dir && !options.ort) {
- // On an right-to-left slider, the left and right keys act inverted
- horizontalKeys.reverse();
- } else if (options.ort && !options.dir) {
- // On a top-to-bottom slider, the up and down keys act inverted
- verticalKeys.reverse();
- largeStepKeys.reverse();
- }
- // Strip "Arrow" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
- var key = event.key.replace('Arrow', '');
- var isLargeDown = key === largeStepKeys[0];
- var isLargeUp = key === largeStepKeys[1];
- var isDown = key === verticalKeys[0] || key === horizontalKeys[0] || isLargeDown;
- var isUp = key === verticalKeys[1] || key === horizontalKeys[1] || isLargeUp;
- var isMin = key === edgeKeys[0];
- var isMax = key === edgeKeys[1];
- if (!isDown && !isUp && !isMin && !isMax) {
- return true;
- }
- event.preventDefault();
- var to;
- if (isUp || isDown) {
- var direction = isDown ? 0 : 1;
- var steps = getNextStepsForHandle(handleNumber);
- var step = steps[direction];
- // At the edge of a slider, do nothing
- if (step === null) {
- return false;
- }
- // No step set, use the default of 10% of the sub-range
- if (step === false) {
- step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, options.keyboardDefaultStep);
- }
- if (isLargeUp || isLargeDown) {
- step *= options.keyboardPageMultiplier;
- } else {
- step *= options.keyboardMultiplier;
- }
- // Step over zero-length ranges (#948);
- step = Math.max(step, 0.0000001);
- // Decrement for down steps
- step = (isDown ? -1 : 1) * step;
- to = scope_Values[handleNumber] + step;
- } else if (isMax) {
- // End key
- to = options.spectrum.xVal[options.spectrum.xVal.length - 1];
- } else {
- // Home key
- to = options.spectrum.xVal[0];
- }
- setHandle(handleNumber, scope_Spectrum.toStepping(to), true, true);
- fireEvent('slide', handleNumber);
- fireEvent('update', handleNumber);
- fireEvent('change', handleNumber);
- fireEvent('set', handleNumber);
- return false;
- }
- // Attach events to several slider parts.
- function bindSliderEvents(behaviour) {
- // Attach the standard drag event to the handles.
- if (!behaviour.fixed) {
- scope_Handles.forEach(function (handle, index) {
- // These events are only bound to the visual handle
- // element, not the 'real' origin element.
- attachEvent(actions.start, handle.children[0], eventStart, {
- handleNumbers: [index]
- });
- });
- }
- // Attach the tap event to the slider base.
- if (behaviour.tap) {
- attachEvent(actions.start, scope_Base, eventTap, {});
- }
- // Fire hover events
- if (behaviour.hover) {
- attachEvent(actions.move, scope_Base, eventHover, {
- hover: true
- });
- }
- // Make the range draggable.
- if (behaviour.drag) {
- scope_Connects.forEach(function (connect, index) {
- if (connect === false || index === 0 || index === scope_Connects.length - 1) {
- return;
- }
- var handleBefore = scope_Handles[index - 1];
- var handleAfter = scope_Handles[index];
- var eventHolders = [connect];
- var handlesToDrag = [handleBefore, handleAfter];
- var handleNumbersToDrag = [index - 1, index];
- addClass(connect, options.cssClasses.draggable);
- // When the range is fixed, the entire range can
- // be dragged by the handles. The handle in the first
- // origin will propagate the start event upward,
- // but it needs to be bound manually on the other.
- if (behaviour.fixed) {
- eventHolders.push(handleBefore.children[0]);
- eventHolders.push(handleAfter.children[0]);
- }
- if (behaviour.dragAll) {
- handlesToDrag = scope_Handles;
- handleNumbersToDrag = scope_HandleNumbers;
- }
- eventHolders.forEach(function (eventHolder) {
- attachEvent(actions.start, eventHolder, eventStart, {
- handles: handlesToDrag,
- handleNumbers: handleNumbersToDrag,
- connect: connect
- });
- });
- });
- }
- }
- // Attach an event to this slider, possibly including a namespace
- function bindEvent(namespacedEvent, callback) {
- scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || [];
- scope_Events[namespacedEvent].push(callback);
- // If the event bound is 'update,' fire it immediately for all handles.
- if (namespacedEvent.split('.')[0] === 'update') {
- scope_Handles.forEach(function (a, index) {
- fireEvent('update', index);
- });
- }
- }
- function isInternalNamespace(namespace) {
- return namespace === INTERNAL_EVENT_NS.aria || namespace === INTERNAL_EVENT_NS.tooltips;
- }
- // Undo attachment of event
- function removeEvent(namespacedEvent) {
- var event = namespacedEvent && namespacedEvent.split('.')[0];
- var namespace = event ? namespacedEvent.substring(event.length) : namespacedEvent;
- Object.keys(scope_Events).forEach(function (bind) {
- var tEvent = bind.split('.')[0];
- var tNamespace = bind.substring(tEvent.length);
- if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {
- // only delete protected internal event if intentional
- if (!isInternalNamespace(tNamespace) || namespace === tNamespace) {
- delete scope_Events[bind];
- }
- }
- });
- }
- // External event handling
- function fireEvent(eventName, handleNumber, tap) {
- Object.keys(scope_Events).forEach(function (targetEvent) {
- var eventType = targetEvent.split('.')[0];
- if (eventName === eventType) {
- scope_Events[targetEvent].forEach(function (callback) {
- callback.call(
- // Use the slider public API as the scope ('this')
- scope_Self,
- // Return values as array, so arg_1[arg_2] is always valid.
- scope_Values.map(options.format.to),
- // Handle index, 0 or 1
- handleNumber,
- // Un-formatted slider values
- scope_Values.slice(),
- // Event is fired by tap, true or false
- tap || false,
- // Left offset of the handle, in relation to the slider
- scope_Locations.slice(),
- // add the slider public API to an accessible parameter when this is unavailable
- scope_Self);
- });
- }
- });
- }
- // Split out the handle positioning logic so the Move event can use it, too
- function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue, smoothSteps) {
- var distance;
- // For sliders with multiple handles, limit movement to the other handle.
- // Apply the margin option by adding it to the handle positions.
- if (scope_Handles.length > 1 && !options.events.unconstrained) {
- if (lookBackward && handleNumber > 0) {
- distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.margin, false);
- to = Math.max(to, distance);
- }
- if (lookForward && handleNumber < scope_Handles.length - 1) {
- distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.margin, true);
- to = Math.min(to, distance);
- }
- }
- // The limit option has the opposite effect, limiting handles to a
- // maximum distance from another. Limit must be > 0, as otherwise
- // handles would be unmovable.
- if (scope_Handles.length > 1 && options.limit) {
- if (lookBackward && handleNumber > 0) {
- distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber - 1], options.limit, false);
- to = Math.min(to, distance);
- }
- if (lookForward && handleNumber < scope_Handles.length - 1) {
- distance = scope_Spectrum.getAbsoluteDistance(reference[handleNumber + 1], options.limit, true);
- to = Math.max(to, distance);
- }
- }
- // The padding option keeps the handles a certain distance from the
- // edges of the slider. Padding must be > 0.
- if (options.padding) {
- if (handleNumber === 0) {
- distance = scope_Spectrum.getAbsoluteDistance(0, options.padding[0], false);
- to = Math.max(to, distance);
- }
- if (handleNumber === scope_Handles.length - 1) {
- distance = scope_Spectrum.getAbsoluteDistance(100, options.padding[1], true);
- to = Math.min(to, distance);
- }
- }
- if (!smoothSteps) {
- to = scope_Spectrum.getStep(to);
- }
- // Limit percentage to the 0 - 100 range
- to = limit(to);
- // Return false if handle can't move
- if (to === reference[handleNumber] && !getValue) {
- return false;
- }
- return to;
- }
- // Uses slider orientation to create CSS rules. a = base value;
- function inRuleOrder(v, a) {
- var o = options.ort;
- return (o ? a : v) + ', ' + (o ? v : a);
- }
- // Moves handle(s) by a percentage
- // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...])
- function moveHandles(upward, proposal, locations, handleNumbers, connect) {
- var proposals = locations.slice();
- // Store first handle now, so we still have it in case handleNumbers is reversed
- var firstHandle = handleNumbers[0];
- var smoothSteps = options.events.smoothSteps;
- var b = [!upward, upward];
- var f = [upward, !upward];
- // Copy handleNumbers so we don't change the dataset
- handleNumbers = handleNumbers.slice();
- // Check to see which handle is 'leading'.
- // If that one can't move the second can't either.
- if (upward) {
- handleNumbers.reverse();
- }
- // Step 1: get the maximum percentage that any of the handles can move
- if (handleNumbers.length > 1) {
- handleNumbers.forEach(function (handleNumber, o) {
- var to = checkHandlePosition(proposals, handleNumber, proposals[handleNumber] + proposal, b[o], f[o], false, smoothSteps);
- // Stop if one of the handles can't move.
- if (to === false) {
- proposal = 0;
- } else {
- proposal = to - proposals[handleNumber];
- proposals[handleNumber] = to;
- }
- });
- }
- // If using one handle, check backward AND forward
- else {
- b = f = [true];
- }
- var state = false;
- // Step 2: Try to set the handles with the found percentage
- handleNumbers.forEach(function (handleNumber, o) {
- state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o], false, smoothSteps) || state;
- });
- // Step 3: If a handle moved, fire events
- if (state) {
- handleNumbers.forEach(function (handleNumber) {
- fireEvent('update', handleNumber);
- fireEvent('slide', handleNumber);
- });
- // If target is a connect, then fire drag event
- if (connect != undefined) {
- fireEvent('drag', firstHandle);
- }
- }
- }
- // Takes a base value and an offset. This offset is used for the connect bar size.
- // In the initial design for this feature, the origin element was 1% wide.
- // Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature
- // in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223
- function transformDirection(a, b) {
- return options.dir ? 100 - a - b : a;
- }
- // Updates scope_Locations and scope_Values, updates visual state
- function updateHandlePosition(handleNumber, to) {
- // Update locations.
- scope_Locations[handleNumber] = to;
- // Convert the value to the slider stepping/range.
- scope_Values[handleNumber] = scope_Spectrum.fromStepping(to);
- var translation = transformDirection(to, 0) - scope_DirOffset;
- var translateRule = 'translate(' + inRuleOrder(translation + '%', '0') + ')';
- scope_Handles[handleNumber].style[options.transformRule] = translateRule;
- updateConnect(handleNumber);
- updateConnect(handleNumber + 1);
- }
- // Handles before the slider middle are stacked later = higher,
- // Handles after the middle later is lower
- // [[7] [8] .......... | .......... [5] [4]
- function setZindex() {
- scope_HandleNumbers.forEach(function (handleNumber) {
- var dir = scope_Locations[handleNumber] > 50 ? -1 : 1;
- var zIndex = 3 + (scope_Handles.length + dir * handleNumber);
- scope_Handles[handleNumber].style.zIndex = String(zIndex);
- });
- }
- // Test suggested values and apply margin, step.
- // if exactInput is true, don't run checkHandlePosition, then the handle can be placed in between steps (#436)
- function setHandle(handleNumber, to, lookBackward, lookForward, exactInput, smoothSteps) {
- if (!exactInput) {
- to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false, smoothSteps);
- }
- if (to === false) {
- return false;
- }
- updateHandlePosition(handleNumber, to);
- return true;
- }
- // Updates style attribute for connect nodes
- function updateConnect(index) {
- // Skip connects set to false
- if (!scope_Connects[index]) {
- return;
- }
- var l = 0;
- var h = 100;
- if (index !== 0) {
- l = scope_Locations[index - 1];
- }
- if (index !== scope_Connects.length - 1) {
- h = scope_Locations[index];
- }
- // We use two rules:
- // 'translate' to change the left/top offset;
- // 'scale' to change the width of the element;
- // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.directorist-custom-range-slider-base)
- var connectWidth = h - l;
- var translateRule = options.dir ? 'translate(' + inRuleOrder(-l + '%', '0') + ')' // RTL
- : 'translate(' + inRuleOrder(l + '%', '0') + ')'; // LTR
- var scaleRule = 'scale(' + inRuleOrder(connectWidth / 100, '1') + ')';
- scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule;
- }
- // Parses value passed to .set method. Returns current value if not parse-able.
- function resolveToValue(to, handleNumber) {
- // Setting with null indicates an 'ignore'.
- // Inputting 'false' is invalid.
- if (to === null || to === false || to === undefined) {
- return scope_Locations[handleNumber];
- }
- // If a formatted number was passed, attempt to decode it.
- if (typeof to === 'number') {
- to = String(to);
- }
- to = options.format.from(to);
- if (to !== false) {
- to = scope_Spectrum.toStepping(to);
- }
- // If parsing the number failed, use the current value.
- if (to === false || isNaN(to)) {
- return scope_Locations[handleNumber];
- }
- return to;
- }
- // Set the slider value.
- function valueSet(input, fireSetEvent, exactInput) {
- var values = asArray(input);
- var isInit = scope_Locations[0] === undefined;
- // Event fires by default
- fireSetEvent = fireSetEvent === undefined ? true : fireSetEvent;
- // Animation is optional.
- // Make sure the initial values were set before using animated placement.
- if (options.animate && !isInit) {
- addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);
- }
- // First pass, without lookAhead but with lookBackward. Values are set from left to right.
- scope_HandleNumbers.forEach(function (handleNumber) {
- setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false, exactInput);
- });
- var i = scope_HandleNumbers.length === 1 ? 0 : 1;
- // Spread handles evenly across the slider if the range has no size (min=max)
- if (isInit && scope_Spectrum.hasNoSize()) {
- exactInput = true;
- scope_Locations[0] = 0;
- if (scope_HandleNumbers.length > 1) {
- var space_1 = 100 / (scope_HandleNumbers.length - 1);
- scope_HandleNumbers.forEach(function (handleNumber) {
- scope_Locations[handleNumber] = handleNumber * space_1;
- });
- }
- }
- // Secondary passes. Now that all base values are set, apply constraints.
- // Iterate all handles to ensure constraints are applied for the entire slider (Issue #1009)
- for (; i < scope_HandleNumbers.length; ++i) {
- scope_HandleNumbers.forEach(function (handleNumber) {
- setHandle(handleNumber, scope_Locations[handleNumber], true, true, exactInput);
- });
- }
- setZindex();
- scope_HandleNumbers.forEach(function (handleNumber) {
- fireEvent('update', handleNumber);
- // Fire the event only for handles that received a new value, as per #579
- if (values[handleNumber] !== null && fireSetEvent) {
- fireEvent('set', handleNumber);
- }
- });
- }
- // Reset slider to initial values
- function valueReset(fireSetEvent) {
- valueSet(options.start, fireSetEvent);
- }
- // Set value for a single handle
- function valueSetHandle(handleNumber, value, fireSetEvent, exactInput) {
- // Ensure numeric input
- handleNumber = Number(handleNumber);
- if (!(handleNumber >= 0 && handleNumber < scope_HandleNumbers.length)) {
- throw new Error('directoristCustomRangeSlider: invalid handle number, got: ' + handleNumber);
- }
- // Look both backward and forward, since we don't want this handle to "push" other handles (#960);
- // The exactInput argument can be used to ignore slider stepping (#436)
- setHandle(handleNumber, resolveToValue(value, handleNumber), true, true, exactInput);
- fireEvent('update', handleNumber);
- if (fireSetEvent) {
- fireEvent('set', handleNumber);
- }
- }
- // Get the slider value.
- function valueGet(unencoded) {
- if (unencoded === void 0) {
- unencoded = false;
- }
- if (unencoded) {
- // return a copy of the raw values
- return scope_Values.length === 1 ? scope_Values[0] : scope_Values.slice(0);
- }
- var values = scope_Values.map(options.format.to);
- // If only one handle is used, return a single value.
- if (values.length === 1) {
- return values[0];
- }
- return values;
- }
- // Removes classes from the root and empties it.
- function destroy() {
- // remove protected internal listeners
- removeEvent(INTERNAL_EVENT_NS.aria);
- removeEvent(INTERNAL_EVENT_NS.tooltips);
- Object.keys(options.cssClasses).forEach(function (key) {
- removeClass(scope_Target, options.cssClasses[key]);
- });
- while (scope_Target.firstChild) {
- scope_Target.removeChild(scope_Target.firstChild);
- }
- delete scope_Target.directoristCustomRangeSlider;
- }
- function getNextStepsForHandle(handleNumber) {
- var location = scope_Locations[handleNumber];
- var nearbySteps = scope_Spectrum.getNearbySteps(location);
- var value = scope_Values[handleNumber];
- var increment = nearbySteps.thisStep.step;
- var decrement = null;
- // If snapped, directly use defined step value
- if (options.snap) {
- return [value - nearbySteps.stepBefore.startValue || null, nearbySteps.stepAfter.startValue - value || null];
- }
- // If the next value in this step moves into the next step,
- // the increment is the start of the next step - the current value
- if (increment !== false) {
- if (value + increment > nearbySteps.stepAfter.startValue) {
- increment = nearbySteps.stepAfter.startValue - value;
- }
- }
- // If the value is beyond the starting point
- if (value > nearbySteps.thisStep.startValue) {
- decrement = nearbySteps.thisStep.step;
- } else if (nearbySteps.stepBefore.step === false) {
- decrement = false;
- }
- // If a handle is at the start of a step, it always steps back into the previous step first
- else {
- decrement = value - nearbySteps.stepBefore.highestStep;
- }
- // Now, if at the slider edges, there is no in/decrement
- if (location === 100) {
- increment = null;
- } else if (location === 0) {
- decrement = null;
- }
- // As per #391, the comparison for the decrement step can have some rounding issues.
- var stepDecimals = scope_Spectrum.countStepDecimals();
- // Round per #391
- if (increment !== null && increment !== false) {
- increment = Number(increment.toFixed(stepDecimals));
- }
- if (decrement !== null && decrement !== false) {
- decrement = Number(decrement.toFixed(stepDecimals));
- }
- return [decrement, increment];
- }
- // Get the current step size for the slider.
- function getNextSteps() {
- return scope_HandleNumbers.map(getNextStepsForHandle);
- }
- // Updatable: margin, limit, padding, step, range, animate, snap
- function updateOptions(optionsToUpdate, fireSetEvent) {
- // Spectrum is created using the range, snap, direction and step options.
- // 'snap' and 'step' can be updated.
- // If 'snap' and 'step' are not passed, they should remain unchanged.
- var v = valueGet();
- var updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format', 'pips', 'tooltips'];
- // Only change options that we're actually passed to update.
- updateAble.forEach(function (name) {
- // Check for undefined. null removes the value.
- if (optionsToUpdate[name] !== undefined) {
- originalOptions[name] = optionsToUpdate[name];
- }
- });
- var newOptions = customRangeOptions(originalOptions);
- // Load new options into the slider state
- updateAble.forEach(function (name) {
- if (optionsToUpdate[name] !== undefined) {
- options[name] = newOptions[name];
- }
- });
- scope_Spectrum = newOptions.spectrum;
- // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)
- options.margin = newOptions.margin;
- options.limit = newOptions.limit;
- options.padding = newOptions.padding;
- // Update pips, removes existing.
- if (options.pips) {
- pips(options.pips);
- } else {
- removePips();
- }
- // Update tooltips, removes existing.
- if (options.tooltips) {
- tooltips();
- } else {
- removeTooltips();
- }
- // Invalidate the current positioning so valueSet forces an update.
- scope_Locations = [];
- valueSet(isSet(optionsToUpdate.start) ? optionsToUpdate.start : v, fireSetEvent);
- }
- // Initialization steps
- function setupSlider() {
- // Create the base element, initialize HTML and set classes.
- // Add handles and connect elements.
- scope_Base = addSlider(scope_Target);
- addElements(options.connect, scope_Base);
- // Attach user events.
- bindSliderEvents(options.events);
- // Use the public value method to set the start values.
- valueSet(options.start);
- if (options.pips) {
- pips(options.pips);
- }
- if (options.tooltips) {
- tooltips();
- }
- aria();
- }
- setupSlider();
- var scope_Self = {
- destroy: destroy,
- steps: getNextSteps,
- on: bindEvent,
- off: removeEvent,
- get: valueGet,
- set: valueSet,
- setHandle: valueSetHandle,
- reset: valueReset,
- disable: disable,
- enable: enable,
- // Exposed for unit testing, don't use this in your application.
- __moveHandles: function __moveHandles(upward, proposal, handleNumbers) {
- moveHandles(upward, proposal, scope_Locations, handleNumbers);
- },
- options: originalOptions,
- updateOptions: updateOptions,
- target: scope_Target,
- removePips: removePips,
- removeTooltips: removeTooltips,
- getPositions: function getPositions() {
- return scope_Locations.slice();
- },
- getTooltips: function getTooltips() {
- return scope_Tooltips;
- },
- getOrigins: function getOrigins() {
- return scope_Handles;
- },
- pips: pips // Issue #594
- };
- return scope_Self;
- }
- // Run the standard initializer
- function initialize(target, originalOptions) {
- if (!target || !target.nodeName) {
- throw new Error("directoristCustomRangeSlider: create requires a single element, got: ".concat(target));
- }
- if (target.directoristCustomRangeSlider) {
- throw new Error('directoristCustomRangeSlider: Slider was already initialized.');
- }
- var options = customRangeOptions(originalOptions);
- var api = scope(target, options, originalOptions);
- target.directoristCustomRangeSlider = api;
- return api;
- }
- var directoristCustomRangeSlider = {
- __spectrum: Spectrum,
- cssClasses: cssClasses,
- create: initialize
- };
- exports.create = initialize;
- exports.cssClasses = cssClasses;
- exports.default = directoristCustomRangeSlider;
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-});
-}();
-/******/ })()
-;
-//# sourceMappingURL=range-slider.js.map
\ No newline at end of file
+ //region Defaults
+ var defaultFormatter = {
+ to: function to(value) {
+ return value === undefined ? '' : value.toFixed(2);
+ },
+ from: Number,
+ };
+ var cssClasses = {
+ target: 'target',
+ base: 'base',
+ origin: 'origin',
+ handle: 'handle',
+ handleLower: 'handle-lower',
+ handleUpper: 'handle-upper',
+ touchArea: 'touch-area',
+ horizontal: 'horizontal',
+ vertical: 'vertical',
+ background: 'background',
+ connect: 'connect',
+ connects: 'connects',
+ ltr: 'ltr',
+ rtl: 'rtl',
+ textDirectionLtr: 'txt-dir-ltr',
+ textDirectionRtl: 'txt-dir-rtl',
+ draggable: 'draggable',
+ drag: 'state-drag',
+ tap: 'state-tap',
+ active: 'active',
+ tooltip: 'tooltip',
+ pips: 'pips',
+ pipsHorizontal: 'pips-horizontal',
+ pipsVertical: 'pips-vertical',
+ marker: 'marker',
+ markerHorizontal: 'marker-horizontal',
+ markerVertical: 'marker-vertical',
+ markerNormal: 'marker-normal',
+ markerLarge: 'marker-large',
+ markerSub: 'marker-sub',
+ value: 'value',
+ valueHorizontal: 'value-horizontal',
+ valueVertical: 'value-vertical',
+ valueNormal: 'value-normal',
+ valueLarge: 'value-large',
+ valueSub: 'value-sub',
+ };
+ // Namespaces of internal event listeners
+ var INTERNAL_EVENT_NS = {
+ tooltips: '.__tooltips',
+ aria: '.__aria',
+ };
+ //endregion
+ function customRangeStep(parsed, entry) {
+ if (!isNumeric(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'step' is not numeric."
+ );
+ }
+ // The step option can still be used to set stepping
+ // for linear sliders. Overwritten if set in 'range'.
+ parsed.singleStep = entry;
+ }
+ function customRangeKeyboardPageMultiplier(parsed, entry) {
+ if (!isNumeric(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'keyboardPageMultiplier' is not numeric."
+ );
+ }
+ parsed.keyboardPageMultiplier = entry;
+ }
+ function customRangeKeyboardMultiplier(parsed, entry) {
+ if (!isNumeric(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'keyboardMultiplier' is not numeric."
+ );
+ }
+ parsed.keyboardMultiplier = entry;
+ }
+ function customRangeKeyboardDefaultStep(parsed, entry) {
+ if (!isNumeric(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'keyboardDefaultStep' is not numeric."
+ );
+ }
+ parsed.keyboardDefaultStep = entry;
+ }
+ function customRangeRange(parsed, entry) {
+ // Filter incorrect input.
+ if (
+ (0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(entry) !== 'object' ||
+ Array.isArray(entry)
+ ) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'range' is not an object."
+ );
+ }
+ // Catch missing start or end.
+ if (entry.min === undefined || entry.max === undefined) {
+ throw new Error(
+ "directoristCustomRangeSlider: Missing 'min' or 'max' in 'range'."
+ );
+ }
+ parsed.spectrum = new Spectrum(
+ entry,
+ parsed.snap || false,
+ parsed.singleStep
+ );
+ }
+ function customRangeStart(parsed, entry) {
+ entry = asArray(entry);
+ // Validate input. Values aren't tested, as the public .val method
+ // will always provide a valid location.
+ if (!Array.isArray(entry) || !entry.length) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'start' option is incorrect."
+ );
+ }
+ // Store the number of handles.
+ parsed.handles = entry.length;
+ // When the slider is initialized, the .val method will
+ // be called with the start options.
+ parsed.start = entry;
+ }
+ function customRangeSnap(parsed, entry) {
+ if (typeof entry !== 'boolean') {
+ throw new Error(
+ "directoristCustomRangeSlider: 'snap' option must be a boolean."
+ );
+ }
+ // Enforce 100% stepping within subranges.
+ parsed.snap = entry;
+ }
+ function customRangeAnimate(parsed, entry) {
+ if (typeof entry !== 'boolean') {
+ throw new Error(
+ "directoristCustomRangeSlider: 'animate' option must be a boolean."
+ );
+ }
+ // Enforce 100% stepping within subranges.
+ parsed.animate = entry;
+ }
+ function customRangeAnimationDuration(parsed, entry) {
+ if (typeof entry !== 'number') {
+ throw new Error(
+ "directoristCustomRangeSlider: 'animationDuration' option must be a number."
+ );
+ }
+ parsed.animationDuration = entry;
+ }
+ function customRangeConnect(parsed, entry) {
+ var connect = [false];
+ var i;
+ // Map legacy options
+ if (entry === 'lower') {
+ entry = [true, false];
+ } else if (entry === 'upper') {
+ entry = [false, true];
+ }
+ // Handle boolean options
+ if (entry === true || entry === false) {
+ for (i = 1; i < parsed.handles; i++) {
+ connect.push(entry);
+ }
+ connect.push(false);
+ }
+ // Reject invalid input
+ else if (
+ !Array.isArray(entry) ||
+ !entry.length ||
+ entry.length !== parsed.handles + 1
+ ) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'connect' option doesn't match handle count."
+ );
+ } else {
+ connect = entry;
+ }
+ parsed.connect = connect;
+ }
+ function customRangeOrientation(parsed, entry) {
+ // Set orientation to an a numerical value for easy
+ // array selection.
+ switch (entry) {
+ case 'horizontal':
+ parsed.ort = 0;
+ break;
+ case 'vertical':
+ parsed.ort = 1;
+ break;
+ default:
+ throw new Error(
+ "directoristCustomRangeSlider: 'orientation' option is invalid."
+ );
+ }
+ }
+ function customRangeMargin(parsed, entry) {
+ if (!isNumeric(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'margin' option must be numeric."
+ );
+ }
+ // Issue #582
+ if (entry === 0) {
+ return;
+ }
+ parsed.margin = parsed.spectrum.getDistance(entry);
+ }
+ function customRangeLimit(parsed, entry) {
+ if (!isNumeric(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'limit' option must be numeric."
+ );
+ }
+ parsed.limit = parsed.spectrum.getDistance(entry);
+ if (!parsed.limit || parsed.handles < 2) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'limit' option is only supported on linear sliders with 2 or more handles."
+ );
+ }
+ }
+ function customRangePadding(parsed, entry) {
+ var index;
+ if (!isNumeric(entry) && !Array.isArray(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'padding' option must be numeric or array of exactly 2 numbers."
+ );
+ }
+ if (
+ Array.isArray(entry) &&
+ !(
+ entry.length === 2 ||
+ isNumeric(entry[0]) ||
+ isNumeric(entry[1])
+ )
+ ) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'padding' option must be numeric or array of exactly 2 numbers."
+ );
+ }
+ if (entry === 0) {
+ return;
+ }
+ if (!Array.isArray(entry)) {
+ entry = [entry, entry];
+ }
+ // 'getDistance' returns false for invalid values.
+ parsed.padding = [
+ parsed.spectrum.getDistance(entry[0]),
+ parsed.spectrum.getDistance(entry[1]),
+ ];
+ for (
+ index = 0;
+ index < parsed.spectrum.xNumSteps.length - 1;
+ index++
+ ) {
+ // last "range" can't contain step size as it is purely an endpoint.
+ if (
+ parsed.padding[0][index] < 0 ||
+ parsed.padding[1][index] < 0
+ ) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'padding' option must be a positive number(s)."
+ );
+ }
+ }
+ var totalPadding = entry[0] + entry[1];
+ var firstValue = parsed.spectrum.xVal[0];
+ var lastValue =
+ parsed.spectrum.xVal[parsed.spectrum.xVal.length - 1];
+ if (totalPadding / (lastValue - firstValue) > 1) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'padding' option must not exceed 100% of the range."
+ );
+ }
+ }
+ function customRangeDirection(parsed, entry) {
+ // Set direction as a numerical value for easy parsing.
+ // Invert connection for RTL sliders, so that the proper
+ // handles get the connect/background classes.
+ switch (entry) {
+ case 'ltr':
+ parsed.dir = 0;
+ break;
+ case 'rtl':
+ parsed.dir = 1;
+ break;
+ default:
+ throw new Error(
+ "directoristCustomRangeSlider: 'direction' option was not recognized."
+ );
+ }
+ }
+ function customRangeBehaviour(parsed, entry) {
+ // Make sure the input is a string.
+ if (typeof entry !== 'string') {
+ throw new Error(
+ "directoristCustomRangeSlider: 'behaviour' must be a string containing options."
+ );
+ }
+ // Check if the string contains any keywords.
+ // None are required.
+ var tap = entry.indexOf('tap') >= 0;
+ var drag = entry.indexOf('drag') >= 0;
+ var fixed = entry.indexOf('fixed') >= 0;
+ var snap = entry.indexOf('snap') >= 0;
+ var hover = entry.indexOf('hover') >= 0;
+ var unconstrained = entry.indexOf('unconstrained') >= 0;
+ var dragAll = entry.indexOf('drag-all') >= 0;
+ var smoothSteps = entry.indexOf('smooth-steps') >= 0;
+ if (fixed) {
+ if (parsed.handles !== 2) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'fixed' behaviour must be used with 2 handles"
+ );
+ }
+ // Use margin to enforce fixed state
+ customRangeMargin(
+ parsed,
+ parsed.start[1] - parsed.start[0]
+ );
+ }
+ if (unconstrained && (parsed.margin || parsed.limit)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'unconstrained' behaviour cannot be used with margin or limit"
+ );
+ }
+ parsed.events = {
+ tap: tap || snap,
+ drag: drag,
+ dragAll: dragAll,
+ smoothSteps: smoothSteps,
+ fixed: fixed,
+ snap: snap,
+ hover: hover,
+ unconstrained: unconstrained,
+ };
+ }
+ function customRangeTooltips(parsed, entry) {
+ if (entry === false) {
+ return;
+ }
+ if (entry === true || isValidPartialFormatter(entry)) {
+ parsed.tooltips = [];
+ for (var i = 0; i < parsed.handles; i++) {
+ parsed.tooltips.push(entry);
+ }
+ } else {
+ entry = asArray(entry);
+ if (entry.length !== parsed.handles) {
+ throw new Error(
+ 'directoristCustomRangeSlider: must pass a formatter for all handles.'
+ );
+ }
+ entry.forEach(function (formatter) {
+ if (
+ typeof formatter !== 'boolean' &&
+ !isValidPartialFormatter(formatter)
+ ) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'tooltips' must be passed a formatter or 'false'."
+ );
+ }
+ });
+ parsed.tooltips = entry;
+ }
+ }
+ function customRangeHandleAttributes(parsed, entry) {
+ if (entry.length !== parsed.handles) {
+ throw new Error(
+ 'directoristCustomRangeSlider: must pass a attributes for all handles.'
+ );
+ }
+ parsed.handleAttributes = entry;
+ }
+ function customRangeAriaFormat(parsed, entry) {
+ if (!isValidPartialFormatter(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'ariaFormat' requires 'to' method."
+ );
+ }
+ parsed.ariaFormat = entry;
+ }
+ function customRangeFormat(parsed, entry) {
+ if (!isValidFormatter(entry)) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'format' requires 'to' and 'from' methods."
+ );
+ }
+ parsed.format = entry;
+ }
+ function customRangeKeyboardSupport(parsed, entry) {
+ if (typeof entry !== 'boolean') {
+ throw new Error(
+ "directoristCustomRangeSlider: 'keyboardSupport' option must be a boolean."
+ );
+ }
+ parsed.keyboardSupport = entry;
+ }
+ function customRangeDocumentElement(parsed, entry) {
+ // This is an advanced option. Passed values are used without validation.
+ parsed.documentElement = entry;
+ }
+ function customRangeCssPrefix(parsed, entry) {
+ if (typeof entry !== 'string' && entry !== false) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'cssPrefix' must be a string or `false`."
+ );
+ }
+ parsed.cssPrefix = entry;
+ }
+ function customRangeCssClasses(parsed, entry) {
+ if (
+ (0,
+ _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(entry) !== 'object'
+ ) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'cssClasses' must be an object."
+ );
+ }
+ if (typeof parsed.cssPrefix === 'string') {
+ parsed.cssClasses = {};
+ Object.keys(entry).forEach(function (key) {
+ parsed.cssClasses[key] = parsed.cssPrefix + entry[key];
+ });
+ } else {
+ parsed.cssClasses = entry;
+ }
+ }
+ // Test all developer settings and parse to assumption-safe values.
+ function customRangeOptions(options) {
+ // To prove a fix for #537, freeze options here.
+ // If the object is modified, an error will be thrown.
+ // Object.freeze(options);
+ var parsed = {
+ margin: null,
+ limit: null,
+ padding: null,
+ animate: true,
+ animationDuration: 300,
+ ariaFormat: defaultFormatter,
+ format: defaultFormatter,
+ };
+ // Tests are executed in the order they are presented here.
+ var customRanges = {
+ step: {
+ r: false,
+ t: customRangeStep,
+ },
+ keyboardPageMultiplier: {
+ r: false,
+ t: customRangeKeyboardPageMultiplier,
+ },
+ keyboardMultiplier: {
+ r: false,
+ t: customRangeKeyboardMultiplier,
+ },
+ keyboardDefaultStep: {
+ r: false,
+ t: customRangeKeyboardDefaultStep,
+ },
+ start: {
+ r: true,
+ t: customRangeStart,
+ },
+ connect: {
+ r: true,
+ t: customRangeConnect,
+ },
+ direction: {
+ r: true,
+ t: customRangeDirection,
+ },
+ snap: {
+ r: false,
+ t: customRangeSnap,
+ },
+ animate: {
+ r: false,
+ t: customRangeAnimate,
+ },
+ animationDuration: {
+ r: false,
+ t: customRangeAnimationDuration,
+ },
+ range: {
+ r: true,
+ t: customRangeRange,
+ },
+ orientation: {
+ r: false,
+ t: customRangeOrientation,
+ },
+ margin: {
+ r: false,
+ t: customRangeMargin,
+ },
+ limit: {
+ r: false,
+ t: customRangeLimit,
+ },
+ padding: {
+ r: false,
+ t: customRangePadding,
+ },
+ behaviour: {
+ r: true,
+ t: customRangeBehaviour,
+ },
+ ariaFormat: {
+ r: false,
+ t: customRangeAriaFormat,
+ },
+ format: {
+ r: false,
+ t: customRangeFormat,
+ },
+ tooltips: {
+ r: false,
+ t: customRangeTooltips,
+ },
+ keyboardSupport: {
+ r: true,
+ t: customRangeKeyboardSupport,
+ },
+ documentElement: {
+ r: false,
+ t: customRangeDocumentElement,
+ },
+ cssPrefix: {
+ r: true,
+ t: customRangeCssPrefix,
+ },
+ cssClasses: {
+ r: true,
+ t: customRangeCssClasses,
+ },
+ handleAttributes: {
+ r: false,
+ t: customRangeHandleAttributes,
+ },
+ };
+ var defaults = {
+ connect: false,
+ direction: 'ltr',
+ behaviour: 'tap',
+ orientation: 'horizontal',
+ keyboardSupport: true,
+ cssPrefix: 'directorist-custom-range-slider-',
+ cssClasses: cssClasses,
+ keyboardPageMultiplier: 5,
+ keyboardMultiplier: 1,
+ keyboardDefaultStep: 10,
+ };
+ // AriaFormat defaults to regular format, if any.
+ if (options.format && !options.ariaFormat) {
+ options.ariaFormat = options.format;
+ }
+ // Run all options through a testing mechanism to ensure correct
+ // input. It should be noted that options might get modified to
+ // be handled properly. E.g. wrapping integers in arrays.
+ Object.keys(customRanges).forEach(function (name) {
+ // If the option isn't set, but it is required, throw an error.
+ if (!isSet(options[name]) && defaults[name] === undefined) {
+ if (customRanges[name].r) {
+ throw new Error(
+ "directoristCustomRangeSlider: '" +
+ name +
+ "' is required."
+ );
+ }
+ return;
+ }
+ customRanges[name].t(
+ parsed,
+ !isSet(options[name]) ? defaults[name] : options[name]
+ );
+ });
+ // Forward pips options
+ parsed.pips = options.pips;
+ // All recent browsers accept unprefixed transform.
+ // We need -ms- for IE9 and -webkit- for older Android;
+ // Assume use of -webkit- if unprefixed and -ms- are not supported.
+ // https://caniuse.com/#feat=transforms2d
+ var d = document.createElement('div');
+ var msPrefix = d.style.msTransform !== undefined;
+ var noPrefix = d.style.transform !== undefined;
+ parsed.transformRule = noPrefix
+ ? 'transform'
+ : msPrefix
+ ? 'msTransform'
+ : 'webkitTransform';
+ // Pips don't move, so we can place them using left/top.
+ var styles = [
+ ['left', 'top'],
+ ['right', 'bottom'],
+ ];
+ parsed.style = styles[parsed.dir][parsed.ort];
+ return parsed;
+ }
+ //endregion
+ function scope(target, options, originalOptions) {
+ var actions = getActions();
+ var supportsTouchActionNone = getSupportsTouchActionNone();
+ var supportsPassive =
+ supportsTouchActionNone && getSupportsPassive();
+ // All variables local to 'scope' are prefixed with 'scope_'
+ // Slider DOM Nodes
+ var scope_Target = target;
+ var scope_Base;
+ var scope_Handles;
+ var scope_Connects;
+ var scope_Pips;
+ var scope_Tooltips;
+ // Slider state values
+ var scope_Spectrum = options.spectrum;
+ var scope_Values = [];
+ var scope_Locations = [];
+ var scope_HandleNumbers = [];
+ var scope_ActiveHandlesCount = 0;
+ var scope_Events = {};
+ // Document Nodes
+ var scope_Document = target.ownerDocument;
+ var scope_DocumentElement =
+ options.documentElement || scope_Document.documentElement;
+ var scope_Body = scope_Document.body;
+ // For horizontal sliders in standard ltr documents,
+ // make .directorist-custom-range-slider-origin overflow to the left so the document doesn't scroll.
+ var scope_DirOffset =
+ scope_Document.dir === 'rtl' || options.ort === 1 ? 0 : 100;
+ // Creates a node, adds it to target, returns the new node.
+ function addNodeTo(addTarget, className) {
+ var div = scope_Document.createElement('div');
+ if (className) {
+ addClass(div, className);
+ }
+ addTarget.appendChild(div);
+ return div;
+ }
+ // Append a origin to the base
+ function addOrigin(base, handleNumber) {
+ var origin = addNodeTo(base, options.cssClasses.origin);
+ var handle = addNodeTo(origin, options.cssClasses.handle);
+ addNodeTo(handle, options.cssClasses.touchArea);
+ handle.setAttribute('data-handle', String(handleNumber));
+ if (options.keyboardSupport) {
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
+ // 0 = focusable and reachable
+ handle.setAttribute('tabindex', '0');
+ handle.addEventListener('keydown', function (event) {
+ return eventKeydown(event, handleNumber);
+ });
+ }
+ if (options.handleAttributes !== undefined) {
+ var attributes_1 =
+ options.handleAttributes[handleNumber];
+ Object.keys(attributes_1).forEach(function (attribute) {
+ handle.setAttribute(
+ attribute,
+ attributes_1[attribute]
+ );
+ });
+ }
+ handle.setAttribute('role', 'slider');
+ handle.setAttribute(
+ 'aria-orientation',
+ options.ort ? 'vertical' : 'horizontal'
+ );
+ if (handleNumber === 0) {
+ addClass(handle, options.cssClasses.handleLower);
+ } else if (handleNumber === options.handles - 1) {
+ addClass(handle, options.cssClasses.handleUpper);
+ }
+ origin.handle = handle;
+ return origin;
+ }
+ // Insert nodes for connect elements
+ function addConnect(base, add) {
+ if (!add) {
+ return false;
+ }
+ return addNodeTo(base, options.cssClasses.connect);
+ }
+ // Add handles to the slider base.
+ function addElements(connectOptions, base) {
+ var connectBase = addNodeTo(
+ base,
+ options.cssClasses.connects
+ );
+ scope_Handles = [];
+ scope_Connects = [];
+ scope_Connects.push(
+ addConnect(connectBase, connectOptions[0])
+ );
+ // [::::O====O====O====]
+ // connectOptions = [0, 1, 1, 1]
+ for (var i = 0; i < options.handles; i++) {
+ // Keep a list of all added handles.
+ scope_Handles.push(addOrigin(base, i));
+ scope_HandleNumbers[i] = i;
+ scope_Connects.push(
+ addConnect(connectBase, connectOptions[i + 1])
+ );
+ }
+ }
+ // Initialize a single slider.
+ function addSlider(addTarget) {
+ // Apply classes and data to the target.
+ addClass(addTarget, options.cssClasses.target);
+ if (options.dir === 0) {
+ addClass(addTarget, options.cssClasses.ltr);
+ } else {
+ addClass(addTarget, options.cssClasses.rtl);
+ }
+ if (options.ort === 0) {
+ addClass(addTarget, options.cssClasses.horizontal);
+ } else {
+ addClass(addTarget, options.cssClasses.vertical);
+ }
+ var textDirection = getComputedStyle(addTarget).direction;
+ if (textDirection === 'rtl') {
+ addClass(
+ addTarget,
+ options.cssClasses.textDirectionRtl
+ );
+ } else {
+ addClass(
+ addTarget,
+ options.cssClasses.textDirectionLtr
+ );
+ }
+ return addNodeTo(addTarget, options.cssClasses.base);
+ }
+ function addTooltip(handle, handleNumber) {
+ if (!options.tooltips || !options.tooltips[handleNumber]) {
+ return false;
+ }
+ return addNodeTo(
+ handle.firstChild,
+ options.cssClasses.tooltip
+ );
+ }
+ function isSliderDisabled() {
+ return scope_Target.hasAttribute('disabled');
+ }
+ // Disable the slider dragging if any handle is disabled
+ function isHandleDisabled(handleNumber) {
+ var handleOrigin = scope_Handles[handleNumber];
+ return handleOrigin.hasAttribute('disabled');
+ }
+ function disable(handleNumber) {
+ if (handleNumber !== null && handleNumber !== undefined) {
+ scope_Handles[handleNumber].setAttribute(
+ 'disabled',
+ ''
+ );
+ scope_Handles[handleNumber].handle.removeAttribute(
+ 'tabindex'
+ );
+ } else {
+ scope_Target.setAttribute('disabled', '');
+ scope_Handles.forEach(function (handle) {
+ handle.handle.removeAttribute('tabindex');
+ });
+ }
+ }
+ function enable(handleNumber) {
+ if (handleNumber !== null && handleNumber !== undefined) {
+ scope_Handles[handleNumber].removeAttribute('disabled');
+ scope_Handles[handleNumber].handle.setAttribute(
+ 'tabindex',
+ '0'
+ );
+ } else {
+ scope_Target.removeAttribute('disabled');
+ scope_Handles.forEach(function (handle) {
+ handle.removeAttribute('disabled');
+ handle.handle.setAttribute('tabindex', '0');
+ });
+ }
+ }
+ function removeTooltips() {
+ if (scope_Tooltips) {
+ removeEvent('update' + INTERNAL_EVENT_NS.tooltips);
+ scope_Tooltips.forEach(function (tooltip) {
+ if (tooltip) {
+ removeElement(tooltip);
+ }
+ });
+ scope_Tooltips = null;
+ }
+ }
+ // The tooltips option is a shorthand for using the 'update' event.
+ function tooltips() {
+ removeTooltips();
+ // Tooltips are added with options.tooltips in original order.
+ scope_Tooltips = scope_Handles.map(addTooltip);
+ bindEvent(
+ 'update' + INTERNAL_EVENT_NS.tooltips,
+ function (values, handleNumber, unencoded) {
+ if (!scope_Tooltips || !options.tooltips) {
+ return;
+ }
+ if (scope_Tooltips[handleNumber] === false) {
+ return;
+ }
+ var formattedValue = values[handleNumber];
+ if (options.tooltips[handleNumber] !== true) {
+ formattedValue = options.tooltips[
+ handleNumber
+ ].to(unencoded[handleNumber]);
+ }
+ scope_Tooltips[handleNumber].innerHTML =
+ formattedValue;
+ }
+ );
+ }
+ function aria() {
+ removeEvent('update' + INTERNAL_EVENT_NS.aria);
+ bindEvent(
+ 'update' + INTERNAL_EVENT_NS.aria,
+ function (
+ values,
+ handleNumber,
+ unencoded,
+ tap,
+ positions
+ ) {
+ // Update Aria Values for all handles, as a change in one changes min and max values for the next.
+ scope_HandleNumbers.forEach(function (index) {
+ var handle = scope_Handles[index];
+ var min = checkHandlePosition(
+ scope_Locations,
+ index,
+ 0,
+ true,
+ true,
+ true
+ );
+ var max = checkHandlePosition(
+ scope_Locations,
+ index,
+ 100,
+ true,
+ true,
+ true
+ );
+ var now = positions[index];
+ // Formatted value for display
+ var text = String(
+ options.ariaFormat.to(unencoded[index])
+ );
+ // Map to slider range values
+ min = scope_Spectrum
+ .fromStepping(min)
+ .toFixed(1);
+ max = scope_Spectrum
+ .fromStepping(max)
+ .toFixed(1);
+ now = scope_Spectrum
+ .fromStepping(now)
+ .toFixed(1);
+ handle.children[0].setAttribute(
+ 'aria-valuemin',
+ min
+ );
+ handle.children[0].setAttribute(
+ 'aria-valuemax',
+ max
+ );
+ handle.children[0].setAttribute(
+ 'aria-valuenow',
+ now
+ );
+ handle.children[0].setAttribute(
+ 'aria-valuetext',
+ text
+ );
+ });
+ }
+ );
+ }
+ function getGroup(pips) {
+ // Use the range.
+ if (
+ pips.mode === exports.PipsMode.Range ||
+ pips.mode === exports.PipsMode.Steps
+ ) {
+ return scope_Spectrum.xVal;
+ }
+ if (pips.mode === exports.PipsMode.Count) {
+ if (pips.values < 2) {
+ throw new Error(
+ "directoristCustomRangeSlider: 'values' (>= 2) required for mode 'count'."
+ );
+ }
+ // Divide 0 - 100 in 'count' parts.
+ var interval = pips.values - 1;
+ var spread = 100 / interval;
+ var values = [];
+ // List these parts and have them handled as 'positions'.
+ while (interval--) {
+ values[interval] = interval * spread;
+ }
+ values.push(100);
+ return mapToRange(values, pips.stepped);
+ }
+ if (pips.mode === exports.PipsMode.Positions) {
+ // Map all percentages to on-range values.
+ return mapToRange(pips.values, pips.stepped);
+ }
+ if (pips.mode === exports.PipsMode.Values) {
+ // If the value must be stepped, it needs to be converted to a percentage first.
+ if (pips.stepped) {
+ return pips.values.map(function (value) {
+ // Convert to percentage, apply step, return to value.
+ return scope_Spectrum.fromStepping(
+ scope_Spectrum.getStep(
+ scope_Spectrum.toStepping(value)
+ )
+ );
+ });
+ }
+ // Otherwise, we can simply use the values.
+ return pips.values;
+ }
+ return []; // pips.mode = never
+ }
+ function mapToRange(values, stepped) {
+ return values.map(function (value) {
+ return scope_Spectrum.fromStepping(
+ stepped ? scope_Spectrum.getStep(value) : value
+ );
+ });
+ }
+ function generateSpread(pips) {
+ function safeIncrement(value, increment) {
+ // Avoid floating point variance by dropping the smallest decimal places.
+ return Number((value + increment).toFixed(7));
+ }
+ var group = getGroup(pips);
+ var indexes = {};
+ var firstInRange = scope_Spectrum.xVal[0];
+ var lastInRange =
+ scope_Spectrum.xVal[scope_Spectrum.xVal.length - 1];
+ var ignoreFirst = false;
+ var ignoreLast = false;
+ var prevPct = 0;
+ // Create a copy of the group, sort it and filter away all duplicates.
+ group = unique(
+ group.slice().sort(function (a, b) {
+ return a - b;
+ })
+ );
+ // Make sure the range starts with the first element.
+ if (group[0] !== firstInRange) {
+ group.unshift(firstInRange);
+ ignoreFirst = true;
+ }
+ // Likewise for the last one.
+ if (group[group.length - 1] !== lastInRange) {
+ group.push(lastInRange);
+ ignoreLast = true;
+ }
+ group.forEach(function (current, index) {
+ // Get the current step and the lower + upper positions.
+ var step;
+ var i;
+ var q;
+ var low = current;
+ var high = group[index + 1];
+ var newPct;
+ var pctDifference;
+ var pctPos;
+ var type;
+ var steps;
+ var realSteps;
+ var stepSize;
+ var isSteps = pips.mode === exports.PipsMode.Steps;
+ // When using 'steps' mode, use the provided steps.
+ // Otherwise, we'll step on to the next subrange.
+ if (isSteps) {
+ step = scope_Spectrum.xNumSteps[index];
+ }
+ // Default to a 'full' step.
+ if (!step) {
+ step = high - low;
+ }
+ // If high is undefined we are at the last subrange. Make sure it iterates once (#1088)
+ if (high === undefined) {
+ high = low;
+ }
+ // Make sure step isn't 0, which would cause an infinite loop (#654)
+ step = Math.max(step, 0.0000001);
+ // Find all steps in the subrange.
+ for (i = low; i <= high; i = safeIncrement(i, step)) {
+ // Get the percentage value for the current step,
+ // calculate the size for the subrange.
+ newPct = scope_Spectrum.toStepping(i);
+ pctDifference = newPct - prevPct;
+ steps = pctDifference / (pips.density || 1);
+ realSteps = Math.round(steps);
+ // This ratio represents the amount of percentage-space a point indicates.
+ // For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-divided.
+ // Round the percentage offset to an even number, then divide by two
+ // to spread the offset on both sides of the range.
+ stepSize = pctDifference / realSteps;
+ // Divide all points evenly, adding the correct number to this subrange.
+ // Run up to <= so that 100% gets a point, event if ignoreLast is set.
+ for (q = 1; q <= realSteps; q += 1) {
+ // The ratio between the rounded value and the actual size might be ~1% off.
+ // Correct the percentage offset by the number of points
+ // per subrange. density = 1 will result in 100 points on the
+ // full range, 2 for 50, 4 for 25, etc.
+ pctPos = prevPct + q * stepSize;
+ indexes[pctPos.toFixed(5)] = [
+ scope_Spectrum.fromStepping(pctPos),
+ 0,
+ ];
+ }
+ // Determine the point type.
+ type =
+ group.indexOf(i) > -1
+ ? exports.PipsType.LargeValue
+ : isSteps
+ ? exports.PipsType.SmallValue
+ : exports.PipsType.NoValue;
+ // Enforce the 'ignoreFirst' option by overwriting the type for 0.
+ if (!index && ignoreFirst && i !== high) {
+ type = 0;
+ }
+ if (!(i === high && ignoreLast)) {
+ // Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.
+ indexes[newPct.toFixed(5)] = [i, type];
+ }
+ // Update the percentage count.
+ prevPct = newPct;
+ }
+ });
+ return indexes;
+ }
+ function addMarking(spread, filterFunc, formatter) {
+ var _a, _b;
+ var element = scope_Document.createElement('div');
+ var valueSizeClasses =
+ ((_a = {}),
+ (_a[exports.PipsType.None] = ''),
+ (_a[exports.PipsType.NoValue] =
+ options.cssClasses.valueNormal),
+ (_a[exports.PipsType.LargeValue] =
+ options.cssClasses.valueLarge),
+ (_a[exports.PipsType.SmallValue] =
+ options.cssClasses.valueSub),
+ _a);
+ var markerSizeClasses =
+ ((_b = {}),
+ (_b[exports.PipsType.None] = ''),
+ (_b[exports.PipsType.NoValue] =
+ options.cssClasses.markerNormal),
+ (_b[exports.PipsType.LargeValue] =
+ options.cssClasses.markerLarge),
+ (_b[exports.PipsType.SmallValue] =
+ options.cssClasses.markerSub),
+ _b);
+ var valueOrientationClasses = [
+ options.cssClasses.valueHorizontal,
+ options.cssClasses.valueVertical,
+ ];
+ var markerOrientationClasses = [
+ options.cssClasses.markerHorizontal,
+ options.cssClasses.markerVertical,
+ ];
+ addClass(element, options.cssClasses.pips);
+ addClass(
+ element,
+ options.ort === 0
+ ? options.cssClasses.pipsHorizontal
+ : options.cssClasses.pipsVertical
+ );
+ function getClasses(type, source) {
+ var a = source === options.cssClasses.value;
+ var orientationClasses = a
+ ? valueOrientationClasses
+ : markerOrientationClasses;
+ var sizeClasses = a
+ ? valueSizeClasses
+ : markerSizeClasses;
+ return (
+ source +
+ ' ' +
+ orientationClasses[options.ort] +
+ ' ' +
+ sizeClasses[type]
+ );
+ }
+ function addSpread(offset, value, type) {
+ // Apply the filter function, if it is set.
+ type = filterFunc ? filterFunc(value, type) : type;
+ if (type === exports.PipsType.None) {
+ return;
+ }
+ // Add a marker for every point
+ var node = addNodeTo(element, false);
+ node.className = getClasses(
+ type,
+ options.cssClasses.marker
+ );
+ node.style[options.style] = offset + '%';
+ // Values are only appended for points marked '1' or '2'.
+ if (type > exports.PipsType.NoValue) {
+ node = addNodeTo(element, false);
+ node.className = getClasses(
+ type,
+ options.cssClasses.value
+ );
+ node.setAttribute('data-value', String(value));
+ node.style[options.style] = offset + '%';
+ node.innerHTML = String(formatter.to(value));
+ }
+ }
+ // Append all points.
+ Object.keys(spread).forEach(function (offset) {
+ addSpread(offset, spread[offset][0], spread[offset][1]);
+ });
+ return element;
+ }
+ function removePips() {
+ if (scope_Pips) {
+ removeElement(scope_Pips);
+ scope_Pips = null;
+ }
+ }
+ function pips(pips) {
+ // Fix #669
+ removePips();
+ var spread = generateSpread(pips);
+ var filter = pips.filter;
+ var format = pips.format || {
+ to: function to(value) {
+ return String(Math.round(value));
+ },
+ };
+ scope_Pips = scope_Target.appendChild(
+ addMarking(spread, filter, format)
+ );
+ return scope_Pips;
+ }
+ // Shorthand for base dimensions.
+ function baseSize() {
+ var rect = scope_Base.getBoundingClientRect();
+ var alt = 'offset' + ['Width', 'Height'][options.ort];
+ return options.ort === 0
+ ? rect.width || scope_Base[alt]
+ : rect.height || scope_Base[alt];
+ }
+ // Handler for attaching events trough a proxy.
+ function attachEvent(events, element, callback, data) {
+ // This function can be used to 'filter' events to the slider.
+ // element is a node, not a nodeList
+ var method = function method(event) {
+ var e = fixEvent(
+ event,
+ data.pageOffset,
+ data.target || element
+ );
+ // fixEvent returns false if this event has a different target
+ // when handling (multi-) touch events;
+ if (!e) {
+ return false;
+ }
+ // doNotReject is passed by all end events to make sure released touches
+ // are not rejected, leaving the slider "stuck" to the cursor;
+ if (isSliderDisabled() && !data.doNotReject) {
+ return false;
+ }
+ // Stop if an active 'tap' transition is taking place.
+ if (
+ hasClass(scope_Target, options.cssClasses.tap) &&
+ !data.doNotReject
+ ) {
+ return false;
+ }
+ // Ignore right or middle clicks on start #454
+ if (
+ events === actions.start &&
+ e.buttons !== undefined &&
+ e.buttons > 1
+ ) {
+ return false;
+ }
+ // Ignore right or middle clicks on start #454
+ if (data.hover && e.buttons) {
+ return false;
+ }
+ // 'supportsPassive' is only true if a browser also supports touch-action: none in CSS.
+ // iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support
+ // touch-action: manipulation, but that allows panning, which breaks
+ // sliders after zooming/on non-responsive pages.
+ // See: https://bugs.webkit.org/show_bug.cgi?id=133112
+ if (!supportsPassive) {
+ e.preventDefault();
+ }
+ e.calcPoint = e.points[options.ort];
+ // Call the event handler with the event [ and additional data ].
+ callback(e, data);
+ return;
+ };
+ var methods = [];
+ // Bind a closure on the target for every event type.
+ events.split(' ').forEach(function (eventName) {
+ element.addEventListener(
+ eventName,
+ method,
+ supportsPassive
+ ? {
+ passive: true,
+ }
+ : false
+ );
+ methods.push([eventName, method]);
+ });
+ return methods;
+ }
+ // Provide a clean event with standardized offset values.
+ function fixEvent(e, pageOffset, eventTarget) {
+ // Filter the event to register the type, which can be
+ // touch, mouse or pointer. Offset changes need to be
+ // made on an event specific basis.
+ var touch = e.type.indexOf('touch') === 0;
+ var mouse = e.type.indexOf('mouse') === 0;
+ var pointer = e.type.indexOf('pointer') === 0;
+ var x = 0;
+ var y = 0;
+ // IE10 implemented pointer events with a prefix;
+ if (e.type.indexOf('MSPointer') === 0) {
+ pointer = true;
+ }
+ // Erroneous events seem to be passed in occasionally on iOS/iPadOS after user finishes interacting with
+ // the slider. They appear to be of type MouseEvent, yet they don't have usual properties set. Ignore
+ // events that have no touches or buttons associated with them. (#1057, #1079, #1095)
+ if (e.type === 'mousedown' && !e.buttons && !e.touches) {
+ return false;
+ }
+ // The only thing one handle should be concerned about is the touches that originated on top of it.
+ if (touch) {
+ // Returns true if a touch originated on the target.
+ var isTouchOnTarget = function isTouchOnTarget(
+ checkTouch
+ ) {
+ var target = checkTouch.target;
+ return (
+ target === eventTarget ||
+ eventTarget.contains(target) ||
+ (e.composed &&
+ e.composedPath().shift() === eventTarget)
+ );
+ };
+ // In the case of touchstart events, we need to make sure there is still no more than one
+ // touch on the target so we look amongst all touches.
+ if (e.type === 'touchstart') {
+ var targetTouches = Array.prototype.filter.call(
+ e.touches,
+ isTouchOnTarget
+ );
+ // Do not support more than one touch per handle.
+ if (targetTouches.length > 1) {
+ return false;
+ }
+ x = targetTouches[0].pageX;
+ y = targetTouches[0].pageY;
+ } else {
+ // In the other cases, find on changedTouches is enough.
+ var targetTouch = Array.prototype.find.call(
+ e.changedTouches,
+ isTouchOnTarget
+ );
+ // Cancel if the target touch has not moved.
+ if (!targetTouch) {
+ return false;
+ }
+ x = targetTouch.pageX;
+ y = targetTouch.pageY;
+ }
+ }
+ pageOffset = pageOffset || getPageOffset(scope_Document);
+ if (mouse || pointer) {
+ x = e.clientX + pageOffset.x;
+ y = e.clientY + pageOffset.y;
+ }
+ e.pageOffset = pageOffset;
+ e.points = [x, y];
+ e.cursor = mouse || pointer; // Fix #435
+ return e;
+ }
+ // Translate a coordinate in the document to a percentage on the slider
+ function calcPointToPercentage(calcPoint) {
+ var location = calcPoint - offset(scope_Base, options.ort);
+ var proposal = (location * 100) / baseSize();
+ // Clamp proposal between 0% and 100%
+ // Out-of-bound coordinates may occur when .directorist-custom-range-slider-base pseudo-elements
+ // are used (e.g. contained handles feature)
+ proposal = limit(proposal);
+ return options.dir ? 100 - proposal : proposal;
+ }
+ // Find handle closest to a certain percentage on the slider
+ function getClosestHandle(clickedPosition) {
+ var smallestDifference = 100;
+ var handleNumber = false;
+ scope_Handles.forEach(function (handle, index) {
+ // Disabled handles are ignored
+ if (isHandleDisabled(index)) {
+ return;
+ }
+ var handlePosition = scope_Locations[index];
+ var differenceWithThisHandle = Math.abs(
+ handlePosition - clickedPosition
+ );
+ // Initial state
+ var clickAtEdge =
+ differenceWithThisHandle === 100 &&
+ smallestDifference === 100;
+ // Difference with this handle is smaller than the previously checked handle
+ var isCloser =
+ differenceWithThisHandle < smallestDifference;
+ var isCloserAfter =
+ differenceWithThisHandle <= smallestDifference &&
+ clickedPosition > handlePosition;
+ if (isCloser || isCloserAfter || clickAtEdge) {
+ handleNumber = index;
+ smallestDifference = differenceWithThisHandle;
+ }
+ });
+ return handleNumber;
+ }
+ // Fire 'end' when a mouse or pen leaves the document.
+ function documentLeave(event, data) {
+ if (
+ event.type === 'mouseout' &&
+ event.target.nodeName === 'HTML' &&
+ event.relatedTarget === null
+ ) {
+ eventEnd(event, data);
+ }
+ }
+ // Handle movement on document for handle and range drag.
+ function eventMove(event, data) {
+ // Fix #498
+ // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).
+ // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero
+ // IE9 has .buttons and .which zero on mousemove.
+ // Firefox breaks the spec MDN defines.
+ if (
+ navigator.appVersion.indexOf('MSIE 9') === -1 &&
+ event.buttons === 0 &&
+ data.buttonsProperty !== 0
+ ) {
+ return eventEnd(event, data);
+ }
+ // Check if we are moving up or down
+ var movement =
+ (options.dir ? -1 : 1) *
+ (event.calcPoint - data.startCalcPoint);
+ // Convert the movement into a percentage of the slider width/height
+ var proposal = (movement * 100) / data.baseSize;
+ moveHandles(
+ movement > 0,
+ proposal,
+ data.locations,
+ data.handleNumbers,
+ data.connect
+ );
+ }
+ // Unbind move events on document, call callbacks.
+ function eventEnd(event, data) {
+ // The handle is no longer active, so remove the class.
+ if (data.handle) {
+ removeClass(data.handle, options.cssClasses.active);
+ scope_ActiveHandlesCount -= 1;
+ }
+ // Unbind the move and end events, which are added on 'start'.
+ data.listeners.forEach(function (c) {
+ scope_DocumentElement.removeEventListener(c[0], c[1]);
+ });
+ if (scope_ActiveHandlesCount === 0) {
+ // Remove dragging class.
+ removeClass(scope_Target, options.cssClasses.drag);
+ setZindex();
+ // Remove cursor styles and text-selection events bound to the body.
+ if (event.cursor) {
+ scope_Body.style.cursor = '';
+ scope_Body.removeEventListener(
+ 'selectstart',
+ preventDefault
+ );
+ }
+ }
+ if (options.events.smoothSteps) {
+ data.handleNumbers.forEach(function (handleNumber) {
+ setHandle(
+ handleNumber,
+ scope_Locations[handleNumber],
+ true,
+ true,
+ false,
+ false
+ );
+ });
+ data.handleNumbers.forEach(function (handleNumber) {
+ fireEvent('update', handleNumber);
+ });
+ }
+ data.handleNumbers.forEach(function (handleNumber) {
+ fireEvent('change', handleNumber);
+ fireEvent('set', handleNumber);
+ fireEvent('end', handleNumber);
+ });
+ }
+ // Bind move events on document.
+ function eventStart(event, data) {
+ // Ignore event if any handle is disabled
+ if (data.handleNumbers.some(isHandleDisabled)) {
+ return;
+ }
+ var handle;
+ if (data.handleNumbers.length === 1) {
+ var handleOrigin = scope_Handles[data.handleNumbers[0]];
+ handle = handleOrigin.children[0];
+ scope_ActiveHandlesCount += 1;
+ // Mark the handle as 'active' so it can be styled.
+ addClass(handle, options.cssClasses.active);
+ }
+ // A drag should never propagate up to the 'tap' event.
+ event.stopPropagation();
+ // Record the event listeners.
+ var listeners = [];
+ // Attach the move and end events.
+ var moveEvent = attachEvent(
+ actions.move,
+ scope_DocumentElement,
+ eventMove,
+ {
+ // The event target has changed so we need to propagate the original one so that we keep
+ // relying on it to extract target touches.
+ target: event.target,
+ handle: handle,
+ connect: data.connect,
+ listeners: listeners,
+ startCalcPoint: event.calcPoint,
+ baseSize: baseSize(),
+ pageOffset: event.pageOffset,
+ handleNumbers: data.handleNumbers,
+ buttonsProperty: event.buttons,
+ locations: scope_Locations.slice(),
+ }
+ );
+ var endEvent = attachEvent(
+ actions.end,
+ scope_DocumentElement,
+ eventEnd,
+ {
+ target: event.target,
+ handle: handle,
+ listeners: listeners,
+ doNotReject: true,
+ handleNumbers: data.handleNumbers,
+ }
+ );
+ var outEvent = attachEvent(
+ 'mouseout',
+ scope_DocumentElement,
+ documentLeave,
+ {
+ target: event.target,
+ handle: handle,
+ listeners: listeners,
+ doNotReject: true,
+ handleNumbers: data.handleNumbers,
+ }
+ );
+ // We want to make sure we pushed the listeners in the listener list rather than creating
+ // a new one as it has already been passed to the event handlers.
+ listeners.push.apply(
+ listeners,
+ moveEvent.concat(endEvent, outEvent)
+ );
+ // Text selection isn't an issue on touch devices,
+ // so adding cursor styles can be skipped.
+ if (event.cursor) {
+ // Prevent the 'I' cursor and extend the range-drag cursor.
+ scope_Body.style.cursor = getComputedStyle(
+ event.target
+ ).cursor;
+ // Mark the target with a dragging state.
+ if (scope_Handles.length > 1) {
+ addClass(scope_Target, options.cssClasses.drag);
+ }
+ // Prevent text selection when dragging the handles.
+ // In directoristCustomRangeSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move,
+ // which is scroll blocking. The selectstart event is supported by FireFox starting from version 52,
+ // meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there.
+ // The 'cursor' flag is false.
+ // See: http://caniuse.com/#search=selectstart
+ scope_Body.addEventListener(
+ 'selectstart',
+ preventDefault,
+ false
+ );
+ }
+ data.handleNumbers.forEach(function (handleNumber) {
+ fireEvent('start', handleNumber);
+ });
+ }
+ // Move closest handle to tapped location.
+ function eventTap(event) {
+ // The tap event shouldn't propagate up
+ event.stopPropagation();
+ var proposal = calcPointToPercentage(event.calcPoint);
+ var handleNumber = getClosestHandle(proposal);
+ // Tackle the case that all handles are 'disabled'.
+ if (handleNumber === false) {
+ return;
+ }
+ // Flag the slider as it is now in a transitional state.
+ // Transition takes a configurable amount of ms (default 300). Re-enable the slider after that.
+ if (!options.events.snap) {
+ addClassFor(
+ scope_Target,
+ options.cssClasses.tap,
+ options.animationDuration
+ );
+ }
+ setHandle(handleNumber, proposal, true, true);
+ setZindex();
+ fireEvent('slide', handleNumber, true);
+ fireEvent('update', handleNumber, true);
+ if (!options.events.snap) {
+ fireEvent('change', handleNumber, true);
+ fireEvent('set', handleNumber, true);
+ } else {
+ eventStart(event, {
+ handleNumbers: [handleNumber],
+ });
+ }
+ }
+ // Fires a 'hover' event for a hovered mouse/pen position.
+ function eventHover(event) {
+ var proposal = calcPointToPercentage(event.calcPoint);
+ var to = scope_Spectrum.getStep(proposal);
+ var value = scope_Spectrum.fromStepping(to);
+ Object.keys(scope_Events).forEach(function (targetEvent) {
+ if ('hover' === targetEvent.split('.')[0]) {
+ scope_Events[targetEvent].forEach(
+ function (callback) {
+ callback.call(scope_Self, value);
+ }
+ );
+ }
+ });
+ }
+ // Handles keydown on focused handles
+ // Don't move the document when pressing arrow keys on focused handles
+ function eventKeydown(event, handleNumber) {
+ if (isSliderDisabled() || isHandleDisabled(handleNumber)) {
+ return false;
+ }
+ var horizontalKeys = ['Left', 'Right'];
+ var verticalKeys = ['Down', 'Up'];
+ var largeStepKeys = ['PageDown', 'PageUp'];
+ var edgeKeys = ['Home', 'End'];
+ if (options.dir && !options.ort) {
+ // On an right-to-left slider, the left and right keys act inverted
+ horizontalKeys.reverse();
+ } else if (options.ort && !options.dir) {
+ // On a top-to-bottom slider, the up and down keys act inverted
+ verticalKeys.reverse();
+ largeStepKeys.reverse();
+ }
+ // Strip "Arrow" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
+ var key = event.key.replace('Arrow', '');
+ var isLargeDown = key === largeStepKeys[0];
+ var isLargeUp = key === largeStepKeys[1];
+ var isDown =
+ key === verticalKeys[0] ||
+ key === horizontalKeys[0] ||
+ isLargeDown;
+ var isUp =
+ key === verticalKeys[1] ||
+ key === horizontalKeys[1] ||
+ isLargeUp;
+ var isMin = key === edgeKeys[0];
+ var isMax = key === edgeKeys[1];
+ if (!isDown && !isUp && !isMin && !isMax) {
+ return true;
+ }
+ event.preventDefault();
+ var to;
+ if (isUp || isDown) {
+ var direction = isDown ? 0 : 1;
+ var steps = getNextStepsForHandle(handleNumber);
+ var step = steps[direction];
+ // At the edge of a slider, do nothing
+ if (step === null) {
+ return false;
+ }
+ // No step set, use the default of 10% of the sub-range
+ if (step === false) {
+ step = scope_Spectrum.getDefaultStep(
+ scope_Locations[handleNumber],
+ isDown,
+ options.keyboardDefaultStep
+ );
+ }
+ if (isLargeUp || isLargeDown) {
+ step *= options.keyboardPageMultiplier;
+ } else {
+ step *= options.keyboardMultiplier;
+ }
+ // Step over zero-length ranges (#948);
+ step = Math.max(step, 0.0000001);
+ // Decrement for down steps
+ step = (isDown ? -1 : 1) * step;
+ to = scope_Values[handleNumber] + step;
+ } else if (isMax) {
+ // End key
+ to =
+ options.spectrum.xVal[
+ options.spectrum.xVal.length - 1
+ ];
+ } else {
+ // Home key
+ to = options.spectrum.xVal[0];
+ }
+ setHandle(
+ handleNumber,
+ scope_Spectrum.toStepping(to),
+ true,
+ true
+ );
+ fireEvent('slide', handleNumber);
+ fireEvent('update', handleNumber);
+ fireEvent('change', handleNumber);
+ fireEvent('set', handleNumber);
+ return false;
+ }
+ // Attach events to several slider parts.
+ function bindSliderEvents(behaviour) {
+ // Attach the standard drag event to the handles.
+ if (!behaviour.fixed) {
+ scope_Handles.forEach(function (handle, index) {
+ // These events are only bound to the visual handle
+ // element, not the 'real' origin element.
+ attachEvent(
+ actions.start,
+ handle.children[0],
+ eventStart,
+ {
+ handleNumbers: [index],
+ }
+ );
+ });
+ }
+ // Attach the tap event to the slider base.
+ if (behaviour.tap) {
+ attachEvent(actions.start, scope_Base, eventTap, {});
+ }
+ // Fire hover events
+ if (behaviour.hover) {
+ attachEvent(actions.move, scope_Base, eventHover, {
+ hover: true,
+ });
+ }
+ // Make the range draggable.
+ if (behaviour.drag) {
+ scope_Connects.forEach(function (connect, index) {
+ if (
+ connect === false ||
+ index === 0 ||
+ index === scope_Connects.length - 1
+ ) {
+ return;
+ }
+ var handleBefore = scope_Handles[index - 1];
+ var handleAfter = scope_Handles[index];
+ var eventHolders = [connect];
+ var handlesToDrag = [handleBefore, handleAfter];
+ var handleNumbersToDrag = [index - 1, index];
+ addClass(connect, options.cssClasses.draggable);
+ // When the range is fixed, the entire range can
+ // be dragged by the handles. The handle in the first
+ // origin will propagate the start event upward,
+ // but it needs to be bound manually on the other.
+ if (behaviour.fixed) {
+ eventHolders.push(handleBefore.children[0]);
+ eventHolders.push(handleAfter.children[0]);
+ }
+ if (behaviour.dragAll) {
+ handlesToDrag = scope_Handles;
+ handleNumbersToDrag = scope_HandleNumbers;
+ }
+ eventHolders.forEach(function (eventHolder) {
+ attachEvent(
+ actions.start,
+ eventHolder,
+ eventStart,
+ {
+ handles: handlesToDrag,
+ handleNumbers: handleNumbersToDrag,
+ connect: connect,
+ }
+ );
+ });
+ });
+ }
+ }
+ // Attach an event to this slider, possibly including a namespace
+ function bindEvent(namespacedEvent, callback) {
+ scope_Events[namespacedEvent] =
+ scope_Events[namespacedEvent] || [];
+ scope_Events[namespacedEvent].push(callback);
+ // If the event bound is 'update,' fire it immediately for all handles.
+ if (namespacedEvent.split('.')[0] === 'update') {
+ scope_Handles.forEach(function (a, index) {
+ fireEvent('update', index);
+ });
+ }
+ }
+ function isInternalNamespace(namespace) {
+ return (
+ namespace === INTERNAL_EVENT_NS.aria ||
+ namespace === INTERNAL_EVENT_NS.tooltips
+ );
+ }
+ // Undo attachment of event
+ function removeEvent(namespacedEvent) {
+ var event =
+ namespacedEvent && namespacedEvent.split('.')[0];
+ var namespace = event
+ ? namespacedEvent.substring(event.length)
+ : namespacedEvent;
+ Object.keys(scope_Events).forEach(function (bind) {
+ var tEvent = bind.split('.')[0];
+ var tNamespace = bind.substring(tEvent.length);
+ if (
+ (!event || event === tEvent) &&
+ (!namespace || namespace === tNamespace)
+ ) {
+ // only delete protected internal event if intentional
+ if (
+ !isInternalNamespace(tNamespace) ||
+ namespace === tNamespace
+ ) {
+ delete scope_Events[bind];
+ }
+ }
+ });
+ }
+ // External event handling
+ function fireEvent(eventName, handleNumber, tap) {
+ Object.keys(scope_Events).forEach(function (targetEvent) {
+ var eventType = targetEvent.split('.')[0];
+ if (eventName === eventType) {
+ scope_Events[targetEvent].forEach(
+ function (callback) {
+ callback.call(
+ // Use the slider public API as the scope ('this')
+ scope_Self,
+ // Return values as array, so arg_1[arg_2] is always valid.
+ scope_Values.map(options.format.to),
+ // Handle index, 0 or 1
+ handleNumber,
+ // Un-formatted slider values
+ scope_Values.slice(),
+ // Event is fired by tap, true or false
+ tap || false,
+ // Left offset of the handle, in relation to the slider
+ scope_Locations.slice(),
+ // add the slider public API to an accessible parameter when this is unavailable
+ scope_Self
+ );
+ }
+ );
+ }
+ });
+ }
+ // Split out the handle positioning logic so the Move event can use it, too
+ function checkHandlePosition(
+ reference,
+ handleNumber,
+ to,
+ lookBackward,
+ lookForward,
+ getValue,
+ smoothSteps
+ ) {
+ var distance;
+ // For sliders with multiple handles, limit movement to the other handle.
+ // Apply the margin option by adding it to the handle positions.
+ if (
+ scope_Handles.length > 1 &&
+ !options.events.unconstrained
+ ) {
+ if (lookBackward && handleNumber > 0) {
+ distance = scope_Spectrum.getAbsoluteDistance(
+ reference[handleNumber - 1],
+ options.margin,
+ false
+ );
+ to = Math.max(to, distance);
+ }
+ if (
+ lookForward &&
+ handleNumber < scope_Handles.length - 1
+ ) {
+ distance = scope_Spectrum.getAbsoluteDistance(
+ reference[handleNumber + 1],
+ options.margin,
+ true
+ );
+ to = Math.min(to, distance);
+ }
+ }
+ // The limit option has the opposite effect, limiting handles to a
+ // maximum distance from another. Limit must be > 0, as otherwise
+ // handles would be unmovable.
+ if (scope_Handles.length > 1 && options.limit) {
+ if (lookBackward && handleNumber > 0) {
+ distance = scope_Spectrum.getAbsoluteDistance(
+ reference[handleNumber - 1],
+ options.limit,
+ false
+ );
+ to = Math.min(to, distance);
+ }
+ if (
+ lookForward &&
+ handleNumber < scope_Handles.length - 1
+ ) {
+ distance = scope_Spectrum.getAbsoluteDistance(
+ reference[handleNumber + 1],
+ options.limit,
+ true
+ );
+ to = Math.max(to, distance);
+ }
+ }
+ // The padding option keeps the handles a certain distance from the
+ // edges of the slider. Padding must be > 0.
+ if (options.padding) {
+ if (handleNumber === 0) {
+ distance = scope_Spectrum.getAbsoluteDistance(
+ 0,
+ options.padding[0],
+ false
+ );
+ to = Math.max(to, distance);
+ }
+ if (handleNumber === scope_Handles.length - 1) {
+ distance = scope_Spectrum.getAbsoluteDistance(
+ 100,
+ options.padding[1],
+ true
+ );
+ to = Math.min(to, distance);
+ }
+ }
+ if (!smoothSteps) {
+ to = scope_Spectrum.getStep(to);
+ }
+ // Limit percentage to the 0 - 100 range
+ to = limit(to);
+ // Return false if handle can't move
+ if (to === reference[handleNumber] && !getValue) {
+ return false;
+ }
+ return to;
+ }
+ // Uses slider orientation to create CSS rules. a = base value;
+ function inRuleOrder(v, a) {
+ var o = options.ort;
+ return (o ? a : v) + ', ' + (o ? v : a);
+ }
+ // Moves handle(s) by a percentage
+ // (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...])
+ function moveHandles(
+ upward,
+ proposal,
+ locations,
+ handleNumbers,
+ connect
+ ) {
+ var proposals = locations.slice();
+ // Store first handle now, so we still have it in case handleNumbers is reversed
+ var firstHandle = handleNumbers[0];
+ var smoothSteps = options.events.smoothSteps;
+ var b = [!upward, upward];
+ var f = [upward, !upward];
+ // Copy handleNumbers so we don't change the dataset
+ handleNumbers = handleNumbers.slice();
+ // Check to see which handle is 'leading'.
+ // If that one can't move the second can't either.
+ if (upward) {
+ handleNumbers.reverse();
+ }
+ // Step 1: get the maximum percentage that any of the handles can move
+ if (handleNumbers.length > 1) {
+ handleNumbers.forEach(function (handleNumber, o) {
+ var to = checkHandlePosition(
+ proposals,
+ handleNumber,
+ proposals[handleNumber] + proposal,
+ b[o],
+ f[o],
+ false,
+ smoothSteps
+ );
+ // Stop if one of the handles can't move.
+ if (to === false) {
+ proposal = 0;
+ } else {
+ proposal = to - proposals[handleNumber];
+ proposals[handleNumber] = to;
+ }
+ });
+ }
+ // If using one handle, check backward AND forward
+ else {
+ b = f = [true];
+ }
+ var state = false;
+ // Step 2: Try to set the handles with the found percentage
+ handleNumbers.forEach(function (handleNumber, o) {
+ state =
+ setHandle(
+ handleNumber,
+ locations[handleNumber] + proposal,
+ b[o],
+ f[o],
+ false,
+ smoothSteps
+ ) || state;
+ });
+ // Step 3: If a handle moved, fire events
+ if (state) {
+ handleNumbers.forEach(function (handleNumber) {
+ fireEvent('update', handleNumber);
+ fireEvent('slide', handleNumber);
+ });
+ // If target is a connect, then fire drag event
+ if (connect != undefined) {
+ fireEvent('drag', firstHandle);
+ }
+ }
+ }
+ // Takes a base value and an offset. This offset is used for the connect bar size.
+ // In the initial design for this feature, the origin element was 1% wide.
+ // Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature
+ // in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223
+ function transformDirection(a, b) {
+ return options.dir ? 100 - a - b : a;
+ }
+ // Updates scope_Locations and scope_Values, updates visual state
+ function updateHandlePosition(handleNumber, to) {
+ // Update locations.
+ scope_Locations[handleNumber] = to;
+ // Convert the value to the slider stepping/range.
+ scope_Values[handleNumber] =
+ scope_Spectrum.fromStepping(to);
+ var translation =
+ transformDirection(to, 0) - scope_DirOffset;
+ var translateRule =
+ 'translate(' +
+ inRuleOrder(translation + '%', '0') +
+ ')';
+ scope_Handles[handleNumber].style[options.transformRule] =
+ translateRule;
+ updateConnect(handleNumber);
+ updateConnect(handleNumber + 1);
+ }
+ // Handles before the slider middle are stacked later = higher,
+ // Handles after the middle later is lower
+ // [[7] [8] .......... | .......... [5] [4]
+ function setZindex() {
+ scope_HandleNumbers.forEach(function (handleNumber) {
+ var dir = scope_Locations[handleNumber] > 50 ? -1 : 1;
+ var zIndex =
+ 3 + (scope_Handles.length + dir * handleNumber);
+ scope_Handles[handleNumber].style.zIndex =
+ String(zIndex);
+ });
+ }
+ // Test suggested values and apply margin, step.
+ // if exactInput is true, don't run checkHandlePosition, then the handle can be placed in between steps (#436)
+ function setHandle(
+ handleNumber,
+ to,
+ lookBackward,
+ lookForward,
+ exactInput,
+ smoothSteps
+ ) {
+ if (!exactInput) {
+ to = checkHandlePosition(
+ scope_Locations,
+ handleNumber,
+ to,
+ lookBackward,
+ lookForward,
+ false,
+ smoothSteps
+ );
+ }
+ if (to === false) {
+ return false;
+ }
+ updateHandlePosition(handleNumber, to);
+ return true;
+ }
+ // Updates style attribute for connect nodes
+ function updateConnect(index) {
+ // Skip connects set to false
+ if (!scope_Connects[index]) {
+ return;
+ }
+ var l = 0;
+ var h = 100;
+ if (index !== 0) {
+ l = scope_Locations[index - 1];
+ }
+ if (index !== scope_Connects.length - 1) {
+ h = scope_Locations[index];
+ }
+ // We use two rules:
+ // 'translate' to change the left/top offset;
+ // 'scale' to change the width of the element;
+ // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.directorist-custom-range-slider-base)
+ var connectWidth = h - l;
+ var translateRule = options.dir
+ ? 'translate(' + inRuleOrder(-l + '%', '0') + ')' // RTL
+ : 'translate(' + inRuleOrder(l + '%', '0') + ')'; // LTR
+ var scaleRule =
+ 'scale(' + inRuleOrder(connectWidth / 100, '1') + ')';
+ scope_Connects[index].style[options.transformRule] =
+ translateRule + ' ' + scaleRule;
+ }
+ // Parses value passed to .set method. Returns current value if not parse-able.
+ function resolveToValue(to, handleNumber) {
+ // Setting with null indicates an 'ignore'.
+ // Inputting 'false' is invalid.
+ if (to === null || to === false || to === undefined) {
+ return scope_Locations[handleNumber];
+ }
+ // If a formatted number was passed, attempt to decode it.
+ if (typeof to === 'number') {
+ to = String(to);
+ }
+ to = options.format.from(to);
+ if (to !== false) {
+ to = scope_Spectrum.toStepping(to);
+ }
+ // If parsing the number failed, use the current value.
+ if (to === false || isNaN(to)) {
+ return scope_Locations[handleNumber];
+ }
+ return to;
+ }
+ // Set the slider value.
+ function valueSet(input, fireSetEvent, exactInput) {
+ var values = asArray(input);
+ var isInit = scope_Locations[0] === undefined;
+ // Event fires by default
+ fireSetEvent =
+ fireSetEvent === undefined ? true : fireSetEvent;
+ // Animation is optional.
+ // Make sure the initial values were set before using animated placement.
+ if (options.animate && !isInit) {
+ addClassFor(
+ scope_Target,
+ options.cssClasses.tap,
+ options.animationDuration
+ );
+ }
+ // First pass, without lookAhead but with lookBackward. Values are set from left to right.
+ scope_HandleNumbers.forEach(function (handleNumber) {
+ setHandle(
+ handleNumber,
+ resolveToValue(values[handleNumber], handleNumber),
+ true,
+ false,
+ exactInput
+ );
+ });
+ var i = scope_HandleNumbers.length === 1 ? 0 : 1;
+ // Spread handles evenly across the slider if the range has no size (min=max)
+ if (isInit && scope_Spectrum.hasNoSize()) {
+ exactInput = true;
+ scope_Locations[0] = 0;
+ if (scope_HandleNumbers.length > 1) {
+ var space_1 =
+ 100 / (scope_HandleNumbers.length - 1);
+ scope_HandleNumbers.forEach(
+ function (handleNumber) {
+ scope_Locations[handleNumber] =
+ handleNumber * space_1;
+ }
+ );
+ }
+ }
+ // Secondary passes. Now that all base values are set, apply constraints.
+ // Iterate all handles to ensure constraints are applied for the entire slider (Issue #1009)
+ for (; i < scope_HandleNumbers.length; ++i) {
+ scope_HandleNumbers.forEach(function (handleNumber) {
+ setHandle(
+ handleNumber,
+ scope_Locations[handleNumber],
+ true,
+ true,
+ exactInput
+ );
+ });
+ }
+ setZindex();
+ scope_HandleNumbers.forEach(function (handleNumber) {
+ fireEvent('update', handleNumber);
+ // Fire the event only for handles that received a new value, as per #579
+ if (values[handleNumber] !== null && fireSetEvent) {
+ fireEvent('set', handleNumber);
+ }
+ });
+ }
+ // Reset slider to initial values
+ function valueReset(fireSetEvent) {
+ valueSet(options.start, fireSetEvent);
+ }
+ // Set value for a single handle
+ function valueSetHandle(
+ handleNumber,
+ value,
+ fireSetEvent,
+ exactInput
+ ) {
+ // Ensure numeric input
+ handleNumber = Number(handleNumber);
+ if (
+ !(
+ handleNumber >= 0 &&
+ handleNumber < scope_HandleNumbers.length
+ )
+ ) {
+ throw new Error(
+ 'directoristCustomRangeSlider: invalid handle number, got: ' +
+ handleNumber
+ );
+ }
+ // Look both backward and forward, since we don't want this handle to "push" other handles (#960);
+ // The exactInput argument can be used to ignore slider stepping (#436)
+ setHandle(
+ handleNumber,
+ resolveToValue(value, handleNumber),
+ true,
+ true,
+ exactInput
+ );
+ fireEvent('update', handleNumber);
+ if (fireSetEvent) {
+ fireEvent('set', handleNumber);
+ }
+ }
+ // Get the slider value.
+ function valueGet(unencoded) {
+ if (unencoded === void 0) {
+ unencoded = false;
+ }
+ if (unencoded) {
+ // return a copy of the raw values
+ return scope_Values.length === 1
+ ? scope_Values[0]
+ : scope_Values.slice(0);
+ }
+ var values = scope_Values.map(options.format.to);
+ // If only one handle is used, return a single value.
+ if (values.length === 1) {
+ return values[0];
+ }
+ return values;
+ }
+ // Removes classes from the root and empties it.
+ function destroy() {
+ // remove protected internal listeners
+ removeEvent(INTERNAL_EVENT_NS.aria);
+ removeEvent(INTERNAL_EVENT_NS.tooltips);
+ Object.keys(options.cssClasses).forEach(function (key) {
+ removeClass(scope_Target, options.cssClasses[key]);
+ });
+ while (scope_Target.firstChild) {
+ scope_Target.removeChild(scope_Target.firstChild);
+ }
+ delete scope_Target.directoristCustomRangeSlider;
+ }
+ function getNextStepsForHandle(handleNumber) {
+ var location = scope_Locations[handleNumber];
+ var nearbySteps = scope_Spectrum.getNearbySteps(location);
+ var value = scope_Values[handleNumber];
+ var increment = nearbySteps.thisStep.step;
+ var decrement = null;
+ // If snapped, directly use defined step value
+ if (options.snap) {
+ return [
+ value - nearbySteps.stepBefore.startValue || null,
+ nearbySteps.stepAfter.startValue - value || null,
+ ];
+ }
+ // If the next value in this step moves into the next step,
+ // the increment is the start of the next step - the current value
+ if (increment !== false) {
+ if (
+ value + increment >
+ nearbySteps.stepAfter.startValue
+ ) {
+ increment =
+ nearbySteps.stepAfter.startValue - value;
+ }
+ }
+ // If the value is beyond the starting point
+ if (value > nearbySteps.thisStep.startValue) {
+ decrement = nearbySteps.thisStep.step;
+ } else if (nearbySteps.stepBefore.step === false) {
+ decrement = false;
+ }
+ // If a handle is at the start of a step, it always steps back into the previous step first
+ else {
+ decrement = value - nearbySteps.stepBefore.highestStep;
+ }
+ // Now, if at the slider edges, there is no in/decrement
+ if (location === 100) {
+ increment = null;
+ } else if (location === 0) {
+ decrement = null;
+ }
+ // As per #391, the comparison for the decrement step can have some rounding issues.
+ var stepDecimals = scope_Spectrum.countStepDecimals();
+ // Round per #391
+ if (increment !== null && increment !== false) {
+ increment = Number(increment.toFixed(stepDecimals));
+ }
+ if (decrement !== null && decrement !== false) {
+ decrement = Number(decrement.toFixed(stepDecimals));
+ }
+ return [decrement, increment];
+ }
+ // Get the current step size for the slider.
+ function getNextSteps() {
+ return scope_HandleNumbers.map(getNextStepsForHandle);
+ }
+ // Updatable: margin, limit, padding, step, range, animate, snap
+ function updateOptions(optionsToUpdate, fireSetEvent) {
+ // Spectrum is created using the range, snap, direction and step options.
+ // 'snap' and 'step' can be updated.
+ // If 'snap' and 'step' are not passed, they should remain unchanged.
+ var v = valueGet();
+ var updateAble = [
+ 'margin',
+ 'limit',
+ 'padding',
+ 'range',
+ 'animate',
+ 'snap',
+ 'step',
+ 'format',
+ 'pips',
+ 'tooltips',
+ ];
+ // Only change options that we're actually passed to update.
+ updateAble.forEach(function (name) {
+ // Check for undefined. null removes the value.
+ if (optionsToUpdate[name] !== undefined) {
+ originalOptions[name] = optionsToUpdate[name];
+ }
+ });
+ var newOptions = customRangeOptions(originalOptions);
+ // Load new options into the slider state
+ updateAble.forEach(function (name) {
+ if (optionsToUpdate[name] !== undefined) {
+ options[name] = newOptions[name];
+ }
+ });
+ scope_Spectrum = newOptions.spectrum;
+ // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)
+ options.margin = newOptions.margin;
+ options.limit = newOptions.limit;
+ options.padding = newOptions.padding;
+ // Update pips, removes existing.
+ if (options.pips) {
+ pips(options.pips);
+ } else {
+ removePips();
+ }
+ // Update tooltips, removes existing.
+ if (options.tooltips) {
+ tooltips();
+ } else {
+ removeTooltips();
+ }
+ // Invalidate the current positioning so valueSet forces an update.
+ scope_Locations = [];
+ valueSet(
+ isSet(optionsToUpdate.start)
+ ? optionsToUpdate.start
+ : v,
+ fireSetEvent
+ );
+ }
+ // Initialization steps
+ function setupSlider() {
+ // Create the base element, initialize HTML and set classes.
+ // Add handles and connect elements.
+ scope_Base = addSlider(scope_Target);
+ addElements(options.connect, scope_Base);
+ // Attach user events.
+ bindSliderEvents(options.events);
+ // Use the public value method to set the start values.
+ valueSet(options.start);
+ if (options.pips) {
+ pips(options.pips);
+ }
+ if (options.tooltips) {
+ tooltips();
+ }
+ aria();
+ }
+ setupSlider();
+ var scope_Self = {
+ destroy: destroy,
+ steps: getNextSteps,
+ on: bindEvent,
+ off: removeEvent,
+ get: valueGet,
+ set: valueSet,
+ setHandle: valueSetHandle,
+ reset: valueReset,
+ disable: disable,
+ enable: enable,
+ // Exposed for unit testing, don't use this in your application.
+ __moveHandles: function __moveHandles(
+ upward,
+ proposal,
+ handleNumbers
+ ) {
+ moveHandles(
+ upward,
+ proposal,
+ scope_Locations,
+ handleNumbers
+ );
+ },
+ options: originalOptions,
+ updateOptions: updateOptions,
+ target: scope_Target,
+ removePips: removePips,
+ removeTooltips: removeTooltips,
+ getPositions: function getPositions() {
+ return scope_Locations.slice();
+ },
+ getTooltips: function getTooltips() {
+ return scope_Tooltips;
+ },
+ getOrigins: function getOrigins() {
+ return scope_Handles;
+ },
+ pips: pips, // Issue #594
+ };
+ return scope_Self;
+ }
+ // Run the standard initializer
+ function initialize(target, originalOptions) {
+ if (!target || !target.nodeName) {
+ throw new Error(
+ 'directoristCustomRangeSlider: create requires a single element, got: '.concat(
+ target
+ )
+ );
+ }
+ if (target.directoristCustomRangeSlider) {
+ throw new Error(
+ 'directoristCustomRangeSlider: Slider was already initialized.'
+ );
+ }
+ var options = customRangeOptions(originalOptions);
+ var api = scope(target, options, originalOptions);
+ target.directoristCustomRangeSlider = api;
+ return api;
+ }
+ var directoristCustomRangeSlider = {
+ __spectrum: Spectrum,
+ cssClasses: cssClasses,
+ create: initialize,
+ };
+ exports.create = initialize;
+ exports.cssClasses = cssClasses;
+ exports.default = directoristCustomRangeSlider;
+ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ });
+ })();
+ /******/
+})();
+//# sourceMappingURL=range-slider.js.map
diff --git a/assets/js/search-form.js b/assets/js/search-form.js
index e094c4c57..9ff968947 100644
--- a/assets/js/search-form.js
+++ b/assets/js/search-form.js
@@ -1,2940 +1,5109 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/components/debounce.js":
-/*!*****************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/components/debounce.js':
+ /*!*****************************************************!*\
!*** ./assets/src/js/global/components/debounce.js ***!
\*****************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ debounce; }
-/* harmony export */ });
-function debounce(func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/select2-custom-control.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ debounce;
+ },
+ /* harmony export */
+ }
+ );
+ function debounce(func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function later() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/select2-custom-control.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/global/components/select2-custom-control.js ***!
\*******************************************************************/
-/***/ (function() {
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-var $ = jQuery;
-window.addEventListener('load', waitAndInit);
-window.addEventListener('directorist-search-form-nav-tab-reloaded', waitAndInit);
-window.addEventListener('directorist-type-change', waitAndInit);
-window.addEventListener('directorist-instant-search-reloaded', waitAndInit);
-function waitAndInit() {
- setTimeout(init, 0);
-}
-
-// Initialize
-function init() {
- // Add custom dropdown toggle button
- selec2_add_custom_dropdown_toggle_button();
-
- // Add custom close button where needed
- selec2_add_custom_close_button_if_needed();
-
- // Add custom close button if field contains value on change
- $('.select2-hidden-accessible').on('change', function (e) {
- var value = $(this).children('option:selected').val();
- if (!value) {
- return;
- }
- selec2_add_custom_close_button($(this));
- var selectItems = this.parentElement.querySelectorAll('.select2-selection__choice');
- selectItems.forEach(function (item) {
- item.childNodes && item.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- item.title = modifiedString;
- }
- });
- });
- var customSelectItem = this.parentElement.querySelector('.select2-selection__rendered');
- customSelectItem.childNodes && customSelectItem.childNodes.forEach(function (node) {
- if (node.nodeType && node.nodeType === Node.TEXT_NODE) {
- var originalString = node.textContent;
- var modifiedString = originalString.replace(/^[\s\xa0]+/, '');
- node.textContent = modifiedString;
- }
- });
- });
-}
-function selec2_add_custom_dropdown_toggle_button() {
- // Remove Default
- $('.select2-selection__arrow').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container('.select2-hidden-accessible');
- if (!addon_container) {
- return;
- }
- var dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
- if (!dropdown.length) {
- // Add Dropdown Toggle Button
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/chevron-down.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var dropdownHTML = "".concat(iconHTML, " ");
- addon_container.append(dropdownHTML);
- }
- var selec2_custom_dropdown = addon_container.find('.directorist-select2-dropdown-toggle');
-
- // Toggle --is-open class
- $('.select2-hidden-accessible').on('select2:open', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.addClass('--is-open');
- });
- $('.select2-hidden-accessible').on('select2:close', function (e) {
- var dropdown_btn = $(this).next().find('.directorist-select2-dropdown-toggle');
- dropdown_btn.removeClass('--is-open');
- var dropdownParent = $(this).closest('.directorist-search-field');
- var renderTitle = $(this).next().find('.select2-selection__rendered').attr('title');
-
- // Check if renderTitle is empty and remove the focus class if so
- if (!renderTitle) {
- dropdownParent.removeClass('input-is-focused');
- } else {
- dropdownParent.addClass('input-has-value');
- }
- });
-
- // Toggle Dropdown
- selec2_custom_dropdown.on('click', function (e) {
- var isOpen = $(this).hasClass('--is-open');
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- if (isOpen) {
- field.select2('close');
- } else {
- field.select2('open');
- }
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_add_custom_close_button_if_needed() {
- var select2_fields = $('.select2-hidden-accessible');
- if (!select2_fields && !select2_fields.length) {
- return;
- }
- var _iterator = _createForOfIteratorHelper(select2_fields),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var field = _step.value;
- var value = $(field).children('option:selected').val();
- if (!value) {
- continue;
- }
- selec2_add_custom_close_button(field);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
-}
-function selec2_add_custom_close_button(field) {
- // Remove Default
- $('.select2-selection__clear').css({
- display: 'none'
- });
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove if already exists
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Add
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/times.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- addon_container.prepend("".concat(iconHTML, " "));
- var selec2_custom_close = addon_container.find('.directorist-select2-dropdown-close');
- selec2_custom_close.on('click', function (e) {
- var field = $(this).closest('.select2-container').siblings('select:enabled');
- field.val(null).trigger('change');
- addon_container.find('.directorist-select2-dropdown-close').remove();
- selec2_adjust_space_for_addons();
- });
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_remove_custom_close_button(field) {
- var addon_container = selec2_get_addon_container(field);
- if (!(addon_container && addon_container.length)) {
- return;
- }
-
- // Remove
- addon_container.find('.directorist-select2-dropdown-close').remove();
-
- // Adjust space for addons
- selec2_adjust_space_for_addons();
-}
-function selec2_get_addon_container(field) {
- var container = field ? $(field).next('.select2-container') : $('.select2-container');
- container = $(container).find('.directorist-select2-addons-area');
- if (!container.length) {
- $('.select2-container').append(' ');
- container = $('.select2-container').find('.directorist-select2-addons-area');
- }
- var container = field ? $(field).next('.select2-container') : null;
- if (!container) {
- return null;
- }
- var addonsArea = $(container).find('.directorist-select2-addons-area');
- if (!addonsArea.length) {
- container.append(' ');
- return container.find('.directorist-select2-addons-area');
- }
- return addonsArea;
-}
-function selec2_adjust_space_for_addons() {
- var container = $('.select2-container').find('.directorist-select2-addons-area');
- if (!container.length) {
- return;
- }
- var width = container.outerWidth();
- $('.select2-container').find('.select2-selection__rendered').css({
- 'padding-right': width + 'px'
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/global/components/setup-select2.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ var $ = jQuery;
+ window.addEventListener('load', waitAndInit);
+ window.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ waitAndInit
+ );
+ window.addEventListener('directorist-type-change', waitAndInit);
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ waitAndInit
+ );
+ function waitAndInit() {
+ setTimeout(init, 0);
+ }
+
+ // Initialize
+ function init() {
+ // Add custom dropdown toggle button
+ selec2_add_custom_dropdown_toggle_button();
+
+ // Add custom close button where needed
+ selec2_add_custom_close_button_if_needed();
+
+ // Add custom close button if field contains value on change
+ $('.select2-hidden-accessible').on('change', function (e) {
+ var value = $(this).children('option:selected').val();
+ if (!value) {
+ return;
+ }
+ selec2_add_custom_close_button($(this));
+ var selectItems = this.parentElement.querySelectorAll(
+ '.select2-selection__choice'
+ );
+ selectItems.forEach(function (item) {
+ item.childNodes &&
+ item.childNodes.forEach(function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ item.title = modifiedString;
+ }
+ });
+ });
+ var customSelectItem = this.parentElement.querySelector(
+ '.select2-selection__rendered'
+ );
+ customSelectItem.childNodes &&
+ customSelectItem.childNodes.forEach(
+ function (node) {
+ if (
+ node.nodeType &&
+ node.nodeType === Node.TEXT_NODE
+ ) {
+ var originalString = node.textContent;
+ var modifiedString =
+ originalString.replace(
+ /^[\s\xa0]+/,
+ ''
+ );
+ node.textContent = modifiedString;
+ }
+ }
+ );
+ });
+ }
+ function selec2_add_custom_dropdown_toggle_button() {
+ // Remove Default
+ $('.select2-selection__arrow').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(
+ '.select2-hidden-accessible'
+ );
+ if (!addon_container) {
+ return;
+ }
+ var dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+ if (!dropdown.length) {
+ // Add Dropdown Toggle Button
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/chevron-down.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ var dropdownHTML =
+ ''.concat(
+ iconHTML,
+ ' '
+ );
+ addon_container.append(dropdownHTML);
+ }
+ var selec2_custom_dropdown = addon_container.find(
+ '.directorist-select2-dropdown-toggle'
+ );
+
+ // Toggle --is-open class
+ $('.select2-hidden-accessible').on(
+ 'select2:open',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.addClass('--is-open');
+ }
+ );
+ $('.select2-hidden-accessible').on(
+ 'select2:close',
+ function (e) {
+ var dropdown_btn = $(this)
+ .next()
+ .find('.directorist-select2-dropdown-toggle');
+ dropdown_btn.removeClass('--is-open');
+ var dropdownParent = $(this).closest(
+ '.directorist-search-field'
+ );
+ var renderTitle = $(this)
+ .next()
+ .find('.select2-selection__rendered')
+ .attr('title');
+
+ // Check if renderTitle is empty and remove the focus class if so
+ if (!renderTitle) {
+ dropdownParent.removeClass('input-is-focused');
+ } else {
+ dropdownParent.addClass('input-has-value');
+ }
+ }
+ );
+
+ // Toggle Dropdown
+ selec2_custom_dropdown.on('click', function (e) {
+ var isOpen = $(this).hasClass('--is-open');
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ if (isOpen) {
+ field.select2('close');
+ } else {
+ field.select2('open');
+ }
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_add_custom_close_button_if_needed() {
+ var select2_fields = $('.select2-hidden-accessible');
+ if (!select2_fields && !select2_fields.length) {
+ return;
+ }
+ var _iterator = _createForOfIteratorHelper(select2_fields),
+ _step;
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
+ var field = _step.value;
+ var value = $(field)
+ .children('option:selected')
+ .val();
+ if (!value) {
+ continue;
+ }
+ selec2_add_custom_close_button(field);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+ function selec2_add_custom_close_button(field) {
+ // Remove Default
+ $('.select2-selection__clear').css({
+ display: 'none',
+ });
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove if already exists
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Add
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/times.svg';
+ var iconHTML = directorist.icon_markup
+ .replace('##URL##', iconURL)
+ .replace('##CLASS##', '');
+ addon_container.prepend(
+ ''.concat(
+ iconHTML,
+ ' '
+ )
+ );
+ var selec2_custom_close = addon_container.find(
+ '.directorist-select2-dropdown-close'
+ );
+ selec2_custom_close.on('click', function (e) {
+ var field = $(this)
+ .closest('.select2-container')
+ .siblings('select:enabled');
+ field.val(null).trigger('change');
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+ selec2_adjust_space_for_addons();
+ });
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_remove_custom_close_button(field) {
+ var addon_container = selec2_get_addon_container(field);
+ if (!(addon_container && addon_container.length)) {
+ return;
+ }
+
+ // Remove
+ addon_container
+ .find('.directorist-select2-dropdown-close')
+ .remove();
+
+ // Adjust space for addons
+ selec2_adjust_space_for_addons();
+ }
+ function selec2_get_addon_container(field) {
+ var container = field
+ ? $(field).next('.select2-container')
+ : $('.select2-container');
+ container = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ $('.select2-container').append(
+ ' '
+ );
+ container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ var container = field
+ ? $(field).next('.select2-container')
+ : null;
+ if (!container) {
+ return null;
+ }
+ var addonsArea = $(container).find(
+ '.directorist-select2-addons-area'
+ );
+ if (!addonsArea.length) {
+ container.append(
+ ' '
+ );
+ return container.find(
+ '.directorist-select2-addons-area'
+ );
+ }
+ return addonsArea;
+ }
+ function selec2_adjust_space_for_addons() {
+ var container = $('.select2-container').find(
+ '.directorist-select2-addons-area'
+ );
+ if (!container.length) {
+ return;
+ }
+ var width = container.outerWidth();
+ $('.select2-container')
+ .find('.select2-selection__rendered')
+ .css({
+ 'padding-right': width + 'px',
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/global/components/setup-select2.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/global/components/setup-select2.js ***!
\**********************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../lib/helper */ "./assets/src/js/lib/helper.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_select2_custom_control__WEBPACK_IMPORTED_MODULE_2__);
-
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-var $ = jQuery;
-window.addEventListener('load', initSelect2);
-document.body.addEventListener('directorist-search-form-nav-tab-reloaded', initSelect2);
-document.body.addEventListener('directorist-reload-select2-fields', initSelect2);
-window.addEventListener('directorist-instant-search-reloaded', initSelect2);
-
-// Init Static Select 2 Fields
-function initSelect2() {
- var selectors = ['.directorist-select select', '#directorist-select-js',
- // Not found in any template
- '#directorist-search-category-js',
- // Not found in any template
- // '#directorist-select-st-s-js',
- // '#directorist-select-sn-s-js',
- // '#directorist-select-mn-e-js',
- // '#directorist-select-tu-e-js',
- // '#directorist-select-wd-s-js',
- // '#directorist-select-wd-e-js',
- // '#directorist-select-th-e-js',
- // '#directorist-select-fr-s-js',
- // '#directorist-select-fr-e-js',
- '.select-basic',
- // Not found in any template
- '#loc-type', '#cat-type', '#at_biz_dir-category', '.bdas-location-search',
- // Not found in any template
- '.bdas-category-search' // Not found in any template
- ];
- selectors.forEach(function (selector) {
- return (0,_lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(selector);
- });
- initMaybeLazyLoadedTaxonomySelect2();
-}
-
-// Init Select2 Ajax Fields
-function initMaybeLazyLoadedTaxonomySelect2() {
- var restBase = "".concat(directorist.rest_url, "directorist/v1");
- maybeLazyLoadCategories({
- selector: '.directorist-search-category select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadCategories({
- selector: '.directorist-form-categories-field select',
- url: "".concat(restBase, "/listings/categories")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-search-location select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadLocations({
- selector: '.directorist-form-location-field select',
- url: "".concat(restBase, "/listings/locations")
- });
- maybeLazyLoadTags({
- selector: '.directorist-form-tag-field select',
- url: "".concat(restBase, "/listings/tags")
- });
-}
-function maybeLazyLoadCategories(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'categories'
- }), args));
-}
-function maybeLazyLoadLocations(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'locations'
- }), args));
-}
-function maybeLazyLoadTags(args) {
- maybeLazyLoadTaxonomyTermsSelect2(_objectSpread(_objectSpread({}, {
- taxonomy: 'tags'
- }), args));
-}
-
-// maybeLazyLoadTaxonomyTermsSelect2
-function maybeLazyLoadTaxonomyTermsSelect2(args) {
- var defaults = {
- selector: '',
- url: '',
- taxonomy: 'tags'
- };
- args = _objectSpread(_objectSpread({}, defaults), args);
- if (!args.selector) {
- return;
- }
- var $el = $(args.selector);
- var $addListing = $el.closest('.directorist-add-listing-form');
- var canCreate = $el.data('allow_new');
- var maxLength = $el.data('max');
- var directoryId = 0;
- if (args.taxonomy !== 'tags') {
- var $searchForm = $el.closest('.directorist-search-form');
- var $archivePage = $el.closest('.directorist-archive-contents');
- var $directory = $addListing.find('input[name="directory_type"]');
- var $navListItem = null;
-
- // If search page
- if ($searchForm.length) {
- $navListItem = $searchForm.find('.directorist-listing-type-selection__link--current');
- }
- if ($archivePage.length) {
- $navListItem = $archivePage.find('.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link');
- }
- if ($navListItem && $navListItem.length) {
- directoryId = Number($navListItem.data('listing_type_id'));
- }
- if ($directory.length) {
- directoryId = $directory.val();
- }
- if (directoryId) {
- directoryId = Number(directoryId);
- }
- }
- var currentPage = 1;
- var select2Options = {
- allowClear: true,
- tags: canCreate,
- maximumSelectionLength: maxLength,
- width: '100%',
- escapeMarkup: function escapeMarkup(text) {
- return text;
- },
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
-
- // Fetch the data-icon attribute
- var iconURI = $(data.element).attr('data-icon');
-
- // Get the original text
- var originalText = data.text;
-
- // Match and count leading spaces
- var leadingSpaces = originalText.match(/^\s+/);
- var spaceCount = leadingSpaces ? leadingSpaces[0].length : 0;
-
- // Trim leading spaces from the original text
- originalText = originalText.trim();
-
- // Construct the icon element
- var iconElm = iconURI ? " ") : '';
-
- // Prepare the combined text (icon + text)
- var combinedText = iconElm + originalText;
-
- // Create the state container
- var $state = $('
');
-
- // Determine the level based on space count
- var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
- if (level > 1) {
- $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
- }
- $state.html(combinedText); // Set the combined content (icon + text)
-
- return $state;
- }
- };
- if (directorist.lazy_load_taxonomy_fields) {
- select2Options.ajax = {
- url: args.url,
- dataType: 'json',
- cache: true,
- delay: 250,
- data: function data(params) {
- currentPage = params.page || 1;
- var query = {
- page: currentPage,
- per_page: args.perPage,
- hide_empty: true
- };
-
- // Load empty terms on add listings.
- if ($addListing.length) {
- query.hide_empty = false;
- }
- if (params.term) {
- query.search = params.term;
- query.hide_empty = false;
- }
- if (directoryId) {
- query.directory = directoryId;
- }
- return query;
- },
- processResults: function processResults(data) {
- return {
- results: data.items,
- pagination: {
- more: data.paginationMore
- }
- };
- },
- transport: function transport(params, success, failure) {
- var $request = $.ajax(params);
- $request.then(function (data, textStatus, jqXHR) {
- var totalPage = Number(jqXHR.getResponseHeader('x-wp-totalpages'));
- var paginationMore = currentPage < totalPage;
- var items = data.map(function (item) {
- var text = item.name;
- if (!$addListing.length && params.data.search) {
- text = "".concat(item.name, " (").concat(item.count, ")");
- }
- return {
- id: item.id,
- text: text
- };
- });
- return {
- items: items,
- paginationMore: paginationMore
- };
- }).then(success);
- $request.fail(failure);
- return $request;
- }
- };
- }
- $el.length && $el.select2(select2Options);
- if (directorist.lazy_load_taxonomy_fields) {
- function setupSelectedItems($el, selectedId, selectedLabel) {
- if (!$el.length || !selectedId) {
- return;
- }
- var selectedIds = "".concat(selectedId).split(',');
- var selectedLabels = selectedLabel ? "".concat(selectedLabel).split(',') : [];
- selectedIds.forEach(function (id, index) {
- var label = selectedLabels.length >= index + 1 ? selectedLabels[index] : '';
- var option = new Option(label, id, true, true);
- $el.append(option);
- $el.trigger({
- type: 'select2:select',
- params: {
- data: {
- id: id,
- text: label
- }
- }
- });
- });
- }
- setupSelectedItems($el, $el.data('selected-id'), $el.data('selected-label'));
- }
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/lib/helper.js":
-/*!*************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _lib_helper__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./../../lib/helper */ './assets/src/js/lib/helper.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _select2_custom_control__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _select2_custom_control__WEBPACK_IMPORTED_MODULE_2__
+ );
+
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r)
+ .enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(
+ t,
+ r
+ )
+ );
+ });
+ }
+ return e;
+ }
+
+ var $ = jQuery;
+ window.addEventListener('load', initSelect2);
+ document.body.addEventListener(
+ 'directorist-search-form-nav-tab-reloaded',
+ initSelect2
+ );
+ document.body.addEventListener(
+ 'directorist-reload-select2-fields',
+ initSelect2
+ );
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ initSelect2
+ );
+
+ // Init Static Select 2 Fields
+ function initSelect2() {
+ var selectors = [
+ '.directorist-select select',
+ '#directorist-select-js',
+ // Not found in any template
+ '#directorist-search-category-js',
+ // Not found in any template
+ // '#directorist-select-st-s-js',
+ // '#directorist-select-sn-s-js',
+ // '#directorist-select-mn-e-js',
+ // '#directorist-select-tu-e-js',
+ // '#directorist-select-wd-s-js',
+ // '#directorist-select-wd-e-js',
+ // '#directorist-select-th-e-js',
+ // '#directorist-select-fr-s-js',
+ // '#directorist-select-fr-e-js',
+ '.select-basic',
+ // Not found in any template
+ '#loc-type',
+ '#cat-type',
+ '#at_biz_dir-category',
+ '.bdas-location-search',
+ // Not found in any template
+ '.bdas-category-search', // Not found in any template
+ ];
+ selectors.forEach(function (selector) {
+ return (0,
+ _lib_helper__WEBPACK_IMPORTED_MODULE_1__.convertToSelect2)(
+ selector
+ );
+ });
+ initMaybeLazyLoadedTaxonomySelect2();
+ }
+
+ // Init Select2 Ajax Fields
+ function initMaybeLazyLoadedTaxonomySelect2() {
+ var restBase = ''.concat(
+ directorist.rest_url,
+ 'directorist/v1'
+ );
+ maybeLazyLoadCategories({
+ selector: '.directorist-search-category select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadCategories({
+ selector: '.directorist-form-categories-field select',
+ url: ''.concat(restBase, '/listings/categories'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-search-location select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadLocations({
+ selector: '.directorist-form-location-field select',
+ url: ''.concat(restBase, '/listings/locations'),
+ });
+ maybeLazyLoadTags({
+ selector: '.directorist-form-tag-field select',
+ url: ''.concat(restBase, '/listings/tags'),
+ });
+ }
+ function maybeLazyLoadCategories(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'categories',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadLocations(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'locations',
+ }
+ ),
+ args
+ )
+ );
+ }
+ function maybeLazyLoadTags(args) {
+ maybeLazyLoadTaxonomyTermsSelect2(
+ _objectSpread(
+ _objectSpread(
+ {},
+ {
+ taxonomy: 'tags',
+ }
+ ),
+ args
+ )
+ );
+ }
+
+ // maybeLazyLoadTaxonomyTermsSelect2
+ function maybeLazyLoadTaxonomyTermsSelect2(args) {
+ var defaults = {
+ selector: '',
+ url: '',
+ taxonomy: 'tags',
+ };
+ args = _objectSpread(_objectSpread({}, defaults), args);
+ if (!args.selector) {
+ return;
+ }
+ var $el = $(args.selector);
+ var $addListing = $el.closest(
+ '.directorist-add-listing-form'
+ );
+ var canCreate = $el.data('allow_new');
+ var maxLength = $el.data('max');
+ var directoryId = 0;
+ if (args.taxonomy !== 'tags') {
+ var $searchForm = $el.closest(
+ '.directorist-search-form'
+ );
+ var $archivePage = $el.closest(
+ '.directorist-archive-contents'
+ );
+ var $directory = $addListing.find(
+ 'input[name="directory_type"]'
+ );
+ var $navListItem = null;
+
+ // If search page
+ if ($searchForm.length) {
+ $navListItem = $searchForm.find(
+ '.directorist-listing-type-selection__link--current'
+ );
+ }
+ if ($archivePage.length) {
+ $navListItem = $archivePage.find(
+ '.directorist-type-nav__list li.directorist-type-nav__list__current .directorist-type-nav__link'
+ );
+ }
+ if ($navListItem && $navListItem.length) {
+ directoryId = Number(
+ $navListItem.data('listing_type_id')
+ );
+ }
+ if ($directory.length) {
+ directoryId = $directory.val();
+ }
+ if (directoryId) {
+ directoryId = Number(directoryId);
+ }
+ }
+ var currentPage = 1;
+ var select2Options = {
+ allowClear: true,
+ tags: canCreate,
+ maximumSelectionLength: maxLength,
+ width: '100%',
+ escapeMarkup: function escapeMarkup(text) {
+ return text;
+ },
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+
+ // Fetch the data-icon attribute
+ var iconURI = $(data.element).attr('data-icon');
+
+ // Get the original text
+ var originalText = data.text;
+
+ // Match and count leading spaces
+ var leadingSpaces = originalText.match(/^\s+/);
+ var spaceCount = leadingSpaces
+ ? leadingSpaces[0].length
+ : 0;
+
+ // Trim leading spaces from the original text
+ originalText = originalText.trim();
+
+ // Construct the icon element
+ var iconElm = iconURI
+ ? ' '
+ )
+ : '';
+
+ // Prepare the combined text (icon + text)
+ var combinedText = iconElm + originalText;
+
+ // Create the state container
+ var $state = $(
+ '
'
+ );
+
+ // Determine the level based on space count
+ var level = Math.floor(spaceCount / 8) + 1; // 8 spaces = level 2, 16 spaces = level 3, etc.
+ if (level > 1) {
+ $state.addClass('item-level-' + level); // Add class for the level (e.g., level-1, level-2, etc.)
+ }
+ $state.html(combinedText); // Set the combined content (icon + text)
+
+ return $state;
+ },
+ };
+ if (directorist.lazy_load_taxonomy_fields) {
+ select2Options.ajax = {
+ url: args.url,
+ dataType: 'json',
+ cache: true,
+ delay: 250,
+ data: function data(params) {
+ currentPage = params.page || 1;
+ var query = {
+ page: currentPage,
+ per_page: args.perPage,
+ hide_empty: true,
+ };
+
+ // Load empty terms on add listings.
+ if ($addListing.length) {
+ query.hide_empty = false;
+ }
+ if (params.term) {
+ query.search = params.term;
+ query.hide_empty = false;
+ }
+ if (directoryId) {
+ query.directory = directoryId;
+ }
+ return query;
+ },
+ processResults: function processResults(data) {
+ return {
+ results: data.items,
+ pagination: {
+ more: data.paginationMore,
+ },
+ };
+ },
+ transport: function transport(
+ params,
+ success,
+ failure
+ ) {
+ var $request = $.ajax(params);
+ $request
+ .then(function (data, textStatus, jqXHR) {
+ var totalPage = Number(
+ jqXHR.getResponseHeader(
+ 'x-wp-totalpages'
+ )
+ );
+ var paginationMore =
+ currentPage < totalPage;
+ var items = data.map(function (item) {
+ var text = item.name;
+ if (
+ !$addListing.length &&
+ params.data.search
+ ) {
+ text = ''
+ .concat(item.name, ' (')
+ .concat(item.count, ')');
+ }
+ return {
+ id: item.id,
+ text: text,
+ };
+ });
+ return {
+ items: items,
+ paginationMore: paginationMore,
+ };
+ })
+ .then(success);
+ $request.fail(failure);
+ return $request;
+ },
+ };
+ }
+ $el.length && $el.select2(select2Options);
+ if (directorist.lazy_load_taxonomy_fields) {
+ function setupSelectedItems(
+ $el,
+ selectedId,
+ selectedLabel
+ ) {
+ if (!$el.length || !selectedId) {
+ return;
+ }
+ var selectedIds = ''.concat(selectedId).split(',');
+ var selectedLabels = selectedLabel
+ ? ''.concat(selectedLabel).split(',')
+ : [];
+ selectedIds.forEach(function (id, index) {
+ var label =
+ selectedLabels.length >= index + 1
+ ? selectedLabels[index]
+ : '';
+ var option = new Option(label, id, true, true);
+ $el.append(option);
+ $el.trigger({
+ type: 'select2:select',
+ params: {
+ data: {
+ id: id,
+ text: label,
+ },
+ },
+ });
+ });
+ }
+ setupSelectedItems(
+ $el,
+ $el.data('selected-id'),
+ $el.data('selected-label')
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/lib/helper.js':
+ /*!*************************************!*\
!*** ./assets/src/js/lib/helper.js ***!
\*************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ convertToSelect2: function() { return /* binding */ convertToSelect2; },
-/* harmony export */ get_dom_data: function() { return /* binding */ get_dom_data; }
-/* harmony export */ });
-var $ = jQuery;
-function get_dom_data(selector, parent) {
- selector = '.directorist-dom-data-' + selector;
- if (!parent) {
- parent = document;
- }
- var el = parent.querySelector(selector);
- if (!el || !el.dataset.value) {
- return {};
- }
- var IS_SCRIPT_DEBUGGING = directorist && directorist.script_debugging && directorist.script_debugging == '1';
- try {
- var value = atob(el.dataset.value);
- return JSON.parse(value);
- } catch (error) {
- if (IS_SCRIPT_DEBUGGING) {
- console.log(el, error);
- }
- return {};
- }
-}
-function convertToSelect2(selector) {
- var $selector = $(selector);
- var args = {
- allowClear: true,
- width: '100%',
- templateResult: function templateResult(data) {
- if (!data.id) {
- return data.text;
- }
- var iconURI = $(data.element).data('icon');
- var iconElm = " ");
- var originalText = data.text;
- var modifiedText = originalText.replace(/^(\s*)/, '$1' + iconElm);
- var $state = $("".concat(typeof iconURI !== 'undefined' && iconURI !== '' ? modifiedText : originalText, "
"));
- return $state;
- }
- };
- var options = $selector.find('option');
- if (options.length && options[0].textContent.length) {
- args.placeholder = options[0].textContent;
- }
- $selector.length && $selector.select2(args);
-}
-
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/category-custom-fields.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ convertToSelect2: function () {
+ return /* binding */ convertToSelect2;
+ },
+ /* harmony export */ get_dom_data: function () {
+ return /* binding */ get_dom_data;
+ },
+ /* harmony export */
+ }
+ );
+ var $ = jQuery;
+ function get_dom_data(selector, parent) {
+ selector = '.directorist-dom-data-' + selector;
+ if (!parent) {
+ parent = document;
+ }
+ var el = parent.querySelector(selector);
+ if (!el || !el.dataset.value) {
+ return {};
+ }
+ var IS_SCRIPT_DEBUGGING =
+ directorist &&
+ directorist.script_debugging &&
+ directorist.script_debugging == '1';
+ try {
+ var value = atob(el.dataset.value);
+ return JSON.parse(value);
+ } catch (error) {
+ if (IS_SCRIPT_DEBUGGING) {
+ console.log(el, error);
+ }
+ return {};
+ }
+ }
+ function convertToSelect2(selector) {
+ var $selector = $(selector);
+ var args = {
+ allowClear: true,
+ width: '100%',
+ templateResult: function templateResult(data) {
+ if (!data.id) {
+ return data.text;
+ }
+ var iconURI = $(data.element).data('icon');
+ var iconElm =
+ ' '
+ );
+ var originalText = data.text;
+ var modifiedText = originalText.replace(
+ /^(\s*)/,
+ '$1' + iconElm
+ );
+ var $state = $(
+ ''.concat(
+ typeof iconURI !== 'undefined' &&
+ iconURI !== ''
+ ? modifiedText
+ : originalText,
+ '
'
+ )
+ );
+ return $state;
+ },
+ };
+ var options = $selector.find('option');
+ if (options.length && options[0].textContent.length) {
+ args.placeholder = options[0].textContent;
+ }
+ $selector.length && $selector.select2(args);
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/category-custom-fields.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/public/components/category-custom-fields.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ initSearchCategoryCustomFields; }
-/* harmony export */ });
-// Search Category Change
-function hideAllCustomFieldsExceptSelected(relations, categories, $container) {
- var fields = Object.keys(relations);
- var wrappers = ['.directorist-advanced-filter__advanced__element', '.directorist-search-modal__input', '.directorist-search-field'];
- if (!fields.length) {
- return;
- }
-
- // Convert categories to array if it's not already
- var categoryArray = Array.isArray(categories) ? categories : [categories];
- fields.forEach(function (field) {
- var fieldCategory = relations[field];
-
- // Try multiple selectors to find the field
- var $field = null;
- var selectors = ["[name=\"custom_field[".concat(field, "]\"]"), "[name=\"custom_field[".concat(field, "][]\"]"), "[name*=\"".concat(field, "\"]"), "[data-field-key=\"".concat(field, "\"]"), "[id*=\"".concat(field, "\"]")];
- for (var _i = 0, _selectors = selectors; _i < _selectors.length; _i++) {
- var selector = _selectors[_i];
- $field = $container.find(selector);
- if ($field.length > 0) {
- break;
- }
- }
- if (!$field || !$field.length) {
- return;
- }
-
- // Check if the field category matches any of the selected categories
- var shouldShow = categoryArray.some(function (category) {
- return Number(category) === Number(fieldCategory);
- });
- if (shouldShow) {
- $field.prop('disabled', false);
- wrappers.forEach(function (wrapper) {
- var $wrapper = $field.closest(wrapper);
- if ($wrapper.length) {
- $wrapper.show();
- }
- });
- } else {
- $field.prop('disabled', true);
- wrappers.forEach(function (wrapper) {
- var $wrapper = $field.closest(wrapper);
- if ($wrapper.length) {
- $wrapper.hide();
- }
- });
- }
- });
-}
-function initSearchCategoryCustomFields($) {
- // Handle multiple search forms and containers
- var containers = ['.directorist-search-contents', '.directorist-archive-contents', '.directorist-search-form', '.directorist-add-listing-form'];
- containers.forEach(function (containerSelector) {
- var $container = $(containerSelector);
- if ($container.length) {
- // Bind events to all category selects within this container
- $container.on('change', '.directorist-category-select, .directorist-search-category select, .bdas-category-search', function (event) {
- var $this = $(this);
- var $form = $this.parents('form');
- var categories = $this.val();
- var attributes = $form.data('atts');
-
- // If form doesn't have attributes, try container
- if (!attributes) {
- attributes = $container.data('atts');
- }
-
- // If still no attributes, try document body
- if (!attributes) {
- attributes = $(document.body).data('atts');
- }
- if (!attributes || !attributes.category_custom_fields_relations) {
- return;
- }
-
- // Handle both single and multiple category selections
- if (categories) {
- // Convert to array if it's a single value
- if (!Array.isArray(categories)) {
- categories = [categories];
- }
- // Convert string values to numbers and filter out empty values
- categories = categories.map(function (cat) {
- return Number(cat);
- }).filter(function (cat) {
- return cat > 0;
- }); // Filter out 0, null, undefined, etc.
- } else {
- categories = [];
- }
-
- // Use the specific container for field search to avoid conflicts
- hideAllCustomFieldsExceptSelected(attributes.category_custom_fields_relations, categories, $container);
- });
-
- // Trigger change event on page load for all category selects in this container
- $container.find('.directorist-category-select, .directorist-search-category select, .bdas-category-search').each(function () {
- $(this).trigger('change');
- });
- }
- });
-
- // Also handle global category selects that might not be in specific containers
- var globalSelectors = '.directorist-category-select, .directorist-search-category select, .bdas-category-search';
- $(document).on('change', globalSelectors, function (event) {
- var $this = $(this);
-
- // Only handle if not already handled by container-specific handlers
- if (!event.isDefaultPrevented()) {
- var $form = $this.parents('form');
- var categories = $this.val();
- var attributes = $form.data('atts');
- if (!attributes) {
- attributes = $(document.body).data('atts');
- }
- if (!attributes || !attributes.category_custom_fields_relations) {
- return;
- }
-
- // Handle both single and multiple category selections
- if (categories) {
- if (!Array.isArray(categories)) {
- categories = [categories];
- }
- categories = categories.map(function (cat) {
- return Number(cat);
- }).filter(function (cat) {
- return cat > 0;
- });
- } else {
- categories = [];
- }
- hideAllCustomFieldsExceptSelected(attributes.category_custom_fields_relations, categories, $(document.body));
- }
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/colorPicker.js":
-/*!********************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ initSearchCategoryCustomFields;
+ },
+ /* harmony export */
+ }
+ );
+ // Search Category Change
+ function hideAllCustomFieldsExceptSelected(
+ relations,
+ categories,
+ $container
+ ) {
+ var fields = Object.keys(relations);
+ var wrappers = [
+ '.directorist-advanced-filter__advanced__element',
+ '.directorist-search-modal__input',
+ '.directorist-search-field',
+ ];
+ if (!fields.length) {
+ return;
+ }
+
+ // Convert categories to array if it's not already
+ var categoryArray = Array.isArray(categories)
+ ? categories
+ : [categories];
+ fields.forEach(function (field) {
+ var fieldCategory = relations[field];
+
+ // Try multiple selectors to find the field
+ var $field = null;
+ var selectors = [
+ '[name="custom_field['.concat(field, ']"]'),
+ '[name="custom_field['.concat(field, '][]"]'),
+ '[name*="'.concat(field, '"]'),
+ '[data-field-key="'.concat(field, '"]'),
+ '[id*="'.concat(field, '"]'),
+ ];
+ for (
+ var _i = 0, _selectors = selectors;
+ _i < _selectors.length;
+ _i++
+ ) {
+ var selector = _selectors[_i];
+ $field = $container.find(selector);
+ if ($field.length > 0) {
+ break;
+ }
+ }
+ if (!$field || !$field.length) {
+ return;
+ }
+
+ // Check if the field category matches any of the selected categories
+ var shouldShow = categoryArray.some(
+ function (category) {
+ return (
+ Number(category) === Number(fieldCategory)
+ );
+ }
+ );
+ if (shouldShow) {
+ $field.prop('disabled', false);
+ wrappers.forEach(function (wrapper) {
+ var $wrapper = $field.closest(wrapper);
+ if ($wrapper.length) {
+ $wrapper.show();
+ }
+ });
+ } else {
+ $field.prop('disabled', true);
+ wrappers.forEach(function (wrapper) {
+ var $wrapper = $field.closest(wrapper);
+ if ($wrapper.length) {
+ $wrapper.hide();
+ }
+ });
+ }
+ });
+ }
+ function initSearchCategoryCustomFields($) {
+ // Handle multiple search forms and containers
+ var containers = [
+ '.directorist-search-contents',
+ '.directorist-archive-contents',
+ '.directorist-search-form',
+ '.directorist-add-listing-form',
+ ];
+ containers.forEach(function (containerSelector) {
+ var $container = $(containerSelector);
+ if ($container.length) {
+ // Bind events to all category selects within this container
+ $container.on(
+ 'change',
+ '.directorist-category-select, .directorist-search-category select, .bdas-category-search',
+ function (event) {
+ var $this = $(this);
+ var $form = $this.parents('form');
+ var categories = $this.val();
+ var attributes = $form.data('atts');
+
+ // If form doesn't have attributes, try container
+ if (!attributes) {
+ attributes = $container.data('atts');
+ }
+
+ // If still no attributes, try document body
+ if (!attributes) {
+ attributes = $(document.body).data(
+ 'atts'
+ );
+ }
+ if (
+ !attributes ||
+ !attributes.category_custom_fields_relations
+ ) {
+ return;
+ }
+
+ // Handle both single and multiple category selections
+ if (categories) {
+ // Convert to array if it's a single value
+ if (!Array.isArray(categories)) {
+ categories = [categories];
+ }
+ // Convert string values to numbers and filter out empty values
+ categories = categories
+ .map(function (cat) {
+ return Number(cat);
+ })
+ .filter(function (cat) {
+ return cat > 0;
+ }); // Filter out 0, null, undefined, etc.
+ } else {
+ categories = [];
+ }
+
+ // Use the specific container for field search to avoid conflicts
+ hideAllCustomFieldsExceptSelected(
+ attributes.category_custom_fields_relations,
+ categories,
+ $container
+ );
+ }
+ );
+
+ // Trigger change event on page load for all category selects in this container
+ $container
+ .find(
+ '.directorist-category-select, .directorist-search-category select, .bdas-category-search'
+ )
+ .each(function () {
+ $(this).trigger('change');
+ });
+ }
+ });
+
+ // Also handle global category selects that might not be in specific containers
+ var globalSelectors =
+ '.directorist-category-select, .directorist-search-category select, .bdas-category-search';
+ $(document).on('change', globalSelectors, function (event) {
+ var $this = $(this);
+
+ // Only handle if not already handled by container-specific handlers
+ if (!event.isDefaultPrevented()) {
+ var $form = $this.parents('form');
+ var categories = $this.val();
+ var attributes = $form.data('atts');
+ if (!attributes) {
+ attributes = $(document.body).data('atts');
+ }
+ if (
+ !attributes ||
+ !attributes.category_custom_fields_relations
+ ) {
+ return;
+ }
+
+ // Handle both single and multiple category selections
+ if (categories) {
+ if (!Array.isArray(categories)) {
+ categories = [categories];
+ }
+ categories = categories
+ .map(function (cat) {
+ return Number(cat);
+ })
+ .filter(function (cat) {
+ return cat > 0;
+ });
+ } else {
+ categories = [];
+ }
+ hideAllCustomFieldsExceptSelected(
+ attributes.category_custom_fields_relations,
+ categories,
+ $(document.body)
+ );
+ }
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/colorPicker.js':
+ /*!********************************************************!*\
!*** ./assets/src/js/public/components/colorPicker.js ***!
\********************************************************/
-/***/ (function() {
-
-/* Initialize wpColorPicker */
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_colorPicker_executed === 'undefined') {
- window.directorist_colorPicker_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* Initialize wp color picker */
- function colorPickerInit() {
- var wpColorPickers = document.querySelectorAll('.directorist-color-picker-wrap');
- wpColorPickers.forEach(function (wrap) {
- var $pickerInput = $(wrap).find('.directorist-color-picker');
- if ($pickerInput) {
- if ($.fn.wpColorPicker) {
- $pickerInput.wpColorPicker({
- change: function change(event, ui) {
- var color = ui.color.toString();
-
- // Dispatch custom event
- var colorChangeEvent = new CustomEvent('directorist-color-changed', {
- detail: {
- color: color,
- input: event.target,
- form: event.target.closest('form')
- }
- });
- window.dispatchEvent(colorChangeEvent);
- }
- });
- } else {
- console.warn('wpColorPicker is NOT available!');
- }
- }
- });
- }
- colorPickerInit();
-
- /* Initialize on Directory type change */
- window.addEventListener('directorist-instant-search-reloaded', colorPickerInit);
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristDropdown.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ /* Initialize wpColorPicker */
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_colorPicker_executed ===
+ 'undefined'
+ ) {
+ window.directorist_colorPicker_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* Initialize wp color picker */
+ function colorPickerInit() {
+ var wpColorPickers = document.querySelectorAll(
+ '.directorist-color-picker-wrap'
+ );
+ wpColorPickers.forEach(function (wrap) {
+ var $pickerInput = $(wrap).find(
+ '.directorist-color-picker'
+ );
+ if ($pickerInput) {
+ if ($.fn.wpColorPicker) {
+ $pickerInput.wpColorPicker({
+ change: function change(event, ui) {
+ var color = ui.color.toString();
+
+ // Dispatch custom event
+ var colorChangeEvent =
+ new CustomEvent(
+ 'directorist-color-changed',
+ {
+ detail: {
+ color: color,
+ input: event.target,
+ form: event.target.closest(
+ 'form'
+ ),
+ },
+ }
+ );
+ window.dispatchEvent(
+ colorChangeEvent
+ );
+ },
+ });
+ } else {
+ console.warn(
+ 'wpColorPicker is NOT available!'
+ );
+ }
+ }
+ });
+ }
+ colorPickerInit();
+
+ /* Initialize on Directory type change */
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ colorPickerInit
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristDropdown.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristDropdown.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_dropdown_executed === 'undefined') {
- window.directorist_dropdown_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.directorist-dropdown-select');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.directorist-dropdown-select-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- el.querySelector('.directorist-dropdown-select-items').classList.add('directorist-dropdown-select-show');
- } else {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'directorist-dropdown-select-toggle') {
- clickCount = 0;
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (el) {
- el.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
-
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.directorist-dropdown-select-toggle').textContent = e.target.textContent;
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // Dropdown
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-toggle', function (e) {
- e.preventDefault();
- $(this).siblings('.directorist-dropdown-option').toggle();
- });
-
- // Select Option after click
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-option ul li a', function (e) {
- e.preventDefault();
- var optionText = $(this).html();
- $(this).children('.directorist-dropdown-toggle__text').html(optionText);
- $(this).closest('.directorist-dropdown-option').siblings('.directorist-dropdown-toggle').children('.directorist-dropdown-toggle__text').html(optionText);
- $('.directorist-dropdown-option').hide();
- });
-
- // Hide Clicked Anywhere
- $(document).bind('click', function (e) {
- var clickedDOM = $(e.target);
- if (!clickedDOM.parents().hasClass('directorist-dropdown')) $('.directorist-dropdown-option').hide();
- });
-
- //atbd_dropdown
- $(document).on('click', '.atbd_dropdown', function (e) {
- if ($(this).attr('class') === 'atbd_dropdown') {
- e.preventDefault();
- $(this).siblings('.atbd_dropdown').removeClass('atbd_drop--active');
- $(this).toggleClass('atbd_drop--active');
- e.stopPropagation();
- }
- });
- $(document).on('click', function (e) {
- if ($(e.target).is('.atbd_dropdown, .atbd_drop--active') === false) {
- $('.atbd_dropdown').removeClass('atbd_drop--active');
- }
- });
- $('body').on('click', '.atbd_dropdown-toggle', function (e) {
- e.preventDefault();
- });
-
- // Directorist Dropdown
- $('body').on('click', '.directorist-dropdown-js .directorist-dropdown__toggle-js', function (e) {
- e.preventDefault();
- if (!$(this).siblings('.directorist-dropdown__links-js').is(':visible')) {
- $('.directorist-dropdown__links').hide();
- }
- $(this).siblings('.directorist-dropdown__links-js').toggle();
- });
- $('body').on('click', function (e) {
- if (!e.target.closest('.directorist-dropdown-js')) {
- $('.directorist-dropdown__links-js').hide();
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristSelect.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_dropdown_executed ===
+ 'undefined'
+ ) {
+ window.directorist_dropdown_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown = document.querySelectorAll(
+ '.directorist-dropdown-select'
+ );
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ el.querySelector(
+ '.directorist-dropdown-select-items'
+ ).classList.add(
+ 'directorist-dropdown-select-show'
+ );
+ } else {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'directorist-dropdown-select-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).textContent =
+ e.target.textContent;
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ });
+ });
+ }
+
+ // Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .siblings('.directorist-dropdown-option')
+ .toggle();
+ }
+ );
+
+ // Select Option after click
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-option ul li a',
+ function (e) {
+ e.preventDefault();
+ var optionText = $(this).html();
+ $(this)
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $(this)
+ .closest('.directorist-dropdown-option')
+ .siblings('.directorist-dropdown-toggle')
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $('.directorist-dropdown-option').hide();
+ }
+ );
+
+ // Hide Clicked Anywhere
+ $(document).bind('click', function (e) {
+ var clickedDOM = $(e.target);
+ if (
+ !clickedDOM
+ .parents()
+ .hasClass('directorist-dropdown')
+ )
+ $('.directorist-dropdown-option').hide();
+ });
+
+ //atbd_dropdown
+ $(document).on('click', '.atbd_dropdown', function (e) {
+ if ($(this).attr('class') === 'atbd_dropdown') {
+ e.preventDefault();
+ $(this)
+ .siblings('.atbd_dropdown')
+ .removeClass('atbd_drop--active');
+ $(this).toggleClass('atbd_drop--active');
+ e.stopPropagation();
+ }
+ });
+ $(document).on('click', function (e) {
+ if (
+ $(e.target).is(
+ '.atbd_dropdown, .atbd_drop--active'
+ ) === false
+ ) {
+ $('.atbd_dropdown').removeClass(
+ 'atbd_drop--active'
+ );
+ }
+ });
+ $('body').on(
+ 'click',
+ '.atbd_dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ }
+ );
+
+ // Directorist Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown-js .directorist-dropdown__toggle-js',
+ function (e) {
+ e.preventDefault();
+ if (
+ !$(this)
+ .siblings(
+ '.directorist-dropdown__links-js'
+ )
+ .is(':visible')
+ ) {
+ $('.directorist-dropdown__links').hide();
+ }
+ $(this)
+ .siblings('.directorist-dropdown__links-js')
+ .toggle();
+ }
+ );
+ $('body').on('click', function (e) {
+ if (!e.target.closest('.directorist-dropdown-js')) {
+ $('.directorist-dropdown__links-js').hide();
+ }
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristSelect.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/directoristSelect.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_select_executed === 'undefined') {
- window.directorist_select_executed = true;
- } else {
- return;
- }
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.atbd-dropdown-toggle').textContent = item.textContent;
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // select data-status
- var atbdSelectData = document.querySelectorAll('.atbd-drop-select.with-sort');
- atbdSelectData.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- var atbd_dropdown = el.querySelector('.atbd-dropdown-toggle');
- var dropdown_item = item.getAttribute('data-status');
- item.addEventListener('click', function (e) {
- atbd_dropdown.setAttribute('data-status', "".concat(dropdown_item));
- });
- });
- });
-});
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":
-/*!*********************************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_select_executed ===
+ 'undefined'
+ ) {
+ window.directorist_select_executed = true;
+ } else {
+ return;
+ }
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.atbd-dropdown-toggle'
+ ).textContent = item.textContent;
+ el.querySelectorAll(
+ '.atbd-dropdown-item'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ }
+ );
+ });
+ }
+
+ // select data-status
+ var atbdSelectData = document.querySelectorAll(
+ '.atbd-drop-select.with-sort'
+ );
+ atbdSelectData.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ var atbd_dropdown = el.querySelector(
+ '.atbd-dropdown-toggle'
+ );
+ var dropdown_item =
+ item.getAttribute('data-status');
+ item.addEventListener('click', function (e) {
+ atbd_dropdown.setAttribute(
+ 'data-status',
+ ''.concat(dropdown_item)
+ );
+ });
+ }
+ );
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js':
+ /*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; }
-/* harmony export */ });
-function _arrayLikeToArray(r, a) {
- (null == a || a > r.length) && (a = r.length);
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
- return n;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayLikeToArray;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _arrayWithHoles; }
-/* harmony export */ });
-function _arrayWithHoles(r) {
- if (Array.isArray(r)) return r;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _arrayWithHoles;
+ },
+ /* harmony export */
+ }
+ );
+ function _arrayWithHoles(r) {
+ if (Array.isArray(r)) return r;
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/classCallCheck.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _classCallCheck; }
-/* harmony export */ });
-function _classCallCheck(a, n) {
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _classCallCheck;
+ },
+ /* harmony export */
+ }
+ );
+ function _classCallCheck(a, n) {
+ if (!(a instanceof n))
+ throw new TypeError(
+ 'Cannot call a class as a function'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/createClass.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _createClass; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperties(e, r) {
- for (var t = 0; t < r.length; t++) {
- var o = r[t];
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o.key), o);
- }
-}
-function _createClass(e, r, t) {
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
- writable: !1
- }), e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _createClass;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperties(e, r) {
+ for (var t = 0; t < r.length; t++) {
+ var o = r[t];
+ ((o.enumerable = o.enumerable || !1),
+ (o.configurable = !0),
+ 'value' in o && (o.writable = !0),
+ Object.defineProperty(
+ e,
+ (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(o.key),
+ o
+ ));
+ }
+ }
+ function _createClass(e, r, t) {
+ return (
+ r && _defineProperties(e.prototype, r),
+ t && _defineProperties(e, t),
+ Object.defineProperty(e, 'prototype', {
+ writable: !1,
+ }),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/defineProperty.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _defineProperty; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperty(e, r, t) {
- return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, {
- value: t,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }) : e[r] = t, e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js":
-/*!*************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _defineProperty;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperty(e, r, t) {
+ return (
+ (r = (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r)) in e
+ ? Object.defineProperty(e, r, {
+ value: t,
+ enumerable: !0,
+ configurable: !0,
+ writable: !0,
+ })
+ : (e[r] = t),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js':
+ /*!*************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***!
\*************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _iterableToArrayLimit; }
-/* harmony export */ });
-function _iterableToArrayLimit(r, l) {
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
- if (null != t) {
- var e,
- n,
- i,
- u,
- a = [],
- f = !0,
- o = !1;
- try {
- if (i = (t = t.call(r)).next, 0 === l) {
- if (Object(t) !== t) return;
- f = !1;
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
- } catch (r) {
- o = !0, n = r;
- } finally {
- try {
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
- } finally {
- if (o) throw n;
- }
- }
- return a;
- }
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js":
-/*!********************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _iterableToArrayLimit;
+ },
+ /* harmony export */
+ }
+ );
+ function _iterableToArrayLimit(r, l) {
+ var t =
+ null == r
+ ? null
+ : ('undefined' != typeof Symbol &&
+ r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (null != t) {
+ var e,
+ n,
+ i,
+ u,
+ a = [],
+ f = !0,
+ o = !1;
+ try {
+ if (((i = (t = t.call(r)).next), 0 === l)) {
+ if (Object(t) !== t) return;
+ f = !1;
+ } else
+ for (
+ ;
+ !(f = (e = i.call(t)).done) &&
+ (a.push(e.value), a.length !== l);
+ f = !0
+ );
+ } catch (r) {
+ ((o = !0), (n = r));
+ } finally {
+ try {
+ if (
+ !f &&
+ null != t['return'] &&
+ ((u = t['return']()), Object(u) !== u)
+ )
+ return;
+ } finally {
+ if (o) throw n;
+ }
+ }
+ return a;
+ }
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/nonIterableRest.js':
+ /*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***!
\********************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _nonIterableRest; }
-/* harmony export */ });
-function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _nonIterableRest;
+ },
+ /* harmony export */
+ }
+ );
+ function _nonIterableRest() {
+ throw new TypeError(
+ 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/slicedToArray.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _slicedToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js");
-/* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js");
-/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
-/* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js");
-
-
-
-
-function _slicedToArray(r, e) {
- return (0,_arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r, e) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r, e) || (0,_nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__["default"])();
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _slicedToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayWithHoles.js */ './node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js'
+ );
+ /* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./iterableToArrayLimit.js */ './node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js'
+ );
+ /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ./unsupportedIterableToArray.js */ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js'
+ );
+ /* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ./nonIterableRest.js */ './node_modules/@babel/runtime/helpers/esm/nonIterableRest.js'
+ );
+
+ function _slicedToArray(r, e) {
+ return (
+ (0,
+ _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r) ||
+ (0,
+ _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(r, e) ||
+ (0,
+ _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(r, e) ||
+ (0,
+ _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])()
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPrimitive; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-function toPrimitive(t, r) {
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPrimitive;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ function toPrimitive(t, r) {
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ t
+ ) ||
+ !t
+ )
+ return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || 'default');
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ )
+ return i;
+ throw new TypeError(
+ '@@toPrimitive must return a primitive value.'
+ );
+ }
+ return ('string' === r ? String : Number)(t);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPropertyKey; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");
-
-
-function toPropertyKey(t) {
- var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string");
- return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + "";
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPropertyKey;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./toPrimitive.js */ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js'
+ );
+
+ function toPropertyKey(t) {
+ var i = (0,
+ _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__['default'])(
+ t,
+ 'string'
+ );
+ return 'symbol' ==
+ (0, _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ ? i
+ : i + '';
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":
-/*!*******************************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js':
+ /*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; }
-/* harmony export */ });
-/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
-
-function _unsupportedIterableToArray(r, a) {
- if (r) {
- if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a);
- var t = {}.toString.call(r).slice(8, -1);
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0;
- }
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!*********************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _unsupportedIterableToArray;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./arrayLikeToArray.js */ './node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js'
+ );
+
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? (0,
+ _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(r, a)
+ : void 0
+ );
+ }
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!*********************************************!*\
!*** ./assets/src/js/public/search-form.js ***!
\*********************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
-/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
-/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
-/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
-/* harmony import */ var _global_components_debounce__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../global/components/debounce */ "./assets/src/js/global/components/debounce.js");
-/* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../global/components/select2-custom-control */ "./assets/src/js/global/components/select2-custom-control.js");
-/* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_5__);
-/* harmony import */ var _global_components_setup_select2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../global/components/setup-select2 */ "./assets/src/js/global/components/setup-select2.js");
-/* harmony import */ var _components_category_custom_fields__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/category-custom-fields */ "./assets/src/js/public/components/category-custom-fields.js");
-/* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./components/colorPicker */ "./assets/src/js/public/components/colorPicker.js");
-/* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_components_colorPicker__WEBPACK_IMPORTED_MODULE_8__);
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./components/directoristDropdown */ "./assets/src/js/public/components/directoristDropdown.js");
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__);
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/directoristSelect */ "./assets/src/js/public/components/directoristSelect.js");
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__);
-
-
-
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
-function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
-
-
-
-
-
-
-
-var ViewportAwareDropdown = /*#__PURE__*/function () {
- function ViewportAwareDropdown() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__["default"])(this, ViewportAwareDropdown);
- this.options = _objectSpread({
- dropdownClass: '.directorist-search-basic-dropdown-content',
- triggerClass: '.directorist-search-basic-dropdown-label',
- activeClass: 'dropdown-content-show',
- upwardClass: 'dropdown-upward',
- offset: 8,
- positioningDelay: 10,
- mutationDelay: 50,
- animationDelay: 300
- }, options);
- this.observer = null;
- this.isInitialized = false;
- this.init();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__["default"])(ViewportAwareDropdown, [{
- key: "init",
- value: function init() {
- if (this.isInitialized) return;
- this.bindEvents();
- this.setupMutationObserver();
- this.isInitialized = true;
- }
- }, {
- key: "bindEvents",
- value: function bindEvents() {
- var _this2 = this;
- var debouncedResize = (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_4__["default"])(function () {
- return _this2.updateVisibleDropdowns();
- }, 100);
- var debouncedScroll = (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_4__["default"])(function () {
- return _this2.updateVisibleDropdowns();
- }, 50);
- window.addEventListener('resize', debouncedResize);
- window.addEventListener('scroll', debouncedScroll);
- }
- }, {
- key: "positionDropdown",
- value: function positionDropdown(trigger) {
- var dropdown = trigger.parentElement.querySelector(this.options.dropdownClass);
- if (!dropdown) return;
- dropdown.classList.remove(this.options.upwardClass);
- var triggerRect = trigger.getBoundingClientRect();
- var dropdownHeight = dropdown.offsetHeight;
- var dropdownWidth = dropdown.offsetWidth;
- var viewportHeight = window.innerHeight;
- var viewportWidth = window.innerWidth;
- var spaceBelow = viewportHeight - triggerRect.bottom;
- var spaceAbove = triggerRect.top;
- var spaceRight = viewportWidth - triggerRect.left;
- var spaceLeft = triggerRect.right;
- var needsUpward = spaceBelow < dropdownHeight + this.options.offset && spaceAbove > spaceBelow;
- var needsLeft = spaceRight < dropdownWidth && spaceLeft > spaceRight;
- if (needsUpward) {
- dropdown.classList.add(this.options.upwardClass);
- }
- this.setDropdownPosition(dropdown, needsUpward, needsLeft);
- }
- }, {
- key: "setDropdownPosition",
- value: function setDropdownPosition(dropdown, upward, left) {
- var isRTL = document.dir === 'rtl' || document.documentElement.dir === 'rtl';
- Object.assign(dropdown.style, (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({
- position: 'absolute',
- top: upward ? '' : '100%',
- bottom: upward ? '100%' : '',
- left: left && !isRTL || !left && isRTL ? 'auto' : '0',
- right: left && !isRTL || !left && isRTL ? '0' : 'auto',
- transform: ''
- }, upward ? 'marginBottom' : 'marginTop', "".concat(this.options.offset, "px")));
- }
- }, {
- key: "updateVisibleDropdowns",
- value: function updateVisibleDropdowns() {
- var _this3 = this;
- var visibleDropdowns = document.querySelectorAll("".concat(this.options.dropdownClass, ".").concat(this.options.activeClass));
- visibleDropdowns.forEach(function (dropdown) {
- var trigger = dropdown.parentElement.querySelector(_this3.options.triggerClass);
- if (trigger) {
- _this3.positionDropdown(trigger);
- }
- });
- }
- }, {
- key: "setupMutationObserver",
- value: function setupMutationObserver() {
- var _this4 = this;
- if (this.observer) return;
- this.observer = new MutationObserver(function (mutations) {
- mutations.forEach(function (mutation) {
- if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
- var target = mutation.target;
- if (target.classList.contains(_this4.options.dropdownClass) && target.classList.contains(_this4.options.activeClass)) {
- var trigger = target.parentElement.querySelector(_this4.options.triggerClass);
- if (trigger) {
- setTimeout(function () {
- return _this4.positionDropdown(trigger);
- }, _this4.options.mutationDelay);
- }
- }
- }
- if (mutation.type === 'childList') {
- mutation.addedNodes.forEach(function (node) {
- if (node.nodeType === Node.ELEMENT_NODE) {
- var dropdowns = node.querySelectorAll ? node.querySelectorAll(_this4.options.dropdownClass) : node.matches && node.matches(_this4.options.dropdownClass) ? [node] : [];
- dropdowns.forEach(function (dropdown) {
- var trigger = dropdown.parentElement.querySelector(_this4.options.triggerClass);
- if (trigger) {
- _this4.attachDropdownEvents(trigger);
- }
- });
- }
- });
- }
- });
- });
- this.observer.observe(document.body, {
- childList: true,
- subtree: true,
- attributes: true,
- attributeFilter: ['class']
- });
- }
- }, {
- key: "attachDropdownEvents",
- value: function attachDropdownEvents(trigger) {
- var _this5 = this;
- if (trigger.dataset.viewportDropdownAttached) return;
- trigger.addEventListener('click', function (e) {
- setTimeout(function () {
- return _this5.positionDropdown(e.target);
- }, _this5.options.positioningDelay);
- });
- trigger.dataset.viewportDropdownAttached = 'true';
- }
- }, {
- key: "initializeAllDropdowns",
- value: function initializeAllDropdowns() {
- var _this6 = this;
- var allTriggers = document.querySelectorAll(this.options.triggerClass);
- allTriggers.forEach(function (trigger) {
- _this6.attachDropdownEvents(trigger);
- });
- }
- }, {
- key: "position",
- value: function position(trigger) {
- var element = typeof trigger === 'string' ? document.querySelector(trigger) : trigger;
- if (element) this.positionDropdown(element);
- }
- }, {
- key: "updateOptions",
- value: function updateOptions(newOptions) {
- Object.assign(this.options, newOptions);
- }
- }, {
- key: "destroy",
- value: function destroy() {
- if (this.observer) {
- this.observer.disconnect();
- this.observer = null;
- }
- this.isInitialized = false;
- }
- }]);
-}();
-var viewportDropdown = new ViewportAwareDropdown();
-
-// Initialize all dropdowns when DOM is ready
-document.addEventListener('DOMContentLoaded', function () {
- viewportDropdown.initializeAllDropdowns();
-});
-(function ($) {
- window.addEventListener('load', function () {
- //Remove Preload after Window Load
- $('body').removeClass('directorist-preload');
- $('.button.wp-color-result').attr('style', ' ');
-
- /* ----------------
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/slicedToArray */ './node_modules/@babel/runtime/helpers/esm/slicedToArray.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/defineProperty */ './node_modules/@babel/runtime/helpers/esm/defineProperty.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/classCallCheck */ './node_modules/@babel/runtime/helpers/esm/classCallCheck.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/createClass */ './node_modules/@babel/runtime/helpers/esm/createClass.js'
+ );
+ /* harmony import */ var _global_components_debounce__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ../global/components/debounce */ './assets/src/js/global/components/debounce.js'
+ );
+ /* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_5__ =
+ __webpack_require__(
+ /*! ./../global/components/select2-custom-control */ './assets/src/js/global/components/select2-custom-control.js'
+ );
+ /* harmony import */ var _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_5___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _global_components_select2_custom_control__WEBPACK_IMPORTED_MODULE_5__
+ );
+ /* harmony import */ var _global_components_setup_select2__WEBPACK_IMPORTED_MODULE_6__ =
+ __webpack_require__(
+ /*! ./../global/components/setup-select2 */ './assets/src/js/global/components/setup-select2.js'
+ );
+ /* harmony import */ var _components_category_custom_fields__WEBPACK_IMPORTED_MODULE_7__ =
+ __webpack_require__(
+ /*! ./components/category-custom-fields */ './assets/src/js/public/components/category-custom-fields.js'
+ );
+ /* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_8__ =
+ __webpack_require__(
+ /*! ./components/colorPicker */ './assets/src/js/public/components/colorPicker.js'
+ );
+ /* harmony import */ var _components_colorPicker__WEBPACK_IMPORTED_MODULE_8___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_colorPicker__WEBPACK_IMPORTED_MODULE_8__
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__ =
+ __webpack_require__(
+ /*! ./components/directoristDropdown */ './assets/src/js/public/components/directoristDropdown.js'
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_9__
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__ =
+ __webpack_require__(
+ /*! ./components/directoristSelect */ './assets/src/js/public/components/directoristSelect.js'
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristSelect__WEBPACK_IMPORTED_MODULE_10__
+ );
+
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r) return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t && r.constructor && (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ function ownKeys(e, r) {
+ var t = Object.keys(e);
+ if (Object.getOwnPropertySymbols) {
+ var o = Object.getOwnPropertySymbols(e);
+ (r &&
+ (o = o.filter(function (r) {
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
+ })),
+ t.push.apply(t, o));
+ }
+ return t;
+ }
+ function _objectSpread(e) {
+ for (var r = 1; r < arguments.length; r++) {
+ var t = null != arguments[r] ? arguments[r] : {};
+ r % 2
+ ? ownKeys(Object(t), !0).forEach(function (r) {
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(e, r, t[r]);
+ })
+ : Object.getOwnPropertyDescriptors
+ ? Object.defineProperties(
+ e,
+ Object.getOwnPropertyDescriptors(t)
+ )
+ : ownKeys(Object(t)).forEach(function (r) {
+ Object.defineProperty(
+ e,
+ r,
+ Object.getOwnPropertyDescriptor(t, r)
+ );
+ });
+ }
+ return e;
+ }
+
+ var ViewportAwareDropdown = /*#__PURE__*/ (function () {
+ function ViewportAwareDropdown() {
+ var options =
+ arguments.length > 0 && arguments[0] !== undefined
+ ? arguments[0]
+ : {};
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__[
+ 'default'
+ ])(this, ViewportAwareDropdown);
+ this.options = _objectSpread(
+ {
+ dropdownClass:
+ '.directorist-search-basic-dropdown-content',
+ triggerClass:
+ '.directorist-search-basic-dropdown-label',
+ activeClass: 'dropdown-content-show',
+ upwardClass: 'dropdown-upward',
+ offset: 8,
+ positioningDelay: 10,
+ mutationDelay: 50,
+ animationDelay: 300,
+ },
+ options
+ );
+ this.observer = null;
+ this.isInitialized = false;
+ this.init();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__[
+ 'default'
+ ])(ViewportAwareDropdown, [
+ {
+ key: 'init',
+ value: function init() {
+ if (this.isInitialized) return;
+ this.bindEvents();
+ this.setupMutationObserver();
+ this.isInitialized = true;
+ },
+ },
+ {
+ key: 'bindEvents',
+ value: function bindEvents() {
+ var _this2 = this;
+ var debouncedResize = (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_4__[
+ 'default'
+ ])(function () {
+ return _this2.updateVisibleDropdowns();
+ }, 100);
+ var debouncedScroll = (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_4__[
+ 'default'
+ ])(function () {
+ return _this2.updateVisibleDropdowns();
+ }, 50);
+ window.addEventListener('resize', debouncedResize);
+ window.addEventListener('scroll', debouncedScroll);
+ },
+ },
+ {
+ key: 'positionDropdown',
+ value: function positionDropdown(trigger) {
+ var dropdown = trigger.parentElement.querySelector(
+ this.options.dropdownClass
+ );
+ if (!dropdown) return;
+ dropdown.classList.remove(this.options.upwardClass);
+ var triggerRect = trigger.getBoundingClientRect();
+ var dropdownHeight = dropdown.offsetHeight;
+ var dropdownWidth = dropdown.offsetWidth;
+ var viewportHeight = window.innerHeight;
+ var viewportWidth = window.innerWidth;
+ var spaceBelow = viewportHeight - triggerRect.bottom;
+ var spaceAbove = triggerRect.top;
+ var spaceRight = viewportWidth - triggerRect.left;
+ var spaceLeft = triggerRect.right;
+ var needsUpward =
+ spaceBelow < dropdownHeight + this.options.offset &&
+ spaceAbove > spaceBelow;
+ var needsLeft =
+ spaceRight < dropdownWidth &&
+ spaceLeft > spaceRight;
+ if (needsUpward) {
+ dropdown.classList.add(this.options.upwardClass);
+ }
+ this.setDropdownPosition(
+ dropdown,
+ needsUpward,
+ needsLeft
+ );
+ },
+ },
+ {
+ key: 'setDropdownPosition',
+ value: function setDropdownPosition(
+ dropdown,
+ upward,
+ left
+ ) {
+ var isRTL =
+ document.dir === 'rtl' ||
+ document.documentElement.dir === 'rtl';
+ Object.assign(
+ dropdown.style,
+ (0,
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(
+ {
+ position: 'absolute',
+ top: upward ? '' : '100%',
+ bottom: upward ? '100%' : '',
+ left:
+ (left && !isRTL) || (!left && isRTL)
+ ? 'auto'
+ : '0',
+ right:
+ (left && !isRTL) || (!left && isRTL)
+ ? '0'
+ : 'auto',
+ transform: '',
+ },
+ upward ? 'marginBottom' : 'marginTop',
+ ''.concat(this.options.offset, 'px')
+ )
+ );
+ },
+ },
+ {
+ key: 'updateVisibleDropdowns',
+ value: function updateVisibleDropdowns() {
+ var _this3 = this;
+ var visibleDropdowns = document.querySelectorAll(
+ ''
+ .concat(this.options.dropdownClass, '.')
+ .concat(this.options.activeClass)
+ );
+ visibleDropdowns.forEach(function (dropdown) {
+ var trigger = dropdown.parentElement.querySelector(
+ _this3.options.triggerClass
+ );
+ if (trigger) {
+ _this3.positionDropdown(trigger);
+ }
+ });
+ },
+ },
+ {
+ key: 'setupMutationObserver',
+ value: function setupMutationObserver() {
+ var _this4 = this;
+ if (this.observer) return;
+ this.observer = new MutationObserver(function (
+ mutations
+ ) {
+ mutations.forEach(function (mutation) {
+ if (
+ mutation.type === 'attributes' &&
+ mutation.attributeName === 'class'
+ ) {
+ var target = mutation.target;
+ if (
+ target.classList.contains(
+ _this4.options.dropdownClass
+ ) &&
+ target.classList.contains(
+ _this4.options.activeClass
+ )
+ ) {
+ var trigger =
+ target.parentElement.querySelector(
+ _this4.options.triggerClass
+ );
+ if (trigger) {
+ setTimeout(function () {
+ return _this4.positionDropdown(
+ trigger
+ );
+ }, _this4.options.mutationDelay);
+ }
+ }
+ }
+ if (mutation.type === 'childList') {
+ mutation.addedNodes.forEach(
+ function (node) {
+ if (
+ node.nodeType ===
+ Node.ELEMENT_NODE
+ ) {
+ var dropdowns =
+ node.querySelectorAll
+ ? node.querySelectorAll(
+ _this4.options
+ .dropdownClass
+ )
+ : node.matches &&
+ node.matches(
+ _this4
+ .options
+ .dropdownClass
+ )
+ ? [node]
+ : [];
+ dropdowns.forEach(
+ function (dropdown) {
+ var trigger =
+ dropdown.parentElement.querySelector(
+ _this4.options
+ .triggerClass
+ );
+ if (trigger) {
+ _this4.attachDropdownEvents(
+ trigger
+ );
+ }
+ }
+ );
+ }
+ }
+ );
+ }
+ });
+ });
+ this.observer.observe(document.body, {
+ childList: true,
+ subtree: true,
+ attributes: true,
+ attributeFilter: ['class'],
+ });
+ },
+ },
+ {
+ key: 'attachDropdownEvents',
+ value: function attachDropdownEvents(trigger) {
+ var _this5 = this;
+ if (trigger.dataset.viewportDropdownAttached) return;
+ trigger.addEventListener('click', function (e) {
+ setTimeout(function () {
+ return _this5.positionDropdown(e.target);
+ }, _this5.options.positioningDelay);
+ });
+ trigger.dataset.viewportDropdownAttached = 'true';
+ },
+ },
+ {
+ key: 'initializeAllDropdowns',
+ value: function initializeAllDropdowns() {
+ var _this6 = this;
+ var allTriggers = document.querySelectorAll(
+ this.options.triggerClass
+ );
+ allTriggers.forEach(function (trigger) {
+ _this6.attachDropdownEvents(trigger);
+ });
+ },
+ },
+ {
+ key: 'position',
+ value: function position(trigger) {
+ var element =
+ typeof trigger === 'string'
+ ? document.querySelector(trigger)
+ : trigger;
+ if (element) this.positionDropdown(element);
+ },
+ },
+ {
+ key: 'updateOptions',
+ value: function updateOptions(newOptions) {
+ Object.assign(this.options, newOptions);
+ },
+ },
+ {
+ key: 'destroy',
+ value: function destroy() {
+ if (this.observer) {
+ this.observer.disconnect();
+ this.observer = null;
+ }
+ this.isInitialized = false;
+ },
+ },
+ ]);
+ })();
+ var viewportDropdown = new ViewportAwareDropdown();
+
+ // Initialize all dropdowns when DOM is ready
+ document.addEventListener('DOMContentLoaded', function () {
+ viewportDropdown.initializeAllDropdowns();
+ });
+ (function ($) {
+ window.addEventListener('load', function () {
+ //Remove Preload after Window Load
+ $('body').removeClass('directorist-preload');
+ $('.button.wp-color-result').attr('style', ' ');
+
+ /* ----------------
Search Form
------------------ */
- // Default Tags Slice
- function defaultTags() {
- $('.directorist-btn-ml').each(function (index, element) {
- var item = $(element).siblings('.atbdp_cf_checkbox, .directorist-search-field-tag, .directorist-search-tags');
- var item_checkbox = $(item).find('.directorist-checkbox');
- $(item_checkbox).slice(4, item_checkbox.length).fadeOut();
- if (item_checkbox.length <= 4) {
- $(element).css('display', 'none');
- }
- });
- }
- defaultTags();
- window.addEventListener('triggerSlice', defaultTags);
-
- // See More Tags Button
- $('body').on('click', '.directorist-btn-ml', function (event) {
- event.preventDefault();
- var item = $(this).siblings('.directorist-search-tags');
- var item_checkbox = $(item).find('.directorist-checkbox');
- $(item_checkbox).slice(4, item_checkbox.length).fadeOut();
- $(this).toggleClass('active');
- if ($(this).hasClass('active')) {
- $(this).text(directorist.i18n_text.show_less);
- $(item_checkbox).slice(4, item_checkbox.length).fadeIn();
- } else {
- $(this).text(directorist.i18n_text.show_more);
- $(item_checkbox).slice(4, item_checkbox.length).fadeOut();
- }
- });
-
- /*** Search Form ***/
-
- // Count Checkbox Selected Items
- function selectedItemCount(item) {
- var dropdownParent = $(item).closest('.directorist-search-field');
- var dropDownContent = $(item).closest('.directorist-search-basic-dropdown-content');
- var selectedItemCount = dropDownContent.find('.directorist-checkbox input[type="checkbox"]:checked');
- var selectedPrefix = dropDownContent.siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-prefix');
- var selectedCounter = dropDownContent.siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-count');
- if (selectedItemCount.length > 0) {
- selectedCounter.text(selectedItemCount.length);
- selectedPrefix.text('Selected');
- dropdownParent.addClass('input-has-value');
- } else {
- // If no items are checked, clear the text
- selectedCounter.text('');
- selectedPrefix.text('');
- dropdownParent.removeClass('input-has-value');
- }
- }
-
- // Radio Selected Items
- function selectedRadioItem(item) {
- var dropdownParent = $(item).closest('.directorist-search-field');
- var dropDownLabel = dropdownParent.find('.directorist-search-basic-dropdown-selected-item');
- var selectedItem = dropdownParent.find('.directorist-radio input[type="radio"]:checked');
- var selectedItemLabel = selectedItem.siblings('.directorist-radio__label').text();
- if (selectedItem) {
- dropDownLabel.text(' - ' + selectedItemLabel);
- dropdownParent.addClass('input-has-value');
- } else {
- // If no items are checked, clear the text
- selectedItem.text('');
- dropdownParent.removeClass('input-has-value');
- }
- }
-
- // Checkbox Field Check
- $('body').on('change', '.directorist-search-form__top .directorist-search-basic-dropdown input[type="checkbox"], .directorist-search-modal .directorist-search-basic-dropdown input[type="checkbox"]', function (e) {
- e.preventDefault();
- selectedItemCount(this);
- });
-
- // Radio Field Check
- $('body').on('change', '.directorist-search-form__top .directorist-search-basic-dropdown input[type="radio"], .directorist-search-modal .directorist-search-basic-dropdown input[type="radio"]', function (e) {
- e.preventDefault();
- selectedRadioItem(this);
- });
-
- // Initialize selected item count for checkboxes that are already checked on page load
- // Process each dropdown that has checked checkboxes to avoid redundant calls
- $('.directorist-search-form__top .directorist-search-basic-dropdown-content, .directorist-search-modal .directorist-search-basic-dropdown-content').each(function () {
- var checkedCheckbox = $(this).find('input[type="checkbox"]:checked');
- if (checkedCheckbox.length > 0) {
- // Call once per dropdown with any checked checkbox
- selectedItemCount(checkedCheckbox.first());
- }
- });
-
- // Initialize selected radio items that are already checked on page load
- $('.directorist-search-form__top .directorist-search-basic-dropdown input[type="radio"]:checked, .directorist-search-modal .directorist-search-basic-dropdown input[type="radio"]:checked').each(function () {
- selectedRadioItem(this);
- });
-
- // Initialize all input fields that have values on page load
- $('.directorist-search-form__top .directorist-search-field__input:not(.directorist-search-basic-dropdown), .directorist-search-modal .directorist-search-field__input:not(.directorist-search-basic-dropdown)').each(function () {
- var inputField = $(this);
- var inputValue = inputField.val();
- var searchField = inputField.closest('.directorist-search-field');
-
- // Check if it's a select field
- if (inputField.hasClass('directorist-select')) {
- var selectElement = inputField.find('select');
- if (selectElement.length) {
- inputValue = selectElement.val() || selectElement.data('selected-id');
- }
- }
-
- // If field has a value, add appropriate classes
- if (inputValue && inputValue !== '' && inputValue !== '0') {
- searchField.addClass('input-has-value');
- if (!searchField.hasClass('input-is-focused')) {
- searchField.addClass('input-is-focused');
- }
- }
- });
-
- // Initialize color picker background colors on page load
- $('.wp-color-picker, .directorist-color-picker').each(function () {
- var colorValue = $(this).val();
- if (colorValue && colorValue !== '') {
- var colorButton = $(this).closest('.directorist-search-field').find('.wp-color-result');
- if (colorButton.length) {
- colorButton.css('background-color', colorValue);
- }
- }
- });
-
- // Basic Search Dropdown Toggle
- $('body').on('click', '.directorist-search-form__top .directorist-search-basic-dropdown-label, .directorist-search-modal .directorist-search-basic-dropdown-label', function (e) {
- var _this7 = this;
- e.preventDefault();
- var dropDownParent = $(this).closest('.directorist-search-field');
- var dropDownContent = $(this).siblings('.directorist-search-basic-dropdown-content');
- dropDownContent.toggleClass('dropdown-content-show');
- if (dropDownContent.hasClass('dropdown-content-show')) {
- dropDownParent.addClass('input-is-focused');
- dropDownContent.slideDown();
- setTimeout(function () {
- viewportDropdown.position(_this7);
- }, viewportDropdown.options.animationDelay);
- } else {
- dropDownParent.removeClass('input-is-focused');
- dropDownContent.slideUp();
- }
- // Hide all other open contents
- $('.directorist-search-basic-dropdown-content.dropdown-content-show').not(dropDownContent).each(function () {
- $(this).removeClass('dropdown-content-show dropdown-upward').slideUp();
- });
- });
-
- // Dropdown Content Hide on Outside Click
- $('body').on('click', function (e) {
- var dropDownRoot = $(e.target).closest('.directorist-search-form-dropdown');
- var dropDownParent = $('.directorist-search-form-dropdown.input-is-focused');
- var dropDownContent = $('.directorist-search-basic-dropdown-content.dropdown-content-show');
- if (!dropDownRoot.length) {
- dropDownParent.each(function () {
- $(this).removeClass('input-is-focused');
- });
- dropDownContent.each(function () {
- $(this).removeClass('dropdown-content-show dropdown-upward').slideUp();
- });
- }
- });
-
- // Check Empty Search Fields on Search Modal
- function initSearchFields() {
- var searchFields = document.querySelectorAll('.directorist-search-field__input:not(.directorist-search-basic-dropdown)');
- searchFields.forEach(function (searchField) {
- var wrapper = searchField.closest('.directorist-search-field');
- if (!wrapper) {
- return;
- }
- var inputFieldValue = searchField.value;
- if (searchField.classList.contains('directorist-select')) {
- inputFieldValue = searchField.querySelector('select').dataset.selectedId;
- }
- if (inputFieldValue !== '') {
- wrapper.classList.add('input-has-value');
- if (!wrapper.classList.contains('input-is-focused')) {
- wrapper.classList.add('input-is-focused');
- }
- } else {
- inputFieldValue = '';
- if (wrapper.classList.contains('input-has-value')) {
- wrapper.classList.remove('input-has-value');
- }
- }
- });
- }
- initSearchFields();
-
- // Search Form Reset Button Initialize
- function initForm(searchForm) {
- var value = false;
-
- // Check all input fields which are not checkbox, radio & hidden
- searchForm.querySelectorAll("input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not(.wp-picker-clear):not(.directorist-custom-range-slider__value__min):not(.directorist-custom-range-slider__value__max)").forEach(function (el) {
- if (el.value !== '') {
- value = true;
- }
- });
-
- // Check all checkbox, radio field
- searchForm.querySelectorAll("input[type='checkbox'], input[type='radio']").forEach(function (el) {
- if (el.checked) {
- value = true;
- }
- });
-
- // Check all select field
- searchForm.querySelectorAll('select').forEach(function (el) {
- if (el.value || el.selectedIndex !== 0) {
- value = true;
- }
- });
-
- // Check all custom number range field
- searchForm.querySelectorAll('.directorist-search-field-text_range .directorist-custom-range-slider__range').forEach(function (el) {
- if (el.value === '0-0') {
- value = false;
- }
- });
-
- // Check all range slider field
- searchForm.querySelectorAll('.directorist-custom-range-slider__value input').forEach(function (el) {
- if (el.value > 0) {
- value = true;
- }
- });
-
- // Disable Reset Button based on value
- if (!value) {
- // Find Reset Button in current form
- var resetButtonWrapper = searchForm.querySelector('.directorist-advanced-filter__action');
- if (resetButtonWrapper) {
- resetButtonWrapper.classList.add('reset-btn-disabled');
- } else {
- var _searchForm$closest;
- // Find Reset Button in whole listing-with-sidebar
- resetButtonWrapper = (_searchForm$closest = searchForm.closest('.listing-with-sidebar')) === null || _searchForm$closest === void 0 ? void 0 : _searchForm$closest.querySelector('.directorist-advanced-filter__action');
- if (resetButtonWrapper) {
- resetButtonWrapper.classList.add('reset-btn-disabled');
- }
- }
- } else {
- setTimeout(function () {
- enableResetButton(searchForm);
- }, 100);
- }
- }
-
- // Enable Reset Button
- function enableResetButton(searchForm) {
- var $resetButtonWrapper = $(searchForm).find('.directorist-advanced-filter__action');
- if (!$resetButtonWrapper.length) {
- $resetButtonWrapper = $(searchForm).closest('.directorist-instant-search').find('.directorist-advanced-filter__action');
- }
- if ($resetButtonWrapper.length) {
- $resetButtonWrapper.removeClass('reset-btn-disabled');
- }
- }
-
- // Initialize Form Reset Button
- var searchForm = document.querySelectorAll('.directorist-contents-wrap form');
- searchForm.forEach(function (form) {
- setTimeout(function () {
- initForm(form);
- }, 100);
- });
-
- // Input Field Check
- $('body').on('keyup', '.directorist-contents-wrap form input:not([type="checkbox"]):not([type="radio"])', function (e) {
- var searchForm = this.closest('form');
- if (this.value && this.value !== 0 && this.value !== undefined) {
- enableResetButton(searchForm);
- } else {
- setTimeout(function () {
- initForm(searchForm);
- }, 100);
- }
- });
- $('body').on('change', '.directorist-contents-wrap form input[type="checkbox"], .directorist-contents-wrap form input[type="radio"]', function (e) {
- var searchForm = this.closest('form');
- if (this.checked) {
- enableResetButton(searchForm);
- } else {
- setTimeout(function () {
- initForm(searchForm);
- }, 100);
- }
- });
- $('body').on('change', '.directorist-contents-wrap form select', function (e) {
- var searchForm = this.closest('form');
- if (this.value !== undefined && this.value !== '') {
- enableResetButton(searchForm);
- } else {
- setTimeout(function () {
- initForm(searchForm);
- }, 100);
- }
- });
-
- // Color Field Open Button Click
- $('.directorist-contents-wrap form .wp-color-result').on('click', function (e) {
- e.preventDefault();
- var $parentElement = $(this).closest('.directorist-search-field');
- if ($parentElement.hasClass('input-has-value') || $parentElement.hasClass('input-is-focused')) {
- $parentElement.removeClass('input-has-value input-is-focused');
- } else {
- $parentElement.addClass('input-has-value input-is-focused');
- }
- });
-
- // Color Field Clear Button Click
- $('.directorist-contents-wrap form .wp-picker-clear').on('click', function (e) {
- e.preventDefault();
- var $parentElement = $(this).closest('.directorist-search-field');
- if ($parentElement.hasClass('input-has-value') || $parentElement.hasClass('input-is-focused')) {
- $parentElement.removeClass('input-has-value input-is-focused');
- }
- var color = '';
- var input = $parentElement.find('.wp-color-picker')[0]; // get raw DOM element
- var form = $parentElement.closest('form')[0];
- if (!input || !form) return;
-
- // Dispatch custom event
- var colorChangeEvent = new CustomEvent('directorist-color-changed', {
- detail: {
- color: color,
- input: input,
- form: form
- }
- });
- window.dispatchEvent(colorChangeEvent);
- });
-
- // Color Change Event
- window.addEventListener('directorist-color-changed', function (e) {
- var _e$detail = e.detail,
- color = _e$detail.color,
- input = _e$detail.input,
- form = _e$detail.form;
- if (color && color !== '') {
- enableResetButton(form);
- var $parentElement = $(input).closest('.directorist-search-field');
- if (!$parentElement.hasClass('input-has-value') && !$parentElement.hasClass('input-is-focused')) {
- $parentElement.addClass('input-has-value input-is-focused');
- }
- } else {
- setTimeout(function () {
- initForm(form);
- }, 100);
- }
- });
-
- // Searchform Reset
- function adsFormReset(searchForm) {
- searchForm.querySelectorAll("input[type='text']:not(.wp-picker-clear)").forEach(function (el) {
- el.value = '';
- if (el.parentElement.classList.contains('input-has-value') || el.parentElement.classList.contains('input-is-focused')) {
- el.parentElement.classList.remove('input-has-value', 'input-is-focused');
- }
- });
- searchForm.querySelectorAll("input[type='date']").forEach(function (el) {
- el.value = '';
- });
- searchForm.querySelectorAll("input[type='time']").forEach(function (el) {
- el.value = '';
- });
- searchForm.querySelectorAll("input[type='url']").forEach(function (el) {
- el.value = '';
- if (el.parentElement.classList.contains('input-has-value') || el.parentElement.classList.contains('input-is-focused')) {
- el.parentElement.classList.remove('input-has-value', 'input-is-focused');
- }
- });
- searchForm.querySelectorAll("input[type='number']").forEach(function (el) {
- el.value = '';
- if (el.parentElement.classList.contains('input-has-value') || el.parentElement.classList.contains('input-is-focused')) {
- el.parentElement.classList.remove('input-has-value', 'input-is-focused');
- }
- });
- searchForm.querySelectorAll("input[type='hidden']:not(.listing_type)").forEach(function (el) {
- if (el.getAttribute('name') === 'directory_type' || el.getAttribute('name') === 'radius-search-based-on') return;
- el.value = '';
- });
- searchForm.querySelectorAll("input[type='radio']").forEach(function (el) {
- el.checked = false;
- });
- searchForm.querySelectorAll("input[type='checkbox']").forEach(function (el) {
- el.checked = false;
- });
- searchForm.querySelectorAll('select').forEach(function (el) {
- el.selectedIndex = 0;
- $('.directorist-select2-dropdown-close').click();
- var parentElem = el.closest('.directorist-search-field');
- if (parentElem.classList.contains('input-has-value') || parentElem.classList.contains('input-is-focused')) {
- setTimeout(function () {
- parentElem.classList.remove('input-has-value', 'input-is-focused');
- }, 100);
- }
- });
- var customRangeSliders = document.querySelectorAll('.directorist-custom-range-slider');
- customRangeSliders.forEach(function (sliderItem) {
- resetCustomRangeSlider(sliderItem);
- });
- searchForm.querySelectorAll('.directorist-search-basic-dropdown-content').forEach(function (dropdown) {
- var dropDownParent = dropdown.closest('.directorist-search-field');
- $(dropdown).siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-count').text('');
- $(dropdown).siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-prefix').text('');
- if (dropDownParent.classList.contains('input-has-value') || dropDownParent.classList.contains('input-is-focused')) {
- dropDownParent.classList.remove('input-has-value', 'input-is-focused');
- }
- });
- var irisPicker = searchForm.querySelector('input.wp-picker-clear');
- if (irisPicker !== null) {
- irisPicker.click();
- }
- handleRadiusVisibility();
- initForm(searchForm);
- }
-
- // Searchform Reset Trigger
- if ($('.directorist-btn-reset-js') !== null) {
- $('body').on('click', '.directorist-btn-reset-js', function (e) {
- var _this8 = this;
- e.preventDefault();
- setTimeout(function () {
- // Clear URL params on modal form reset
- var baseUrl = window.location.origin + window.location.pathname;
-
- // Update the URL in the address bar
- window.history.replaceState(null, '', baseUrl);
- if (_this8.closest('.directorist-search-modal')) {
- // Clear only the query parameters
- var _baseUrl = window.location.origin + window.location.pathname;
-
- // Update the URL in the address bar
- window.history.replaceState(null, '', _baseUrl);
- }
- }, 300);
-
- // Reset search form values
- if (this.closest('.directorist-contents-wrap')) {
- var _searchForm = this.closest('.directorist-contents-wrap').querySelector('.directorist-search-form');
- if (_searchForm) {
- adsFormReset(_searchForm);
- }
- var advanceSearchForm = this.closest('.directorist-contents-wrap').querySelector('.directorist-advanced-filter__form');
- if (advanceSearchForm) {
- adsFormReset(advanceSearchForm);
- }
- var advanceSearchFilter = this.closest('.directorist-contents-wrap').querySelector('.directorist-advanced-filter__advanced');
- if (advanceSearchFilter) {
- adsFormReset(advanceSearchFilter);
- }
- }
- });
- }
-
- // Search Modal Open
- function searchModalOpen(searchModalParent) {
- var modalOverlay = searchModalParent.querySelector('.directorist-search-modal__overlay');
- var modalContent = searchModalParent.querySelector('.directorist-search-modal__contents');
-
- // Overlay Style
- modalOverlay.style.cssText = 'opacity: 1; visibility: visible; transition: 0.3s ease;';
-
- // Modal Content Style
- modalContent.style.cssText = 'opacity: 1; visibility: visible; bottom:0;';
- }
-
- // Search Modal Close
- function searchModalClose(searchModalParent) {
- var modalOverlay = searchModalParent.querySelector('.directorist-search-modal__overlay');
- var modalContent = searchModalParent.querySelector('.directorist-search-modal__contents');
-
- // Overlay Style
- if (modalOverlay) {
- modalOverlay.style.cssText = 'opacity: 0; visibility: hidden; transition: 0.5s ease';
- }
-
- // Modal Content Style
- if (modalContent) {
- modalContent.style.cssText = 'opacity: 0; visibility: hidden; bottom: -200px;';
- }
- }
-
- // Search Modal Minimizer
- function searchModalMinimize(searchModalParent) {
- var modalContent = searchModalParent.querySelector('.directorist-search-modal__contents');
- var modalMinimizer = searchModalParent.querySelector('.directorist-search-modal__minimizer');
- if (modalMinimizer.classList.contains('minimized')) {
- modalMinimizer.classList.remove('minimized');
- modalContent.style.bottom = '0';
- } else {
- modalMinimizer.classList.add('minimized');
- modalContent.style.bottom = '-50%';
- }
- }
-
- // Search Modal Open Trigger
- $('body').on('click', '.directorist-modal-btn', function (e) {
- e.preventDefault();
- // added overlay class on body
- document.querySelector('.directorist-content-active').classList.add('directorist-overlay-active');
- var parentElement = this.closest('.directorist-contents-wrap');
- if (this.classList.contains('directorist-modal-btn--basic')) {
- var searchModalElement = parentElement.querySelector('.directorist-search-modal--basic');
- searchModalOpen(searchModalElement);
- }
- if (this.classList.contains('directorist-modal-btn--advanced')) {
- var _searchModalElement = parentElement.querySelector('.directorist-search-modal--advanced');
- searchModalOpen(_searchModalElement);
- }
- if (this.classList.contains('directorist-modal-btn--full')) {
- var _searchModalElement2 = parentElement.querySelector('.directorist-search-modal--full');
- searchModalOpen(_searchModalElement2);
- }
- });
-
- // Search Modal Close Trigger
- $('body').on('click', '.directorist-search-modal__contents__btn--close, .directorist-search-modal__overlay', function (e) {
- e.preventDefault();
- // removed overlay class from body
- document.querySelector('.directorist-content-active').classList.remove('directorist-overlay-active');
- var searchModalElement = this.closest('.directorist-search-modal');
- searchModalClose(searchModalElement);
- });
-
- // Search Modal Minimizer Trigger
- $('body').on('click', '.directorist-search-modal__minimizer', function (e) {
- e.preventDefault();
- var searchModalElement = this.closest('.directorist-search-modal');
- searchModalMinimize(searchModalElement);
- });
-
- // Search Field Input Value Check
- function inputValueCheck(searchField) {
- searchField = searchField[0];
- var inputBox = searchField.querySelector('.directorist-search-field__input:not(.directorist-search-basic-dropdown)');
- var inputFieldValue = inputBox && inputBox.value;
- if (inputFieldValue) {
- searchField.classList.add('input-has-value');
- if (!searchField.classList.contains('input-is-focused')) {
- searchField.classList.add('input-is-focused');
- }
- } else {
- inputFieldValue = '';
- if (searchField.classList.contains('input-has-value')) {
- searchField.classList.remove('input-has-value');
- }
- if (searchField.classList.contains('input-is-focused')) {
- searchField.classList.remove('input-is-focused');
- }
- }
- }
-
- // Search Field Input Event Check
- function inputEventCheck(e, searchField) {
- searchField = searchField[0];
- var inputBox = searchField.querySelector('.directorist-search-field__input:not(.directorist-search-basic-dropdown)');
- var inputFieldValue = inputBox.value;
- if (e.type === 'focusin') {
- searchField.classList.add('input-is-focused');
- } else if (e.type === 'focusout') {
- if (inputBox.classList.contains('directorist-select')) {
- selectFocusOutCheck(searchField, inputBox);
- } else {
- if (inputFieldValue) {
- searchField.classList.add('input-has-value');
- if (!searchField.classList.contains('input-is-focused')) {
- searchField.classList.add('input-is-focused');
- }
- } else {
- searchField.classList.remove('input-is-focused');
- }
- }
- }
- }
-
- // Search Field Input Focusout Event Check
- function selectFocusOutCheck(searchField, inputBox) {
- searchField.classList.add('input-is-focused');
- var inputFieldValue = inputBox.querySelector('select').value;
- $('body').one('click', function (e) {
- inputFieldValue = inputBox.querySelector('select').value;
- var parentWithClass = e.target.closest('.directorist-search-field__input:not(.directorist-search-basic-dropdown)');
- if (!parentWithClass) {
- if (inputFieldValue) {
- searchField.classList.add('input-has-value');
- if (!searchField.classList.contains('input-is-focused')) {
- searchField.classList.add('input-is-focused');
- }
- } else {
- searchField.classList.remove('input-is-focused');
- }
- }
- });
- }
-
- // Search Form Select Field Init
- function initSelectFields() {
- var selectFields = document.querySelectorAll('.directorist-select.directorist-search-field__input:not(.directorist-search-basic-dropdown');
- selectFields.forEach(function (selectField) {
- var searchField = $(selectField).closest('.directorist-search-field');
- inputValueCheck(searchField);
- });
- }
- initSelectFields();
-
- // Search Form Input Field Check Trigger
- $('body').on('input keyup change', '.directorist-search-field__input:not(.directorist-search-basic-dropdown)', function (e) {
- var searchField = $(this).closest('.directorist-search-field');
- inputValueCheck(searchField);
- });
- $('body').on('focus blur', '.directorist-search-field__input:not(.directorist-search-basic-dropdown)', function (e) {
- var searchField = $(this).closest('.directorist-search-field');
- inputEventCheck(e, searchField);
- });
-
- // Search Form Input Clear Button
- $('body').on('click', '.directorist-search-field__btn--clear', function (e) {
- var inputFields = this.parentElement.querySelectorAll('.directorist-form-element');
- var selectboxField = this.parentElement.querySelector('.directorist-select select');
- var basicDropdown = this.parentElement.querySelectorAll('.directorist-search-basic-dropdown-content');
- var radioFields = this.parentElement.querySelectorAll('input[type="radio"]');
- var checkboxFields = this.parentElement.querySelectorAll('input[type="checkbox"]');
- if (selectboxField) {
- selectboxField.selectedIndex = 0;
- selectboxField.dispatchEvent(new Event('change'));
- $(selectboxField).trigger('change');
- }
- if (inputFields) {
- inputFields.forEach(function (inputField) {
- inputField.value = '';
- });
- }
- if (radioFields) {
- radioFields.forEach(function (element) {
- element.checked = false;
- });
- }
- if (checkboxFields) {
- checkboxFields.forEach(function (element) {
- element.checked = false;
- });
- }
- if (basicDropdown) {
- basicDropdown.forEach(function (dropdown) {
- $(dropdown).slideUp();
- $(dropdown).siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-count').text('');
- $(dropdown).siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-prefix').text('');
- $(dropdown).siblings('.directorist-search-basic-dropdown-label').find('.directorist-search-basic-dropdown-selected-item').text('');
- });
- }
- if (this.parentElement.classList.contains('input-has-value') || this.parentElement.classList.contains('input-is-focused')) {
- var _this$parentElement$q;
- this.parentElement.classList.remove('input-has-value', 'input-is-focused');
- (_this$parentElement$q = this.parentElement.querySelector('.directorist-search-basic-dropdown-content.dropdown-content-show')) === null || _this$parentElement$q === void 0 || _this$parentElement$q.classList.remove('dropdown-content-show');
- }
- handleRadiusVisibility();
-
- // Reset Button Disable
- var searchform = this.closest('form');
- var inputValue = $(this).parent('.directorist-search-field').find('.directorist-search-field__input:not(.directorist-search-basic-dropdown)').val();
- var selectValue = $(this).parent('.directorist-search-field').find('.directorist-search-field__input select:not(.directorist-search-basic-dropdown)').val();
- if (inputValue && inputValue !== 0 && inputValue !== undefined || selectValue && selectValue.selectedIndex === 0 || selectValue && selectValue.selectedIndex !== undefined) {
- enableResetButton(searchform);
- } else {
- setTimeout(function () {
- initForm(searchform);
- }, 100);
- }
- });
-
- // Search Form Input Field Back Button
- $('body').on('click', '.directorist-search-field__label:not(.directorist-search-basic-dropdown-label)', function (e) {
- var windowScreen = window.innerWidth;
- var parentField = this.closest('.directorist-search-field');
- if (windowScreen <= 575) {
- if (parentField.classList.contains('input-is-focused')) {
- parentField.classList.remove('input-is-focused');
- }
- }
- });
-
- // Listing Type Change
- $('body').on('click', '.search_listing_types', function (event) {
- event.preventDefault();
- var parent = $(this).closest('.directorist-search-contents');
- var listing_type = $(this).attr('data-listing_type');
- var type_current = parent.find('.directorist-listing-type-selection__link--current');
- if (type_current.length) {
- type_current.removeClass('directorist-listing-type-selection__link--current');
- $(this).addClass('directorist-listing-type-selection__link--current');
- }
- parent.find('.listing_type').val(listing_type);
- var form_data = new FormData();
- form_data.append('action', 'atbdp_listing_types_form');
- form_data.append('nonce', directorist.directorist_nonce);
- form_data.append('listing_type', listing_type);
- var atts = parent.attr('data-atts');
- var atts_decoded = btoa(atts);
- form_data.append('atts', atts_decoded);
- parent.find('.directorist-search-form-box').addClass('atbdp-form-fade');
- $.ajax({
- method: 'POST',
- processData: false,
- contentType: false,
- url: directorist.ajax_url,
- data: form_data,
- success: function success(response) {
- if (response) {
- // Add Temp Element
- var new_inserted_elm = '';
- parent.before(new_inserted_elm);
-
- // Remove Old Parent
- parent.remove();
-
- // Insert New Parent
- $('.directorist_search_temp').after(response['search_form']);
- var newParent = $('.directorist_search_temp').next();
-
- // Toggle Active Class
- newParent.find('.directorist-listing-type-selection__link--current').removeClass('directorist-listing-type-selection__link--current');
- newParent.find("[data-listing_type='" + listing_type + "']").addClass('directorist-listing-type-selection__link--current');
-
- // Remove Temp Element
- $('.directorist_search_temp').remove();
- var events = [new CustomEvent('directorist-search-form-nav-tab-reloaded'), new CustomEvent('directorist-reload-select2-fields'), new CustomEvent('directorist-reload-map-api-field'), new CustomEvent('triggerSlice')];
- events.forEach(function (event) {
- document.body.dispatchEvent(event);
- window.dispatchEvent(event);
- });
- handleRadiusVisibility();
- directorist_custom_range_slider();
- initSearchFields();
- (0,_components_category_custom_fields__WEBPACK_IMPORTED_MODULE_7__["default"])($);
- }
- var parentAfterAjax = $(this).closest('.directorist-search-contents');
- parentAfterAjax.find('.directorist-search-form-box').removeClass('atbdp-form-fade');
- if (parentAfterAjax.find('.directorist-search-form-box').find('.directorist-search-field-radius_search').length) {
- handleRadiusVisibility();
- directorist_custom_range_slider();
- }
- },
- error: function error(_error) {
- // console.log(error);
- }
- });
- });
- (0,_components_category_custom_fields__WEBPACK_IMPORTED_MODULE_7__["default"])($);
-
- // Back Button to go back to the previous page
- $('body').on('click', '.directorist-btn__back', function (e) {
- e.preventDefault();
- window.history.back();
- });
-
- // Radius Search Field Hide on Empty Location Field
- function handleRadiusVisibility() {
- // Add class to mark the radius search field
- $('.directorist-range-slider-wrap').closest('.directorist-search-field').addClass('directorist-search-field-radius_search');
- var radius_search_item_selector = null;
- var radius_search_based_on = $('.directorist-radius_search_based_on').val();
-
- // Determine which search item selector to use
- if (radius_search_based_on === 'address') {
- radius_search_item_selector = '.directorist-location-js';
- } else if (radius_search_based_on === 'zip') {
- radius_search_item_selector = '.directorist-zipcode-search .zip-radius-search';
- } else {
- // Default fallback
- radius_search_item_selector = '.directorist-location-js';
- }
-
- // Check if radius search item selector elements exist
- var $radiusSearchItems = $(radius_search_item_selector);
- if ($radiusSearchItems.length === 0) {
- // If no elements found, hide all radius search containers
- $('.directorist-search-field-radius_search, .directorist-radius-search').css({
- display: 'none'
- });
- } else {
- // Loop through the elements
- $radiusSearchItems.each(function (index, locationDOM) {
- var $location = $(locationDOM);
- var isEmpty = $location.val() === '';
- var $container = $location.closest('.directorist-contents-wrap').find('.directorist-search-field-radius_search, .directorist-radius-search');
- $container.css({
- display: isEmpty ? 'none' : 'block'
- });
- });
- }
- }
-
- // handleRadiusVisibility Trigger
- $('body').on('keyup keydown input change focus', '.directorist-location-js, .zip-radius-search', function (e) {
- handleRadiusVisibility();
- });
-
- // rangeSlider, defaultTags Trigger on directory type | page change
- $('body').on('click', '.directorist-type-nav__link, .directorist-pagination .page-numbers, .directorist-viewas .directorist-viewas__item', function (e) {
- setTimeout(function () {
- handleRadiusVisibility();
- directorist_custom_range_slider();
- defaultTags();
- }, 600);
- });
-
- // directorist-instant-search-reloaded event
- window.addEventListener('directorist-instant-search-reloaded', function () {
- handleRadiusVisibility();
- directorist_custom_range_slider();
- defaultTags();
- });
-
- // active class add on view as button
- $('body').on('click', '.directorist-viewas .directorist-viewas__item', function (e) {
- $(this).addClass('active').siblings().removeClass('active');
- });
-
- // Hide Country Result Click on Outside of Zipcode Field
- $(document).on('click', function (e) {
- if (!$(e.target).closest('.directorist-zip-code').length) {
- $('.directorist-country').hide();
- }
- });
- $('body').on('click', '.directorist-country ul li a', function (event) {
- event.preventDefault();
- var zipcode_search = $(this).closest('.directorist-zipcode-search');
- var lat = $(this).data('lat');
- var lon = $(this).data('lon');
- zipcode_search.find('.zip-cityLat').val(lat);
- zipcode_search.find('.zip-cityLng').val(lon);
- $('.directorist-country').hide();
- });
- $('.address_result').hide();
-
- // Init Location
- init_map_api_field();
- document.body.addEventListener('directorist-reload-map-api-field', init_map_api_field);
- function init_map_api_field() {
- if (directorist.i18n_text.select_listing_map === 'google') {
- function initialize() {
- var opt = {
- types: ['geocode'],
- componentRestrictions: {
- country: directorist.restricted_countries
- }
- };
- var options = directorist.countryRestriction ? opt : '';
- var input_fields = [{
- input_class: '.directorist-location-js',
- lat_id: 'cityLat',
- lng_id: 'cityLng',
- options: options
- }, {
- input_id: 'address_widget',
- lat_id: 'cityLat',
- lng_id: 'cityLng',
- options: options
- }];
- var setupAutocomplete = function setupAutocomplete(field) {
- var input = document.querySelectorAll(field.input_class);
- input.forEach(function (elm) {
- if (!elm) {
- return;
- }
- var autocomplete = new google.maps.places.Autocomplete(elm, field.options);
- google.maps.event.addListener(autocomplete, 'place_changed', function () {
- var place = autocomplete.getPlace();
- elm.closest('.directorist-search-field').querySelector("#".concat(field.lat_id)).value = place.geometry.location.lat();
- elm.closest('.directorist-search-field').querySelector("#".concat(field.lng_id)).value = place.geometry.location.lng();
- });
- });
- };
- input_fields.forEach(function (field) {
- setupAutocomplete(field);
- });
- }
- initialize();
- } else if (directorist.i18n_text.select_listing_map === 'openstreet') {
- var getResultContainer = function getResultContainer(context, field) {
- return $(context).next(field.search_result_elm);
- };
- var getWidgetResultContainer = function getWidgetResultContainer(context, field) {
- return $(context).parent().next(field.search_result_elm);
- };
- var input_fields = [{
- input_elm: '.directorist-location-js',
- search_result_elm: '.address_result',
- getResultContainer: getResultContainer
- }, {
- input_elm: '#q_addressss',
- search_result_elm: '.address_result',
- getResultContainer: getResultContainer
- }, {
- input_elm: '.atbdp-search-address',
- search_result_elm: '.address_result',
- getResultContainer: getResultContainer
- }, {
- input_elm: '#address_widget',
- search_result_elm: '#address_widget_result',
- getResultContainer: getWidgetResultContainer
- }];
- input_fields.forEach(function (field) {
- if (!$(field.input_elm).length) {
- return;
- }
- $(field.input_elm).on('keyup', (0,_global_components_debounce__WEBPACK_IMPORTED_MODULE_4__["default"])(function (event) {
- event.preventDefault();
- var blockedKeyCodes = [16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 91, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 144, 145];
-
- // Return early when blocked key is pressed.
- if (blockedKeyCodes.includes(event.keyCode)) {
- return;
- }
- var locationAddressField = $(this).parent('.directorist-search-field');
- var result_container = field.getResultContainer(this, field);
- var search = $(this).val();
- if (search.length < 3) {
- result_container.css({
- display: 'none'
- });
- } else {
- locationAddressField.addClass('atbdp-form-fade');
- result_container.css({
- display: 'block'
- });
- $.ajax({
- url: 'https://nominatim.openstreetmap.org/?q=%27+'.concat(search, '+%27&format=json'),
- type: 'GET',
- data: {},
- success: function success(data) {
- var res = '';
- var currentIconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/paper-plane.svg';
- var currentIconHTML = directorist.icon_markup.replace('##URL##', currentIconURL).replace('##CLASS##', '');
- var currentLocationIconHTML = "
" + currentIconHTML + ' ';
- var currentLocationAddressHTML = "
";
- var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/map-marker-alt.svg';
- var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', '');
- var locationIconHTML = "
" + iconHTML + ' ';
- for (var i = 0, len = data.length > 5 ? 5 : data.length; i < len; i++) {
- res += '
' + locationIconHTML + "" + data[i].display_name, +' ';
- }
- function displayLocation(position, event) {
- var lat = position.coords.latitude;
- var lng = position.coords.longitude;
- $.ajax({
- url: 'https://nominatim.openstreetmap.org/reverse?format=json&lon=' + lng + '&lat=' + lat,
- type: 'GET',
- data: {},
- success: function success(data) {
- $('.directorist-location-js, .atbdp-search-address').val(data.display_name);
- $('.directorist-location-js, .atbdp-search-address').attr('data-value', data.display_name);
- $('#cityLat').val(lat);
- $('#cityLng').val(lng);
- var locationSearch = $('.directorist-search-location');
- if (locationSearch.length) {
- locationSearch.trigger('change');
- }
- }
- });
- }
- result_container.html('
');
- if (res.length) {
- result_container.show();
- } else {
- result_container.hide();
- }
- locationAddressField.removeClass('atbdp-form-fade');
- $('body').off('click', '.address_result .current-location').on('click', '.address_result .current-location', function (e) {
- e.preventDefault();
- navigator.geolocation.getCurrentPosition(function (position) {
- return displayLocation(position, e);
- });
- });
- },
- error: function error(_error3) {
- console.log({
- error: _error3
- });
- locationAddressField.removeClass('atbdp-form-fade');
- }
- });
- }
- }, 750));
- });
-
- // hide address result when click outside the input field
- $(document).on('click', function (e) {
- if (!$(e.target).closest('.directorist-location-js, #q_addressss, .atbdp-search-address, .current-location').length) {
- var locationSearch = $(e.target).closest('.directorist-search-location');
- var zipCodeSearch = $(e.target).closest('.directorist-zipcode-search');
- if (locationSearch.length) {
- locationSearch.trigger('change');
- }
- if (zipCodeSearch.length) {
- zipCodeSearch.trigger('change');
- }
- $('.address_result').hide();
- }
- });
- var syncLatLngData = function syncLatLngData(context, event, args) {
- event.preventDefault();
- var text = $(context).text();
- var lat = $(context).data('lat');
- var lon = $(context).data('lon');
- var _this = event.target;
- $(_this).closest('.address_result').siblings('input[name="cityLat"]').val(lat);
- $(_this).closest('.address_result').siblings('input[name="cityLng"]').val(lon);
- var inp = $(context).closest(args.result_list_container).parent().find('.directorist-location-js, #address_widget, #q_addressss, .atbdp-search-address');
- inp.val(text);
- $(args.result_list_container).hide();
- };
- $('body').on('click', '.address_result ul li a', function (event) {
- syncLatLngData(this, event, {
- result_list_container: '.address_result'
- });
- });
- $('body').on('click', '#address_widget_result ul li a', function (event) {
- syncLatLngData(this, event, {
- result_list_container: '#address_widget_result'
- });
- });
- }
- if ($('.directorist-location-js, #q_addressss, .atbdp-search-address').val() === '') {
- $(this).parent().next('.address_result').css({
- display: 'none'
- });
- }
- }
- $('.directorist-search-contents').each(function () {
- if ($(this).next().length === 0) {
- $(this).find('.directorist-search-country').css('max-height', '175px');
- $(this).find('.directorist-search-field .address_result').css('max-height', '175px');
- }
- });
-
- // Custom Range Slider
- function directorist_custom_range_slider() {
- var sliders = document.querySelectorAll('.directorist-custom-range-slider');
- sliders.forEach(function (sliderItem) {
- var _slider$directoristCu, _slider$directoristCu2, _slider$directoristCu3;
- var slider = sliderItem.querySelector('.directorist-custom-range-slider__slide');
-
- // Skip if already initialized
- if (!slider || slider.directoristCustomRangeSlider) return;
- var sliderStep = parseInt(slider.getAttribute('step')) || 1;
- var sliderMinValue = parseInt(slider.getAttribute('min-value')) || 0;
- var sliderMaxValue = parseInt(slider.getAttribute('max-value')) || 100;
- var sliderDefaultValue = parseInt(slider.getAttribute('default-value'));
- var minInput = sliderItem.querySelector('.directorist-custom-range-slider__value__min');
- var maxInput = sliderItem.querySelector('.directorist-custom-range-slider__value__max');
- var sliderRange = sliderItem.querySelector('.directorist-custom-range-slider__range');
- var sliderRangeShow = sliderItem.querySelector('.directorist-custom-range-slider__range__show');
- var sliderRangeValue = sliderItem.querySelector('.directorist-custom-range-slider__wrap .directorist-custom-range-slider__range');
- var minInputName = (minInput === null || minInput === void 0 ? void 0 : minInput.getAttribute('name')) || '';
- var maxInputName = (maxInput === null || maxInput === void 0 ? void 0 : maxInput.getAttribute('name')) || '';
- var isRTL = document.dir === 'rtl';
-
- // Flags
- var rangeInitLoad = true;
- var sliderActivated = false;
- var sliderRadiusActive = false;
-
- // Parse the URL parameters
- var urlParams = new URLSearchParams(window.location.search);
- var customNumberParams = urlParams.get('custom-number');
- var rangeFieldName = (sliderRange === null || sliderRange === void 0 ? void 0 : sliderRange.getAttribute('name')) || '';
- var fieldRangeValueParam = rangeFieldName ? urlParams.get(rangeFieldName) : null;
- var specificRangeMinParam = minInputName ? urlParams.get(minInputName) : null;
- var specificRangeMaxParam = maxInputName ? urlParams.get(maxInputName) : null;
- var globalRangeMinParam = urlParams.get('directorist-custom-range-slider__value__min');
- var globalRangeMaxParam = urlParams.get('directorist-custom-range-slider__value__max');
- var effectiveRangeMinParam = specificRangeMinParam !== null && specificRangeMinParam !== void 0 ? specificRangeMinParam : globalRangeMinParam;
- var effectiveRangeMaxParam = specificRangeMaxParam !== null && specificRangeMaxParam !== void 0 ? specificRangeMaxParam : globalRangeMaxParam;
- var locationDistanceParams = urlParams.get('miles');
- var milesParams = urlParams.has('miles');
- if (rangeFieldName === 'miles' && locationDistanceParams !== '0-0' && sliderDefaultValue >= 0) {
- sliderRadiusActive = true;
- }
-
- // if already have custom values, then slider is activated
- if (fieldRangeValueParam && fieldRangeValueParam !== '0-0') {
- sliderActivated = true;
- } else if (customNumberParams && customNumberParams !== '0-0') {
- sliderActivated = true;
- } else if (effectiveRangeMaxParam && effectiveRangeMaxParam !== '0') {
- sliderActivated = true;
- }
- if (typeof directoristCustomRangeSlider === 'undefined') return;
- if (sliderRadiusActive) {
- var _directoristCustomRan;
- // Radius Search Range Slider
- (_directoristCustomRan = directoristCustomRangeSlider) === null || _directoristCustomRan === void 0 || _directoristCustomRan.create(slider, {
- start: [minInput.value, !milesParams ? sliderDefaultValue : maxInput.value],
- connect: true,
- direction: isRTL ? 'rtl' : 'ltr',
- step: sliderStep ? sliderStep : 1,
- range: {
- min: Number(sliderMinValue || 0),
- max: Number(sliderMaxValue || 100)
- }
- });
- } else if (sliderActivated) {
- var _directoristCustomRan2;
- // Custom Number Range Slider
- var minValue = minInput.value;
- var maxValue = maxInput.value;
-
- // Assign min-max values from custom-range-slider params
- if (fieldRangeValueParam && fieldRangeValueParam !== '0-0') {
- var _fieldRangeValueParam = fieldRangeValueParam.split('-').map(Number),
- _fieldRangeValueParam2 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_fieldRangeValueParam, 2),
- min = _fieldRangeValueParam2[0],
- max = _fieldRangeValueParam2[1];
- minValue = min;
- maxValue = max;
- } else if (customNumberParams && customNumberParams !== '0-0') {
- var _customNumberParams$s = customNumberParams.split('-').map(Number),
- _customNumberParams$s2 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_customNumberParams$s, 2),
- _min = _customNumberParams$s2[0],
- _max = _customNumberParams$s2[1];
-
- // Use the split values as min-max
- minValue = _min;
- maxValue = _max;
- } else if (effectiveRangeMinParam && effectiveRangeMaxParam) {
- // Modal Search Form
- minValue = effectiveRangeMinParam;
- maxValue = effectiveRangeMaxParam;
- }
-
- // Initial with [min, max] value
- (_directoristCustomRan2 = directoristCustomRangeSlider) === null || _directoristCustomRan2 === void 0 || _directoristCustomRan2.create(slider, {
- start: [minValue, !milesParams ? sliderDefaultValue || maxValue : maxValue],
- connect: true,
- direction: isRTL ? 'rtl' : 'ltr',
- step: sliderStep ? sliderStep : 1,
- range: {
- min: Number(sliderMinValue || 0),
- max: Number(sliderMaxValue || 100)
- }
- });
- } else {
- var _directoristCustomRan3;
- // Initialize with [0, 0] and temp min/max
- (_directoristCustomRan3 = directoristCustomRangeSlider) === null || _directoristCustomRan3 === void 0 || _directoristCustomRan3.create(slider, {
- start: [0, 0],
- connect: true,
- direction: isRTL ? 'rtl' : 'ltr',
- step: 1,
- range: {
- min: 0,
- max: 1
- }
- });
- }
-
- // Handle first interaction
- (_slider$directoristCu = slider.directoristCustomRangeSlider) === null || _slider$directoristCu === void 0 || _slider$directoristCu.on('start', function () {
- if (sliderActivated || sliderRadiusActive) return;
- sliderActivated = true;
-
- // Range slider options update
- slider.directoristCustomRangeSlider.updateOptions({
- start: [sliderMinValue, sliderMinValue],
- step: sliderStep,
- range: {
- min: sliderMinValue,
- max: sliderMaxValue
- }
- });
-
- // Trigger range slider observer
- rangeSliderObserver();
- });
-
- // Update slider config - update values but don't trigger change during drag
- (_slider$directoristCu2 = slider.directoristCustomRangeSlider) === null || _slider$directoristCu2 === void 0 || _slider$directoristCu2.on('update', function (values, handle) {
- var value = Math.round(values[handle]);
- // Assign min-max value based on handler
- if (handle === 0) {
- minInput.value = value;
- } else {
- maxInput.value = value;
- }
- var rangeValue = "".concat(minInput.value, "-").concat(maxInput.value);
- if (sliderRange) sliderRange.value = rangeValue;
- if (sliderRangeShow) sliderRangeShow.innerHTML = rangeValue;
- if (sliderRangeValue) {
- sliderRangeValue.setAttribute('value', rangeValue);
- }
- });
-
- // Trigger change only when dragging ends (mouse/touch released)
- (_slider$directoristCu3 = slider.directoristCustomRangeSlider) === null || _slider$directoristCu3 === void 0 || _slider$directoristCu3.on('end', function () {
- if (sliderRangeValue && !rangeInitLoad) {
- $(sliderRangeValue).trigger('change');
- }
- });
-
- // Mark init complete
- rangeInitLoad = false;
-
- // 🔁 Manual input update logic (on change/keyup)
- function updateSliderFromInputs() {
- var minValue = Math.round(parseInt(minInput.value || 0, 10) / sliderStep) * sliderStep;
- var maxValue = Math.round(parseInt(maxInput.value || 0, 10) / sliderStep) * sliderStep;
- if (isNaN(minValue)) minValue = 0;
- if (isNaN(maxValue)) maxValue = 0;
- if (!sliderActivated) {
- sliderActivated = true;
- slider.directoristCustomRangeSlider.updateOptions({
- range: {
- min: sliderMinValue,
- max: sliderMaxValue
- },
- step: sliderStep,
- start: [sliderMinValue, sliderMaxValue]
- });
- }
-
- // Fix invalid ranges
- if (minValue > maxValue) {
- minInput.value = maxValue;
- minValue = maxValue;
- }
- if (maxValue < minValue) {
- maxInput.value = minValue;
- maxValue = minValue;
- }
- slider.directoristCustomRangeSlider.set([minValue, maxValue]);
- }
- ['change', 'keyup'].forEach(function (evt) {
- minInput.addEventListener(evt, updateSliderFromInputs);
- maxInput.addEventListener(evt, updateSliderFromInputs);
- });
- });
- }
- directorist_custom_range_slider();
-
- // Reset Custom Range Slider
- function resetCustomRangeSlider(sliderItem) {
- var slider = sliderItem.querySelector('.directorist-custom-range-slider__slide');
- var minInput = sliderItem.querySelector('.directorist-custom-range-slider__value__min');
- var maxInput = sliderItem.querySelector('.directorist-custom-range-slider__value__max');
- var rangeValue = sliderItem.querySelector('.directorist-custom-range-slider__range');
- var radiusSearch = sliderItem.closest('.directorist-search-field-radius_search');
- var defaultValue = slider.getAttribute('default-value') || '0';
- if (radiusSearch) {
- var _slider$directoristCu4;
- minInput.value = '0';
- maxInput.value = defaultValue;
- slider === null || slider === void 0 || (_slider$directoristCu4 = slider.directoristCustomRangeSlider) === null || _slider$directoristCu4 === void 0 || _slider$directoristCu4.set([0, defaultValue]); // Set initial values
- } else {
- var _slider$directoristCu5;
- // Reset values to their initial state
- slider === null || slider === void 0 || (_slider$directoristCu5 = slider.directoristCustomRangeSlider) === null || _slider$directoristCu5 === void 0 || _slider$directoristCu5.set([0, 0]); // Set initial values
- minInput.value = '0'; // Set initial min value
- maxInput.value = '0'; // Set initial max value
- rangeValue.value = '0-0';
- }
- var sidebarRangeSlider = slider.closest('.listing-with-sidebar');
- if (sidebarRangeSlider && slider !== null && slider !== void 0 && slider.directoristCustomRangeSlider) {
- // Destroy the custom range slider instance
- slider.directoristCustomRangeSlider.destroy();
- delete slider.directoristCustomRangeSlider;
- }
- }
-
- // DOM Mutation Observer on Location Field
- function locationObserver() {
- var targetNode = document.querySelector('.directorist-location-js');
- if (targetNode) {
- var observer = new MutationObserver(handleRadiusVisibility);
- observer.observe(targetNode, {
- attributes: true
- });
- }
- }
- locationObserver();
- handleRadiusVisibility();
- $('body').on('keyup', '.zip-radius-search', directorist_debounce(function () {
- var zipcode = $(this).val();
- var zipcode_search = $(this).closest('.directorist-zipcode-search');
- var country_suggest = zipcode_search.find('.directorist-country');
- var zipcode_search = $(this).closest('.directorist-zipcode-search');
- if (zipcode) {
- zipcode_search.addClass('dir_loading');
- }
- if (directorist.i18n_text.select_listing_map === 'google') {
- var url = directorist.ajax_url;
- } else {
- url = "https://nominatim.openstreetmap.org/?postalcode=".concat(zipcode, "&format=json&addressdetails=1");
- $('.directorist-country').css({
- display: 'block'
- });
- if (zipcode === '') {
- $('.directorist-country').css({
- display: 'none'
- });
- }
- }
- var res = '';
- var google_data = {
- nonce: directorist.directorist_nonce,
- action: 'directorist_zipcode_search',
- zipcode: zipcode
- };
- $.ajax({
- url: url,
- method: 'POST',
- data: directorist.i18n_text.select_listing_map === 'google' ? google_data : '',
- success: function success(data) {
- if (data.data && data.data.error_message) {
- zipcode_search.find('.error_message').remove();
- zipcode_search.find('.zip-cityLat').val('');
- zipcode_search.find('.zip-cityLng').val('');
- zipcode_search.append(data.data.error_message);
- }
- zipcode_search.removeClass('dir_loading');
- if (directorist.i18n_text.select_listing_map === 'google' && typeof data.lat !== 'undefined' && typeof data.lng !== 'undefined') {
- zipcode_search.find('.error_message').remove();
- zipcode_search.find('.zip-cityLat').val(data.lat);
- zipcode_search.find('.zip-cityLng').val(data.lng);
- } else {
- if (data.length === 1) {
- var lat = data[0].lat;
- var lon = data[0].lon;
- zipcode_search.find('.zip-cityLat').val(lat);
- zipcode_search.find('.zip-cityLng').val(lon);
- } else {
- for (var i = 0; i < data.length; i++) {
- res += "
").concat(data[i].address.country, " ");
- }
- }
- $(country_suggest).html("
"));
- if (res.length) {
- $('.directorist-country').show();
- } else {
- $('.directorist-country').hide();
- }
- }
- }
- });
- }, 250));
-
- // Returns a function, that, as long as it continues to be invoked, will not
- // be triggered. The function will be called after it stops being called for
- // N milliseconds. If `immediate` is passed, trigger the function on the
- // leading edge, instead of the trailing.
- function directorist_debounce(func, wait, immediate) {
- var timeout;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
- }
-
- // Custom Range Slider Value Check on Change
- function sliderValueCheck(searchForm, targetNode, value) {
- if (value > 0) {
- enableResetButton(searchForm);
- var rangeSlider = targetNode.closest('.directorist-custom-range-slider');
- if (!rangeSlider) return;
- var customSliderMin = rangeSlider.querySelector('.directorist-custom-range-slider__value__min');
- var customSliderRange = rangeSlider.querySelector('.directorist-custom-range-slider__range');
- customSliderMin.value = customSliderMin.value ? customSliderMin.value : 0;
- customSliderRange.value = customSliderMin.value + '-' + value;
- } else {
- initForm(searchForm);
- }
- }
-
- // DOM Mutation Observer on Custom Range Slider
- function rangeSliderObserver() {
- var targetNodes = document.querySelectorAll('.directorist-search-field:not(.directorist-search-field-radius_search) .directorist-custom-range-slider-handle-upper');
- targetNodes.forEach(function (targetNode) {
- if (targetNode) {
- var _searchForm2 = targetNode.closest('form');
- var observerCallback = function observerCallback(mutationList, observer) {
- var _iterator = _createForOfIteratorHelper(mutationList),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var mutation = _step.value;
- if (targetNode.classList.contains('directorist-custom-range-slider-handle-upper')) {
- sliderValueCheck(_searchForm2, targetNode, parseInt(targetNode.ariaValueNow));
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- };
- var sliderObserver = new MutationObserver(observerCallback);
- sliderObserver.observe(targetNode, {
- attributes: true
- });
- }
- });
- }
- rangeSliderObserver();
- });
-})(jQuery);
-}();
-/******/ })()
-;
-//# sourceMappingURL=search-form.js.map
\ No newline at end of file
+ // Default Tags Slice
+ function defaultTags() {
+ $('.directorist-btn-ml').each(function (index, element) {
+ var item = $(element).siblings(
+ '.atbdp_cf_checkbox, .directorist-search-field-tag, .directorist-search-tags'
+ );
+ var item_checkbox = $(item).find(
+ '.directorist-checkbox'
+ );
+ $(item_checkbox)
+ .slice(4, item_checkbox.length)
+ .fadeOut();
+ if (item_checkbox.length <= 4) {
+ $(element).css('display', 'none');
+ }
+ });
+ }
+ defaultTags();
+ window.addEventListener('triggerSlice', defaultTags);
+
+ // See More Tags Button
+ $('body').on('click', '.directorist-btn-ml', function (event) {
+ event.preventDefault();
+ var item = $(this).siblings('.directorist-search-tags');
+ var item_checkbox = $(item).find('.directorist-checkbox');
+ $(item_checkbox).slice(4, item_checkbox.length).fadeOut();
+ $(this).toggleClass('active');
+ if ($(this).hasClass('active')) {
+ $(this).text(directorist.i18n_text.show_less);
+ $(item_checkbox)
+ .slice(4, item_checkbox.length)
+ .fadeIn();
+ } else {
+ $(this).text(directorist.i18n_text.show_more);
+ $(item_checkbox)
+ .slice(4, item_checkbox.length)
+ .fadeOut();
+ }
+ });
+
+ /*** Search Form ***/
+
+ // Count Checkbox Selected Items
+ function selectedItemCount(item) {
+ var dropdownParent = $(item).closest(
+ '.directorist-search-field'
+ );
+ var dropDownContent = $(item).closest(
+ '.directorist-search-basic-dropdown-content'
+ );
+ var selectedItemCount = dropDownContent.find(
+ '.directorist-checkbox input[type="checkbox"]:checked'
+ );
+ var selectedPrefix = dropDownContent
+ .siblings('.directorist-search-basic-dropdown-label')
+ .find(
+ '.directorist-search-basic-dropdown-selected-prefix'
+ );
+ var selectedCounter = dropDownContent
+ .siblings('.directorist-search-basic-dropdown-label')
+ .find(
+ '.directorist-search-basic-dropdown-selected-count'
+ );
+ if (selectedItemCount.length > 0) {
+ selectedCounter.text(selectedItemCount.length);
+ selectedPrefix.text('Selected');
+ dropdownParent.addClass('input-has-value');
+ } else {
+ // If no items are checked, clear the text
+ selectedCounter.text('');
+ selectedPrefix.text('');
+ dropdownParent.removeClass('input-has-value');
+ }
+ }
+
+ // Radio Selected Items
+ function selectedRadioItem(item) {
+ var dropdownParent = $(item).closest(
+ '.directorist-search-field'
+ );
+ var dropDownLabel = dropdownParent.find(
+ '.directorist-search-basic-dropdown-selected-item'
+ );
+ var selectedItem = dropdownParent.find(
+ '.directorist-radio input[type="radio"]:checked'
+ );
+ var selectedItemLabel = selectedItem
+ .siblings('.directorist-radio__label')
+ .text();
+ if (selectedItem) {
+ dropDownLabel.text(' - ' + selectedItemLabel);
+ dropdownParent.addClass('input-has-value');
+ } else {
+ // If no items are checked, clear the text
+ selectedItem.text('');
+ dropdownParent.removeClass('input-has-value');
+ }
+ }
+
+ // Checkbox Field Check
+ $('body').on(
+ 'change',
+ '.directorist-search-form__top .directorist-search-basic-dropdown input[type="checkbox"], .directorist-search-modal .directorist-search-basic-dropdown input[type="checkbox"]',
+ function (e) {
+ e.preventDefault();
+ selectedItemCount(this);
+ }
+ );
+
+ // Radio Field Check
+ $('body').on(
+ 'change',
+ '.directorist-search-form__top .directorist-search-basic-dropdown input[type="radio"], .directorist-search-modal .directorist-search-basic-dropdown input[type="radio"]',
+ function (e) {
+ e.preventDefault();
+ selectedRadioItem(this);
+ }
+ );
+
+ // Initialize selected item count for checkboxes that are already checked on page load
+ // Process each dropdown that has checked checkboxes to avoid redundant calls
+ $(
+ '.directorist-search-form__top .directorist-search-basic-dropdown-content, .directorist-search-modal .directorist-search-basic-dropdown-content'
+ ).each(function () {
+ var checkedCheckbox = $(this).find(
+ 'input[type="checkbox"]:checked'
+ );
+ if (checkedCheckbox.length > 0) {
+ // Call once per dropdown with any checked checkbox
+ selectedItemCount(checkedCheckbox.first());
+ }
+ });
+
+ // Initialize selected radio items that are already checked on page load
+ $(
+ '.directorist-search-form__top .directorist-search-basic-dropdown input[type="radio"]:checked, .directorist-search-modal .directorist-search-basic-dropdown input[type="radio"]:checked'
+ ).each(function () {
+ selectedRadioItem(this);
+ });
+
+ // Initialize all input fields that have values on page load
+ $(
+ '.directorist-search-form__top .directorist-search-field__input:not(.directorist-search-basic-dropdown), .directorist-search-modal .directorist-search-field__input:not(.directorist-search-basic-dropdown)'
+ ).each(function () {
+ var inputField = $(this);
+ var inputValue = inputField.val();
+ var searchField = inputField.closest(
+ '.directorist-search-field'
+ );
+
+ // Check if it's a select field
+ if (inputField.hasClass('directorist-select')) {
+ var selectElement = inputField.find('select');
+ if (selectElement.length) {
+ inputValue =
+ selectElement.val() ||
+ selectElement.data('selected-id');
+ }
+ }
+
+ // If field has a value, add appropriate classes
+ if (inputValue && inputValue !== '' && inputValue !== '0') {
+ searchField.addClass('input-has-value');
+ if (!searchField.hasClass('input-is-focused')) {
+ searchField.addClass('input-is-focused');
+ }
+ }
+ });
+
+ // Initialize color picker background colors on page load
+ $('.wp-color-picker, .directorist-color-picker').each(
+ function () {
+ var colorValue = $(this).val();
+ if (colorValue && colorValue !== '') {
+ var colorButton = $(this)
+ .closest('.directorist-search-field')
+ .find('.wp-color-result');
+ if (colorButton.length) {
+ colorButton.css('background-color', colorValue);
+ }
+ }
+ }
+ );
+
+ // Basic Search Dropdown Toggle
+ $('body').on(
+ 'click',
+ '.directorist-search-form__top .directorist-search-basic-dropdown-label, .directorist-search-modal .directorist-search-basic-dropdown-label',
+ function (e) {
+ var _this7 = this;
+ e.preventDefault();
+ var dropDownParent = $(this).closest(
+ '.directorist-search-field'
+ );
+ var dropDownContent = $(this).siblings(
+ '.directorist-search-basic-dropdown-content'
+ );
+ dropDownContent.toggleClass('dropdown-content-show');
+ if (dropDownContent.hasClass('dropdown-content-show')) {
+ dropDownParent.addClass('input-is-focused');
+ dropDownContent.slideDown();
+ setTimeout(function () {
+ viewportDropdown.position(_this7);
+ }, viewportDropdown.options.animationDelay);
+ } else {
+ dropDownParent.removeClass('input-is-focused');
+ dropDownContent.slideUp();
+ }
+ // Hide all other open contents
+ $(
+ '.directorist-search-basic-dropdown-content.dropdown-content-show'
+ )
+ .not(dropDownContent)
+ .each(function () {
+ $(this)
+ .removeClass(
+ 'dropdown-content-show dropdown-upward'
+ )
+ .slideUp();
+ });
+ }
+ );
+
+ // Dropdown Content Hide on Outside Click
+ $('body').on('click', function (e) {
+ var dropDownRoot = $(e.target).closest(
+ '.directorist-search-form-dropdown'
+ );
+ var dropDownParent = $(
+ '.directorist-search-form-dropdown.input-is-focused'
+ );
+ var dropDownContent = $(
+ '.directorist-search-basic-dropdown-content.dropdown-content-show'
+ );
+ if (!dropDownRoot.length) {
+ dropDownParent.each(function () {
+ $(this).removeClass('input-is-focused');
+ });
+ dropDownContent.each(function () {
+ $(this)
+ .removeClass(
+ 'dropdown-content-show dropdown-upward'
+ )
+ .slideUp();
+ });
+ }
+ });
+
+ // Check Empty Search Fields on Search Modal
+ function initSearchFields() {
+ var searchFields = document.querySelectorAll(
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)'
+ );
+ searchFields.forEach(function (searchField) {
+ var wrapper = searchField.closest(
+ '.directorist-search-field'
+ );
+ if (!wrapper) {
+ return;
+ }
+ var inputFieldValue = searchField.value;
+ if (
+ searchField.classList.contains('directorist-select')
+ ) {
+ inputFieldValue =
+ searchField.querySelector('select').dataset
+ .selectedId;
+ }
+ if (inputFieldValue !== '') {
+ wrapper.classList.add('input-has-value');
+ if (
+ !wrapper.classList.contains('input-is-focused')
+ ) {
+ wrapper.classList.add('input-is-focused');
+ }
+ } else {
+ inputFieldValue = '';
+ if (wrapper.classList.contains('input-has-value')) {
+ wrapper.classList.remove('input-has-value');
+ }
+ }
+ });
+ }
+ initSearchFields();
+
+ // Search Form Reset Button Initialize
+ function initForm(searchForm) {
+ var value = false;
+
+ // Check all input fields which are not checkbox, radio & hidden
+ searchForm
+ .querySelectorAll(
+ "input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not(.wp-picker-clear):not(.directorist-custom-range-slider__value__min):not(.directorist-custom-range-slider__value__max)"
+ )
+ .forEach(function (el) {
+ if (el.value !== '') {
+ value = true;
+ }
+ });
+
+ // Check all checkbox, radio field
+ searchForm
+ .querySelectorAll(
+ "input[type='checkbox'], input[type='radio']"
+ )
+ .forEach(function (el) {
+ if (el.checked) {
+ value = true;
+ }
+ });
+
+ // Check all select field
+ searchForm
+ .querySelectorAll('select')
+ .forEach(function (el) {
+ if (el.value || el.selectedIndex !== 0) {
+ value = true;
+ }
+ });
+
+ // Check all custom number range field
+ searchForm
+ .querySelectorAll(
+ '.directorist-search-field-text_range .directorist-custom-range-slider__range'
+ )
+ .forEach(function (el) {
+ if (el.value === '0-0') {
+ value = false;
+ }
+ });
+
+ // Check all range slider field
+ searchForm
+ .querySelectorAll(
+ '.directorist-custom-range-slider__value input'
+ )
+ .forEach(function (el) {
+ if (el.value > 0) {
+ value = true;
+ }
+ });
+
+ // Disable Reset Button based on value
+ if (!value) {
+ // Find Reset Button in current form
+ var resetButtonWrapper = searchForm.querySelector(
+ '.directorist-advanced-filter__action'
+ );
+ if (resetButtonWrapper) {
+ resetButtonWrapper.classList.add(
+ 'reset-btn-disabled'
+ );
+ } else {
+ var _searchForm$closest;
+ // Find Reset Button in whole listing-with-sidebar
+ resetButtonWrapper =
+ (_searchForm$closest = searchForm.closest(
+ '.listing-with-sidebar'
+ )) === null || _searchForm$closest === void 0
+ ? void 0
+ : _searchForm$closest.querySelector(
+ '.directorist-advanced-filter__action'
+ );
+ if (resetButtonWrapper) {
+ resetButtonWrapper.classList.add(
+ 'reset-btn-disabled'
+ );
+ }
+ }
+ } else {
+ setTimeout(function () {
+ enableResetButton(searchForm);
+ }, 100);
+ }
+ }
+
+ // Enable Reset Button
+ function enableResetButton(searchForm) {
+ var $resetButtonWrapper = $(searchForm).find(
+ '.directorist-advanced-filter__action'
+ );
+ if (!$resetButtonWrapper.length) {
+ $resetButtonWrapper = $(searchForm)
+ .closest('.directorist-instant-search')
+ .find('.directorist-advanced-filter__action');
+ }
+ if ($resetButtonWrapper.length) {
+ $resetButtonWrapper.removeClass('reset-btn-disabled');
+ }
+ }
+
+ // Initialize Form Reset Button
+ var searchForm = document.querySelectorAll(
+ '.directorist-contents-wrap form'
+ );
+ searchForm.forEach(function (form) {
+ setTimeout(function () {
+ initForm(form);
+ }, 100);
+ });
+
+ // Input Field Check
+ $('body').on(
+ 'keyup',
+ '.directorist-contents-wrap form input:not([type="checkbox"]):not([type="radio"])',
+ function (e) {
+ var searchForm = this.closest('form');
+ if (
+ this.value &&
+ this.value !== 0 &&
+ this.value !== undefined
+ ) {
+ enableResetButton(searchForm);
+ } else {
+ setTimeout(function () {
+ initForm(searchForm);
+ }, 100);
+ }
+ }
+ );
+ $('body').on(
+ 'change',
+ '.directorist-contents-wrap form input[type="checkbox"], .directorist-contents-wrap form input[type="radio"]',
+ function (e) {
+ var searchForm = this.closest('form');
+ if (this.checked) {
+ enableResetButton(searchForm);
+ } else {
+ setTimeout(function () {
+ initForm(searchForm);
+ }, 100);
+ }
+ }
+ );
+ $('body').on(
+ 'change',
+ '.directorist-contents-wrap form select',
+ function (e) {
+ var searchForm = this.closest('form');
+ if (this.value !== undefined && this.value !== '') {
+ enableResetButton(searchForm);
+ } else {
+ setTimeout(function () {
+ initForm(searchForm);
+ }, 100);
+ }
+ }
+ );
+
+ // Color Field Open Button Click
+ $('.directorist-contents-wrap form .wp-color-result').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var $parentElement = $(this).closest(
+ '.directorist-search-field'
+ );
+ if (
+ $parentElement.hasClass('input-has-value') ||
+ $parentElement.hasClass('input-is-focused')
+ ) {
+ $parentElement.removeClass(
+ 'input-has-value input-is-focused'
+ );
+ } else {
+ $parentElement.addClass(
+ 'input-has-value input-is-focused'
+ );
+ }
+ }
+ );
+
+ // Color Field Clear Button Click
+ $('.directorist-contents-wrap form .wp-picker-clear').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var $parentElement = $(this).closest(
+ '.directorist-search-field'
+ );
+ if (
+ $parentElement.hasClass('input-has-value') ||
+ $parentElement.hasClass('input-is-focused')
+ ) {
+ $parentElement.removeClass(
+ 'input-has-value input-is-focused'
+ );
+ }
+ var color = '';
+ var input = $parentElement.find('.wp-color-picker')[0]; // get raw DOM element
+ var form = $parentElement.closest('form')[0];
+ if (!input || !form) return;
+
+ // Dispatch custom event
+ var colorChangeEvent = new CustomEvent(
+ 'directorist-color-changed',
+ {
+ detail: {
+ color: color,
+ input: input,
+ form: form,
+ },
+ }
+ );
+ window.dispatchEvent(colorChangeEvent);
+ }
+ );
+
+ // Color Change Event
+ window.addEventListener(
+ 'directorist-color-changed',
+ function (e) {
+ var _e$detail = e.detail,
+ color = _e$detail.color,
+ input = _e$detail.input,
+ form = _e$detail.form;
+ if (color && color !== '') {
+ enableResetButton(form);
+ var $parentElement = $(input).closest(
+ '.directorist-search-field'
+ );
+ if (
+ !$parentElement.hasClass('input-has-value') &&
+ !$parentElement.hasClass('input-is-focused')
+ ) {
+ $parentElement.addClass(
+ 'input-has-value input-is-focused'
+ );
+ }
+ } else {
+ setTimeout(function () {
+ initForm(form);
+ }, 100);
+ }
+ }
+ );
+
+ // Searchform Reset
+ function adsFormReset(searchForm) {
+ searchForm
+ .querySelectorAll(
+ "input[type='text']:not(.wp-picker-clear)"
+ )
+ .forEach(function (el) {
+ el.value = '';
+ if (
+ el.parentElement.classList.contains(
+ 'input-has-value'
+ ) ||
+ el.parentElement.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ el.parentElement.classList.remove(
+ 'input-has-value',
+ 'input-is-focused'
+ );
+ }
+ });
+ searchForm
+ .querySelectorAll("input[type='date']")
+ .forEach(function (el) {
+ el.value = '';
+ });
+ searchForm
+ .querySelectorAll("input[type='time']")
+ .forEach(function (el) {
+ el.value = '';
+ });
+ searchForm
+ .querySelectorAll("input[type='url']")
+ .forEach(function (el) {
+ el.value = '';
+ if (
+ el.parentElement.classList.contains(
+ 'input-has-value'
+ ) ||
+ el.parentElement.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ el.parentElement.classList.remove(
+ 'input-has-value',
+ 'input-is-focused'
+ );
+ }
+ });
+ searchForm
+ .querySelectorAll("input[type='number']")
+ .forEach(function (el) {
+ el.value = '';
+ if (
+ el.parentElement.classList.contains(
+ 'input-has-value'
+ ) ||
+ el.parentElement.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ el.parentElement.classList.remove(
+ 'input-has-value',
+ 'input-is-focused'
+ );
+ }
+ });
+ searchForm
+ .querySelectorAll(
+ "input[type='hidden']:not(.listing_type)"
+ )
+ .forEach(function (el) {
+ if (
+ el.getAttribute('name') === 'directory_type' ||
+ el.getAttribute('name') ===
+ 'radius-search-based-on'
+ )
+ return;
+ el.value = '';
+ });
+ searchForm
+ .querySelectorAll("input[type='radio']")
+ .forEach(function (el) {
+ el.checked = false;
+ });
+ searchForm
+ .querySelectorAll("input[type='checkbox']")
+ .forEach(function (el) {
+ el.checked = false;
+ });
+ searchForm
+ .querySelectorAll('select')
+ .forEach(function (el) {
+ el.selectedIndex = 0;
+ $('.directorist-select2-dropdown-close').click();
+ var parentElem = el.closest(
+ '.directorist-search-field'
+ );
+ if (
+ parentElem.classList.contains(
+ 'input-has-value'
+ ) ||
+ parentElem.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ setTimeout(function () {
+ parentElem.classList.remove(
+ 'input-has-value',
+ 'input-is-focused'
+ );
+ }, 100);
+ }
+ });
+ var customRangeSliders = document.querySelectorAll(
+ '.directorist-custom-range-slider'
+ );
+ customRangeSliders.forEach(function (sliderItem) {
+ resetCustomRangeSlider(sliderItem);
+ });
+ searchForm
+ .querySelectorAll(
+ '.directorist-search-basic-dropdown-content'
+ )
+ .forEach(function (dropdown) {
+ var dropDownParent = dropdown.closest(
+ '.directorist-search-field'
+ );
+ $(dropdown)
+ .siblings(
+ '.directorist-search-basic-dropdown-label'
+ )
+ .find(
+ '.directorist-search-basic-dropdown-selected-count'
+ )
+ .text('');
+ $(dropdown)
+ .siblings(
+ '.directorist-search-basic-dropdown-label'
+ )
+ .find(
+ '.directorist-search-basic-dropdown-selected-prefix'
+ )
+ .text('');
+ if (
+ dropDownParent.classList.contains(
+ 'input-has-value'
+ ) ||
+ dropDownParent.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ dropDownParent.classList.remove(
+ 'input-has-value',
+ 'input-is-focused'
+ );
+ }
+ });
+ var irisPicker = searchForm.querySelector(
+ 'input.wp-picker-clear'
+ );
+ if (irisPicker !== null) {
+ irisPicker.click();
+ }
+ handleRadiusVisibility();
+ initForm(searchForm);
+ }
+
+ // Searchform Reset Trigger
+ if ($('.directorist-btn-reset-js') !== null) {
+ $('body').on(
+ 'click',
+ '.directorist-btn-reset-js',
+ function (e) {
+ var _this8 = this;
+ e.preventDefault();
+ setTimeout(function () {
+ // Clear URL params on modal form reset
+ var baseUrl =
+ window.location.origin +
+ window.location.pathname;
+
+ // Update the URL in the address bar
+ window.history.replaceState(null, '', baseUrl);
+ if (
+ _this8.closest('.directorist-search-modal')
+ ) {
+ // Clear only the query parameters
+ var _baseUrl =
+ window.location.origin +
+ window.location.pathname;
+
+ // Update the URL in the address bar
+ window.history.replaceState(
+ null,
+ '',
+ _baseUrl
+ );
+ }
+ }, 300);
+
+ // Reset search form values
+ if (this.closest('.directorist-contents-wrap')) {
+ var _searchForm = this.closest(
+ '.directorist-contents-wrap'
+ ).querySelector('.directorist-search-form');
+ if (_searchForm) {
+ adsFormReset(_searchForm);
+ }
+ var advanceSearchForm = this.closest(
+ '.directorist-contents-wrap'
+ ).querySelector(
+ '.directorist-advanced-filter__form'
+ );
+ if (advanceSearchForm) {
+ adsFormReset(advanceSearchForm);
+ }
+ var advanceSearchFilter = this.closest(
+ '.directorist-contents-wrap'
+ ).querySelector(
+ '.directorist-advanced-filter__advanced'
+ );
+ if (advanceSearchFilter) {
+ adsFormReset(advanceSearchFilter);
+ }
+ }
+ }
+ );
+ }
+
+ // Search Modal Open
+ function searchModalOpen(searchModalParent) {
+ var modalOverlay = searchModalParent.querySelector(
+ '.directorist-search-modal__overlay'
+ );
+ var modalContent = searchModalParent.querySelector(
+ '.directorist-search-modal__contents'
+ );
+
+ // Overlay Style
+ modalOverlay.style.cssText =
+ 'opacity: 1; visibility: visible; transition: 0.3s ease;';
+
+ // Modal Content Style
+ modalContent.style.cssText =
+ 'opacity: 1; visibility: visible; bottom:0;';
+ }
+
+ // Search Modal Close
+ function searchModalClose(searchModalParent) {
+ var modalOverlay = searchModalParent.querySelector(
+ '.directorist-search-modal__overlay'
+ );
+ var modalContent = searchModalParent.querySelector(
+ '.directorist-search-modal__contents'
+ );
+
+ // Overlay Style
+ if (modalOverlay) {
+ modalOverlay.style.cssText =
+ 'opacity: 0; visibility: hidden; transition: 0.5s ease';
+ }
+
+ // Modal Content Style
+ if (modalContent) {
+ modalContent.style.cssText =
+ 'opacity: 0; visibility: hidden; bottom: -200px;';
+ }
+ }
+
+ // Search Modal Minimizer
+ function searchModalMinimize(searchModalParent) {
+ var modalContent = searchModalParent.querySelector(
+ '.directorist-search-modal__contents'
+ );
+ var modalMinimizer = searchModalParent.querySelector(
+ '.directorist-search-modal__minimizer'
+ );
+ if (modalMinimizer.classList.contains('minimized')) {
+ modalMinimizer.classList.remove('minimized');
+ modalContent.style.bottom = '0';
+ } else {
+ modalMinimizer.classList.add('minimized');
+ modalContent.style.bottom = '-50%';
+ }
+ }
+
+ // Search Modal Open Trigger
+ $('body').on('click', '.directorist-modal-btn', function (e) {
+ e.preventDefault();
+ // added overlay class on body
+ document
+ .querySelector('.directorist-content-active')
+ .classList.add('directorist-overlay-active');
+ var parentElement = this.closest(
+ '.directorist-contents-wrap'
+ );
+ if (
+ this.classList.contains('directorist-modal-btn--basic')
+ ) {
+ var searchModalElement = parentElement.querySelector(
+ '.directorist-search-modal--basic'
+ );
+ searchModalOpen(searchModalElement);
+ }
+ if (
+ this.classList.contains(
+ 'directorist-modal-btn--advanced'
+ )
+ ) {
+ var _searchModalElement = parentElement.querySelector(
+ '.directorist-search-modal--advanced'
+ );
+ searchModalOpen(_searchModalElement);
+ }
+ if (
+ this.classList.contains('directorist-modal-btn--full')
+ ) {
+ var _searchModalElement2 = parentElement.querySelector(
+ '.directorist-search-modal--full'
+ );
+ searchModalOpen(_searchModalElement2);
+ }
+ });
+
+ // Search Modal Close Trigger
+ $('body').on(
+ 'click',
+ '.directorist-search-modal__contents__btn--close, .directorist-search-modal__overlay',
+ function (e) {
+ e.preventDefault();
+ // removed overlay class from body
+ document
+ .querySelector('.directorist-content-active')
+ .classList.remove('directorist-overlay-active');
+ var searchModalElement = this.closest(
+ '.directorist-search-modal'
+ );
+ searchModalClose(searchModalElement);
+ }
+ );
+
+ // Search Modal Minimizer Trigger
+ $('body').on(
+ 'click',
+ '.directorist-search-modal__minimizer',
+ function (e) {
+ e.preventDefault();
+ var searchModalElement = this.closest(
+ '.directorist-search-modal'
+ );
+ searchModalMinimize(searchModalElement);
+ }
+ );
+
+ // Search Field Input Value Check
+ function inputValueCheck(searchField) {
+ searchField = searchField[0];
+ var inputBox = searchField.querySelector(
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)'
+ );
+ var inputFieldValue = inputBox && inputBox.value;
+ if (inputFieldValue) {
+ searchField.classList.add('input-has-value');
+ if (
+ !searchField.classList.contains('input-is-focused')
+ ) {
+ searchField.classList.add('input-is-focused');
+ }
+ } else {
+ inputFieldValue = '';
+ if (searchField.classList.contains('input-has-value')) {
+ searchField.classList.remove('input-has-value');
+ }
+ if (
+ searchField.classList.contains('input-is-focused')
+ ) {
+ searchField.classList.remove('input-is-focused');
+ }
+ }
+ }
+
+ // Search Field Input Event Check
+ function inputEventCheck(e, searchField) {
+ searchField = searchField[0];
+ var inputBox = searchField.querySelector(
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)'
+ );
+ var inputFieldValue = inputBox.value;
+ if (e.type === 'focusin') {
+ searchField.classList.add('input-is-focused');
+ } else if (e.type === 'focusout') {
+ if (inputBox.classList.contains('directorist-select')) {
+ selectFocusOutCheck(searchField, inputBox);
+ } else {
+ if (inputFieldValue) {
+ searchField.classList.add('input-has-value');
+ if (
+ !searchField.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ searchField.classList.add(
+ 'input-is-focused'
+ );
+ }
+ } else {
+ searchField.classList.remove(
+ 'input-is-focused'
+ );
+ }
+ }
+ }
+ }
+
+ // Search Field Input Focusout Event Check
+ function selectFocusOutCheck(searchField, inputBox) {
+ searchField.classList.add('input-is-focused');
+ var inputFieldValue =
+ inputBox.querySelector('select').value;
+ $('body').one('click', function (e) {
+ inputFieldValue =
+ inputBox.querySelector('select').value;
+ var parentWithClass = e.target.closest(
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)'
+ );
+ if (!parentWithClass) {
+ if (inputFieldValue) {
+ searchField.classList.add('input-has-value');
+ if (
+ !searchField.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ searchField.classList.add(
+ 'input-is-focused'
+ );
+ }
+ } else {
+ searchField.classList.remove(
+ 'input-is-focused'
+ );
+ }
+ }
+ });
+ }
+
+ // Search Form Select Field Init
+ function initSelectFields() {
+ var selectFields = document.querySelectorAll(
+ '.directorist-select.directorist-search-field__input:not(.directorist-search-basic-dropdown'
+ );
+ selectFields.forEach(function (selectField) {
+ var searchField = $(selectField).closest(
+ '.directorist-search-field'
+ );
+ inputValueCheck(searchField);
+ });
+ }
+ initSelectFields();
+
+ // Search Form Input Field Check Trigger
+ $('body').on(
+ 'input keyup change',
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)',
+ function (e) {
+ var searchField = $(this).closest(
+ '.directorist-search-field'
+ );
+ inputValueCheck(searchField);
+ }
+ );
+ $('body').on(
+ 'focus blur',
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)',
+ function (e) {
+ var searchField = $(this).closest(
+ '.directorist-search-field'
+ );
+ inputEventCheck(e, searchField);
+ }
+ );
+
+ // Search Form Input Clear Button
+ $('body').on(
+ 'click',
+ '.directorist-search-field__btn--clear',
+ function (e) {
+ var inputFields = this.parentElement.querySelectorAll(
+ '.directorist-form-element'
+ );
+ var selectboxField = this.parentElement.querySelector(
+ '.directorist-select select'
+ );
+ var basicDropdown = this.parentElement.querySelectorAll(
+ '.directorist-search-basic-dropdown-content'
+ );
+ var radioFields = this.parentElement.querySelectorAll(
+ 'input[type="radio"]'
+ );
+ var checkboxFields =
+ this.parentElement.querySelectorAll(
+ 'input[type="checkbox"]'
+ );
+ if (selectboxField) {
+ selectboxField.selectedIndex = 0;
+ selectboxField.dispatchEvent(new Event('change'));
+ $(selectboxField).trigger('change');
+ }
+ if (inputFields) {
+ inputFields.forEach(function (inputField) {
+ inputField.value = '';
+ });
+ }
+ if (radioFields) {
+ radioFields.forEach(function (element) {
+ element.checked = false;
+ });
+ }
+ if (checkboxFields) {
+ checkboxFields.forEach(function (element) {
+ element.checked = false;
+ });
+ }
+ if (basicDropdown) {
+ basicDropdown.forEach(function (dropdown) {
+ $(dropdown).slideUp();
+ $(dropdown)
+ .siblings(
+ '.directorist-search-basic-dropdown-label'
+ )
+ .find(
+ '.directorist-search-basic-dropdown-selected-count'
+ )
+ .text('');
+ $(dropdown)
+ .siblings(
+ '.directorist-search-basic-dropdown-label'
+ )
+ .find(
+ '.directorist-search-basic-dropdown-selected-prefix'
+ )
+ .text('');
+ $(dropdown)
+ .siblings(
+ '.directorist-search-basic-dropdown-label'
+ )
+ .find(
+ '.directorist-search-basic-dropdown-selected-item'
+ )
+ .text('');
+ });
+ }
+ if (
+ this.parentElement.classList.contains(
+ 'input-has-value'
+ ) ||
+ this.parentElement.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ var _this$parentElement$q;
+ this.parentElement.classList.remove(
+ 'input-has-value',
+ 'input-is-focused'
+ );
+ (_this$parentElement$q =
+ this.parentElement.querySelector(
+ '.directorist-search-basic-dropdown-content.dropdown-content-show'
+ )) === null ||
+ _this$parentElement$q === void 0 ||
+ _this$parentElement$q.classList.remove(
+ 'dropdown-content-show'
+ );
+ }
+ handleRadiusVisibility();
+
+ // Reset Button Disable
+ var searchform = this.closest('form');
+ var inputValue = $(this)
+ .parent('.directorist-search-field')
+ .find(
+ '.directorist-search-field__input:not(.directorist-search-basic-dropdown)'
+ )
+ .val();
+ var selectValue = $(this)
+ .parent('.directorist-search-field')
+ .find(
+ '.directorist-search-field__input select:not(.directorist-search-basic-dropdown)'
+ )
+ .val();
+ if (
+ (inputValue &&
+ inputValue !== 0 &&
+ inputValue !== undefined) ||
+ (selectValue && selectValue.selectedIndex === 0) ||
+ (selectValue &&
+ selectValue.selectedIndex !== undefined)
+ ) {
+ enableResetButton(searchform);
+ } else {
+ setTimeout(function () {
+ initForm(searchform);
+ }, 100);
+ }
+ }
+ );
+
+ // Search Form Input Field Back Button
+ $('body').on(
+ 'click',
+ '.directorist-search-field__label:not(.directorist-search-basic-dropdown-label)',
+ function (e) {
+ var windowScreen = window.innerWidth;
+ var parentField = this.closest(
+ '.directorist-search-field'
+ );
+ if (windowScreen <= 575) {
+ if (
+ parentField.classList.contains(
+ 'input-is-focused'
+ )
+ ) {
+ parentField.classList.remove(
+ 'input-is-focused'
+ );
+ }
+ }
+ }
+ );
+
+ // Listing Type Change
+ $('body').on(
+ 'click',
+ '.search_listing_types',
+ function (event) {
+ event.preventDefault();
+ var parent = $(this).closest(
+ '.directorist-search-contents'
+ );
+ var listing_type = $(this).attr('data-listing_type');
+ var type_current = parent.find(
+ '.directorist-listing-type-selection__link--current'
+ );
+ if (type_current.length) {
+ type_current.removeClass(
+ 'directorist-listing-type-selection__link--current'
+ );
+ $(this).addClass(
+ 'directorist-listing-type-selection__link--current'
+ );
+ }
+ parent.find('.listing_type').val(listing_type);
+ var form_data = new FormData();
+ form_data.append('action', 'atbdp_listing_types_form');
+ form_data.append(
+ 'nonce',
+ directorist.directorist_nonce
+ );
+ form_data.append('listing_type', listing_type);
+ var atts = parent.attr('data-atts');
+ var atts_decoded = btoa(atts);
+ form_data.append('atts', atts_decoded);
+ parent
+ .find('.directorist-search-form-box')
+ .addClass('atbdp-form-fade');
+ $.ajax({
+ method: 'POST',
+ processData: false,
+ contentType: false,
+ url: directorist.ajax_url,
+ data: form_data,
+ success: function success(response) {
+ if (response) {
+ // Add Temp Element
+ var new_inserted_elm =
+ '
';
+ parent.before(new_inserted_elm);
+
+ // Remove Old Parent
+ parent.remove();
+
+ // Insert New Parent
+ $('.directorist_search_temp').after(
+ response['search_form']
+ );
+ var newParent = $(
+ '.directorist_search_temp'
+ ).next();
+
+ // Toggle Active Class
+ newParent
+ .find(
+ '.directorist-listing-type-selection__link--current'
+ )
+ .removeClass(
+ 'directorist-listing-type-selection__link--current'
+ );
+ newParent
+ .find(
+ "[data-listing_type='" +
+ listing_type +
+ "']"
+ )
+ .addClass(
+ 'directorist-listing-type-selection__link--current'
+ );
+
+ // Remove Temp Element
+ $('.directorist_search_temp').remove();
+ var events = [
+ new CustomEvent(
+ 'directorist-search-form-nav-tab-reloaded'
+ ),
+ new CustomEvent(
+ 'directorist-reload-select2-fields'
+ ),
+ new CustomEvent(
+ 'directorist-reload-map-api-field'
+ ),
+ new CustomEvent('triggerSlice'),
+ ];
+ events.forEach(function (event) {
+ document.body.dispatchEvent(event);
+ window.dispatchEvent(event);
+ });
+ handleRadiusVisibility();
+ directorist_custom_range_slider();
+ initSearchFields();
+ (0,
+ _components_category_custom_fields__WEBPACK_IMPORTED_MODULE_7__[
+ 'default'
+ ])($);
+ }
+ var parentAfterAjax = $(this).closest(
+ '.directorist-search-contents'
+ );
+ parentAfterAjax
+ .find('.directorist-search-form-box')
+ .removeClass('atbdp-form-fade');
+ if (
+ parentAfterAjax
+ .find('.directorist-search-form-box')
+ .find(
+ '.directorist-search-field-radius_search'
+ ).length
+ ) {
+ handleRadiusVisibility();
+ directorist_custom_range_slider();
+ }
+ },
+ error: function error(_error) {
+ // console.log(error);
+ },
+ });
+ }
+ );
+ (0,
+ _components_category_custom_fields__WEBPACK_IMPORTED_MODULE_7__[
+ 'default'
+ ])($);
+
+ // Back Button to go back to the previous page
+ $('body').on('click', '.directorist-btn__back', function (e) {
+ e.preventDefault();
+ window.history.back();
+ });
+
+ // Radius Search Field Hide on Empty Location Field
+ function handleRadiusVisibility() {
+ // Add class to mark the radius search field
+ $('.directorist-range-slider-wrap')
+ .closest('.directorist-search-field')
+ .addClass('directorist-search-field-radius_search');
+ var radius_search_item_selector = null;
+ var radius_search_based_on = $(
+ '.directorist-radius_search_based_on'
+ ).val();
+
+ // Determine which search item selector to use
+ if (radius_search_based_on === 'address') {
+ radius_search_item_selector =
+ '.directorist-location-js';
+ } else if (radius_search_based_on === 'zip') {
+ radius_search_item_selector =
+ '.directorist-zipcode-search .zip-radius-search';
+ } else {
+ // Default fallback
+ radius_search_item_selector =
+ '.directorist-location-js';
+ }
+
+ // Check if radius search item selector elements exist
+ var $radiusSearchItems = $(radius_search_item_selector);
+ if ($radiusSearchItems.length === 0) {
+ // If no elements found, hide all radius search containers
+ $(
+ '.directorist-search-field-radius_search, .directorist-radius-search'
+ ).css({
+ display: 'none',
+ });
+ } else {
+ // Loop through the elements
+ $radiusSearchItems.each(function (index, locationDOM) {
+ var $location = $(locationDOM);
+ var isEmpty = $location.val() === '';
+ var $container = $location
+ .closest('.directorist-contents-wrap')
+ .find(
+ '.directorist-search-field-radius_search, .directorist-radius-search'
+ );
+ $container.css({
+ display: isEmpty ? 'none' : 'block',
+ });
+ });
+ }
+ }
+
+ // handleRadiusVisibility Trigger
+ $('body').on(
+ 'keyup keydown input change focus',
+ '.directorist-location-js, .zip-radius-search',
+ function (e) {
+ handleRadiusVisibility();
+ }
+ );
+
+ // rangeSlider, defaultTags Trigger on directory type | page change
+ $('body').on(
+ 'click',
+ '.directorist-type-nav__link, .directorist-pagination .page-numbers, .directorist-viewas .directorist-viewas__item',
+ function (e) {
+ setTimeout(function () {
+ handleRadiusVisibility();
+ directorist_custom_range_slider();
+ defaultTags();
+ }, 600);
+ }
+ );
+
+ // directorist-instant-search-reloaded event
+ window.addEventListener(
+ 'directorist-instant-search-reloaded',
+ function () {
+ handleRadiusVisibility();
+ directorist_custom_range_slider();
+ defaultTags();
+ }
+ );
+
+ // active class add on view as button
+ $('body').on(
+ 'click',
+ '.directorist-viewas .directorist-viewas__item',
+ function (e) {
+ $(this)
+ .addClass('active')
+ .siblings()
+ .removeClass('active');
+ }
+ );
+
+ // Hide Country Result Click on Outside of Zipcode Field
+ $(document).on('click', function (e) {
+ if (!$(e.target).closest('.directorist-zip-code').length) {
+ $('.directorist-country').hide();
+ }
+ });
+ $('body').on(
+ 'click',
+ '.directorist-country ul li a',
+ function (event) {
+ event.preventDefault();
+ var zipcode_search = $(this).closest(
+ '.directorist-zipcode-search'
+ );
+ var lat = $(this).data('lat');
+ var lon = $(this).data('lon');
+ zipcode_search.find('.zip-cityLat').val(lat);
+ zipcode_search.find('.zip-cityLng').val(lon);
+ $('.directorist-country').hide();
+ }
+ );
+ $('.address_result').hide();
+
+ // Init Location
+ init_map_api_field();
+ document.body.addEventListener(
+ 'directorist-reload-map-api-field',
+ init_map_api_field
+ );
+ function init_map_api_field() {
+ if (directorist.i18n_text.select_listing_map === 'google') {
+ function initialize() {
+ var opt = {
+ types: ['geocode'],
+ componentRestrictions: {
+ country: directorist.restricted_countries,
+ },
+ };
+ var options = directorist.countryRestriction
+ ? opt
+ : '';
+ var input_fields = [
+ {
+ input_class: '.directorist-location-js',
+ lat_id: 'cityLat',
+ lng_id: 'cityLng',
+ options: options,
+ },
+ {
+ input_id: 'address_widget',
+ lat_id: 'cityLat',
+ lng_id: 'cityLng',
+ options: options,
+ },
+ ];
+ var setupAutocomplete = function setupAutocomplete(
+ field
+ ) {
+ var input = document.querySelectorAll(
+ field.input_class
+ );
+ input.forEach(function (elm) {
+ if (!elm) {
+ return;
+ }
+ var autocomplete =
+ new google.maps.places.Autocomplete(
+ elm,
+ field.options
+ );
+ google.maps.event.addListener(
+ autocomplete,
+ 'place_changed',
+ function () {
+ var place = autocomplete.getPlace();
+ elm
+ .closest(
+ '.directorist-search-field'
+ )
+ .querySelector(
+ '#'.concat(field.lat_id)
+ ).value =
+ place.geometry.location.lat();
+ elm
+ .closest(
+ '.directorist-search-field'
+ )
+ .querySelector(
+ '#'.concat(field.lng_id)
+ ).value =
+ place.geometry.location.lng();
+ }
+ );
+ });
+ };
+ input_fields.forEach(function (field) {
+ setupAutocomplete(field);
+ });
+ }
+ initialize();
+ } else if (
+ directorist.i18n_text.select_listing_map ===
+ 'openstreet'
+ ) {
+ var getResultContainer = function getResultContainer(
+ context,
+ field
+ ) {
+ return $(context).next(field.search_result_elm);
+ };
+ var getWidgetResultContainer =
+ function getWidgetResultContainer(context, field) {
+ return $(context)
+ .parent()
+ .next(field.search_result_elm);
+ };
+ var input_fields = [
+ {
+ input_elm: '.directorist-location-js',
+ search_result_elm: '.address_result',
+ getResultContainer: getResultContainer,
+ },
+ {
+ input_elm: '#q_addressss',
+ search_result_elm: '.address_result',
+ getResultContainer: getResultContainer,
+ },
+ {
+ input_elm: '.atbdp-search-address',
+ search_result_elm: '.address_result',
+ getResultContainer: getResultContainer,
+ },
+ {
+ input_elm: '#address_widget',
+ search_result_elm: '#address_widget_result',
+ getResultContainer: getWidgetResultContainer,
+ },
+ ];
+ input_fields.forEach(function (field) {
+ if (!$(field.input_elm).length) {
+ return;
+ }
+ $(field.input_elm).on(
+ 'keyup',
+ (0,
+ _global_components_debounce__WEBPACK_IMPORTED_MODULE_4__[
+ 'default'
+ ])(function (event) {
+ event.preventDefault();
+ var blockedKeyCodes = [
+ 16, 17, 18, 19, 20, 27, 33, 34, 35, 36,
+ 37, 38, 39, 40, 45, 91, 93, 112, 113,
+ 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 144, 145,
+ ];
+
+ // Return early when blocked key is pressed.
+ if (
+ blockedKeyCodes.includes(event.keyCode)
+ ) {
+ return;
+ }
+ var locationAddressField = $(this).parent(
+ '.directorist-search-field'
+ );
+ var result_container =
+ field.getResultContainer(this, field);
+ var search = $(this).val();
+ if (search.length < 3) {
+ result_container.css({
+ display: 'none',
+ });
+ } else {
+ locationAddressField.addClass(
+ 'atbdp-form-fade'
+ );
+ result_container.css({
+ display: 'block',
+ });
+ $.ajax({
+ url: 'https://nominatim.openstreetmap.org/?q=%27+'.concat(
+ search,
+ '+%27&format=json'
+ ),
+ type: 'GET',
+ data: {},
+ success: function success(data) {
+ var res = '';
+ var currentIconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/paper-plane.svg';
+ var currentIconHTML =
+ directorist.icon_markup
+ .replace(
+ '##URL##',
+ currentIconURL
+ )
+ .replace(
+ '##CLASS##',
+ ''
+ );
+ var currentLocationIconHTML =
+ "
" +
+ currentIconHTML +
+ ' ';
+ var currentLocationAddressHTML =
+ "
";
+ var iconURL =
+ directorist.assets_url +
+ 'icons/font-awesome/svgs/solid/map-marker-alt.svg';
+ var iconHTML =
+ directorist.icon_markup
+ .replace(
+ '##URL##',
+ iconURL
+ )
+ .replace(
+ '##CLASS##',
+ ''
+ );
+ var locationIconHTML =
+ "
" +
+ iconHTML +
+ ' ';
+ for (
+ var i = 0,
+ len =
+ data.length > 5
+ ? 5
+ : data.length;
+ i < len;
+ i++
+ ) {
+ ((res +=
+ '
' +
+ locationIconHTML +
+ "" +
+ data[i].display_name),
+ +' ');
+ }
+ function displayLocation(
+ position,
+ event
+ ) {
+ var lat =
+ position.coords
+ .latitude;
+ var lng =
+ position.coords
+ .longitude;
+ $.ajax({
+ url:
+ 'https://nominatim.openstreetmap.org/reverse?format=json&lon=' +
+ lng +
+ '&lat=' +
+ lat,
+ type: 'GET',
+ data: {},
+ success:
+ function success(
+ data
+ ) {
+ $(
+ '.directorist-location-js, .atbdp-search-address'
+ ).val(
+ data.display_name
+ );
+ $(
+ '.directorist-location-js, .atbdp-search-address'
+ ).attr(
+ 'data-value',
+ data.display_name
+ );
+ $(
+ '#cityLat'
+ ).val(lat);
+ $(
+ '#cityLng'
+ ).val(lng);
+ var locationSearch =
+ $(
+ '.directorist-search-location'
+ );
+ if (
+ locationSearch.length
+ ) {
+ locationSearch.trigger(
+ 'change'
+ );
+ }
+ },
+ });
+ }
+ result_container.html(
+ '
'
+ );
+ if (res.length) {
+ result_container.show();
+ } else {
+ result_container.hide();
+ }
+ locationAddressField.removeClass(
+ 'atbdp-form-fade'
+ );
+ $('body')
+ .off(
+ 'click',
+ '.address_result .current-location'
+ )
+ .on(
+ 'click',
+ '.address_result .current-location',
+ function (e) {
+ e.preventDefault();
+ navigator.geolocation.getCurrentPosition(
+ function (
+ position
+ ) {
+ return displayLocation(
+ position,
+ e
+ );
+ }
+ );
+ }
+ );
+ },
+ error: function error(_error3) {
+ console.log({
+ error: _error3,
+ });
+ locationAddressField.removeClass(
+ 'atbdp-form-fade'
+ );
+ },
+ });
+ }
+ }, 750)
+ );
+ });
+
+ // hide address result when click outside the input field
+ $(document).on('click', function (e) {
+ if (
+ !$(e.target).closest(
+ '.directorist-location-js, #q_addressss, .atbdp-search-address, .current-location'
+ ).length
+ ) {
+ var locationSearch = $(e.target).closest(
+ '.directorist-search-location'
+ );
+ var zipCodeSearch = $(e.target).closest(
+ '.directorist-zipcode-search'
+ );
+ if (locationSearch.length) {
+ locationSearch.trigger('change');
+ }
+ if (zipCodeSearch.length) {
+ zipCodeSearch.trigger('change');
+ }
+ $('.address_result').hide();
+ }
+ });
+ var syncLatLngData = function syncLatLngData(
+ context,
+ event,
+ args
+ ) {
+ event.preventDefault();
+ var text = $(context).text();
+ var lat = $(context).data('lat');
+ var lon = $(context).data('lon');
+ var _this = event.target;
+ $(_this)
+ .closest('.address_result')
+ .siblings('input[name="cityLat"]')
+ .val(lat);
+ $(_this)
+ .closest('.address_result')
+ .siblings('input[name="cityLng"]')
+ .val(lon);
+ var inp = $(context)
+ .closest(args.result_list_container)
+ .parent()
+ .find(
+ '.directorist-location-js, #address_widget, #q_addressss, .atbdp-search-address'
+ );
+ inp.val(text);
+ $(args.result_list_container).hide();
+ };
+ $('body').on(
+ 'click',
+ '.address_result ul li a',
+ function (event) {
+ syncLatLngData(this, event, {
+ result_list_container: '.address_result',
+ });
+ }
+ );
+ $('body').on(
+ 'click',
+ '#address_widget_result ul li a',
+ function (event) {
+ syncLatLngData(this, event, {
+ result_list_container:
+ '#address_widget_result',
+ });
+ }
+ );
+ }
+ if (
+ $(
+ '.directorist-location-js, #q_addressss, .atbdp-search-address'
+ ).val() === ''
+ ) {
+ $(this).parent().next('.address_result').css({
+ display: 'none',
+ });
+ }
+ }
+ $('.directorist-search-contents').each(function () {
+ if ($(this).next().length === 0) {
+ $(this)
+ .find('.directorist-search-country')
+ .css('max-height', '175px');
+ $(this)
+ .find('.directorist-search-field .address_result')
+ .css('max-height', '175px');
+ }
+ });
+
+ // Custom Range Slider
+ function directorist_custom_range_slider() {
+ var sliders = document.querySelectorAll(
+ '.directorist-custom-range-slider'
+ );
+ sliders.forEach(function (sliderItem) {
+ var _slider$directoristCu,
+ _slider$directoristCu2,
+ _slider$directoristCu3;
+ var slider = sliderItem.querySelector(
+ '.directorist-custom-range-slider__slide'
+ );
+
+ // Skip if already initialized
+ if (!slider || slider.directoristCustomRangeSlider)
+ return;
+ var sliderStep =
+ parseInt(slider.getAttribute('step')) || 1;
+ var sliderMinValue =
+ parseInt(slider.getAttribute('min-value')) || 0;
+ var sliderMaxValue =
+ parseInt(slider.getAttribute('max-value')) || 100;
+ var sliderDefaultValue = parseInt(
+ slider.getAttribute('default-value')
+ );
+ var minInput = sliderItem.querySelector(
+ '.directorist-custom-range-slider__value__min'
+ );
+ var maxInput = sliderItem.querySelector(
+ '.directorist-custom-range-slider__value__max'
+ );
+ var sliderRange = sliderItem.querySelector(
+ '.directorist-custom-range-slider__range'
+ );
+ var sliderRangeShow = sliderItem.querySelector(
+ '.directorist-custom-range-slider__range__show'
+ );
+ var sliderRangeValue = sliderItem.querySelector(
+ '.directorist-custom-range-slider__wrap .directorist-custom-range-slider__range'
+ );
+ var minInputName =
+ (minInput === null || minInput === void 0
+ ? void 0
+ : minInput.getAttribute('name')) || '';
+ var maxInputName =
+ (maxInput === null || maxInput === void 0
+ ? void 0
+ : maxInput.getAttribute('name')) || '';
+ var isRTL = document.dir === 'rtl';
+
+ // Flags
+ var rangeInitLoad = true;
+ var sliderActivated = false;
+ var sliderRadiusActive = false;
+
+ // Parse the URL parameters
+ var urlParams = new URLSearchParams(
+ window.location.search
+ );
+ var customNumberParams = urlParams.get('custom-number');
+ var rangeFieldName =
+ (sliderRange === null || sliderRange === void 0
+ ? void 0
+ : sliderRange.getAttribute('name')) || '';
+ var fieldRangeValueParam = rangeFieldName
+ ? urlParams.get(rangeFieldName)
+ : null;
+ var specificRangeMinParam = minInputName
+ ? urlParams.get(minInputName)
+ : null;
+ var specificRangeMaxParam = maxInputName
+ ? urlParams.get(maxInputName)
+ : null;
+ var globalRangeMinParam = urlParams.get(
+ 'directorist-custom-range-slider__value__min'
+ );
+ var globalRangeMaxParam = urlParams.get(
+ 'directorist-custom-range-slider__value__max'
+ );
+ var effectiveRangeMinParam =
+ specificRangeMinParam !== null &&
+ specificRangeMinParam !== void 0
+ ? specificRangeMinParam
+ : globalRangeMinParam;
+ var effectiveRangeMaxParam =
+ specificRangeMaxParam !== null &&
+ specificRangeMaxParam !== void 0
+ ? specificRangeMaxParam
+ : globalRangeMaxParam;
+ var locationDistanceParams = urlParams.get('miles');
+ var milesParams = urlParams.has('miles');
+ if (
+ rangeFieldName === 'miles' &&
+ locationDistanceParams !== '0-0' &&
+ sliderDefaultValue >= 0
+ ) {
+ sliderRadiusActive = true;
+ }
+
+ // if already have custom values, then slider is activated
+ if (
+ fieldRangeValueParam &&
+ fieldRangeValueParam !== '0-0'
+ ) {
+ sliderActivated = true;
+ } else if (
+ customNumberParams &&
+ customNumberParams !== '0-0'
+ ) {
+ sliderActivated = true;
+ } else if (
+ effectiveRangeMaxParam &&
+ effectiveRangeMaxParam !== '0'
+ ) {
+ sliderActivated = true;
+ }
+ if (typeof directoristCustomRangeSlider === 'undefined')
+ return;
+ if (sliderRadiusActive) {
+ var _directoristCustomRan;
+ // Radius Search Range Slider
+ (_directoristCustomRan =
+ directoristCustomRangeSlider) === null ||
+ _directoristCustomRan === void 0 ||
+ _directoristCustomRan.create(slider, {
+ start: [
+ minInput.value,
+ !milesParams
+ ? sliderDefaultValue
+ : maxInput.value,
+ ],
+ connect: true,
+ direction: isRTL ? 'rtl' : 'ltr',
+ step: sliderStep ? sliderStep : 1,
+ range: {
+ min: Number(sliderMinValue || 0),
+ max: Number(sliderMaxValue || 100),
+ },
+ });
+ } else if (sliderActivated) {
+ var _directoristCustomRan2;
+ // Custom Number Range Slider
+ var minValue = minInput.value;
+ var maxValue = maxInput.value;
+
+ // Assign min-max values from custom-range-slider params
+ if (
+ fieldRangeValueParam &&
+ fieldRangeValueParam !== '0-0'
+ ) {
+ var _fieldRangeValueParam = fieldRangeValueParam
+ .split('-')
+ .map(Number),
+ _fieldRangeValueParam2 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(_fieldRangeValueParam, 2),
+ min = _fieldRangeValueParam2[0],
+ max = _fieldRangeValueParam2[1];
+ minValue = min;
+ maxValue = max;
+ } else if (
+ customNumberParams &&
+ customNumberParams !== '0-0'
+ ) {
+ var _customNumberParams$s = customNumberParams
+ .split('-')
+ .map(Number),
+ _customNumberParams$s2 = (0,
+ _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(_customNumberParams$s, 2),
+ _min = _customNumberParams$s2[0],
+ _max = _customNumberParams$s2[1];
+
+ // Use the split values as min-max
+ minValue = _min;
+ maxValue = _max;
+ } else if (
+ effectiveRangeMinParam &&
+ effectiveRangeMaxParam
+ ) {
+ // Modal Search Form
+ minValue = effectiveRangeMinParam;
+ maxValue = effectiveRangeMaxParam;
+ }
+
+ // Initial with [min, max] value
+ (_directoristCustomRan2 =
+ directoristCustomRangeSlider) === null ||
+ _directoristCustomRan2 === void 0 ||
+ _directoristCustomRan2.create(slider, {
+ start: [
+ minValue,
+ !milesParams
+ ? sliderDefaultValue || maxValue
+ : maxValue,
+ ],
+ connect: true,
+ direction: isRTL ? 'rtl' : 'ltr',
+ step: sliderStep ? sliderStep : 1,
+ range: {
+ min: Number(sliderMinValue || 0),
+ max: Number(sliderMaxValue || 100),
+ },
+ });
+ } else {
+ var _directoristCustomRan3;
+ // Initialize with [0, 0] and temp min/max
+ (_directoristCustomRan3 =
+ directoristCustomRangeSlider) === null ||
+ _directoristCustomRan3 === void 0 ||
+ _directoristCustomRan3.create(slider, {
+ start: [0, 0],
+ connect: true,
+ direction: isRTL ? 'rtl' : 'ltr',
+ step: 1,
+ range: {
+ min: 0,
+ max: 1,
+ },
+ });
+ }
+
+ // Handle first interaction
+ (_slider$directoristCu =
+ slider.directoristCustomRangeSlider) === null ||
+ _slider$directoristCu === void 0 ||
+ _slider$directoristCu.on('start', function () {
+ if (sliderActivated || sliderRadiusActive)
+ return;
+ sliderActivated = true;
+
+ // Range slider options update
+ slider.directoristCustomRangeSlider.updateOptions(
+ {
+ start: [sliderMinValue, sliderMinValue],
+ step: sliderStep,
+ range: {
+ min: sliderMinValue,
+ max: sliderMaxValue,
+ },
+ }
+ );
+
+ // Trigger range slider observer
+ rangeSliderObserver();
+ });
+
+ // Update slider config - update values but don't trigger change during drag
+ (_slider$directoristCu2 =
+ slider.directoristCustomRangeSlider) === null ||
+ _slider$directoristCu2 === void 0 ||
+ _slider$directoristCu2.on(
+ 'update',
+ function (values, handle) {
+ var value = Math.round(values[handle]);
+ // Assign min-max value based on handler
+ if (handle === 0) {
+ minInput.value = value;
+ } else {
+ maxInput.value = value;
+ }
+ var rangeValue = ''
+ .concat(minInput.value, '-')
+ .concat(maxInput.value);
+ if (sliderRange)
+ sliderRange.value = rangeValue;
+ if (sliderRangeShow)
+ sliderRangeShow.innerHTML = rangeValue;
+ if (sliderRangeValue) {
+ sliderRangeValue.setAttribute(
+ 'value',
+ rangeValue
+ );
+ }
+ }
+ );
+
+ // Trigger change only when dragging ends (mouse/touch released)
+ (_slider$directoristCu3 =
+ slider.directoristCustomRangeSlider) === null ||
+ _slider$directoristCu3 === void 0 ||
+ _slider$directoristCu3.on('end', function () {
+ if (sliderRangeValue && !rangeInitLoad) {
+ $(sliderRangeValue).trigger('change');
+ }
+ });
+
+ // Mark init complete
+ rangeInitLoad = false;
+
+ // 🔁 Manual input update logic (on change/keyup)
+ function updateSliderFromInputs() {
+ var minValue =
+ Math.round(
+ parseInt(minInput.value || 0, 10) /
+ sliderStep
+ ) * sliderStep;
+ var maxValue =
+ Math.round(
+ parseInt(maxInput.value || 0, 10) /
+ sliderStep
+ ) * sliderStep;
+ if (isNaN(minValue)) minValue = 0;
+ if (isNaN(maxValue)) maxValue = 0;
+ if (!sliderActivated) {
+ sliderActivated = true;
+ slider.directoristCustomRangeSlider.updateOptions(
+ {
+ range: {
+ min: sliderMinValue,
+ max: sliderMaxValue,
+ },
+ step: sliderStep,
+ start: [sliderMinValue, sliderMaxValue],
+ }
+ );
+ }
+
+ // Fix invalid ranges
+ if (minValue > maxValue) {
+ minInput.value = maxValue;
+ minValue = maxValue;
+ }
+ if (maxValue < minValue) {
+ maxInput.value = minValue;
+ maxValue = minValue;
+ }
+ slider.directoristCustomRangeSlider.set([
+ minValue,
+ maxValue,
+ ]);
+ }
+ ['change', 'keyup'].forEach(function (evt) {
+ minInput.addEventListener(
+ evt,
+ updateSliderFromInputs
+ );
+ maxInput.addEventListener(
+ evt,
+ updateSliderFromInputs
+ );
+ });
+ });
+ }
+ directorist_custom_range_slider();
+
+ // Reset Custom Range Slider
+ function resetCustomRangeSlider(sliderItem) {
+ var slider = sliderItem.querySelector(
+ '.directorist-custom-range-slider__slide'
+ );
+ var minInput = sliderItem.querySelector(
+ '.directorist-custom-range-slider__value__min'
+ );
+ var maxInput = sliderItem.querySelector(
+ '.directorist-custom-range-slider__value__max'
+ );
+ var rangeValue = sliderItem.querySelector(
+ '.directorist-custom-range-slider__range'
+ );
+ var radiusSearch = sliderItem.closest(
+ '.directorist-search-field-radius_search'
+ );
+ var defaultValue =
+ slider.getAttribute('default-value') || '0';
+ if (radiusSearch) {
+ var _slider$directoristCu4;
+ minInput.value = '0';
+ maxInput.value = defaultValue;
+ slider === null ||
+ slider === void 0 ||
+ (_slider$directoristCu4 =
+ slider.directoristCustomRangeSlider) === null ||
+ _slider$directoristCu4 === void 0 ||
+ _slider$directoristCu4.set([0, defaultValue]); // Set initial values
+ } else {
+ var _slider$directoristCu5;
+ // Reset values to their initial state
+ slider === null ||
+ slider === void 0 ||
+ (_slider$directoristCu5 =
+ slider.directoristCustomRangeSlider) === null ||
+ _slider$directoristCu5 === void 0 ||
+ _slider$directoristCu5.set([0, 0]); // Set initial values
+ minInput.value = '0'; // Set initial min value
+ maxInput.value = '0'; // Set initial max value
+ rangeValue.value = '0-0';
+ }
+ var sidebarRangeSlider = slider.closest(
+ '.listing-with-sidebar'
+ );
+ if (
+ sidebarRangeSlider &&
+ slider !== null &&
+ slider !== void 0 &&
+ slider.directoristCustomRangeSlider
+ ) {
+ // Destroy the custom range slider instance
+ slider.directoristCustomRangeSlider.destroy();
+ delete slider.directoristCustomRangeSlider;
+ }
+ }
+
+ // DOM Mutation Observer on Location Field
+ function locationObserver() {
+ var targetNode = document.querySelector(
+ '.directorist-location-js'
+ );
+ if (targetNode) {
+ var observer = new MutationObserver(
+ handleRadiusVisibility
+ );
+ observer.observe(targetNode, {
+ attributes: true,
+ });
+ }
+ }
+ locationObserver();
+ handleRadiusVisibility();
+ $('body').on(
+ 'keyup',
+ '.zip-radius-search',
+ directorist_debounce(function () {
+ var zipcode = $(this).val();
+ var zipcode_search = $(this).closest(
+ '.directorist-zipcode-search'
+ );
+ var country_suggest = zipcode_search.find(
+ '.directorist-country'
+ );
+ var zipcode_search = $(this).closest(
+ '.directorist-zipcode-search'
+ );
+ if (zipcode) {
+ zipcode_search.addClass('dir_loading');
+ }
+ if (
+ directorist.i18n_text.select_listing_map ===
+ 'google'
+ ) {
+ var url = directorist.ajax_url;
+ } else {
+ url =
+ 'https://nominatim.openstreetmap.org/?postalcode='.concat(
+ zipcode,
+ '&format=json&addressdetails=1'
+ );
+ $('.directorist-country').css({
+ display: 'block',
+ });
+ if (zipcode === '') {
+ $('.directorist-country').css({
+ display: 'none',
+ });
+ }
+ }
+ var res = '';
+ var google_data = {
+ nonce: directorist.directorist_nonce,
+ action: 'directorist_zipcode_search',
+ zipcode: zipcode,
+ };
+ $.ajax({
+ url: url,
+ method: 'POST',
+ data:
+ directorist.i18n_text.select_listing_map ===
+ 'google'
+ ? google_data
+ : '',
+ success: function success(data) {
+ if (data.data && data.data.error_message) {
+ zipcode_search
+ .find('.error_message')
+ .remove();
+ zipcode_search.find('.zip-cityLat').val('');
+ zipcode_search.find('.zip-cityLng').val('');
+ zipcode_search.append(
+ data.data.error_message
+ );
+ }
+ zipcode_search.removeClass('dir_loading');
+ if (
+ directorist.i18n_text.select_listing_map ===
+ 'google' &&
+ typeof data.lat !== 'undefined' &&
+ typeof data.lng !== 'undefined'
+ ) {
+ zipcode_search
+ .find('.error_message')
+ .remove();
+ zipcode_search
+ .find('.zip-cityLat')
+ .val(data.lat);
+ zipcode_search
+ .find('.zip-cityLng')
+ .val(data.lng);
+ } else {
+ if (data.length === 1) {
+ var lat = data[0].lat;
+ var lon = data[0].lon;
+ zipcode_search
+ .find('.zip-cityLat')
+ .val(lat);
+ zipcode_search
+ .find('.zip-cityLng')
+ .val(lon);
+ } else {
+ for (var i = 0; i < data.length; i++) {
+ res += '
')
+ .concat(
+ data[i].address.country,
+ ' '
+ );
+ }
+ }
+ $(country_suggest).html(
+ '
')
+ );
+ if (res.length) {
+ $('.directorist-country').show();
+ } else {
+ $('.directorist-country').hide();
+ }
+ }
+ },
+ });
+ }, 250)
+ );
+
+ // Returns a function, that, as long as it continues to be invoked, will not
+ // be triggered. The function will be called after it stops being called for
+ // N milliseconds. If `immediate` is passed, trigger the function on the
+ // leading edge, instead of the trailing.
+ function directorist_debounce(func, wait, immediate) {
+ var timeout;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function later() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+ }
+
+ // Custom Range Slider Value Check on Change
+ function sliderValueCheck(searchForm, targetNode, value) {
+ if (value > 0) {
+ enableResetButton(searchForm);
+ var rangeSlider = targetNode.closest(
+ '.directorist-custom-range-slider'
+ );
+ if (!rangeSlider) return;
+ var customSliderMin = rangeSlider.querySelector(
+ '.directorist-custom-range-slider__value__min'
+ );
+ var customSliderRange = rangeSlider.querySelector(
+ '.directorist-custom-range-slider__range'
+ );
+ customSliderMin.value = customSliderMin.value
+ ? customSliderMin.value
+ : 0;
+ customSliderRange.value =
+ customSliderMin.value + '-' + value;
+ } else {
+ initForm(searchForm);
+ }
+ }
+
+ // DOM Mutation Observer on Custom Range Slider
+ function rangeSliderObserver() {
+ var targetNodes = document.querySelectorAll(
+ '.directorist-search-field:not(.directorist-search-field-radius_search) .directorist-custom-range-slider-handle-upper'
+ );
+ targetNodes.forEach(function (targetNode) {
+ if (targetNode) {
+ var _searchForm2 = targetNode.closest('form');
+ var observerCallback = function observerCallback(
+ mutationList,
+ observer
+ ) {
+ var _iterator =
+ _createForOfIteratorHelper(
+ mutationList
+ ),
+ _step;
+ try {
+ for (
+ _iterator.s();
+ !(_step = _iterator.n()).done;
+
+ ) {
+ var mutation = _step.value;
+ if (
+ targetNode.classList.contains(
+ 'directorist-custom-range-slider-handle-upper'
+ )
+ ) {
+ sliderValueCheck(
+ _searchForm2,
+ targetNode,
+ parseInt(
+ targetNode.ariaValueNow
+ )
+ );
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ };
+ var sliderObserver = new MutationObserver(
+ observerCallback
+ );
+ sliderObserver.observe(targetNode, {
+ attributes: true,
+ });
+ }
+ });
+ }
+ rangeSliderObserver();
+ });
+ })(jQuery);
+ })();
+ /******/
+})();
+//# sourceMappingURL=search-form.js.map
diff --git a/assets/js/single-listing.js b/assets/js/single-listing.js
index 0bf133fcd..b7157993a 100644
--- a/assets/js/single-listing.js
+++ b/assets/js/single-listing.js
@@ -1,1336 +1,2509 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/global/components/modal.js":
-/*!**************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/global/components/modal.js':
+ /*!**************************************************!*\
!*** ./assets/src/js/global/components/modal.js ***!
\**************************************************/
-/***/ (function() {
-
-var $ = jQuery;
-$(document).ready(function () {
- modalToggle();
-});
-function modalToggle() {
- $('.atbdp_recovery_pass').on('click', function (e) {
- e.preventDefault();
- $('#recover-pass-modal').slideToggle().show();
- });
-
- // Contact form [on modal closed]
- $('#atbdp-contact-modal').on('hidden.bs.modal', function (e) {
- $('#atbdp-contact-message').val('');
- $('#atbdp-contact-message-display').html('');
- });
-
- // Template Restructured
- // Modal
- var directoristModal = document.querySelector('.directorist-modal-js');
- $('body').on('click', '.directorist-btn-modal-js', function (e) {
- e.preventDefault();
- var data_target = $(this).attr('data-directorist_target');
- document.querySelector(".".concat(data_target)).classList.add('directorist-show');
- });
- $('body').on('click', '.directorist-modal-close-js', function (e) {
- e.preventDefault();
- $(this).closest('.directorist-modal-js').removeClass('directorist-show');
- });
- $(document).bind('click', function (e) {
- if (e.target == directoristModal) {
- directoristModal.classList.remove('directorist-show');
- }
- });
-}
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristAlert.js":
-/*!*************************************************************!*\
+ /***/ function () {
+ var $ = jQuery;
+ $(document).ready(function () {
+ modalToggle();
+ });
+ function modalToggle() {
+ $('.atbdp_recovery_pass').on('click', function (e) {
+ e.preventDefault();
+ $('#recover-pass-modal').slideToggle().show();
+ });
+
+ // Contact form [on modal closed]
+ $('#atbdp-contact-modal').on(
+ 'hidden.bs.modal',
+ function (e) {
+ $('#atbdp-contact-message').val('');
+ $('#atbdp-contact-message-display').html('');
+ }
+ );
+
+ // Template Restructured
+ // Modal
+ var directoristModal = document.querySelector(
+ '.directorist-modal-js'
+ );
+ $('body').on(
+ 'click',
+ '.directorist-btn-modal-js',
+ function (e) {
+ e.preventDefault();
+ var data_target = $(this).attr(
+ 'data-directorist_target'
+ );
+ document
+ .querySelector('.'.concat(data_target))
+ .classList.add('directorist-show');
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-modal-close-js',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .closest('.directorist-modal-js')
+ .removeClass('directorist-show');
+ }
+ );
+ $(document).bind('click', function (e) {
+ if (e.target == directoristModal) {
+ directoristModal.classList.remove(
+ 'directorist-show'
+ );
+ }
+ });
+ }
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristAlert.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/directoristAlert.js ***!
\*************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_alert_executed === 'undefined') {
- window.directorist_alert_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* Directorist alert dismiss */
- var getUrl = window.location.href;
- var newUrl = getUrl.replace('notice=1', '');
- if ($('.directorist-alert__close') !== null) {
- $('.directorist-alert__close').each(function (i, e) {
- $(e).on('click', function (e) {
- e.preventDefault();
- history.pushState({}, null, newUrl);
- $(this).closest('.directorist-alert').remove();
- });
- });
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristDropdown.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_alert_executed === 'undefined'
+ ) {
+ window.directorist_alert_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* Directorist alert dismiss */
+ var getUrl = window.location.href;
+ var newUrl = getUrl.replace('notice=1', '');
+ if ($('.directorist-alert__close') !== null) {
+ $('.directorist-alert__close').each(
+ function (i, e) {
+ $(e).on('click', function (e) {
+ e.preventDefault();
+ history.pushState({}, null, newUrl);
+ $(this)
+ .closest('.directorist-alert')
+ .remove();
+ });
+ }
+ );
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristDropdown.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristDropdown.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_dropdown_executed === 'undefined') {
- window.directorist_dropdown_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- /* custom dropdown */
- var atbdDropdown = document.querySelectorAll('.directorist-dropdown-select');
-
- // toggle dropdown
- var clickCount = 0;
- if (atbdDropdown !== null) {
- atbdDropdown.forEach(function (el) {
- el.querySelector('.directorist-dropdown-select-toggle').addEventListener('click', function (e) {
- e.preventDefault();
- clickCount++;
- if (clickCount % 2 === 1) {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- el.querySelector('.directorist-dropdown-select-items').classList.add('directorist-dropdown-select-show');
- } else {
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elem) {
- elem.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
- });
- }
-
- // remvoe toggle when click outside
- document.body.addEventListener('click', function (e) {
- if (e.target.getAttribute('data-drop-toggle') !== 'directorist-dropdown-select-toggle') {
- clickCount = 0;
- document.querySelectorAll('.directorist-dropdown-select-items').forEach(function (el) {
- el.classList.remove('directorist-dropdown-select-show');
- });
- }
- });
-
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.directorist-dropdown-select-toggle').textContent = e.target.textContent;
- el.querySelectorAll('.directorist-dropdown-select-items').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // Dropdown
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-toggle', function (e) {
- e.preventDefault();
- $(this).siblings('.directorist-dropdown-option').toggle();
- });
-
- // Select Option after click
- $('body').on('click', '.directorist-dropdown .directorist-dropdown-option ul li a', function (e) {
- e.preventDefault();
- var optionText = $(this).html();
- $(this).children('.directorist-dropdown-toggle__text').html(optionText);
- $(this).closest('.directorist-dropdown-option').siblings('.directorist-dropdown-toggle').children('.directorist-dropdown-toggle__text').html(optionText);
- $('.directorist-dropdown-option').hide();
- });
-
- // Hide Clicked Anywhere
- $(document).bind('click', function (e) {
- var clickedDOM = $(e.target);
- if (!clickedDOM.parents().hasClass('directorist-dropdown')) $('.directorist-dropdown-option').hide();
- });
-
- //atbd_dropdown
- $(document).on('click', '.atbd_dropdown', function (e) {
- if ($(this).attr('class') === 'atbd_dropdown') {
- e.preventDefault();
- $(this).siblings('.atbd_dropdown').removeClass('atbd_drop--active');
- $(this).toggleClass('atbd_drop--active');
- e.stopPropagation();
- }
- });
- $(document).on('click', function (e) {
- if ($(e.target).is('.atbd_dropdown, .atbd_drop--active') === false) {
- $('.atbd_dropdown').removeClass('atbd_drop--active');
- }
- });
- $('body').on('click', '.atbd_dropdown-toggle', function (e) {
- e.preventDefault();
- });
-
- // Directorist Dropdown
- $('body').on('click', '.directorist-dropdown-js .directorist-dropdown__toggle-js', function (e) {
- e.preventDefault();
- if (!$(this).siblings('.directorist-dropdown__links-js').is(':visible')) {
- $('.directorist-dropdown__links').hide();
- }
- $(this).siblings('.directorist-dropdown__links-js').toggle();
- });
- $('body').on('click', function (e) {
- if (!e.target.closest('.directorist-dropdown-js')) {
- $('.directorist-dropdown__links-js').hide();
- }
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristFavorite.js":
-/*!****************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_dropdown_executed ===
+ 'undefined'
+ ) {
+ window.directorist_dropdown_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ /* custom dropdown */
+ var atbdDropdown = document.querySelectorAll(
+ '.directorist-dropdown-select'
+ );
+
+ // toggle dropdown
+ var clickCount = 0;
+ if (atbdDropdown !== null) {
+ atbdDropdown.forEach(function (el) {
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).addEventListener('click', function (e) {
+ e.preventDefault();
+ clickCount++;
+ if (clickCount % 2 === 1) {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ el.querySelector(
+ '.directorist-dropdown-select-items'
+ ).classList.add(
+ 'directorist-dropdown-select-show'
+ );
+ } else {
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (elem) {
+ elem.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+ });
+ }
+
+ // remvoe toggle when click outside
+ document.body.addEventListener('click', function (e) {
+ if (
+ e.target.getAttribute('data-drop-toggle') !==
+ 'directorist-dropdown-select-toggle'
+ ) {
+ clickCount = 0;
+ document
+ .querySelectorAll(
+ '.directorist-dropdown-select-items'
+ )
+ .forEach(function (el) {
+ el.classList.remove(
+ 'directorist-dropdown-select-show'
+ );
+ });
+ }
+ });
+
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.directorist-dropdown-select-toggle'
+ ).textContent =
+ e.target.textContent;
+ el.querySelectorAll(
+ '.directorist-dropdown-select-items'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ });
+ });
+ }
+
+ // Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ $(this)
+ .siblings('.directorist-dropdown-option')
+ .toggle();
+ }
+ );
+
+ // Select Option after click
+ $('body').on(
+ 'click',
+ '.directorist-dropdown .directorist-dropdown-option ul li a',
+ function (e) {
+ e.preventDefault();
+ var optionText = $(this).html();
+ $(this)
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $(this)
+ .closest('.directorist-dropdown-option')
+ .siblings('.directorist-dropdown-toggle')
+ .children(
+ '.directorist-dropdown-toggle__text'
+ )
+ .html(optionText);
+ $('.directorist-dropdown-option').hide();
+ }
+ );
+
+ // Hide Clicked Anywhere
+ $(document).bind('click', function (e) {
+ var clickedDOM = $(e.target);
+ if (
+ !clickedDOM
+ .parents()
+ .hasClass('directorist-dropdown')
+ )
+ $('.directorist-dropdown-option').hide();
+ });
+
+ //atbd_dropdown
+ $(document).on('click', '.atbd_dropdown', function (e) {
+ if ($(this).attr('class') === 'atbd_dropdown') {
+ e.preventDefault();
+ $(this)
+ .siblings('.atbd_dropdown')
+ .removeClass('atbd_drop--active');
+ $(this).toggleClass('atbd_drop--active');
+ e.stopPropagation();
+ }
+ });
+ $(document).on('click', function (e) {
+ if (
+ $(e.target).is(
+ '.atbd_dropdown, .atbd_drop--active'
+ ) === false
+ ) {
+ $('.atbd_dropdown').removeClass(
+ 'atbd_drop--active'
+ );
+ }
+ });
+ $('body').on(
+ 'click',
+ '.atbd_dropdown-toggle',
+ function (e) {
+ e.preventDefault();
+ }
+ );
+
+ // Directorist Dropdown
+ $('body').on(
+ 'click',
+ '.directorist-dropdown-js .directorist-dropdown__toggle-js',
+ function (e) {
+ e.preventDefault();
+ if (
+ !$(this)
+ .siblings(
+ '.directorist-dropdown__links-js'
+ )
+ .is(':visible')
+ ) {
+ $('.directorist-dropdown__links').hide();
+ }
+ $(this)
+ .siblings('.directorist-dropdown__links-js')
+ .toggle();
+ }
+ );
+ $('body').on('click', function (e) {
+ if (!e.target.closest('.directorist-dropdown-js')) {
+ $('.directorist-dropdown__links-js').hide();
+ }
+ });
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristFavorite.js':
+ /*!****************************************************************!*\
!*** ./assets/src/js/public/components/directoristFavorite.js ***!
\****************************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_favorite_executed === 'undefined') {
- window.directorist_favorite_executed = true;
- } else {
- return;
- }
- window.addEventListener('load', function () {
- // Add or Remove from favourites
- $('.directorist-action-bookmark').on('click', function (e) {
- e.preventDefault();
- var data = {
- action: 'atbdp_public_add_remove_favorites',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id'),
- label: $(this).data('label')
- };
- $.post(directorist.ajaxurl, data, function (response) {
- if (response) {
- $('.directorist-action-bookmark').html(response);
- }
- });
- });
- $('.directorist-favourite-remove-btn').each(function () {
- $(this).on('click', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajaxurl, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist_favourite_' + post_id);
- if ('false' === response) {
- staElement.remove();
- }
- });
- });
- });
- $('body').on('click', '.directorist-mark-as-favorite__btn', function (event) {
- event.preventDefault();
- var data = {
- action: 'atbdp-favourites-all-listing',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $(this).data('listing_id')
- };
- var fav_tooltip_success = '
' + directorist.i18n_text.added_favourite + ' ';
- var fav_tooltip_warning = '
' + directorist.i18n_text.please_login + ' ';
- $('.directorist-favorite-tooltip').hide();
- $.post(directorist.ajax_url, data, function (response) {
- var post_id = data['post_id'].toString();
- var staElement = $('.directorist-fav_' + post_id);
- var data_id = staElement.attr('data-listing_id');
- if (response === 'login_required') {
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_warning);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- } else if ('false' === response) {
- staElement.removeClass('directorist-added-to-favorite');
- $('.directorist-favorite-tooltip span').remove();
- } else {
- if (data_id === post_id) {
- staElement.addClass('directorist-added-to-favorite');
- staElement.children('.directorist-favorite-tooltip').append(fav_tooltip_success);
- staElement.children('.directorist-favorite-tooltip').fadeIn();
- setTimeout(function () {
- staElement.children('.directorist-favorite-tooltip').children('span').remove();
- }, 3000);
- }
- }
- });
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/directoristSelect.js":
-/*!**************************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_favorite_executed ===
+ 'undefined'
+ ) {
+ window.directorist_favorite_executed = true;
+ } else {
+ return;
+ }
+ window.addEventListener('load', function () {
+ // Add or Remove from favourites
+ $('.directorist-action-bookmark').on(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ var data = {
+ action: 'atbdp_public_add_remove_favorites',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ label: $(this).data('label'),
+ };
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ if (response) {
+ $(
+ '.directorist-action-bookmark'
+ ).html(response);
+ }
+ }
+ );
+ }
+ );
+ $('.directorist-favourite-remove-btn').each(
+ function () {
+ $(this).on('click', function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist_favourite_' +
+ post_id
+ );
+ if ('false' === response) {
+ staElement.remove();
+ }
+ }
+ );
+ });
+ }
+ );
+ $('body').on(
+ 'click',
+ '.directorist-mark-as-favorite__btn',
+ function (event) {
+ event.preventDefault();
+ var data = {
+ action: 'atbdp-favourites-all-listing',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $(this).data('listing_id'),
+ };
+ var fav_tooltip_success =
+ '
' +
+ directorist.i18n_text.added_favourite +
+ ' ';
+ var fav_tooltip_warning =
+ '
' +
+ directorist.i18n_text.please_login +
+ ' ';
+ $('.directorist-favorite-tooltip').hide();
+ $.post(
+ directorist.ajax_url,
+ data,
+ function (response) {
+ var post_id =
+ data['post_id'].toString();
+ var staElement = $(
+ '.directorist-fav_' + post_id
+ );
+ var data_id =
+ staElement.attr('data-listing_id');
+ if (response === 'login_required') {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(fav_tooltip_warning);
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ } else if ('false' === response) {
+ staElement.removeClass(
+ 'directorist-added-to-favorite'
+ );
+ $(
+ '.directorist-favorite-tooltip span'
+ ).remove();
+ } else {
+ if (data_id === post_id) {
+ staElement.addClass(
+ 'directorist-added-to-favorite'
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .append(
+ fav_tooltip_success
+ );
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .fadeIn();
+ setTimeout(function () {
+ staElement
+ .children(
+ '.directorist-favorite-tooltip'
+ )
+ .children('span')
+ .remove();
+ }, 3000);
+ }
+ }
+ }
+ );
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/directoristSelect.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/directoristSelect.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_select_executed === 'undefined') {
- window.directorist_select_executed = true;
- } else {
- return;
- }
- //custom select
- var atbdSelect = document.querySelectorAll('.atbd-drop-select');
- if (atbdSelect !== null) {
- atbdSelect.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- item.addEventListener('click', function (e) {
- e.preventDefault();
- el.querySelector('.atbd-dropdown-toggle').textContent = item.textContent;
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (elm) {
- elm.classList.remove('atbd-active');
- });
- item.classList.add('atbd-active');
- });
- });
- });
- }
-
- // select data-status
- var atbdSelectData = document.querySelectorAll('.atbd-drop-select.with-sort');
- atbdSelectData.forEach(function (el) {
- el.querySelectorAll('.atbd-dropdown-item').forEach(function (item) {
- var atbd_dropdown = el.querySelector('.atbd-dropdown-toggle');
- var dropdown_item = item.getAttribute('data-status');
- item.addEventListener('click', function (e) {
- atbd_dropdown.setAttribute('data-status', "".concat(dropdown_item));
- });
- });
- });
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/formValidation.js":
-/*!***********************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_select_executed ===
+ 'undefined'
+ ) {
+ window.directorist_select_executed = true;
+ } else {
+ return;
+ }
+ //custom select
+ var atbdSelect =
+ document.querySelectorAll('.atbd-drop-select');
+ if (atbdSelect !== null) {
+ atbdSelect.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ item.addEventListener(
+ 'click',
+ function (e) {
+ e.preventDefault();
+ el.querySelector(
+ '.atbd-dropdown-toggle'
+ ).textContent = item.textContent;
+ el.querySelectorAll(
+ '.atbd-dropdown-item'
+ ).forEach(function (elm) {
+ elm.classList.remove(
+ 'atbd-active'
+ );
+ });
+ item.classList.add('atbd-active');
+ }
+ );
+ }
+ );
+ });
+ }
+
+ // select data-status
+ var atbdSelectData = document.querySelectorAll(
+ '.atbd-drop-select.with-sort'
+ );
+ atbdSelectData.forEach(function (el) {
+ el.querySelectorAll('.atbd-dropdown-item').forEach(
+ function (item) {
+ var atbd_dropdown = el.querySelector(
+ '.atbd-dropdown-toggle'
+ );
+ var dropdown_item =
+ item.getAttribute('data-status');
+ item.addEventListener('click', function (e) {
+ atbd_dropdown.setAttribute(
+ 'data-status',
+ ''.concat(dropdown_item)
+ );
+ });
+ }
+ );
+ });
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/formValidation.js':
+ /*!***********************************************************!*\
!*** ./assets/src/js/public/components/formValidation.js ***!
\***********************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- $('#directorist-report-abuse-form').on('submit', function (e) {
- $('.directorist-report-abuse-modal button[type=submit]').addClass('directorist-btn-loading');
- // Check for errors
- if (!e.isDefaultPrevented()) {
- e.preventDefault();
- // Post via AJAX
- var data = {
- action: 'atbdp_public_report_abuse',
- directorist_nonce: directorist.directorist_nonce,
- post_id: $('#atbdp-post-id').val(),
- message: $('#directorist-report-message').val()
- };
- $.post(directorist.ajaxurl, data, function (response) {
- if (1 == response.error) {
- $('#directorist-report-abuse-message-display').addClass('text-danger').html(response.message);
- } else {
- $('#directorist-report-message').val('');
- $('#directorist-report-abuse-message-display').addClass('text-success').html(response.message);
- }
- $('.directorist-report-abuse-modal button[type=submit]').removeClass('directorist-btn-loading');
- }, 'json');
- }
- });
- $('#atbdp-report-abuse-form').removeAttr('novalidate');
-
- // Validate contact form
- $('.directorist-contact-owner-form').on('submit', function (e) {
- e.preventDefault();
- var $form = $(this);
- var submit_button = $(this).find('button[type="submit"]');
- var status_area = $(this).find('.directorist-contact-message-display');
-
- // Show loading message
- var msg = '
' + directorist.waiting_msg + '
';
- status_area.html(msg);
-
- // Serialize form data
- var form_data = $form.serializeArray();
- var data = {
- action: 'atbdp_public_send_contact_email',
- directorist_nonce: directorist.directorist_nonce
- };
-
- // Convert serialized data array into an object
- $.each(form_data, function (index, elem) {
- data[elem.name] = elem.value;
- });
- $.post(directorist.ajaxurl, data, function (response) {
- submit_button.prop('disabled', false);
- if (1 == response.error) {
- atbdp_contact_submitted = false;
-
- // Show error message
- var msg = '
' + response.message + '
';
- status_area.html(msg);
- } else {
- $form.trigger('reset');
-
- // Show success message
- var msg = '
' + response.message + '
';
- status_area.html(msg);
- }
- setTimeout(function () {
- status_area.html('');
- }, 5000);
- }, 'json').always(function () {
- submit_button.prop('disabled', false);
- });
- });
- $('#atbdp-contact-form,#directorist-contact-owner-form').removeAttr('novalidate');
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/general.js":
-/*!****************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ $('#directorist-report-abuse-form').on(
+ 'submit',
+ function (e) {
+ $(
+ '.directorist-report-abuse-modal button[type=submit]'
+ ).addClass('directorist-btn-loading');
+ // Check for errors
+ if (!e.isDefaultPrevented()) {
+ e.preventDefault();
+ // Post via AJAX
+ var data = {
+ action: 'atbdp_public_report_abuse',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ post_id: $('#atbdp-post-id').val(),
+ message: $(
+ '#directorist-report-message'
+ ).val(),
+ };
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ if (1 == response.error) {
+ $(
+ '#directorist-report-abuse-message-display'
+ )
+ .addClass('text-danger')
+ .html(response.message);
+ } else {
+ $(
+ '#directorist-report-message'
+ ).val('');
+ $(
+ '#directorist-report-abuse-message-display'
+ )
+ .addClass('text-success')
+ .html(response.message);
+ }
+ $(
+ '.directorist-report-abuse-modal button[type=submit]'
+ ).removeClass(
+ 'directorist-btn-loading'
+ );
+ },
+ 'json'
+ );
+ }
+ }
+ );
+ $('#atbdp-report-abuse-form').removeAttr('novalidate');
+
+ // Validate contact form
+ $('.directorist-contact-owner-form').on(
+ 'submit',
+ function (e) {
+ e.preventDefault();
+ var $form = $(this);
+ var submit_button = $(this).find(
+ 'button[type="submit"]'
+ );
+ var status_area = $(this).find(
+ '.directorist-contact-message-display'
+ );
+
+ // Show loading message
+ var msg =
+ '
' +
+ directorist.waiting_msg +
+ '
';
+ status_area.html(msg);
+
+ // Serialize form data
+ var form_data = $form.serializeArray();
+ var data = {
+ action: 'atbdp_public_send_contact_email',
+ directorist_nonce:
+ directorist.directorist_nonce,
+ };
+
+ // Convert serialized data array into an object
+ $.each(form_data, function (index, elem) {
+ data[elem.name] = elem.value;
+ });
+ $.post(
+ directorist.ajaxurl,
+ data,
+ function (response) {
+ submit_button.prop('disabled', false);
+ if (1 == response.error) {
+ atbdp_contact_submitted = false;
+
+ // Show error message
+ var msg =
+ '
' +
+ response.message +
+ '
';
+ status_area.html(msg);
+ } else {
+ $form.trigger('reset');
+
+ // Show success message
+ var msg =
+ '
' +
+ response.message +
+ '
';
+ status_area.html(msg);
+ }
+ setTimeout(function () {
+ status_area.html('');
+ }, 5000);
+ },
+ 'json'
+ ).always(function () {
+ submit_button.prop('disabled', false);
+ });
+ }
+ );
+ $(
+ '#atbdp-contact-form,#directorist-contact-owner-form'
+ ).removeAttr('novalidate');
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/general.js':
+ /*!****************************************************!*\
!*** ./assets/src/js/public/components/general.js ***!
\****************************************************/
-/***/ (function() {
-
-// Fix listing with no thumb if card width is less than 220px
-(function ($) {
- window.addEventListener('load', function () {
- if ($('.directorist-listing-no-thumb').innerWidth() <= 220) {
- $('.directorist-listing-no-thumb').addClass('directorist-listing-no-thumb--fix');
- }
- // Auhtor Profile Listing responsive fix
- if ($('.directorist-author-listing-content').innerWidth() <= 750) {
- $('.directorist-author-listing-content').addClass('directorist-author-listing-grid--fix');
- }
- // Directorist Archive responsive fix
- if ($('.directorist-archive-grid-view').innerWidth() <= 500) {
- $('.directorist-archive-grid-view').addClass('directorist-archive-grid--fix');
- }
-
- // Back Button to go back to the previous page
- $('body').on('click', '.directorist-btn__back', function (e) {
- window.history.back();
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/listing-track.js":
-/*!**********************************************************!*\
+ /***/ function () {
+ // Fix listing with no thumb if card width is less than 220px
+ (function ($) {
+ window.addEventListener('load', function () {
+ if (
+ $('.directorist-listing-no-thumb').innerWidth() <=
+ 220
+ ) {
+ $('.directorist-listing-no-thumb').addClass(
+ 'directorist-listing-no-thumb--fix'
+ );
+ }
+ // Auhtor Profile Listing responsive fix
+ if (
+ $(
+ '.directorist-author-listing-content'
+ ).innerWidth() <= 750
+ ) {
+ $('.directorist-author-listing-content').addClass(
+ 'directorist-author-listing-grid--fix'
+ );
+ }
+ // Directorist Archive responsive fix
+ if (
+ $('.directorist-archive-grid-view').innerWidth() <=
+ 500
+ ) {
+ $('.directorist-archive-grid-view').addClass(
+ 'directorist-archive-grid--fix'
+ );
+ }
+
+ // Back Button to go back to the previous page
+ $('body').on(
+ 'click',
+ '.directorist-btn__back',
+ function (e) {
+ window.history.back();
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/listing-track.js':
+ /*!**********************************************************!*\
!*** ./assets/src/js/public/components/listing-track.js ***!
\**********************************************************/
-/***/ (function() {
-
-(function ($) {
- window.addEventListener('load', function () {
- if ($('.directorist-single-contents-area').length > 0) {
- var listing_id = directorist.current_page_id; // listing id
- var storage_key = 'directorist_listing_views'; // Key for session storage
-
- // Check if the user has already viewed this listing during the session.
- var viewed_listings = JSON.parse(sessionStorage.getItem(storage_key)) || {};
- if (!viewed_listings[listing_id]) {
- // Send an AJAX request to track the view for this specific listing.
- $.ajax({
- type: 'POST',
- url: directorist.ajaxurl,
- data: {
- action: 'directorist_track_listing_views',
- listing_id: listing_id,
- directorist_nonce: directorist.directorist_nonce
- },
- success: function success(response) {
- if (response.success) {
- // Mark this listing as viewed in the session storage.
- viewed_listings[listing_id] = true;
- // Update the session storage.
- sessionStorage.setItem(storage_key, JSON.stringify(viewed_listings));
- }
- }
- });
- }
- }
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/login.js":
-/*!**************************************************!*\
+ /***/ function () {
+ (function ($) {
+ window.addEventListener('load', function () {
+ if ($('.directorist-single-contents-area').length > 0) {
+ var listing_id = directorist.current_page_id; // listing id
+ var storage_key = 'directorist_listing_views'; // Key for session storage
+
+ // Check if the user has already viewed this listing during the session.
+ var viewed_listings =
+ JSON.parse(
+ sessionStorage.getItem(storage_key)
+ ) || {};
+ if (!viewed_listings[listing_id]) {
+ // Send an AJAX request to track the view for this specific listing.
+ $.ajax({
+ type: 'POST',
+ url: directorist.ajaxurl,
+ data: {
+ action: 'directorist_track_listing_views',
+ listing_id: listing_id,
+ directorist_nonce:
+ directorist.directorist_nonce,
+ },
+ success: function success(response) {
+ if (response.success) {
+ // Mark this listing as viewed in the session storage.
+ viewed_listings[listing_id] = true;
+ // Update the session storage.
+ sessionStorage.setItem(
+ storage_key,
+ JSON.stringify(viewed_listings)
+ );
+ }
+ },
+ });
+ }
+ }
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/login.js':
+ /*!**************************************************!*\
!*** ./assets/src/js/public/components/login.js ***!
\**************************************************/
-/***/ (function() {
-
-(function ($) {
- // Make sure the codes in this file runs only once, even if enqueued twice
- if (typeof window.directorist_loginjs_executed === 'undefined') {
- window.directorist_loginjs_executed = true;
- } else {
- return;
- }
- function initPasswordToggle() {
- var passwordGroups = document.querySelectorAll('.directorist-password-group');
- passwordGroups.forEach(function (group) {
- var passwordInput = group.querySelector('.directorist-password-group-input');
- var togglePassword = group.querySelector('.directorist-password-group-toggle');
- var eyeIcon = group.querySelector('.directorist-password-group-eyeIcon');
- if (passwordInput && togglePassword) {
- togglePassword.addEventListener('click', function () {
- var type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
- passwordInput.setAttribute('type', type);
-
- // Toggle eye icon (simple swap for open/closed)
- if (eyeIcon) {
- if (type === 'text') {
- eyeIcon.innerHTML = "\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t";
- } else {
- eyeIcon.innerHTML = "\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t";
- }
- }
- });
- }
- });
- }
-
- // Call the function after DOM is ready
- document.addEventListener('DOMContentLoaded', initPasswordToggle);
-
- // Trigger reset on form change
- $('.directorist-authentication__btn').on('click', function () {
- // Reset all forms with the specified class
- $('.directorist__authentication__signin').each(function () {
- this.reset(); // Reset the individual form
- });
-
- // Reset error and warning messages
- $('#directorist__authentication__login p.status').hide().empty();
- });
- window.addEventListener('load', function () {
- // Perform AJAX login on form submit
- $('form#directorist__authentication__login').on('submit', function (e) {
- e.preventDefault();
- var $this = $(this);
- var $button = $(this).find('.directorist-authentication__form__btn');
- $button.addClass('directorist-btn-loading'); // Added loading class
-
- $('#directorist__authentication__login p.status').show().html('' + directorist.loading_message + '
');
- var form_data = {
- action: 'ajaxlogin',
- username: $this.find('#username').val(),
- password: $this.find('#password').val(),
- rememberme: $this.find('#keep_signed_in').is(':checked') ? 1 : 0,
- security: $this.find('#security').val()
- };
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: directorist.ajax_url,
- data: form_data,
- success: function success(data) {
- // Removed loading class
- setTimeout(function () {
- return $button.removeClass('directorist-btn-loading');
- }, 1000);
- if ('nonce_faild' in data && data.nonce_faild) {
- $('p.status').html('' + data.message + '
');
- }
- if (data.loggedin == true) {
- $('p.status').html('' + data.message + '
');
- document.location.href = directorist.redirect_url;
- } else {
- $('p.status').html('' + data.message + '
');
- }
- },
- error: function error(data) {
- if ('nonce_faild' in data && data.nonce_faild) {
- $('p.status').html('' + data.message + '
');
- }
- $('p.status').show().html('' + directorist.login_error_message + '
');
- }
- });
- e.preventDefault();
- });
- $('form#directorist__authentication__login .status').on('click', 'a', function (e) {
- e.preventDefault();
- if ($(this).attr('href') === '#atbdp_recovery_pass') {
- $('#recover-pass-modal').slideDown().show();
- window.scrollTo({
- top: $('#recover-pass-modal').offset().top - 100,
- behavior: 'smooth'
- });
- } else {
- location.href = $(this).attr('href');
- }
- });
-
- // Alert users to login (only if applicable)
- $('.atbdp-require-login, .directorist-action-report-not-loggedin').on('click', function (e) {
- e.preventDefault();
- alert(directorist.login_alert_message);
- return false;
- });
-
- // Remove URL params to avoid show message again and again
- var current_url = location.href;
- var url = new URL(current_url);
- url.searchParams.delete('registration_status');
- url.searchParams.delete('errors');
- // url.searchParams.delete('key');
- url.searchParams.delete('password_reset');
- url.searchParams.delete('confirm_mail');
- // url.searchParams.delete('user');
- url.searchParams.delete('verification');
- url.searchParams.delete('send_verification_email');
- window.history.pushState(null, null, url.toString());
-
- // Authentication Form Toggle
- $('body').on('click', '.directorist-authentication__btn, .directorist-authentication__toggle', function (e) {
- e.preventDefault();
- $('.directorist-login-wrapper').toggleClass('active');
- $('.directorist-registration-wrapper').toggleClass('active');
- });
- });
-})(jQuery);
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review.js":
-/*!***************************************************!*\
+ /***/ function () {
+ (function ($) {
+ // Make sure the codes in this file runs only once, even if enqueued twice
+ if (
+ typeof window.directorist_loginjs_executed ===
+ 'undefined'
+ ) {
+ window.directorist_loginjs_executed = true;
+ } else {
+ return;
+ }
+ function initPasswordToggle() {
+ var passwordGroups = document.querySelectorAll(
+ '.directorist-password-group'
+ );
+ passwordGroups.forEach(function (group) {
+ var passwordInput = group.querySelector(
+ '.directorist-password-group-input'
+ );
+ var togglePassword = group.querySelector(
+ '.directorist-password-group-toggle'
+ );
+ var eyeIcon = group.querySelector(
+ '.directorist-password-group-eyeIcon'
+ );
+ if (passwordInput && togglePassword) {
+ togglePassword.addEventListener(
+ 'click',
+ function () {
+ var type =
+ passwordInput.getAttribute(
+ 'type'
+ ) === 'password'
+ ? 'text'
+ : 'password';
+ passwordInput.setAttribute(
+ 'type',
+ type
+ );
+
+ // Toggle eye icon (simple swap for open/closed)
+ if (eyeIcon) {
+ if (type === 'text') {
+ eyeIcon.innerHTML =
+ '\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t';
+ } else {
+ eyeIcon.innerHTML =
+ '\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t';
+ }
+ }
+ }
+ );
+ }
+ });
+ }
+
+ // Call the function after DOM is ready
+ document.addEventListener(
+ 'DOMContentLoaded',
+ initPasswordToggle
+ );
+
+ // Trigger reset on form change
+ $('.directorist-authentication__btn').on(
+ 'click',
+ function () {
+ // Reset all forms with the specified class
+ $('.directorist__authentication__signin').each(
+ function () {
+ this.reset(); // Reset the individual form
+ }
+ );
+
+ // Reset error and warning messages
+ $('#directorist__authentication__login p.status')
+ .hide()
+ .empty();
+ }
+ );
+ window.addEventListener('load', function () {
+ // Perform AJAX login on form submit
+ $('form#directorist__authentication__login').on(
+ 'submit',
+ function (e) {
+ e.preventDefault();
+ var $this = $(this);
+ var $button = $(this).find(
+ '.directorist-authentication__form__btn'
+ );
+ $button.addClass('directorist-btn-loading'); // Added loading class
+
+ $(
+ '#directorist__authentication__login p.status'
+ )
+ .show()
+ .html(
+ '' +
+ directorist.loading_message +
+ '
'
+ );
+ var form_data = {
+ action: 'ajaxlogin',
+ username: $this.find('#username').val(),
+ password: $this.find('#password').val(),
+ rememberme: $this
+ .find('#keep_signed_in')
+ .is(':checked')
+ ? 1
+ : 0,
+ security: $this.find('#security').val(),
+ };
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: directorist.ajax_url,
+ data: form_data,
+ success: function success(data) {
+ // Removed loading class
+ setTimeout(function () {
+ return $button.removeClass(
+ 'directorist-btn-loading'
+ );
+ }, 1000);
+ if (
+ 'nonce_faild' in data &&
+ data.nonce_faild
+ ) {
+ $('p.status').html(
+ '' +
+ data.message +
+ '
'
+ );
+ }
+ if (data.loggedin == true) {
+ $('p.status').html(
+ '' +
+ data.message +
+ '
'
+ );
+ document.location.href =
+ directorist.redirect_url;
+ } else {
+ $('p.status').html(
+ '' +
+ data.message +
+ '
'
+ );
+ }
+ },
+ error: function error(data) {
+ if (
+ 'nonce_faild' in data &&
+ data.nonce_faild
+ ) {
+ $('p.status').html(
+ '' +
+ data.message +
+ '
'
+ );
+ }
+ $('p.status')
+ .show()
+ .html(
+ '' +
+ directorist.login_error_message +
+ '
'
+ );
+ },
+ });
+ e.preventDefault();
+ }
+ );
+ $('form#directorist__authentication__login .status').on(
+ 'click',
+ 'a',
+ function (e) {
+ e.preventDefault();
+ if (
+ $(this).attr('href') ===
+ '#atbdp_recovery_pass'
+ ) {
+ $('#recover-pass-modal').slideDown().show();
+ window.scrollTo({
+ top:
+ $('#recover-pass-modal').offset()
+ .top - 100,
+ behavior: 'smooth',
+ });
+ } else {
+ location.href = $(this).attr('href');
+ }
+ }
+ );
+
+ // Alert users to login (only if applicable)
+ $(
+ '.atbdp-require-login, .directorist-action-report-not-loggedin'
+ ).on('click', function (e) {
+ e.preventDefault();
+ alert(directorist.login_alert_message);
+ return false;
+ });
+
+ // Remove URL params to avoid show message again and again
+ var current_url = location.href;
+ var url = new URL(current_url);
+ url.searchParams.delete('registration_status');
+ url.searchParams.delete('errors');
+ // url.searchParams.delete('key');
+ url.searchParams.delete('password_reset');
+ url.searchParams.delete('confirm_mail');
+ // url.searchParams.delete('user');
+ url.searchParams.delete('verification');
+ url.searchParams.delete('send_verification_email');
+ window.history.pushState(null, null, url.toString());
+
+ // Authentication Form Toggle
+ $('body').on(
+ 'click',
+ '.directorist-authentication__btn, .directorist-authentication__toggle',
+ function (e) {
+ e.preventDefault();
+ $('.directorist-login-wrapper').toggleClass(
+ 'active'
+ );
+ $(
+ '.directorist-registration-wrapper'
+ ).toggleClass('active');
+ }
+ );
+ });
+ })(jQuery);
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review.js':
+ /*!***************************************************!*\
!*** ./assets/src/js/public/components/review.js ***!
\***************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./review/starRating */ "./assets/src/js/public/components/review/starRating.js");
-/* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_review_starRating__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _review_advanced_review__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./review/advanced-review */ "./assets/src/js/public/components/review/advanced-review.js");
-// Helper Components
-
-// import './review/addReview'
-// import './review/reviewAttatchment'
-// import './review/deleteReview'
-// import './review/reviewPagination'
-
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review/advanced-review.js":
-/*!*******************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./review/starRating */ './assets/src/js/public/components/review/starRating.js'
+ );
+ /* harmony import */ var _review_starRating__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _review_starRating__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _review_advanced_review__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./review/advanced-review */ './assets/src/js/public/components/review/advanced-review.js'
+ );
+ // Helper Components
+
+ // import './review/addReview'
+ // import './review/reviewAttatchment'
+ // import './review/deleteReview'
+ // import './review/reviewPagination'
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review/advanced-review.js':
+ /*!*******************************************************************!*\
!*** ./assets/src/js/public/components/review/advanced-review.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
-/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
-
-
-function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
-function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
-function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
-window.addEventListener('load', function () {
- (function ($) {
- 'use strict';
-
- var ReplyFormObserver = /*#__PURE__*/function () {
- function ReplyFormObserver() {
- var _this = this;
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, ReplyFormObserver);
- this.init();
- $(document).on('directorist_review_updated', function () {
- return _this.init();
- });
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(ReplyFormObserver, [{
- key: "init",
- value: function init() {
- var node = document.querySelector('.commentlist');
- if (node) {
- this.observe(node);
- }
- }
- }, {
- key: "observe",
- value: function observe(node) {
- var config = {
- childList: true,
- subtree: true
- };
- var observer = new MutationObserver(this.callback);
- observer.observe(node, config);
- }
- }, {
- key: "callback",
- value: function callback(mutationsList, observer) {
- var _iterator = _createForOfIteratorHelper(mutationsList),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var mutation = _step.value;
- var target = mutation.target;
- if (mutation.removedNodes) {
- target.classList.remove('directorist-form-added');
- var _iterator2 = _createForOfIteratorHelper(mutation.removedNodes),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var node = _step2.value;
- if (!node.id || node.id !== 'respond') {
- continue;
- }
- var criteria = node.querySelector('.directorist-review-criteria');
- if (criteria) {
- criteria.style.display = '';
- }
- var ratings = node.querySelectorAll('.directorist-review-criteria-select');
- var _iterator3 = _createForOfIteratorHelper(ratings),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var rating = _step3.value;
- rating.removeAttribute('disabled');
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- node.querySelector('#submit').innerHTML = 'Submit Review';
- node.querySelector('#comment').setAttribute('placeholder', 'Leave a review');
- //console.log(node.querySelector('#comment'))
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- }
- var form = target.querySelector('#commentform');
- if (form) {
- target.classList.add('directorist-form-added');
- var isReview = target.classList.contains('review');
- var isEditing = target.classList.contains('directorist-form-editing');
- if (!isReview || isReview && !isEditing) {
- var _criteria = form.querySelector('.directorist-review-criteria');
- if (_criteria) {
- _criteria.style.display = 'none';
- }
- var _ratings = form.querySelectorAll('.directorist-review-criteria-select');
- var _iterator4 = _createForOfIteratorHelper(_ratings),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _rating = _step4.value;
- _rating.setAttribute('disabled', 'disabled');
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- }
- var alert = form.querySelector('.directorist-alert');
- if (alert) {
- alert.style.display = 'none';
- }
- form.querySelector('#submit').innerHTML = 'Submit Reply';
- form.querySelector('#comment').setAttribute('placeholder', 'Leave your reply');
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- }]);
- }();
- var CommentEditHandler = /*#__PURE__*/function () {
- function CommentEditHandler() {
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CommentEditHandler);
- this.init();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CommentEditHandler, [{
- key: "init",
- value: function init() {
- $(document).on('submit', '#directorist-form-comment-edit', this.onSubmit);
- }
- }, {
- key: "onSubmit",
- value: function onSubmit(event) {
- event.preventDefault();
- var $form = $(event.target);
- var originalButtonLabel = $form.find('[type="submit"]').val();
- $(document).trigger('directorist_review_before_submit', $form);
- var formData = new FormData($form[0]);
-
- // Apply the filter
- formData = wp.hooks.applyFilters('directorist_add_review_form_data', formData, 'directorist-advanced-review');
- var updateComment = $.ajax({
- url: $form.attr('action'),
- type: 'POST',
- contentType: false,
- cache: false,
- processData: false,
- data: formData
- });
- $form.find('#comment').prop('disabled', true);
- $form.find('[type="submit"]').prop('disabled', true).val('loading');
- var commentID = $form.find('input[name="comment_id"]').val();
- var $wrap = $('#div-comment-' + commentID);
- $wrap.addClass('directorist-comment-edit-request');
- updateComment.done(function (data, status, request) {
- if (typeof data !== 'string' && !data.success) {
- $wrap.removeClass('directorist-comment-edit-request');
- CommentEditHandler.showError($form, data.data.html);
- return;
- }
- var body = $('
');
- body.append(data);
- var comment_section = '.directorist-review-container';
- var comments = body.find(comment_section);
- $(comment_section).replaceWith(comments);
- $(document).trigger('directorist_review_updated', data);
- var commentTop = $('#comment-' + commentID).offset().top;
- if ($('body').hasClass('admin-bar')) {
- commentTop = commentTop - $('#wpadminbar').height();
- }
-
- // scroll to comment
- if (commentID) {
- $('body, html').animate({
- scrollTop: commentTop
- }, 600);
- }
- });
- updateComment.fail(function (data) {
- CommentEditHandler.showError($form, data.responseText);
- });
- updateComment.always(function () {
- $form.find('#comment').prop('disabled', false);
- $form.find('[type="submit"]').prop('disabled', false).val(originalButtonLabel);
- });
- $(document).trigger('directorist_review_after_submit', $form);
- }
- }], [{
- key: "showError",
- value: function showError($form, msg) {
- $form.find('.directorist-alert').remove();
- $form.prepend(msg);
- }
- }]);
- }();
- var CommentAddReplyHandler = /*#__PURE__*/function () {
- function CommentAddReplyHandler() {
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CommentAddReplyHandler);
- this.init();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CommentAddReplyHandler, [{
- key: "init",
- value: function init() {
- var t = setTimeout(function () {
- if ($('.directorist-review-container').length) {
- $(document).off('submit', '#commentform');
- }
- clearTimeout(t);
- }, 2000);
- $(document).off('submit', '.directorist-review-container #commentform');
- $(document).on('submit', '.directorist-review-container #commentform', this.onSubmit);
- }
- }, {
- key: "onSubmit",
- value: function onSubmit(event) {
- var _this2 = this;
- event.preventDefault();
- console.log(wp.hooks);
- var form = $('.directorist-review-container #commentform');
- var originalButtonLabel = form.find('[type="submit"]').val();
- $(document).trigger('directorist_review_before_submit', form);
- var formData = new FormData(form[0]);
-
- // Apply the filter
- formData = wp.hooks.applyFilters('directorist_add_review_form_data', formData, 'directorist-advanced-review');
- var do_comment = $.ajax({
- url: form.attr('action'),
- type: 'POST',
- contentType: false,
- cache: false,
- processData: false,
- data: formData
- });
- $('#comment').prop('disabled', true);
- form.find('[type="submit"]').prop('disabled', true).val('loading');
- do_comment.done(function (data, status, request) {
- var body = $('
');
- body.append(data);
- var comment_section = '.directorist-review-container';
- var comments = body.find(comment_section);
- var errorMsg = body.find('.wp-die-message');
- if (errorMsg.length > 0) {
- CommentAddReplyHandler.showError(form, errorMsg);
- $(document).trigger('directorist_review_update_failed');
- return;
- }
- $(comment_section).replaceWith(comments);
- $(document).trigger('directorist_review_updated', data);
- var newComment = comments.find('.commentlist li:first-child');
- var newCommentId = newComment.attr('id');
-
- // // catch the new comment id by comparing to old dom.
- // commentsLists.each(
- // function ( index ) {
- // var _this = $( commentsLists[ index ] );
- // if ( $( '#' + _this.attr( 'id' ) ).length == 0 ) {
- // newCommentId = _this.attr( 'id' );
- // }
- // }
- // );
-
- // console.log(newComment, newCommentId)
-
- var commentTop = $('#' + newCommentId).offset().top;
- if ($('body').hasClass('admin-bar')) {
- commentTop = commentTop - $('#wpadminbar').height();
- }
-
- // scroll to comment
- if (newCommentId) {
- $('body, html').animate({
- scrollTop: commentTop
- }, 600);
- }
- });
- do_comment.fail(function (data) {
- var body = $('
');
- body.append(data.responseText);
- console.log(data);
- CommentAddReplyHandler.showError(form, body.find('.wp-die-message'));
- $(document).trigger('directorist_review_update_failed');
- if (data.status === 403 || data.status === 401) {
- $(document).off('submit', '.directorist-review-container #commentform', _this2.onSubmit);
- $('#comment').prop('disabled', false);
- form.find('[type="submit"]').prop('disabled', false).click();
- }
- });
- do_comment.always(function () {
- $('#comment').prop('disabled', false);
- $('#commentform').find('[type="submit"]').prop('disabled', false).val(originalButtonLabel);
- });
- $(document).trigger('directorist_review_after_submit', form);
- }
- }], [{
- key: "getErrorMsg",
- value: function getErrorMsg($dom) {
- if ($dom.find('p').length) {
- $dom = $dom.find('p');
- }
- var words = $dom.text().split(':');
- if (words.length > 1) {
- words.shift();
- }
- return words.join(' ').trim();
- }
- }, {
- key: "showError",
- value: function showError(form, $dom) {
- if (form.find('.directorist-alert').length) {
- form.find('.directorist-alert').remove();
- }
- var $error = $('
', {
- class: 'directorist-alert directorist-alert-danger'
- }).html(CommentAddReplyHandler.getErrorMsg($dom));
- form.prepend($error);
- }
- }]);
- }();
- var CommentsManager = /*#__PURE__*/function () {
- function CommentsManager() {
- (0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CommentsManager);
- this.$doc = $(document);
- this.setupComponents();
- this.addEventListeners();
- }
- return (0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CommentsManager, [{
- key: "initStarRating",
- value: function initStarRating() {
- $('.directorist-review-criteria-select').barrating({
- theme: 'fontawesome-stars'
- });
- }
- }, {
- key: "cancelOthersEditMode",
- value: function cancelOthersEditMode(currentCommentId) {
- $('.directorist-comment-editing').each(function (index, comment) {
- var $cancelButton = $(comment).find('.directorist-js-cancel-comment-edit');
- if ($cancelButton.data('commentid') != currentCommentId) {
- $cancelButton.click();
- }
- });
- }
- }, {
- key: "cancelReplyMode",
- value: function cancelReplyMode() {
- var replyLink = document.querySelector('.directorist-review-content #cancel-comment-reply-link');
- replyLink && replyLink.click();
- }
- }, {
- key: "addEventListeners",
- value: function addEventListeners() {
- var _this3 = this;
- var self = this;
- this.$doc.on('directorist_review_updated', function (event) {
- _this3.initStarRating();
- });
- this.$doc.on('directorist_comment_edit_form_loaded', function (event) {
- _this3.initStarRating();
- });
- this.$doc.on('click', 'a[href="#respond"]', function (event) {
- // First cancle the reply form then scroll to review form. Order matters.
- _this3.cancelReplyMode();
- _this3.onWriteReivewClick(event);
- });
- this.$doc.on('click', '.directorist-js-edit-comment', function (event) {
- event.preventDefault();
- var $target = $(event.target);
- var $wrap = $target.parents('#div-comment-' + $target.data('commentid'));
- $wrap.addClass('directorist-comment-edit-request');
- $.ajax({
- url: $target.attr('href'),
- data: {
- post_id: $target.data('postid'),
- comment_id: $target.data('commentid')
- },
- setContent: false,
- method: 'GET',
- reload: 'strict',
- success: function success(response) {
- $target.prop('disabled', true);
- $target.parents('#div-comment-' + $target.data('commentid')).find('.directorist-review-single__info').append(response.data.html);
- $wrap.removeClass('directorist-comment-edit-request').addClass('directorist-comment-editing');
- self.cancelOthersEditMode($target.data('commentid'));
- self.cancelReplyMode();
- var $editForm = $('#directorist-form-comment-edit');
- $editForm.find('textarea').focus();
- self.$doc.trigger('directorist_comment_edit_form_loaded', $target.data('commentid'));
- }
- });
- });
- this.$doc.on('click', '.directorist-js-cancel-comment-edit', function (event) {
- event.preventDefault();
- var $target = $(event.target);
- var $wrap = $target.parents('#div-comment-' + $target.data('commentid'));
- $wrap.removeClass(['directorist-comment-edit-request', 'directorist-comment-editing']).find('form').remove();
- $wrap.find('.directorist-js-edit-comment').prop('disabled', false);
- });
- }
- }, {
- key: "onWriteReivewClick",
- value: function onWriteReivewClick(event) {
- event.preventDefault();
- var scrollTop = $('#respond').offset().top;
- if ($('body').hasClass('admin-bar')) {
- scrollTop = scrollTop - $('#wpadminbar').height();
- }
- $('body, html').animate({
- scrollTop: scrollTop
- }, 600);
- }
- }, {
- key: "setupComponents",
- value: function setupComponents() {
- new ReplyFormObserver();
- new CommentAddReplyHandler();
- new CommentEditHandler();
- }
- }]);
- }();
- var commentsManager = new CommentsManager();
- })(jQuery);
-});
-
-/***/ }),
-
-/***/ "./assets/src/js/public/components/review/starRating.js":
-/*!**************************************************************!*\
+ /***/ function (
+ __unused_webpack_module,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/classCallCheck */ './node_modules/@babel/runtime/helpers/esm/classCallCheck.js'
+ );
+ /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! @babel/runtime/helpers/createClass */ './node_modules/@babel/runtime/helpers/esm/createClass.js'
+ );
+
+ function _createForOfIteratorHelper(r, e) {
+ var t =
+ ('undefined' != typeof Symbol && r[Symbol.iterator]) ||
+ r['@@iterator'];
+ if (!t) {
+ if (
+ Array.isArray(r) ||
+ (t = _unsupportedIterableToArray(r)) ||
+ (e && r && 'number' == typeof r.length)
+ ) {
+ t && (r = t);
+ var _n = 0,
+ F = function F() {};
+ return {
+ s: F,
+ n: function n() {
+ return _n >= r.length
+ ? { done: !0 }
+ : { done: !1, value: r[_n++] };
+ },
+ e: function e(r) {
+ throw r;
+ },
+ f: F,
+ };
+ }
+ throw new TypeError(
+ 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
+ );
+ }
+ var o,
+ a = !0,
+ u = !1;
+ return {
+ s: function s() {
+ t = t.call(r);
+ },
+ n: function n() {
+ var r = t.next();
+ return ((a = r.done), r);
+ },
+ e: function e(r) {
+ ((u = !0), (o = r));
+ },
+ f: function f() {
+ try {
+ a || null == t.return || t.return();
+ } finally {
+ if (u) throw o;
+ }
+ },
+ };
+ }
+ function _unsupportedIterableToArray(r, a) {
+ if (r) {
+ if ('string' == typeof r)
+ return _arrayLikeToArray(r, a);
+ var t = {}.toString.call(r).slice(8, -1);
+ return (
+ 'Object' === t &&
+ r.constructor &&
+ (t = r.constructor.name),
+ 'Map' === t || 'Set' === t
+ ? Array.from(r)
+ : 'Arguments' === t ||
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(
+ t
+ )
+ ? _arrayLikeToArray(r, a)
+ : void 0
+ );
+ }
+ }
+ function _arrayLikeToArray(r, a) {
+ (null == a || a > r.length) && (a = r.length);
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
+ return n;
+ }
+ window.addEventListener('load', function () {
+ (function ($) {
+ 'use strict';
+
+ var ReplyFormObserver = /*#__PURE__*/ (function () {
+ function ReplyFormObserver() {
+ var _this = this;
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, ReplyFormObserver);
+ this.init();
+ $(document).on(
+ 'directorist_review_updated',
+ function () {
+ return _this.init();
+ }
+ );
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(ReplyFormObserver, [
+ {
+ key: 'init',
+ value: function init() {
+ var node =
+ document.querySelector(
+ '.commentlist'
+ );
+ if (node) {
+ this.observe(node);
+ }
+ },
+ },
+ {
+ key: 'observe',
+ value: function observe(node) {
+ var config = {
+ childList: true,
+ subtree: true,
+ };
+ var observer = new MutationObserver(
+ this.callback
+ );
+ observer.observe(node, config);
+ },
+ },
+ {
+ key: 'callback',
+ value: function callback(
+ mutationsList,
+ observer
+ ) {
+ var _iterator =
+ _createForOfIteratorHelper(
+ mutationsList
+ ),
+ _step;
+ try {
+ for (
+ _iterator.s();
+ !(_step = _iterator.n()).done;
+
+ ) {
+ var mutation = _step.value;
+ var target = mutation.target;
+ if (mutation.removedNodes) {
+ target.classList.remove(
+ 'directorist-form-added'
+ );
+ var _iterator2 =
+ _createForOfIteratorHelper(
+ mutation.removedNodes
+ ),
+ _step2;
+ try {
+ for (
+ _iterator2.s();
+ !(_step2 =
+ _iterator2.n())
+ .done;
+
+ ) {
+ var node =
+ _step2.value;
+ if (
+ !node.id ||
+ node.id !==
+ 'respond'
+ ) {
+ continue;
+ }
+ var criteria =
+ node.querySelector(
+ '.directorist-review-criteria'
+ );
+ if (criteria) {
+ criteria.style.display =
+ '';
+ }
+ var ratings =
+ node.querySelectorAll(
+ '.directorist-review-criteria-select'
+ );
+ var _iterator3 =
+ _createForOfIteratorHelper(
+ ratings
+ ),
+ _step3;
+ try {
+ for (
+ _iterator3.s();
+ !(_step3 =
+ _iterator3.n())
+ .done;
+
+ ) {
+ var rating =
+ _step3.value;
+ rating.removeAttribute(
+ 'disabled'
+ );
+ }
+ } catch (err) {
+ _iterator3.e(
+ err
+ );
+ } finally {
+ _iterator3.f();
+ }
+ node.querySelector(
+ '#submit'
+ ).innerHTML =
+ 'Submit Review';
+ node.querySelector(
+ '#comment'
+ ).setAttribute(
+ 'placeholder',
+ 'Leave a review'
+ );
+ //console.log(node.querySelector('#comment'))
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
+ }
+ var form =
+ target.querySelector(
+ '#commentform'
+ );
+ if (form) {
+ target.classList.add(
+ 'directorist-form-added'
+ );
+ var isReview =
+ target.classList.contains(
+ 'review'
+ );
+ var isEditing =
+ target.classList.contains(
+ 'directorist-form-editing'
+ );
+ if (
+ !isReview ||
+ (isReview && !isEditing)
+ ) {
+ var _criteria =
+ form.querySelector(
+ '.directorist-review-criteria'
+ );
+ if (_criteria) {
+ _criteria.style.display =
+ 'none';
+ }
+ var _ratings =
+ form.querySelectorAll(
+ '.directorist-review-criteria-select'
+ );
+ var _iterator4 =
+ _createForOfIteratorHelper(
+ _ratings
+ ),
+ _step4;
+ try {
+ for (
+ _iterator4.s();
+ !(_step4 =
+ _iterator4.n())
+ .done;
+
+ ) {
+ var _rating =
+ _step4.value;
+ _rating.setAttribute(
+ 'disabled',
+ 'disabled'
+ );
+ }
+ } catch (err) {
+ _iterator4.e(err);
+ } finally {
+ _iterator4.f();
+ }
+ }
+ var alert =
+ form.querySelector(
+ '.directorist-alert'
+ );
+ if (alert) {
+ alert.style.display =
+ 'none';
+ }
+ form.querySelector(
+ '#submit'
+ ).innerHTML =
+ 'Submit Reply';
+ form.querySelector(
+ '#comment'
+ ).setAttribute(
+ 'placeholder',
+ 'Leave your reply'
+ );
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ },
+ },
+ ]);
+ })();
+ var CommentEditHandler = /*#__PURE__*/ (function () {
+ function CommentEditHandler() {
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, CommentEditHandler);
+ this.init();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(
+ CommentEditHandler,
+ [
+ {
+ key: 'init',
+ value: function init() {
+ $(document).on(
+ 'submit',
+ '#directorist-form-comment-edit',
+ this.onSubmit
+ );
+ },
+ },
+ {
+ key: 'onSubmit',
+ value: function onSubmit(event) {
+ event.preventDefault();
+ var $form = $(event.target);
+ var originalButtonLabel = $form
+ .find('[type="submit"]')
+ .val();
+ $(document).trigger(
+ 'directorist_review_before_submit',
+ $form
+ );
+ var formData = new FormData(
+ $form[0]
+ );
+
+ // Apply the filter
+ formData = wp.hooks.applyFilters(
+ 'directorist_add_review_form_data',
+ formData,
+ 'directorist-advanced-review'
+ );
+ var updateComment = $.ajax({
+ url: $form.attr('action'),
+ type: 'POST',
+ contentType: false,
+ cache: false,
+ processData: false,
+ data: formData,
+ });
+ $form
+ .find('#comment')
+ .prop('disabled', true);
+ $form
+ .find('[type="submit"]')
+ .prop('disabled', true)
+ .val('loading');
+ var commentID = $form
+ .find(
+ 'input[name="comment_id"]'
+ )
+ .val();
+ var $wrap = $(
+ '#div-comment-' + commentID
+ );
+ $wrap.addClass(
+ 'directorist-comment-edit-request'
+ );
+ updateComment.done(
+ function (
+ data,
+ status,
+ request
+ ) {
+ if (
+ typeof data !==
+ 'string' &&
+ !data.success
+ ) {
+ $wrap.removeClass(
+ 'directorist-comment-edit-request'
+ );
+ CommentEditHandler.showError(
+ $form,
+ data.data.html
+ );
+ return;
+ }
+ var body = $('
');
+ body.append(data);
+ var comment_section =
+ '.directorist-review-container';
+ var comments =
+ body.find(
+ comment_section
+ );
+ $(
+ comment_section
+ ).replaceWith(comments);
+ $(document).trigger(
+ 'directorist_review_updated',
+ data
+ );
+ var commentTop = $(
+ '#comment-' + commentID
+ ).offset().top;
+ if (
+ $('body').hasClass(
+ 'admin-bar'
+ )
+ ) {
+ commentTop =
+ commentTop -
+ $(
+ '#wpadminbar'
+ ).height();
+ }
+
+ // scroll to comment
+ if (commentID) {
+ $('body, html').animate(
+ {
+ scrollTop:
+ commentTop,
+ },
+ 600
+ );
+ }
+ }
+ );
+ updateComment.fail(function (data) {
+ CommentEditHandler.showError(
+ $form,
+ data.responseText
+ );
+ });
+ updateComment.always(function () {
+ $form
+ .find('#comment')
+ .prop('disabled', false);
+ $form
+ .find('[type="submit"]')
+ .prop('disabled', false)
+ .val(originalButtonLabel);
+ });
+ $(document).trigger(
+ 'directorist_review_after_submit',
+ $form
+ );
+ },
+ },
+ ],
+ [
+ {
+ key: 'showError',
+ value: function showError($form, msg) {
+ $form
+ .find('.directorist-alert')
+ .remove();
+ $form.prepend(msg);
+ },
+ },
+ ]
+ );
+ })();
+ var CommentAddReplyHandler =
+ /*#__PURE__*/ (function () {
+ function CommentAddReplyHandler() {
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, CommentAddReplyHandler);
+ this.init();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(
+ CommentAddReplyHandler,
+ [
+ {
+ key: 'init',
+ value: function init() {
+ var t = setTimeout(function () {
+ if (
+ $(
+ '.directorist-review-container'
+ ).length
+ ) {
+ $(document).off(
+ 'submit',
+ '#commentform'
+ );
+ }
+ clearTimeout(t);
+ }, 2000);
+ $(document).off(
+ 'submit',
+ '.directorist-review-container #commentform'
+ );
+ $(document).on(
+ 'submit',
+ '.directorist-review-container #commentform',
+ this.onSubmit
+ );
+ },
+ },
+ {
+ key: 'onSubmit',
+ value: function onSubmit(event) {
+ var _this2 = this;
+ event.preventDefault();
+ console.log(wp.hooks);
+ var form = $(
+ '.directorist-review-container #commentform'
+ );
+ var originalButtonLabel = form
+ .find('[type="submit"]')
+ .val();
+ $(document).trigger(
+ 'directorist_review_before_submit',
+ form
+ );
+ var formData = new FormData(
+ form[0]
+ );
+
+ // Apply the filter
+ formData =
+ wp.hooks.applyFilters(
+ 'directorist_add_review_form_data',
+ formData,
+ 'directorist-advanced-review'
+ );
+ var do_comment = $.ajax({
+ url: form.attr('action'),
+ type: 'POST',
+ contentType: false,
+ cache: false,
+ processData: false,
+ data: formData,
+ });
+ $('#comment').prop(
+ 'disabled',
+ true
+ );
+ form.find('[type="submit"]')
+ .prop('disabled', true)
+ .val('loading');
+ do_comment.done(
+ function (
+ data,
+ status,
+ request
+ ) {
+ var body =
+ $('
');
+ body.append(data);
+ var comment_section =
+ '.directorist-review-container';
+ var comments =
+ body.find(
+ comment_section
+ );
+ var errorMsg =
+ body.find(
+ '.wp-die-message'
+ );
+ if (
+ errorMsg.length > 0
+ ) {
+ CommentAddReplyHandler.showError(
+ form,
+ errorMsg
+ );
+ $(document).trigger(
+ 'directorist_review_update_failed'
+ );
+ return;
+ }
+ $(
+ comment_section
+ ).replaceWith(comments);
+ $(document).trigger(
+ 'directorist_review_updated',
+ data
+ );
+ var newComment =
+ comments.find(
+ '.commentlist li:first-child'
+ );
+ var newCommentId =
+ newComment.attr(
+ 'id'
+ );
+
+ // // catch the new comment id by comparing to old dom.
+ // commentsLists.each(
+ // function ( index ) {
+ // var _this = $( commentsLists[ index ] );
+ // if ( $( '#' + _this.attr( 'id' ) ).length == 0 ) {
+ // newCommentId = _this.attr( 'id' );
+ // }
+ // }
+ // );
+
+ // console.log(newComment, newCommentId)
+
+ var commentTop = $(
+ '#' + newCommentId
+ ).offset().top;
+ if (
+ $('body').hasClass(
+ 'admin-bar'
+ )
+ ) {
+ commentTop =
+ commentTop -
+ $(
+ '#wpadminbar'
+ ).height();
+ }
+
+ // scroll to comment
+ if (newCommentId) {
+ $(
+ 'body, html'
+ ).animate(
+ {
+ scrollTop:
+ commentTop,
+ },
+ 600
+ );
+ }
+ }
+ );
+ do_comment.fail(
+ function (data) {
+ var body =
+ $('
');
+ body.append(
+ data.responseText
+ );
+ console.log(data);
+ CommentAddReplyHandler.showError(
+ form,
+ body.find(
+ '.wp-die-message'
+ )
+ );
+ $(document).trigger(
+ 'directorist_review_update_failed'
+ );
+ if (
+ data.status ===
+ 403 ||
+ data.status === 401
+ ) {
+ $(document).off(
+ 'submit',
+ '.directorist-review-container #commentform',
+ _this2.onSubmit
+ );
+ $('#comment').prop(
+ 'disabled',
+ false
+ );
+ form.find(
+ '[type="submit"]'
+ )
+ .prop(
+ 'disabled',
+ false
+ )
+ .click();
+ }
+ }
+ );
+ do_comment.always(function () {
+ $('#comment').prop(
+ 'disabled',
+ false
+ );
+ $('#commentform')
+ .find('[type="submit"]')
+ .prop('disabled', false)
+ .val(
+ originalButtonLabel
+ );
+ });
+ $(document).trigger(
+ 'directorist_review_after_submit',
+ form
+ );
+ },
+ },
+ ],
+ [
+ {
+ key: 'getErrorMsg',
+ value: function getErrorMsg($dom) {
+ if ($dom.find('p').length) {
+ $dom = $dom.find('p');
+ }
+ var words = $dom
+ .text()
+ .split(':');
+ if (words.length > 1) {
+ words.shift();
+ }
+ return words.join(' ').trim();
+ },
+ },
+ {
+ key: 'showError',
+ value: function showError(
+ form,
+ $dom
+ ) {
+ if (
+ form.find(
+ '.directorist-alert'
+ ).length
+ ) {
+ form.find(
+ '.directorist-alert'
+ ).remove();
+ }
+ var $error = $('
', {
+ class: 'directorist-alert directorist-alert-danger',
+ }).html(
+ CommentAddReplyHandler.getErrorMsg(
+ $dom
+ )
+ );
+ form.prepend($error);
+ },
+ },
+ ]
+ );
+ })();
+ var CommentsManager = /*#__PURE__*/ (function () {
+ function CommentsManager() {
+ (0,
+ _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(this, CommentsManager);
+ this.$doc = $(document);
+ this.setupComponents();
+ this.addEventListeners();
+ }
+ return (0,
+ _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__[
+ 'default'
+ ])(CommentsManager, [
+ {
+ key: 'initStarRating',
+ value: function initStarRating() {
+ $(
+ '.directorist-review-criteria-select'
+ ).barrating({
+ theme: 'fontawesome-stars',
+ });
+ },
+ },
+ {
+ key: 'cancelOthersEditMode',
+ value: function cancelOthersEditMode(
+ currentCommentId
+ ) {
+ $('.directorist-comment-editing').each(
+ function (index, comment) {
+ var $cancelButton = $(
+ comment
+ ).find(
+ '.directorist-js-cancel-comment-edit'
+ );
+ if (
+ $cancelButton.data(
+ 'commentid'
+ ) != currentCommentId
+ ) {
+ $cancelButton.click();
+ }
+ }
+ );
+ },
+ },
+ {
+ key: 'cancelReplyMode',
+ value: function cancelReplyMode() {
+ var replyLink = document.querySelector(
+ '.directorist-review-content #cancel-comment-reply-link'
+ );
+ replyLink && replyLink.click();
+ },
+ },
+ {
+ key: 'addEventListeners',
+ value: function addEventListeners() {
+ var _this3 = this;
+ var self = this;
+ this.$doc.on(
+ 'directorist_review_updated',
+ function (event) {
+ _this3.initStarRating();
+ }
+ );
+ this.$doc.on(
+ 'directorist_comment_edit_form_loaded',
+ function (event) {
+ _this3.initStarRating();
+ }
+ );
+ this.$doc.on(
+ 'click',
+ 'a[href="#respond"]',
+ function (event) {
+ // First cancle the reply form then scroll to review form. Order matters.
+ _this3.cancelReplyMode();
+ _this3.onWriteReivewClick(
+ event
+ );
+ }
+ );
+ this.$doc.on(
+ 'click',
+ '.directorist-js-edit-comment',
+ function (event) {
+ event.preventDefault();
+ var $target = $(event.target);
+ var $wrap = $target.parents(
+ '#div-comment-' +
+ $target.data(
+ 'commentid'
+ )
+ );
+ $wrap.addClass(
+ 'directorist-comment-edit-request'
+ );
+ $.ajax({
+ url: $target.attr('href'),
+ data: {
+ post_id:
+ $target.data(
+ 'postid'
+ ),
+ comment_id:
+ $target.data(
+ 'commentid'
+ ),
+ },
+ setContent: false,
+ method: 'GET',
+ reload: 'strict',
+ success: function success(
+ response
+ ) {
+ $target.prop(
+ 'disabled',
+ true
+ );
+ $target
+ .parents(
+ '#div-comment-' +
+ $target.data(
+ 'commentid'
+ )
+ )
+ .find(
+ '.directorist-review-single__info'
+ )
+ .append(
+ response.data
+ .html
+ );
+ $wrap
+ .removeClass(
+ 'directorist-comment-edit-request'
+ )
+ .addClass(
+ 'directorist-comment-editing'
+ );
+ self.cancelOthersEditMode(
+ $target.data(
+ 'commentid'
+ )
+ );
+ self.cancelReplyMode();
+ var $editForm = $(
+ '#directorist-form-comment-edit'
+ );
+ $editForm
+ .find('textarea')
+ .focus();
+ self.$doc.trigger(
+ 'directorist_comment_edit_form_loaded',
+ $target.data(
+ 'commentid'
+ )
+ );
+ },
+ });
+ }
+ );
+ this.$doc.on(
+ 'click',
+ '.directorist-js-cancel-comment-edit',
+ function (event) {
+ event.preventDefault();
+ var $target = $(event.target);
+ var $wrap = $target.parents(
+ '#div-comment-' +
+ $target.data(
+ 'commentid'
+ )
+ );
+ $wrap
+ .removeClass([
+ 'directorist-comment-edit-request',
+ 'directorist-comment-editing',
+ ])
+ .find('form')
+ .remove();
+ $wrap
+ .find(
+ '.directorist-js-edit-comment'
+ )
+ .prop('disabled', false);
+ }
+ );
+ },
+ },
+ {
+ key: 'onWriteReivewClick',
+ value: function onWriteReivewClick(event) {
+ event.preventDefault();
+ var scrollTop =
+ $('#respond').offset().top;
+ if ($('body').hasClass('admin-bar')) {
+ scrollTop =
+ scrollTop -
+ $('#wpadminbar').height();
+ }
+ $('body, html').animate(
+ {
+ scrollTop: scrollTop,
+ },
+ 600
+ );
+ },
+ },
+ {
+ key: 'setupComponents',
+ value: function setupComponents() {
+ new ReplyFormObserver();
+ new CommentAddReplyHandler();
+ new CommentEditHandler();
+ },
+ },
+ ]);
+ })();
+ var commentsManager = new CommentsManager();
+ })(jQuery);
+ });
+
+ /***/
+ },
+
+ /***/ './assets/src/js/public/components/review/starRating.js':
+ /*!**************************************************************!*\
!*** ./assets/src/js/public/components/review/starRating.js ***!
\**************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- (function ($) {
- //Star rating
- if ($('.directorist-review-criteria-select').length) {
- $('.directorist-review-criteria-select').barrating({
- theme: 'fontawesome-stars'
- });
- }
- })(jQuery);
-});
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
-/*!*******************************************************************!*\
+ /***/ function () {
+ window.addEventListener('load', function () {
+ (function ($) {
+ //Star rating
+ if ($('.directorist-review-criteria-select').length) {
+ $('.directorist-review-criteria-select').barrating({
+ theme: 'fontawesome-stars',
+ });
+ }
+ })(jQuery);
+ });
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/classCallCheck.js':
+ /*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
\*******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _classCallCheck; }
-/* harmony export */ });
-function _classCallCheck(a, n) {
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _classCallCheck;
+ },
+ /* harmony export */
+ }
+ );
+ function _classCallCheck(a, n) {
+ if (!(a instanceof n))
+ throw new TypeError(
+ 'Cannot call a class as a function'
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/createClass.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _createClass; }
-/* harmony export */ });
-/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
-
-function _defineProperties(e, r) {
- for (var t = 0; t < r.length; t++) {
- var o = r[t];
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o.key), o);
- }
-}
-function _createClass(e, r, t) {
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
- writable: !1
- }), e;
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":
-/*!****************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _createClass;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./toPropertyKey.js */ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js'
+ );
+
+ function _defineProperties(e, r) {
+ for (var t = 0; t < r.length; t++) {
+ var o = r[t];
+ ((o.enumerable = o.enumerable || !1),
+ (o.configurable = !0),
+ 'value' in o && (o.writable = !0),
+ Object.defineProperty(
+ e,
+ (0,
+ _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__[
+ 'default'
+ ])(o.key),
+ o
+ ));
+ }
+ }
+ function _createClass(e, r, t) {
+ return (
+ r && _defineProperties(e.prototype, r),
+ t && _defineProperties(e, t),
+ Object.defineProperty(e, 'prototype', {
+ writable: !1,
+ }),
+ e
+ );
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js':
+ /*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***!
\****************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPrimitive; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-
-function toPrimitive(t, r) {
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
-/*!******************************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPrimitive;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+
+ function toPrimitive(t, r) {
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ t
+ ) ||
+ !t
+ )
+ return t;
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || 'default');
+ if (
+ 'object' !=
+ (0,
+ _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ )
+ return i;
+ throw new TypeError(
+ '@@toPrimitive must return a primitive value.'
+ );
+ }
+ return ('string' === r ? String : Number)(t);
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/toPropertyKey.js':
+ /*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***!
\******************************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ toPropertyKey; }
-/* harmony export */ });
-/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
-/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");
-
-
-function toPropertyKey(t) {
- var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string");
- return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + "";
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
-/*!***********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ toPropertyKey;
+ },
+ /* harmony export */
+ }
+ );
+ /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ./typeof.js */ './node_modules/@babel/runtime/helpers/esm/typeof.js'
+ );
+ /* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ./toPrimitive.js */ './node_modules/@babel/runtime/helpers/esm/toPrimitive.js'
+ );
+
+ function toPropertyKey(t) {
+ var i = (0,
+ _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__['default'])(
+ t,
+ 'string'
+ );
+ return 'symbol' ==
+ (0, _typeof_js__WEBPACK_IMPORTED_MODULE_0__['default'])(
+ i
+ )
+ ? i
+ : i + '';
+ }
+
+ /***/
+ },
+
+ /***/ './node_modules/@babel/runtime/helpers/esm/typeof.js':
+ /*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
-/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": function() { return /* binding */ _typeof; }
-/* harmony export */ });
-function _typeof(o) {
- "@babel/helpers - typeof";
-
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, _typeof(o);
-}
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!********************************************************!*\
+ /***/ function (
+ __unused_webpack___webpack_module__,
+ __webpack_exports__,
+ __webpack_require__
+ ) {
+ 'use strict';
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony export */ __webpack_require__.d(
+ __webpack_exports__,
+ {
+ /* harmony export */ default: function () {
+ return /* binding */ _typeof;
+ },
+ /* harmony export */
+ }
+ );
+ function _typeof(o) {
+ '@babel/helpers - typeof';
+
+ return (
+ (_typeof =
+ 'function' == typeof Symbol &&
+ 'symbol' == typeof Symbol.iterator
+ ? function (o) {
+ return typeof o;
+ }
+ : function (o) {
+ return o &&
+ 'function' == typeof Symbol &&
+ o.constructor === Symbol &&
+ o !== Symbol.prototype
+ ? 'symbol'
+ : typeof o;
+ }),
+ _typeof(o)
+ );
+ }
+
+ /***/
+ },
+
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!********************************************************!*\
!*** ./assets/src/js/public/modules/single-listing.js ***!
\********************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/general */ "./assets/src/js/public/components/general.js");
-/* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_general__WEBPACK_IMPORTED_MODULE_0__);
-/* harmony import */ var _components_review__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/review */ "./assets/src/js/public/components/review.js");
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/directoristAlert */ "./assets/src/js/public/components/directoristAlert.js");
-/* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_components_directoristAlert__WEBPACK_IMPORTED_MODULE_2__);
-/* harmony import */ var _components_formValidation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/formValidation */ "./assets/src/js/public/components/formValidation.js");
-/* harmony import */ var _components_formValidation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_components_formValidation__WEBPACK_IMPORTED_MODULE_3__);
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/directoristFavorite */ "./assets/src/js/public/components/directoristFavorite.js");
-/* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__);
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/directoristDropdown */ "./assets/src/js/public/components/directoristDropdown.js");
-/* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__);
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/directoristSelect */ "./assets/src/js/public/components/directoristSelect.js");
-/* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_directoristSelect__WEBPACK_IMPORTED_MODULE_6__);
-/* harmony import */ var _components_login__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/login */ "./assets/src/js/public/components/login.js");
-/* harmony import */ var _components_login__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_components_login__WEBPACK_IMPORTED_MODULE_7__);
-/* harmony import */ var _components_listing_track__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components/listing-track */ "./assets/src/js/public/components/listing-track.js");
-/* harmony import */ var _components_listing_track__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_components_listing_track__WEBPACK_IMPORTED_MODULE_8__);
-/* harmony import */ var _global_components_modal__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../global/components/modal */ "./assets/src/js/global/components/modal.js");
-/* harmony import */ var _global_components_modal__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_global_components_modal__WEBPACK_IMPORTED_MODULE_9__);
-// General Components
-
-
-
-
-
-
-
-
-
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=single-listing.js.map
\ No newline at end of file
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../components/general */ './assets/src/js/public/components/general.js'
+ );
+ /* harmony import */ var _components_general__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_general__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* harmony import */ var _components_review__WEBPACK_IMPORTED_MODULE_1__ =
+ __webpack_require__(
+ /*! ../components/review */ './assets/src/js/public/components/review.js'
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_2__ =
+ __webpack_require__(
+ /*! ../components/directoristAlert */ './assets/src/js/public/components/directoristAlert.js'
+ );
+ /* harmony import */ var _components_directoristAlert__WEBPACK_IMPORTED_MODULE_2___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristAlert__WEBPACK_IMPORTED_MODULE_2__
+ );
+ /* harmony import */ var _components_formValidation__WEBPACK_IMPORTED_MODULE_3__ =
+ __webpack_require__(
+ /*! ../components/formValidation */ './assets/src/js/public/components/formValidation.js'
+ );
+ /* harmony import */ var _components_formValidation__WEBPACK_IMPORTED_MODULE_3___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_formValidation__WEBPACK_IMPORTED_MODULE_3__
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__ =
+ __webpack_require__(
+ /*! ../components/directoristFavorite */ './assets/src/js/public/components/directoristFavorite.js'
+ );
+ /* harmony import */ var _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristFavorite__WEBPACK_IMPORTED_MODULE_4__
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__ =
+ __webpack_require__(
+ /*! ../components/directoristDropdown */ './assets/src/js/public/components/directoristDropdown.js'
+ );
+ /* harmony import */ var _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristDropdown__WEBPACK_IMPORTED_MODULE_5__
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_6__ =
+ __webpack_require__(
+ /*! ../components/directoristSelect */ './assets/src/js/public/components/directoristSelect.js'
+ );
+ /* harmony import */ var _components_directoristSelect__WEBPACK_IMPORTED_MODULE_6___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_directoristSelect__WEBPACK_IMPORTED_MODULE_6__
+ );
+ /* harmony import */ var _components_login__WEBPACK_IMPORTED_MODULE_7__ =
+ __webpack_require__(
+ /*! ../components/login */ './assets/src/js/public/components/login.js'
+ );
+ /* harmony import */ var _components_login__WEBPACK_IMPORTED_MODULE_7___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_login__WEBPACK_IMPORTED_MODULE_7__
+ );
+ /* harmony import */ var _components_listing_track__WEBPACK_IMPORTED_MODULE_8__ =
+ __webpack_require__(
+ /*! ../components/listing-track */ './assets/src/js/public/components/listing-track.js'
+ );
+ /* harmony import */ var _components_listing_track__WEBPACK_IMPORTED_MODULE_8___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_listing_track__WEBPACK_IMPORTED_MODULE_8__
+ );
+ /* harmony import */ var _global_components_modal__WEBPACK_IMPORTED_MODULE_9__ =
+ __webpack_require__(
+ /*! ../../global/components/modal */ './assets/src/js/global/components/modal.js'
+ );
+ /* harmony import */ var _global_components_modal__WEBPACK_IMPORTED_MODULE_9___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _global_components_modal__WEBPACK_IMPORTED_MODULE_9__
+ );
+ // General Components
+ })();
+ /******/
+})();
+//# sourceMappingURL=single-listing.js.map
diff --git a/assets/js/widgets.js b/assets/js/widgets.js
index 9a861ee0b..3f47d5c42 100644
--- a/assets/js/widgets.js
+++ b/assets/js/widgets.js
@@ -1,198 +1,313 @@
-/******/ (function() { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ "./assets/src/js/public/components/categoryLocation.js":
-/*!*************************************************************!*\
+/******/ (function () {
+ // webpackBootstrap
+ /******/ var __webpack_modules__ = {
+ /***/ './assets/src/js/public/components/categoryLocation.js':
+ /*!*************************************************************!*\
!*** ./assets/src/js/public/components/categoryLocation.js ***!
\*************************************************************/
-/***/ (function() {
-
-window.addEventListener('load', function () {
- var $ = jQuery;
+ /***/ function () {
+ window.addEventListener('load', function () {
+ var $ = jQuery;
- /* Make sure the codes in this file runs only once, even if enqueued twice */
- if (typeof window.directorist_catloc_executed === 'undefined') {
- window.directorist_catloc_executed = true;
- } else {
- return;
- }
+ /* Make sure the codes in this file runs only once, even if enqueued twice */
+ if (
+ typeof window.directorist_catloc_executed ===
+ 'undefined'
+ ) {
+ window.directorist_catloc_executed = true;
+ } else {
+ return;
+ }
- /* Category card grid three width/height adjustment */
- var categoryCard = document.querySelectorAll('.directorist-categories__single--style-three');
- if (categoryCard) {
- categoryCard.forEach(function (elm) {
- var categoryCardWidth = elm.offsetWidth;
- elm.style.setProperty('--directorist-category-box-width', "".concat(categoryCardWidth, "px"));
- });
- }
+ /* Category card grid three width/height adjustment */
+ var categoryCard = document.querySelectorAll(
+ '.directorist-categories__single--style-three'
+ );
+ if (categoryCard) {
+ categoryCard.forEach(function (elm) {
+ var categoryCardWidth = elm.offsetWidth;
+ elm.style.setProperty(
+ '--directorist-category-box-width',
+ ''.concat(categoryCardWidth, 'px')
+ );
+ });
+ }
- /* Taxonomy list dropdown */
- function categoryDropdown(selector, parent) {
- var categoryListToggle = document.querySelectorAll(selector);
- categoryListToggle.forEach(function (item) {
- item.addEventListener('click', function (e) {
- var categoryName = item.querySelector('.directorist-taxonomy-list__name');
- if (e.target !== categoryName) {
- e.preventDefault();
- this.classList.toggle('directorist-taxonomy-list__toggle--open');
- }
- });
- });
- }
- categoryDropdown('.directorist-taxonomy-list-one .directorist-taxonomy-list__toggle', '.directorist-taxonomy-list-one .directorist-taxonomy-list');
- categoryDropdown('.directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle', '.directorist-taxonomy-list-one .directorist-taxonomy-list');
+ /* Taxonomy list dropdown */
+ function categoryDropdown(selector, parent) {
+ var categoryListToggle =
+ document.querySelectorAll(selector);
+ categoryListToggle.forEach(function (item) {
+ item.addEventListener('click', function (e) {
+ var categoryName = item.querySelector(
+ '.directorist-taxonomy-list__name'
+ );
+ if (e.target !== categoryName) {
+ e.preventDefault();
+ this.classList.toggle(
+ 'directorist-taxonomy-list__toggle--open'
+ );
+ }
+ });
+ });
+ }
+ categoryDropdown(
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list__toggle',
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list'
+ );
+ categoryDropdown(
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle',
+ '.directorist-taxonomy-list-one .directorist-taxonomy-list'
+ );
- // Taxonomy Ajax
- $(document).on('click', '.directorist-categories .directorist-pagination a', function (e) {
- taxonomyPagination(e, $(this), '.directorist-categories');
- });
- $(document).on('click', '.directorist-location .directorist-pagination a', function (e) {
- taxonomyPagination(e, $(this), '.directorist-location');
- });
- function taxonomyPagination(event, clickedElement, containerSelector) {
- event.preventDefault();
- var pageNumber = (clickedElement === null || clickedElement === void 0 ? void 0 : clickedElement.attr('data-page')) || 1;
- var container = clickedElement.closest(containerSelector);
- var containerAttributes = container ? $(container).data('attrs') : {};
- $.ajax({
- url: directorist.ajax_url,
- type: 'POST',
- dataType: 'json',
- data: {
- action: 'directorist_taxonomy_pagination',
- nonce: directorist.directorist_nonce,
- page: parseInt(pageNumber),
- attrs: containerAttributes
- },
- beforeSend: function beforeSend() {
- $(containerSelector).addClass('atbdp-form-fade');
- },
- success: function success(response) {
- var _tempContainer$queryS, _tempContainer$queryS2;
- if (!(response !== null && response !== void 0 && response.success)) {
- console.error('Failed to load taxonomy content');
- return;
- }
- var tempContainer = document.createElement('div');
- tempContainer.innerHTML = response.data.content;
- // Handle both category and location wrappers
- var taxonomyWrapper = document.querySelector('.taxonomy-category-wrapper');
- var locationWrapper = document.querySelector('.taxonomy-location-wrapper');
- var updatedCategoryContent = (_tempContainer$queryS = tempContainer.querySelector('.taxonomy-category-wrapper')) === null || _tempContainer$queryS === void 0 ? void 0 : _tempContainer$queryS.innerHTML;
- var updatedLocationContent = (_tempContainer$queryS2 = tempContainer.querySelector('.taxonomy-location-wrapper')) === null || _tempContainer$queryS2 === void 0 ? void 0 : _tempContainer$queryS2.innerHTML;
- if (taxonomyWrapper && updatedCategoryContent) {
- taxonomyWrapper.innerHTML = updatedCategoryContent;
- }
- if (locationWrapper && updatedLocationContent) {
- locationWrapper.innerHTML = updatedLocationContent;
- }
- if (!taxonomyWrapper && !locationWrapper) {
- console.error('Required elements not found in response');
- return;
- }
- },
- complete: function complete() {
- $(containerSelector).removeClass('atbdp-form-fade');
- }
- });
- }
-});
+ // Taxonomy Ajax
+ $(document).on(
+ 'click',
+ '.directorist-categories .directorist-pagination a',
+ function (e) {
+ taxonomyPagination(
+ e,
+ $(this),
+ '.directorist-categories'
+ );
+ }
+ );
+ $(document).on(
+ 'click',
+ '.directorist-location .directorist-pagination a',
+ function (e) {
+ taxonomyPagination(
+ e,
+ $(this),
+ '.directorist-location'
+ );
+ }
+ );
+ function taxonomyPagination(
+ event,
+ clickedElement,
+ containerSelector
+ ) {
+ event.preventDefault();
+ var pageNumber =
+ (clickedElement === null ||
+ clickedElement === void 0
+ ? void 0
+ : clickedElement.attr('data-page')) || 1;
+ var container =
+ clickedElement.closest(containerSelector);
+ var containerAttributes = container
+ ? $(container).data('attrs')
+ : {};
+ $.ajax({
+ url: directorist.ajax_url,
+ type: 'POST',
+ dataType: 'json',
+ data: {
+ action: 'directorist_taxonomy_pagination',
+ nonce: directorist.directorist_nonce,
+ page: parseInt(pageNumber),
+ attrs: containerAttributes,
+ },
+ beforeSend: function beforeSend() {
+ $(containerSelector).addClass(
+ 'atbdp-form-fade'
+ );
+ },
+ success: function success(response) {
+ var _tempContainer$queryS,
+ _tempContainer$queryS2;
+ if (
+ !(
+ response !== null &&
+ response !== void 0 &&
+ response.success
+ )
+ ) {
+ console.error(
+ 'Failed to load taxonomy content'
+ );
+ return;
+ }
+ var tempContainer =
+ document.createElement('div');
+ tempContainer.innerHTML = response.data.content;
+ // Handle both category and location wrappers
+ var taxonomyWrapper = document.querySelector(
+ '.taxonomy-category-wrapper'
+ );
+ var locationWrapper = document.querySelector(
+ '.taxonomy-location-wrapper'
+ );
+ var updatedCategoryContent =
+ (_tempContainer$queryS =
+ tempContainer.querySelector(
+ '.taxonomy-category-wrapper'
+ )) === null ||
+ _tempContainer$queryS === void 0
+ ? void 0
+ : _tempContainer$queryS.innerHTML;
+ var updatedLocationContent =
+ (_tempContainer$queryS2 =
+ tempContainer.querySelector(
+ '.taxonomy-location-wrapper'
+ )) === null ||
+ _tempContainer$queryS2 === void 0
+ ? void 0
+ : _tempContainer$queryS2.innerHTML;
+ if (taxonomyWrapper && updatedCategoryContent) {
+ taxonomyWrapper.innerHTML =
+ updatedCategoryContent;
+ }
+ if (locationWrapper && updatedLocationContent) {
+ locationWrapper.innerHTML =
+ updatedLocationContent;
+ }
+ if (!taxonomyWrapper && !locationWrapper) {
+ console.error(
+ 'Required elements not found in response'
+ );
+ return;
+ }
+ },
+ complete: function complete() {
+ $(containerSelector).removeClass(
+ 'atbdp-form-fade'
+ );
+ },
+ });
+ }
+ });
-/***/ })
+ /***/
+ },
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Check if module exists (development only)
-/******/ if (__webpack_modules__[moduleId] === undefined) {
-/******/ var e = new Error("Cannot find module '" + moduleId + "'");
-/******/ e.code = 'MODULE_NOT_FOUND';
-/******/ throw e;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ !function() {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function() { return module['default']; } :
-/******/ function() { return module; };
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ !function() {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = function(exports, definition) {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ }();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ !function() {
-/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
-/******/ }();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ !function() {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ }();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
-!function() {
-"use strict";
-/*!*************************************************!*\
+ /******/
+ };
+ /************************************************************************/
+ /******/ // The module cache
+ /******/ var __webpack_module_cache__ = {};
+ /******/
+ /******/ // The require function
+ /******/ function __webpack_require__(moduleId) {
+ /******/ // Check if module is in cache
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
+ /******/ if (cachedModule !== undefined) {
+ /******/ return cachedModule.exports;
+ /******/
+ }
+ /******/ // Create a new module (and put it into the cache)
+ /******/ var module = (__webpack_module_cache__[moduleId] = {
+ /******/ // no module.id needed
+ /******/ // no module.loaded needed
+ /******/ exports: {},
+ /******/
+ });
+ /******/
+ /******/ // Execute the module function
+ /******/ __webpack_modules__[moduleId](
+ module,
+ module.exports,
+ __webpack_require__
+ );
+ /******/
+ /******/ // Return the exports of the module
+ /******/ return module.exports;
+ /******/
+ }
+ /******/
+ /************************************************************************/
+ /******/ /* webpack/runtime/compat get default export */
+ /******/ !(function () {
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
+ /******/ __webpack_require__.n = function (module) {
+ /******/ var getter =
+ module && module.__esModule
+ ? /******/ function () {
+ return module['default'];
+ }
+ : /******/ function () {
+ return module;
+ };
+ /******/ __webpack_require__.d(getter, { a: getter });
+ /******/ return getter;
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/define property getters */
+ /******/ !(function () {
+ /******/ // define getter functions for harmony exports
+ /******/ __webpack_require__.d = function (exports, definition) {
+ /******/ for (var key in definition) {
+ /******/ if (
+ __webpack_require__.o(definition, key) &&
+ !__webpack_require__.o(exports, key)
+ ) {
+ /******/ Object.defineProperty(exports, key, {
+ enumerable: true,
+ get: definition[key],
+ });
+ /******/
+ }
+ /******/
+ }
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
+ /******/ !(function () {
+ /******/ __webpack_require__.o = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ /******/
+ })();
+ /******/
+ /******/ /* webpack/runtime/make namespace object */
+ /******/ !(function () {
+ /******/ // define __esModule on exports
+ /******/ __webpack_require__.r = function (exports) {
+ /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, {
+ value: 'Module',
+ });
+ /******/
+ }
+ /******/ Object.defineProperty(exports, '__esModule', {
+ value: true,
+ });
+ /******/
+ };
+ /******/
+ })();
+ /******/
+ /************************************************************************/
+ var __webpack_exports__ = {};
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
+ !(function () {
+ 'use strict';
+ /*!*************************************************!*\
!*** ./assets/src/js/public/modules/widgets.js ***!
\*************************************************/
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/categoryLocation */ "./assets/src/js/public/components/categoryLocation.js");
-/* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__);
-/* window.addEventListener('load', () => {
+ __webpack_require__.r(__webpack_exports__);
+ /* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__ =
+ __webpack_require__(
+ /*! ../components/categoryLocation */ './assets/src/js/public/components/categoryLocation.js'
+ );
+ /* harmony import */ var _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0___default =
+ /*#__PURE__*/ __webpack_require__.n(
+ _components_categoryLocation__WEBPACK_IMPORTED_MODULE_0__
+ );
+ /* window.addEventListener('load', () => {
(function ($) {
})(jQuery);
}); */
-
-
-}();
-/******/ })()
-;
-//# sourceMappingURL=widgets.js.map
\ No newline at end of file
+ })();
+ /******/
+})();
+//# sourceMappingURL=widgets.js.map
diff --git a/assets/src/js/public/components/instantSearch.js b/assets/src/js/public/components/instantSearch.js
index d33a50b8e..11d6aec15 100644
--- a/assets/src/js/public/components/instantSearch.js
+++ b/assets/src/js/public/components/instantSearch.js
@@ -355,7 +355,7 @@ import initSearchCategoryCustomFields from './category-custom-fields';
function checkRequiredFields(searchElm) {
// Select all required inputs and selects inside searchElm
const requiredInputs = searchElm.find(
- 'input[required], select[required], textarea[required]'
+ '.directorist-search-field input[required], .directorist-search-field select[required], .directorist-search-field textarea[required]'
);
let requiredFieldsAreValid = true;