From 422a5a375e3cf8bff6457b0bd2323ff383fe2e1e Mon Sep 17 00:00:00 2001 From: Ibrahim Riaz Date: Tue, 23 Dec 2025 16:16:47 +0600 Subject: [PATCH 1/2] fix: OpenStreet location autocomplete suggestion issue on directory type change --- assets/css/admin-main.rtl.css | 69 ++-- assets/css/all-listings.rtl.css | 59 +-- assets/css/public-main.rtl.css | 59 +-- assets/js/search-form.js | 421 +++++++++---------- assets/src/js/public/search-form.js | 604 ++++++++++++++-------------- 5 files changed, 594 insertions(+), 618 deletions(-) diff --git a/assets/css/admin-main.rtl.css b/assets/css/admin-main.rtl.css index ebf6e5b23..530d2c34d 100644 --- a/assets/css/admin-main.rtl.css +++ b/assets/css/admin-main.rtl.css @@ -18,15 +18,22 @@ !*** css ./node_modules/css-loader/dist/cjs.js??clonedRuleSet-4.use[1]!./node_modules/resolve-url-loader/index.js!./node_modules/postcss-loader/src/index.js??clonedRuleSet-4.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-4.use[4]!./assets/src/scss/layout/admin/admin-style.scss (4) ***! \**********************************************************************************************************************************************************************************************************************************************************************************************************/ /* typography */ +#directiost-listing-fields_wrapper { + padding: 18px 20px; + /*********************************************************** + ************************************************************ + css for Custom Field + ************************************************************* + **************************************************************/ + /* + for shortable field*/ +} #directiost-listing-fields_wrapper .directorist-show { display: block !important; } #directiost-listing-fields_wrapper .directorist-hide { display: none !important; } -#directiost-listing-fields_wrapper { - padding: 18px 20px; -} #directiost-listing-fields_wrapper a:focus, #directiost-listing-fields_wrapper a:active { -webkit-box-shadow: unset; @@ -383,13 +390,6 @@ #directiost-listing-fields_wrapper .single_thm .btn_wrapper { text-align: center; } -#directiost-listing-fields_wrapper { - /*********************************************************** - ************************************************************ - css for Custom Field - ************************************************************* - **************************************************************/ -} #directiost-listing-fields_wrapper .postbox table.widefat { -webkit-box-shadow: none; box-shadow: none; @@ -411,10 +411,6 @@ #directiost-listing-fields_wrapper .atbdp-tick-cross2 { margin-right: 25px; } -#directiost-listing-fields_wrapper { - /* - for shortable field*/ -} #directiost-listing-fields_wrapper .ui-sortable tr:hover { cursor: move; } @@ -9533,6 +9529,7 @@ body.stop-scrolling { border: 1px solid var(--directorist-color-border-light); -webkit-transition: background 0.2s ease; transition: background 0.2s ease; + /* Legacy Icon */ } .directorist-add-listing-types__single__link .directorist-icon-mask { display: -webkit-box; @@ -9575,9 +9572,6 @@ body.stop-scrolling { .directorist-icon-mask:after { background-color: var(--directorist-color-primary); } -.directorist-add-listing-types__single__link { - /* Legacy Icon */ -} .directorist-add-listing-types__single__link > i:not(.directorist-icon-mask) { display: inline-block; margin-bottom: 10px; @@ -9617,6 +9611,7 @@ body.stop-scrolling { #directiost-listing-fields_wrapper .directorist-content-module { margin-bottom: 35px; border-radius: 12px; + /* social info */ } @media (max-width: 991px) { .directorist-add-listing-form .directorist-content-module, @@ -9695,10 +9690,6 @@ body.stop-scrolling { height: 40px; top: 26px; } -.directorist-add-listing-form .directorist-content-module, -#directiost-listing-fields_wrapper .directorist-content-module { - /* social info */ -} .directorist-add-listing-form .directorist-content-module .directorist-form-social-fields, @@ -47370,12 +47361,6 @@ input[type="radio"]:checked::before { } } -.directorist_vertical-align-m .directorist_item { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; -} .directorist_vertical-align-m { display: -webkit-box; display: -webkit-flex; @@ -47386,6 +47371,12 @@ input[type="radio"]:checked::before { -ms-flex-align: center; align-items: center; } +.directorist_vertical-align-m .directorist_item { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} .atbdp-settings-manager .atbdp-tab-sub-contents .directorist_btn-start { font-size: 14px; @@ -52083,18 +52074,6 @@ span.drop-toggle-caret:before { -ms-flex-wrap: wrap; flex-wrap: wrap; } -.directorist-ai-keyword-field__list-item.--h-24 { - height: 24px; -} -.directorist-ai-keyword-field__list-item.--h-32 { - height: 32px; -} -.directorist-ai-keyword-field__list-item.--px-8 { - padding: 0px 8px; -} -.directorist-ai-keyword-field__list-item.--px-12 { - padding: 0px 12px; -} .directorist-ai-keyword-field__list-item { display: -webkit-box; display: -webkit-flex; @@ -52114,6 +52093,18 @@ span.drop-toggle-caret:before { line-height: 16px; letter-spacing: 0.12px; } +.directorist-ai-keyword-field__list-item.--h-24 { + height: 24px; +} +.directorist-ai-keyword-field__list-item.--h-32 { + height: 32px; +} +.directorist-ai-keyword-field__list-item.--px-8 { + padding: 0px 8px; +} +.directorist-ai-keyword-field__list-item.--px-12 { + padding: 0px 12px; +} .directorist-ai-keyword-field__list-item svg { width: 20px; height: 20px; diff --git a/assets/css/all-listings.rtl.css b/assets/css/all-listings.rtl.css index 4bcccf858..95df5edc3 100644 --- a/assets/css/all-listings.rtl.css +++ b/assets/css/all-listings.rtl.css @@ -3350,6 +3350,7 @@ body.stop-scrolling { border: 1px solid var(--directorist-color-border-light); -webkit-transition: background 0.2s ease; transition: background 0.2s ease; + /* Legacy Icon */ } .directorist-add-listing-types__single__link .directorist-icon-mask { display: -webkit-box; @@ -3392,9 +3393,6 @@ body.stop-scrolling { .directorist-icon-mask:after { background-color: var(--directorist-color-primary); } -.directorist-add-listing-types__single__link { - /* Legacy Icon */ -} .directorist-add-listing-types__single__link > i:not(.directorist-icon-mask) { display: inline-block; margin-bottom: 10px; @@ -3434,6 +3432,7 @@ body.stop-scrolling { #directiost-listing-fields_wrapper .directorist-content-module { margin-bottom: 35px; border-radius: 12px; + /* social info */ } @media (max-width: 991px) { .directorist-add-listing-form .directorist-content-module, @@ -3512,10 +3511,6 @@ body.stop-scrolling { height: 40px; top: 26px; } -.directorist-add-listing-form .directorist-content-module, -#directiost-listing-fields_wrapper .directorist-content-module { - /* social info */ -} .directorist-add-listing-form .directorist-content-module .directorist-form-social-fields, @@ -12541,6 +12536,7 @@ input.directorist-toggle-input:checked } .directorist-content-active .directorist-author-social__item a:hover { background-color: var(--directorist-color-primary); + /* Legacy Icon */ } .directorist-content-active .directorist-author-social__item @@ -12548,9 +12544,6 @@ input.directorist-toggle-input:checked .directorist-icon-mask::after { background-color: var(--directorist-color-white); } -.directorist-content-active .directorist-author-social__item a:hover { - /* Legacy Icon */ -} .directorist-content-active .directorist-author-social__item a:hover span.la, .directorist-content-active .directorist-author-social__item a:hover span.fa { background: none; @@ -17561,6 +17554,7 @@ input.directorist-toggle-input:checked -ms-flex-pack: center; justify-content: center; background-color: var(--directorist-color-white); + /* Styles */ } .directorist-categories__single--image { background-position: center; @@ -17613,9 +17607,6 @@ input.directorist-toggle-input:checked width: 100%; height: 100%; } -.directorist-categories__single { - /* Styles */ -} .directorist-categories__single--style-one .directorist-categories__single__content .directorist-icon-mask::after { @@ -17746,6 +17737,10 @@ input.directorist-toggle-input:checked } /* Taxonomy List Style One */ +.directorist-taxonomy-list-one .directorist-taxonomy-list { + /* Sub Item */ + /* Sub Item Toggle */ +} .directorist-taxonomy-list-one .directorist-taxonomy-list__card { display: -webkit-box; display: -webkit-flex; @@ -17834,9 +17829,6 @@ input.directorist-toggle-input:checked -webkit-transition: 0.3s ease; transition: 0.3s ease; } -.directorist-taxonomy-list-one .directorist-taxonomy-list { - /* Sub Item */ -} .directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item { margin: 0; list-style: none; @@ -17913,9 +17905,6 @@ input.directorist-toggle-input:checked opacity: 1; margin-top: 0; } -.directorist-taxonomy-list-one .directorist-taxonomy-list { - /* Sub Item Toggle */ -} .directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle { display: -webkit-box; display: -webkit-flex; @@ -18806,6 +18795,7 @@ input.directorist-toggle-input:checked display: -ms-flexbox; display: flex; margin: 0; + /* Legacy Icon */ } .directorist-content-active .directorist-authors__card__info-list @@ -18833,9 +18823,6 @@ input.directorist-toggle-input:checked width: 16px; height: 16px; } -.directorist-content-active .directorist-authors__card__info-list li { - /* Legacy Icon */ -} .directorist-content-active .directorist-authors__card__info-list li @@ -19674,6 +19661,7 @@ input.directorist-toggle-input:checked -ms-flex-align: center; align-items: center; gap: 5px; + /* Legacy Icon */ } .directorist-content-active .directorist-listing-single__meta @@ -19683,11 +19671,6 @@ input.directorist-toggle-input:checked height: 15px; background-color: var(--directorist-color-light-gray); } -.directorist-content-active - .directorist-listing-single__meta - .directorist-view-count { - /* Legacy Icon */ -} .directorist-content-active .directorist-listing-single__meta .directorist-view-count @@ -19718,6 +19701,12 @@ input.directorist-toggle-input:checked width: auto; height: auto; } +.directorist-content-active + .directorist-listing-single__meta + .directorist-listing-category + > a { + /* Legacy Icon */ +} .directorist-content-active .directorist-listing-single__meta .directorist-listing-category @@ -19750,12 +19739,6 @@ input.directorist-toggle-input:checked width: 14px; height: 14px; } -.directorist-content-active - .directorist-listing-single__meta - .directorist-listing-category - > a { - /* Legacy Icon */ -} .directorist-content-active .directorist-listing-single__meta .directorist-listing-category @@ -22537,6 +22520,7 @@ input.directorist-toggle-input:checked display: -ms-flexbox; display: flex; gap: 10px; + /* Legacy Icon */ } .directorist-single-tag-list a .directorist-icon-mask { display: -webkit-inline-box; @@ -22564,9 +22548,6 @@ input.directorist-toggle-input:checked .directorist-single-tag-list a .directorist-icon-mask:after { font-size: 15px; } -.directorist-single-tag-list a { - /* Legacy Icon */ -} .directorist-single-tag-list a > span:not(.directorist-icon-mask) { display: -webkit-inline-box; display: -webkit-inline-flex; @@ -26015,6 +25996,7 @@ Review: New Style line-height: 2.65; opacity: 0; visibility: hidden; + /* Legacy Icon */ } .directorist-favourite-items-wrap .directorist-dashboard-items-list__single__action @@ -26028,11 +26010,6 @@ Review: New Style .directorist-icon-mask:after { background-color: var(--directorist-color-white); } -.directorist-favourite-items-wrap - .directorist-dashboard-items-list__single__action - .directorist-favourite-remove-btn { - /* Legacy Icon */ -} .directorist-favourite-items-wrap .directorist-dashboard-items-list__single__action .directorist-favourite-remove-btn diff --git a/assets/css/public-main.rtl.css b/assets/css/public-main.rtl.css index 4bcccf858..95df5edc3 100644 --- a/assets/css/public-main.rtl.css +++ b/assets/css/public-main.rtl.css @@ -3350,6 +3350,7 @@ body.stop-scrolling { border: 1px solid var(--directorist-color-border-light); -webkit-transition: background 0.2s ease; transition: background 0.2s ease; + /* Legacy Icon */ } .directorist-add-listing-types__single__link .directorist-icon-mask { display: -webkit-box; @@ -3392,9 +3393,6 @@ body.stop-scrolling { .directorist-icon-mask:after { background-color: var(--directorist-color-primary); } -.directorist-add-listing-types__single__link { - /* Legacy Icon */ -} .directorist-add-listing-types__single__link > i:not(.directorist-icon-mask) { display: inline-block; margin-bottom: 10px; @@ -3434,6 +3432,7 @@ body.stop-scrolling { #directiost-listing-fields_wrapper .directorist-content-module { margin-bottom: 35px; border-radius: 12px; + /* social info */ } @media (max-width: 991px) { .directorist-add-listing-form .directorist-content-module, @@ -3512,10 +3511,6 @@ body.stop-scrolling { height: 40px; top: 26px; } -.directorist-add-listing-form .directorist-content-module, -#directiost-listing-fields_wrapper .directorist-content-module { - /* social info */ -} .directorist-add-listing-form .directorist-content-module .directorist-form-social-fields, @@ -12541,6 +12536,7 @@ input.directorist-toggle-input:checked } .directorist-content-active .directorist-author-social__item a:hover { background-color: var(--directorist-color-primary); + /* Legacy Icon */ } .directorist-content-active .directorist-author-social__item @@ -12548,9 +12544,6 @@ input.directorist-toggle-input:checked .directorist-icon-mask::after { background-color: var(--directorist-color-white); } -.directorist-content-active .directorist-author-social__item a:hover { - /* Legacy Icon */ -} .directorist-content-active .directorist-author-social__item a:hover span.la, .directorist-content-active .directorist-author-social__item a:hover span.fa { background: none; @@ -17561,6 +17554,7 @@ input.directorist-toggle-input:checked -ms-flex-pack: center; justify-content: center; background-color: var(--directorist-color-white); + /* Styles */ } .directorist-categories__single--image { background-position: center; @@ -17613,9 +17607,6 @@ input.directorist-toggle-input:checked width: 100%; height: 100%; } -.directorist-categories__single { - /* Styles */ -} .directorist-categories__single--style-one .directorist-categories__single__content .directorist-icon-mask::after { @@ -17746,6 +17737,10 @@ input.directorist-toggle-input:checked } /* Taxonomy List Style One */ +.directorist-taxonomy-list-one .directorist-taxonomy-list { + /* Sub Item */ + /* Sub Item Toggle */ +} .directorist-taxonomy-list-one .directorist-taxonomy-list__card { display: -webkit-box; display: -webkit-flex; @@ -17834,9 +17829,6 @@ input.directorist-toggle-input:checked -webkit-transition: 0.3s ease; transition: 0.3s ease; } -.directorist-taxonomy-list-one .directorist-taxonomy-list { - /* Sub Item */ -} .directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item { margin: 0; list-style: none; @@ -17913,9 +17905,6 @@ input.directorist-toggle-input:checked opacity: 1; margin-top: 0; } -.directorist-taxonomy-list-one .directorist-taxonomy-list { - /* Sub Item Toggle */ -} .directorist-taxonomy-list-one .directorist-taxonomy-list__sub-item-toggle { display: -webkit-box; display: -webkit-flex; @@ -18806,6 +18795,7 @@ input.directorist-toggle-input:checked display: -ms-flexbox; display: flex; margin: 0; + /* Legacy Icon */ } .directorist-content-active .directorist-authors__card__info-list @@ -18833,9 +18823,6 @@ input.directorist-toggle-input:checked width: 16px; height: 16px; } -.directorist-content-active .directorist-authors__card__info-list li { - /* Legacy Icon */ -} .directorist-content-active .directorist-authors__card__info-list li @@ -19674,6 +19661,7 @@ input.directorist-toggle-input:checked -ms-flex-align: center; align-items: center; gap: 5px; + /* Legacy Icon */ } .directorist-content-active .directorist-listing-single__meta @@ -19683,11 +19671,6 @@ input.directorist-toggle-input:checked height: 15px; background-color: var(--directorist-color-light-gray); } -.directorist-content-active - .directorist-listing-single__meta - .directorist-view-count { - /* Legacy Icon */ -} .directorist-content-active .directorist-listing-single__meta .directorist-view-count @@ -19718,6 +19701,12 @@ input.directorist-toggle-input:checked width: auto; height: auto; } +.directorist-content-active + .directorist-listing-single__meta + .directorist-listing-category + > a { + /* Legacy Icon */ +} .directorist-content-active .directorist-listing-single__meta .directorist-listing-category @@ -19750,12 +19739,6 @@ input.directorist-toggle-input:checked width: 14px; height: 14px; } -.directorist-content-active - .directorist-listing-single__meta - .directorist-listing-category - > a { - /* Legacy Icon */ -} .directorist-content-active .directorist-listing-single__meta .directorist-listing-category @@ -22537,6 +22520,7 @@ input.directorist-toggle-input:checked display: -ms-flexbox; display: flex; gap: 10px; + /* Legacy Icon */ } .directorist-single-tag-list a .directorist-icon-mask { display: -webkit-inline-box; @@ -22564,9 +22548,6 @@ input.directorist-toggle-input:checked .directorist-single-tag-list a .directorist-icon-mask:after { font-size: 15px; } -.directorist-single-tag-list a { - /* Legacy Icon */ -} .directorist-single-tag-list a > span:not(.directorist-icon-mask) { display: -webkit-inline-box; display: -webkit-inline-flex; @@ -26015,6 +25996,7 @@ Review: New Style line-height: 2.65; opacity: 0; visibility: hidden; + /* Legacy Icon */ } .directorist-favourite-items-wrap .directorist-dashboard-items-list__single__action @@ -26028,11 +26010,6 @@ Review: New Style .directorist-icon-mask:after { background-color: var(--directorist-color-white); } -.directorist-favourite-items-wrap - .directorist-dashboard-items-list__single__action - .directorist-favourite-remove-btn { - /* Legacy Icon */ -} .directorist-favourite-items-wrap .directorist-dashboard-items-list__single__action .directorist-favourite-remove-btn diff --git a/assets/js/search-form.js b/assets/js/search-form.js index 9ff968947..56d82fedc 100644 --- a/assets/js/search-form.js +++ b/assets/js/search-form.js @@ -3797,7 +3797,7 @@ // Listing Type Change $('body').on( 'click', - '.search_listing_types', + '.search_listing_types, .directorist-type-nav__link', function (event) { event.preventDefault(); var parent = $(this).closest( @@ -4164,216 +4164,227 @@ }, ]; 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 + $('body') + .off( + 'keyup.directoristOpenstreet', + field.input_elm + ) + .on( + 'keyup.directoristOpenstreet', + field.input_elm, + (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 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 = + 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-search-location' + '.directorist-location-js, .atbdp-search-address' + ).val( + data.display_name ); - if ( - locationSearch.length - ) { - locationSearch.trigger( - 'change' + $( + '.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, }); - } - 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 - ); - } - ); - } + locationAddressField.removeClass( + 'atbdp-form-fade' ); - }, - error: function error(_error3) { - console.log({ - error: _error3, - }); - locationAddressField.removeClass( - 'atbdp-form-fade' - ); - }, - }); - } - }, 750) - ); + }, + }); + } + }, 750) + ); }); // hide address result when click outside the input field diff --git a/assets/src/js/public/search-form.js b/assets/src/js/public/search-form.js index 4e7030e45..79c49e3c6 100644 --- a/assets/src/js/public/search-form.js +++ b/assets/src/js/public/search-form.js @@ -1325,124 +1325,134 @@ document.addEventListener('DOMContentLoaded', () => { ); // Listing Type Change - $('body').on('click', '.search_listing_types', function (event) { - event.preventDefault(); - let parent = $(this).closest('.directorist-search-contents'); - let listing_type = $(this).attr('data-listing_type'); - let 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' + $('body').on( + 'click', + '.search_listing_types, .directorist-type-nav__link', + function (event) { + event.preventDefault(); + let parent = $(this).closest('.directorist-search-contents'); + let listing_type = $(this).attr('data-listing_type'); + let type_current = parent.find( + '.directorist-listing-type-selection__link--current' ); - } - parent.find('.listing_type').val(listing_type); - - let 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); - - let atts = parent.attr('data-atts'); - let 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(response) { - if (response) { - // Add Temp Element - let new_inserted_elm = - '
    '; - parent.before(new_inserted_elm); - - // Remove Old Parent - parent.remove(); - - // Insert New Parent - $('.directorist_search_temp').after( - response['search_form'] - ); - let newParent = $('.directorist_search_temp').next(); + if (type_current.length) { + type_current.removeClass( + 'directorist-listing-type-selection__link--current' + ); + $(this).addClass( + 'directorist-listing-type-selection__link--current' + ); + } - // 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' + parent.find('.listing_type').val(listing_type); + + let 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); + + let atts = parent.attr('data-atts'); + let 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(response) { + if (response) { + // Add Temp Element + let new_inserted_elm = + '
    '; + parent.before(new_inserted_elm); + + // Remove Old Parent + parent.remove(); + + // Insert New Parent + $('.directorist_search_temp').after( + response['search_form'] ); + let 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(); - - let 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((event) => { - document.body.dispatchEvent(event); - window.dispatchEvent(event); - }); + // Remove Temp Element + $('.directorist_search_temp').remove(); + + let 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'), + ]; - handleRadiusVisibility(); - directorist_custom_range_slider(); + events.forEach((event) => { + document.body.dispatchEvent(event); + window.dispatchEvent(event); + }); - initSearchFields(); + handleRadiusVisibility(); + directorist_custom_range_slider(); - initSearchCategoryCustomFields($); - } + initSearchFields(); - let parentAfterAjax = $(this).closest( - '.directorist-search-contents' - ); + initSearchCategoryCustomFields($); + } + + let 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(error) { - // console.log(error); - }, - }); - }); + .removeClass('atbdp-form-fade'); + if ( + parentAfterAjax + .find('.directorist-search-form-box') + .find('.directorist-search-field-radius_search') + .length + ) { + handleRadiusVisibility(); + directorist_custom_range_slider(); + } + }, + error(error) { + // console.log(error); + }, + }); + } + ); initSearchCategoryCustomFields($); @@ -1674,200 +1684,210 @@ document.addEventListener('DOMContentLoaded', () => { ]; input_fields.forEach((field) => { - if (!$(field.input_elm).length) { - return; - } - - $(field.input_elm).on( - 'keyup', - debounce(function (event) { - event.preventDefault(); - - let 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, - ]; + $('body') + .off('keyup.directoristOpenstreet', field.input_elm) + .on( + 'keyup.directoristOpenstreet', + field.input_elm, + debounce(function (event) { + event.preventDefault(); + + let 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; + } - // Return early when blocked key is pressed. - if (blockedKeyCodes.includes(event.keyCode)) { - return; - } + let locationAddressField = $(this).parent( + '.directorist-search-field' + ); + let result_container = field.getResultContainer( + this, + field + ); + let 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) { + let res = ''; + + let currentIconURL = + directorist.assets_url + + 'icons/font-awesome/svgs/solid/paper-plane.svg'; + let currentIconHTML = + directorist.icon_markup + .replace( + '##URL##', + currentIconURL + ) + .replace('##CLASS##', ''); + let currentLocationIconHTML = + "" + + currentIconHTML + + ''; + let currentLocationAddressHTML = + ""; + + let iconURL = + directorist.assets_url + + 'icons/font-awesome/svgs/solid/map-marker-alt.svg'; + let iconHTML = + directorist.icon_markup + .replace('##URL##', iconURL) + .replace('##CLASS##', ''); + let locationIconHTML = + "" + + iconHTML + + ''; + + for ( + let i = 0, + len = + data.length > 5 + ? 5 + : data.length; + i < len; + i++ + ) { + ((res += + '
  • ' + + locationIconHTML + + "" + + data[i].display_name), + +'
  • '); + } + + function displayLocation( + position, + event + ) { + let lat = + position.coords.latitude; + let 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); - let locationAddressField = $(this).parent( - '.directorist-search-field' - ); - let result_container = field.getResultContainer( - this, - field - ); - let search = $(this).val(); + const 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' + ); - 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) { - let res = ''; - - let currentIconURL = - directorist.assets_url + - 'icons/font-awesome/svgs/solid/paper-plane.svg'; - let currentIconHTML = - directorist.icon_markup - .replace( - '##URL##', - currentIconURL + $('body') + .off( + 'click', + '.address_result .current-location' ) - .replace('##CLASS##', ''); - let currentLocationIconHTML = - "" + - currentIconHTML + - ''; - let currentLocationAddressHTML = - ""; - - let iconURL = - directorist.assets_url + - 'icons/font-awesome/svgs/solid/map-marker-alt.svg'; - let iconHTML = directorist.icon_markup - .replace('##URL##', iconURL) - .replace('##CLASS##', ''); - let locationIconHTML = - "" + - iconHTML + - ''; - - for ( - let i = 0, - len = - data.length > 5 - ? 5 - : data.length; - i < len; - i++ - ) { - ((res += - '
  • ' + - locationIconHTML + - "" + - data[i].display_name), - +'
  • '); - } - - function displayLocation( - position, - event - ) { - let lat = position.coords.latitude; - let 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); - - const locationSearch = $( - '.directorist-search-location' - ); - if (locationSearch.length) { - locationSearch.trigger( - 'change' + .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, }); - } - - 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 - ); - } - ); - } + locationAddressField.removeClass( + 'atbdp-form-fade' ); - }, - error: function error(_error3) { - console.log({ - error: _error3, - }); - locationAddressField.removeClass( - 'atbdp-form-fade' - ); - }, - }); - } - }, 750) - ); + }, + }); + } + }, 750) + ); }); // hide address result when click outside the input field From 05335686ef0683adea2c777bdba38326d811b5c4 Mon Sep 17 00:00:00 2001 From: Ibrahim Riaz Date: Tue, 20 Jan 2026 11:10:51 +0600 Subject: [PATCH 2/2] escapeHtml on openstreet map location suggestion --- assets/css/admin-main.css | 81 ++++++++++++++++++++ assets/css/admin-main.rtl.css | 81 ++++++++++++++++++++ assets/css/all-listings.css | 81 ++++++++++++++++++++ assets/css/all-listings.rtl.css | 81 ++++++++++++++++++++ assets/css/public-main.css | 81 ++++++++++++++++++++ assets/css/public-main.rtl.css | 81 ++++++++++++++++++++ assets/js/account.js | 6 -- assets/js/add-listing-google-map.js | 6 -- assets/js/add-listing-openstreet-map.js | 6 -- assets/js/add-listing.js | 6 -- assets/js/admin-builder-archive.js | 6 -- assets/js/admin-import-export.js | 6 -- assets/js/admin-main.js | 6 -- assets/js/all-authors.js | 6 -- assets/js/all-listings.js | 6 -- assets/js/all-location-category.js | 6 -- assets/js/author-profile.js | 6 -- assets/js/directorist-dashboard.js | 6 -- assets/js/directorist-plupload.js | 80 ++++++++++++++----- assets/js/global-main.js | 6 -- assets/js/global-markerclusterer.js | 6 -- assets/js/google-map.js | 6 -- assets/js/openstreet-map.js | 6 -- assets/js/public-main.js | 6 -- assets/js/range-slider.js | 6 -- assets/js/search-form.js | 16 +++- assets/js/single-listing.js | 6 -- assets/js/widgets.js | 6 -- assets/src/js/global/directorist-plupload.js | 41 +++++++--- assets/src/js/public/search-form.js | 60 +++++++++++---- 30 files changed, 636 insertions(+), 167 deletions(-) diff --git a/assets/css/admin-main.css b/assets/css/admin-main.css index 04ec8266d..7742d7260 100644 --- a/assets/css/admin-main.css +++ b/assets/css/admin-main.css @@ -10471,8 +10471,11 @@ body.stop-scrolling { width: 100%; top: 0; left: 0; + z-index: 10; + pointer-events: none; } .plupload-thumbs .atbdp-thumb-actions .thumbremovelink { + pointer-events: auto; position: absolute; top: 10px; right: 10px; @@ -10541,6 +10544,84 @@ body.stop-scrolling { z-index: 1; } +.plupload-thumbs .thumb .atbdp-file-wrapper { + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + padding: 20px; + background: var(--directorist-color-bg-gray, #f8f9fa); + border-radius: 12px; + cursor: move; + position: relative; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + z-index: 1; + pointer-events: auto; +} +.plupload-thumbs .thumb .atbdp-file-wrapper:hover { + background: var(--directorist-color-border-gray, #e9ecef); +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon { + width: 64px; + height: 64px; + margin-bottom: 12px; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon::after { + width: 64px; + height: 64px; + background-color: var(--directorist-color-primary, #2563eb); + opacity: 0.15; + border-radius: 8px; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-name { + font-size: 12px; + font-weight: 500; + color: var(--directorist-color-body, #374151); + text-align: center; + word-break: break-word; + line-height: 1.4; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + margin-top: 4px; +} + .plupload-thumbs .thumb .thumbi { position: absolute; right: -10px; diff --git a/assets/css/admin-main.rtl.css b/assets/css/admin-main.rtl.css index 67ce97258..16734f389 100644 --- a/assets/css/admin-main.rtl.css +++ b/assets/css/admin-main.rtl.css @@ -10471,8 +10471,11 @@ body.stop-scrolling { width: 100%; top: 0; right: 0; + z-index: 10; + pointer-events: none; } .plupload-thumbs .atbdp-thumb-actions .thumbremovelink { + pointer-events: auto; position: absolute; top: 10px; left: 10px; @@ -10541,6 +10544,84 @@ body.stop-scrolling { z-index: 1; } +.plupload-thumbs .thumb .atbdp-file-wrapper { + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + padding: 20px; + background: var(--directorist-color-bg-gray, #f8f9fa); + border-radius: 12px; + cursor: move; + position: relative; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + z-index: 1; + pointer-events: auto; +} +.plupload-thumbs .thumb .atbdp-file-wrapper:hover { + background: var(--directorist-color-border-gray, #e9ecef); +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon { + width: 64px; + height: 64px; + margin-bottom: 12px; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon::after { + width: 64px; + height: 64px; + background-color: var(--directorist-color-primary, #2563eb); + opacity: 0.15; + border-radius: 8px; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-name { + font-size: 12px; + font-weight: 500; + color: var(--directorist-color-body, #374151); + text-align: center; + word-break: break-word; + line-height: 1.4; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + margin-top: 4px; +} + .plupload-thumbs .thumb .thumbi { position: absolute; left: -10px; diff --git a/assets/css/all-listings.css b/assets/css/all-listings.css index 7c2e36a6c..afd5a19f6 100644 --- a/assets/css/all-listings.css +++ b/assets/css/all-listings.css @@ -5320,8 +5320,11 @@ body.stop-scrolling { width: 100%; top: 0; left: 0; + z-index: 10; + pointer-events: none; } .plupload-thumbs .atbdp-thumb-actions .thumbremovelink { + pointer-events: auto; position: absolute; top: 10px; right: 10px; @@ -5390,6 +5393,84 @@ body.stop-scrolling { z-index: 1; } +.plupload-thumbs .thumb .atbdp-file-wrapper { + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + padding: 20px; + background: var(--directorist-color-bg-gray, #f8f9fa); + border-radius: 12px; + cursor: move; + position: relative; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + z-index: 1; + pointer-events: auto; +} +.plupload-thumbs .thumb .atbdp-file-wrapper:hover { + background: var(--directorist-color-border-gray, #e9ecef); +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon { + width: 64px; + height: 64px; + margin-bottom: 12px; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon::after { + width: 64px; + height: 64px; + background-color: var(--directorist-color-primary, #2563eb); + opacity: 0.15; + border-radius: 8px; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-name { + font-size: 12px; + font-weight: 500; + color: var(--directorist-color-body, #374151); + text-align: center; + word-break: break-word; + line-height: 1.4; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + margin-top: 4px; +} + .plupload-thumbs .thumb .thumbi { position: absolute; right: -10px; diff --git a/assets/css/all-listings.rtl.css b/assets/css/all-listings.rtl.css index c06beb02e..4d3b77b9c 100644 --- a/assets/css/all-listings.rtl.css +++ b/assets/css/all-listings.rtl.css @@ -5320,8 +5320,11 @@ body.stop-scrolling { width: 100%; top: 0; right: 0; + z-index: 10; + pointer-events: none; } .plupload-thumbs .atbdp-thumb-actions .thumbremovelink { + pointer-events: auto; position: absolute; top: 10px; left: 10px; @@ -5390,6 +5393,84 @@ body.stop-scrolling { z-index: 1; } +.plupload-thumbs .thumb .atbdp-file-wrapper { + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + padding: 20px; + background: var(--directorist-color-bg-gray, #f8f9fa); + border-radius: 12px; + cursor: move; + position: relative; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + z-index: 1; + pointer-events: auto; +} +.plupload-thumbs .thumb .atbdp-file-wrapper:hover { + background: var(--directorist-color-border-gray, #e9ecef); +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon { + width: 64px; + height: 64px; + margin-bottom: 12px; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon::after { + width: 64px; + height: 64px; + background-color: var(--directorist-color-primary, #2563eb); + opacity: 0.15; + border-radius: 8px; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-name { + font-size: 12px; + font-weight: 500; + color: var(--directorist-color-body, #374151); + text-align: center; + word-break: break-word; + line-height: 1.4; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + margin-top: 4px; +} + .plupload-thumbs .thumb .thumbi { position: absolute; left: -10px; diff --git a/assets/css/public-main.css b/assets/css/public-main.css index 4efede260..b3ed57eb0 100644 --- a/assets/css/public-main.css +++ b/assets/css/public-main.css @@ -5320,8 +5320,11 @@ body.stop-scrolling { width: 100%; top: 0; left: 0; + z-index: 10; + pointer-events: none; } .plupload-thumbs .atbdp-thumb-actions .thumbremovelink { + pointer-events: auto; position: absolute; top: 10px; right: 10px; @@ -5390,6 +5393,84 @@ body.stop-scrolling { z-index: 1; } +.plupload-thumbs .thumb .atbdp-file-wrapper { + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + padding: 20px; + background: var(--directorist-color-bg-gray, #f8f9fa); + border-radius: 12px; + cursor: move; + position: relative; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + z-index: 1; + pointer-events: auto; +} +.plupload-thumbs .thumb .atbdp-file-wrapper:hover { + background: var(--directorist-color-border-gray, #e9ecef); +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon { + width: 64px; + height: 64px; + margin-bottom: 12px; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon::after { + width: 64px; + height: 64px; + background-color: var(--directorist-color-primary, #2563eb); + opacity: 0.15; + border-radius: 8px; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-name { + font-size: 12px; + font-weight: 500; + color: var(--directorist-color-body, #374151); + text-align: center; + word-break: break-word; + line-height: 1.4; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + margin-top: 4px; +} + .plupload-thumbs .thumb .thumbi { position: absolute; right: -10px; diff --git a/assets/css/public-main.rtl.css b/assets/css/public-main.rtl.css index c06beb02e..4d3b77b9c 100644 --- a/assets/css/public-main.rtl.css +++ b/assets/css/public-main.rtl.css @@ -5320,8 +5320,11 @@ body.stop-scrolling { width: 100%; top: 0; right: 0; + z-index: 10; + pointer-events: none; } .plupload-thumbs .atbdp-thumb-actions .thumbremovelink { + pointer-events: auto; position: absolute; top: 10px; left: 10px; @@ -5390,6 +5393,84 @@ body.stop-scrolling { z-index: 1; } +.plupload-thumbs .thumb .atbdp-file-wrapper { + -webkit-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + padding: 20px; + background: var(--directorist-color-bg-gray, #f8f9fa); + border-radius: 12px; + cursor: move; + position: relative; + -webkit-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; + z-index: 1; + pointer-events: auto; +} +.plupload-thumbs .thumb .atbdp-file-wrapper:hover { + background: var(--directorist-color-border-gray, #e9ecef); +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon { + width: 64px; + height: 64px; + margin-bottom: 12px; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-icon::after { + width: 64px; + height: 64px; + background-color: var(--directorist-color-primary, #2563eb); + opacity: 0.15; + border-radius: 8px; +} +.plupload-thumbs .thumb .atbdp-file-wrapper .atbdp-file-name { + font-size: 12px; + font-weight: 500; + color: var(--directorist-color-body, #374151); + text-align: center; + word-break: break-word; + line-height: 1.4; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + margin-top: 4px; +} + .plupload-thumbs .thumb .thumbi { position: absolute; left: -10px; diff --git a/assets/js/account.js b/assets/js/account.js index 272bc89b7..6ee162daa 100644 --- a/assets/js/account.js +++ b/assets/js/account.js @@ -315,12 +315,6 @@ jQuery(function ($) { /******/ 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 diff --git a/assets/js/add-listing-google-map.js b/assets/js/add-listing-google-map.js index 470ca6464..702df3318 100644 --- a/assets/js/add-listing-google-map.js +++ b/assets/js/add-listing-google-map.js @@ -73,12 +73,6 @@ function convertToSelect2(selector) { /******/ 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 diff --git a/assets/js/add-listing-openstreet-map.js b/assets/js/add-listing-openstreet-map.js index 9981c91df..ba4bd857f 100644 --- a/assets/js/add-listing-openstreet-map.js +++ b/assets/js/add-listing-openstreet-map.js @@ -101,12 +101,6 @@ function convertToSelect2(selector) { /******/ 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 diff --git a/assets/js/add-listing.js b/assets/js/add-listing.js index 6f30726d9..9c6ae21ab 100644 --- a/assets/js/add-listing.js +++ b/assets/js/add-listing.js @@ -1094,12 +1094,6 @@ function _unsupportedIterableToArray(r, a) { /******/ 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 diff --git a/assets/js/admin-builder-archive.js b/assets/js/admin-builder-archive.js index 8442fae1e..1c91c0555 100644 --- a/assets/js/admin-builder-archive.js +++ b/assets/js/admin-builder-archive.js @@ -2257,12 +2257,6 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"axios","version":"0.21.4","de /******/ 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 diff --git a/assets/js/admin-import-export.js b/assets/js/admin-import-export.js index e64f0242c..57c485b28 100644 --- a/assets/js/admin-import-export.js +++ b/assets/js/admin-import-export.js @@ -109,12 +109,6 @@ function _typeof(o) { /******/ 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 diff --git a/assets/js/admin-main.js b/assets/js/admin-main.js index b296ffd44..efe241400 100644 --- a/assets/js/admin-main.js +++ b/assets/js/admin-main.js @@ -3168,12 +3168,6 @@ function _unsupportedIterableToArray(r, a) { /******/ 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 diff --git a/assets/js/all-authors.js b/assets/js/all-authors.js index affa1b5b9..3f7b2e96e 100644 --- a/assets/js/all-authors.js +++ b/assets/js/all-authors.js @@ -110,12 +110,6 @@ /******/ 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 diff --git a/assets/js/all-listings.js b/assets/js/all-listings.js index 1a6e6e2df..c245ace26 100644 --- a/assets/js/all-listings.js +++ b/assets/js/all-listings.js @@ -3379,12 +3379,6 @@ function _unsupportedIterableToArray(r, a) { /******/ 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 diff --git a/assets/js/all-location-category.js b/assets/js/all-location-category.js index 4de59761e..298f3ce7e 100644 --- a/assets/js/all-location-category.js +++ b/assets/js/all-location-category.js @@ -112,12 +112,6 @@ window.addEventListener('load', function () { /******/ 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 diff --git a/assets/js/author-profile.js b/assets/js/author-profile.js index 5eb17891b..004c21feb 100644 --- a/assets/js/author-profile.js +++ b/assets/js/author-profile.js @@ -335,12 +335,6 @@ window.addEventListener('load', function () { /******/ 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 diff --git a/assets/js/directorist-dashboard.js b/assets/js/directorist-dashboard.js index 1ded7c4e9..b6e944090 100644 --- a/assets/js/directorist-dashboard.js +++ b/assets/js/directorist-dashboard.js @@ -1147,12 +1147,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length) /******/ 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 diff --git a/assets/js/directorist-plupload.js b/assets/js/directorist-plupload.js index b5a72e8c1..23a49a8d7 100644 --- a/assets/js/directorist-plupload.js +++ b/assets/js/directorist-plupload.js @@ -73,12 +73,6 @@ function convertToSelect2(selector) { /******/ 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 @@ -407,25 +401,71 @@ function plu_show_thumbs(imgId) { image_caption_html = '' + image_caption + ''; } } else { - var file_type_class = 'la-file'; + // Map file extensions to Directorist icon classes + var icon_class = 'las 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'; + icon_class = 'fas fa-file-pdf'; + } else if (file_ext == 'zip' || file_ext == 'tar' || file_ext == 'rar' || file_ext == '7z') { + icon_class = 'fas fa-file-archive'; + } else if (file_ext == 'doc' || file_ext == 'docx' || file_ext == 'odt') { + icon_class = 'fas fa-file-word'; } 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'; + icon_class = 'far fa-file-alt'; + } else if (file_ext == 'csv' || file_ext == 'ods' || file_ext == 'ots' || file_ext == 'xls' || file_ext == 'xlsx') { + icon_class = 'fas fa-file-excel'; + } else if (file_ext == 'avi' || file_ext == 'mp4' || file_ext == 'mov' || file_ext == 'wmv' || file_ext == 'flv' || file_ext == 'mkv') { + icon_class = 'fas fa-file-video'; + } else if (file_ext == 'mp3' || file_ext == 'wav' || file_ext == 'ogg' || file_ext == 'm4a' || file_ext == 'flac') { + icon_class = 'fas fa-file-audio'; + } else if (file_ext == 'ppt' || file_ext == 'pptx') { + icon_class = 'fas fa-file-powerpoint'; + } else if (file_ext == 'xps') { + icon_class = 'fas fa-file-alt'; + } + + // Get icon URL using Directorist icon system + var iconURL = ''; + var iconPath = ''; + if (typeof directorist !== 'undefined' && directorist.assets_url) { + // Map icon class to file path + if (icon_class.indexOf('fa-file-pdf') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-pdf.svg'; + } else if (icon_class.indexOf('fa-file-archive') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-archive.svg'; + } else if (icon_class.indexOf('fa-file-word') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-word.svg'; + } else if (icon_class.indexOf('fa-file-alt') !== -1) { + iconPath = 'font-awesome/svgs/regular/file-alt.svg'; + } else if (icon_class.indexOf('fa-file-excel') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-excel.svg'; + } else if (icon_class.indexOf('fa-file-video') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-video.svg'; + } else if (icon_class.indexOf('fa-file-audio') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-audio.svg'; + } else if (icon_class.indexOf('fa-file-powerpoint') !== -1) { + iconPath = 'font-awesome/svgs/solid/file-powerpoint.svg'; + } else { + iconPath = 'font-awesome/svgs/regular/file.svg'; + } + iconURL = directorist.assets_url + 'icons/' + iconPath; + } + + // Generate Directorist icon HTML for file + var fileIconHTML = ''; + if (iconURL && typeof directorist !== 'undefined' && directorist.icon_markup) { + fileIconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', 'atbdp-file-icon'); + } else if (iconURL) { + // Fallback to simple icon if directorist.icon_markup is not available + fileIconHTML = ''; + } else { + // Final fallback - use a generic file icon + fileIconHTML = ''; } file_display_class = 'file-thumb'; - file_display = ''; + file_display = '
    ' + fileIconHTML + '' + atbdp_esc_entities(file_name) + '' + '
    '; } - var iconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/trash-alt.svg'; - var iconHTML = directorist.icon_markup.replace('##URL##', iconURL).replace('##CLASS##', ''); + var removeIconURL = directorist.assets_url + 'icons/font-awesome/svgs/solid/trash-alt.svg'; + var iconHTML = directorist.icon_markup.replace('##URL##', removeIconURL).replace('##CLASS##', ''); var thumb = $('
    ' + image_title_html + file_display + image_caption_html + '
    ' + '' + iconHTML + '' + '
    ' + '
    '); thumbsC.append(thumb); thumb.find('.thumbremovelink').click(function () { diff --git a/assets/js/global-main.js b/assets/js/global-main.js index c8336f204..365f46a67 100644 --- a/assets/js/global-main.js +++ b/assets/js/global-main.js @@ -924,12 +924,6 @@ function _unsupportedIterableToArray(r, a) { /******/ 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 diff --git a/assets/js/global-markerclusterer.js b/assets/js/global-markerclusterer.js index b44bb386f..54de8bc56 100644 --- a/assets/js/global-markerclusterer.js +++ b/assets/js/global-markerclusterer.js @@ -37,12 +37,6 @@ function _typeof(o) { /******/ 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 diff --git a/assets/js/google-map.js b/assets/js/google-map.js index cba290543..bf4c262e7 100644 --- a/assets/js/google-map.js +++ b/assets/js/google-map.js @@ -783,12 +783,6 @@ function convertToSelect2(selector) { /******/ 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 diff --git a/assets/js/openstreet-map.js b/assets/js/openstreet-map.js index 4877f652b..5347152cd 100644 --- a/assets/js/openstreet-map.js +++ b/assets/js/openstreet-map.js @@ -497,12 +497,6 @@ function convertToSelect2(selector) { /******/ 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 diff --git a/assets/js/public-main.js b/assets/js/public-main.js index e09016353..94836ad64 100644 --- a/assets/js/public-main.js +++ b/assets/js/public-main.js @@ -961,12 +961,6 @@ function _unsupportedIterableToArray(r, a) { /******/ 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 diff --git a/assets/js/range-slider.js b/assets/js/range-slider.js index 3f818adfe..8bf4ea905 100644 --- a/assets/js/range-slider.js +++ b/assets/js/range-slider.js @@ -37,12 +37,6 @@ function _typeof(o) { /******/ 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 diff --git a/assets/js/search-form.js b/assets/js/search-form.js index 36945f15b..338e5f389 100644 --- a/assets/js/search-form.js +++ b/assets/js/search-form.js @@ -1504,6 +1504,13 @@ document.addEventListener('DOMContentLoaded', function () { $('body').removeClass('directorist-preload'); $('.button.wp-color-result').attr('style', ' '); + // Escape text for safe HTML insertion (XSS prevention) + function escapeHtml(text) { + var div = document.createElement('div'); + div.textContent = text == null ? '' : String(text); + return div.innerHTML; + } + /* ---------------- Search Form ------------------ */ @@ -2439,7 +2446,7 @@ document.addEventListener('DOMContentLoaded', function () { display: 'block' }); $.ajax({ - url: 'https://nominatim.openstreetmap.org/?q=%27+'.concat(search, '+%27&format=json'), + url: 'https://nominatim.openstreetmap.org/?q=' + encodeURIComponent(search) + '&format=json&limit=5', type: 'GET', data: {}, success: function success(data) { @@ -2452,7 +2459,7 @@ document.addEventListener('DOMContentLoaded', function () { 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, +'
  • '; + res += '
  • ' + locationIconHTML + "" + escapeHtml(String(data[i].display_name || '')) + '
  • '; } function displayLocation(position, event) { var lat = position.coords.latitude; @@ -2804,7 +2811,7 @@ document.addEventListener('DOMContentLoaded', function () { 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"); + url = "https://nominatim.openstreetmap.org/?postalcode=".concat(encodeURIComponent(zipcode), "&format=json&addressdetails=1"); $('.directorist-country').css({ display: 'block' }); @@ -2844,7 +2851,8 @@ document.addEventListener('DOMContentLoaded', function () { zipcode_search.find('.zip-cityLng').val(lon); } else { for (var i = 0; i < data.length; i++) { - res += "
  • ").concat(data[i].address.country, "
  • "); + var country = data[i] && data[i].address && data[i].address.country ? data[i].address.country : ''; + res += '
  • ' + escapeHtml(country) + '
  • '; } } $(country_suggest).html("
      ".concat(res, "
    ")); diff --git a/assets/js/single-listing.js b/assets/js/single-listing.js index 0bf133fcd..549b2bdfa 100644 --- a/assets/js/single-listing.js +++ b/assets/js/single-listing.js @@ -1230,12 +1230,6 @@ function _typeof(o) { /******/ 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 diff --git a/assets/js/widgets.js b/assets/js/widgets.js index 9a861ee0b..5d6f040fb 100644 --- a/assets/js/widgets.js +++ b/assets/js/widgets.js @@ -112,12 +112,6 @@ window.addEventListener('load', function () { /******/ 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 diff --git a/assets/src/js/global/directorist-plupload.js b/assets/src/js/global/directorist-plupload.js index 98215efe4..fd09afe64 100644 --- a/assets/src/js/global/directorist-plupload.js +++ b/assets/src/js/global/directorist-plupload.js @@ -438,9 +438,18 @@ function plu_show_thumbs(imgId) { var icon_class = 'las la-file'; if (file_ext == 'pdf') { icon_class = 'fas fa-file-pdf'; - } else if (file_ext == 'zip' || file_ext == 'tar' || file_ext == 'rar' || file_ext == '7z') { + } else if ( + file_ext == 'zip' || + file_ext == 'tar' || + file_ext == 'rar' || + file_ext == '7z' + ) { icon_class = 'fas fa-file-archive'; - } else if (file_ext == 'doc' || file_ext == 'docx' || file_ext == 'odt') { + } else if ( + file_ext == 'doc' || + file_ext == 'docx' || + file_ext == 'odt' + ) { icon_class = 'fas fa-file-word'; } else if (file_ext == 'txt' || file_ext == 'text') { icon_class = 'far fa-file-alt'; @@ -478,8 +487,11 @@ function plu_show_thumbs(imgId) { // Get icon URL using Directorist icon system var iconURL = ''; var iconPath = ''; - - if (typeof directorist !== 'undefined' && directorist.assets_url) { + + if ( + typeof directorist !== 'undefined' && + directorist.assets_url + ) { // Map icon class to file path if (icon_class.indexOf('fa-file-pdf') !== -1) { iconPath = 'font-awesome/svgs/solid/file-pdf.svg'; @@ -495,8 +507,11 @@ function plu_show_thumbs(imgId) { iconPath = 'font-awesome/svgs/solid/file-video.svg'; } else if (icon_class.indexOf('fa-file-audio') !== -1) { iconPath = 'font-awesome/svgs/solid/file-audio.svg'; - } else if (icon_class.indexOf('fa-file-powerpoint') !== -1) { - iconPath = 'font-awesome/svgs/solid/file-powerpoint.svg'; + } else if ( + icon_class.indexOf('fa-file-powerpoint') !== -1 + ) { + iconPath = + 'font-awesome/svgs/solid/file-powerpoint.svg'; } else { iconPath = 'font-awesome/svgs/regular/file.svg'; } @@ -505,16 +520,24 @@ function plu_show_thumbs(imgId) { // Generate Directorist icon HTML for file var fileIconHTML = ''; - if (iconURL && typeof directorist !== 'undefined' && directorist.icon_markup) { + if ( + iconURL && + typeof directorist !== 'undefined' && + directorist.icon_markup + ) { fileIconHTML = directorist.icon_markup .replace('##URL##', iconURL) .replace('##CLASS##', 'atbdp-file-icon'); } else if (iconURL) { // Fallback to simple icon if directorist.icon_markup is not available - fileIconHTML = ''; + fileIconHTML = + ''; } else { // Final fallback - use a generic file icon - fileIconHTML = ''; + fileIconHTML = + ''; } file_display_class = 'file-thumb'; diff --git a/assets/src/js/public/search-form.js b/assets/src/js/public/search-form.js index 79c49e3c6..fcf20d826 100644 --- a/assets/src/js/public/search-form.js +++ b/assets/src/js/public/search-form.js @@ -224,6 +224,13 @@ document.addEventListener('DOMContentLoaded', () => { $('body').removeClass('directorist-preload'); $('.button.wp-color-result').attr('style', ' '); + // Escape text for safe HTML insertion (XSS prevention) + function escapeHtml(text) { + const div = document.createElement('div'); + div.textContent = text == null ? '' : String(text); + return div.innerHTML; + } + /* ---------------- Search Form ------------------ */ @@ -1726,10 +1733,10 @@ document.addEventListener('DOMContentLoaded', () => { }); $.ajax({ - url: 'https://nominatim.openstreetmap.org/?q=%27+'.concat( - search, - '+%27&format=json' - ), + url: + 'https://nominatim.openstreetmap.org/?q=' + + encodeURIComponent(search) + + '&format=json&limit=5', type: 'GET', data: {}, success: function success(data) { @@ -1773,16 +1780,26 @@ document.addEventListener('DOMContentLoaded', () => { i < len; i++ ) { - ((res += - '
  • ' + + res += + '
  • ' + locationIconHTML + "" + - data[i].display_name), - +'
  • '); + escapeHtml( + String( + data[i] + .display_name || + '' + ) + ) + + ''; } function displayLocation( @@ -2335,7 +2352,9 @@ document.addEventListener('DOMContentLoaded', () => { if (directorist.i18n_text.select_listing_map === 'google') { var url = directorist.ajax_url; } else { - url = `https://nominatim.openstreetmap.org/?postalcode=${zipcode}&format=json&addressdetails=1`; + url = `https://nominatim.openstreetmap.org/?postalcode=${encodeURIComponent( + zipcode + )}&format=json&addressdetails=1`; $('.directorist-country').css({ display: 'block', @@ -2386,7 +2405,20 @@ document.addEventListener('DOMContentLoaded', () => { zipcode_search.find('.zip-cityLng').val(lon); } else { for (let i = 0; i < data.length; i++) { - res += `
  • ${data[i].address.country}
  • `; + let country = + data[i] && + data[i].address && + data[i].address.country + ? data[i].address.country + : ''; + res += + '
  • ' + + escapeHtml(country) + + '
  • '; } }