Version Description
- Fixed - AJAX search results displaying out of viewport.
- Fixed - AJAX search results Undefined index notices.
- Fixed - AJAX search results displays on wrong location on scroll.
- Fixed - Searching exact words with " " quote marks.
Download this release
Release Info
Developer | vinod dalvi |
Plugin | Ivory Search – WordPress Search Plugin |
Version | 4.4.3 |
Comparing to | |
See all releases |
Code changes from version 4.4.2 to 4.4.3
- add-search-to-menu.php +2 -3
- languages/default.po +2 -2
- public/class-is-ajax.php +22 -22
- public/class-is-public.php +3 -1
- public/js/ivory-ajax-search.js +45 -15
- readme.txt +7 -1
add-search-to-menu.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Ivory Search
|
4 |
* Plugin URI: https://ivorysearch.com
|
5 |
* Description: The WordPress Search plugin that includes Search Form Customizer, WooCommerce Search, Image Search, Search Shortcode, AJAX Search & Live Search support!
|
6 |
-
* Version: 4.4.
|
7 |
* Author: Ivory Search
|
8 |
* Author URI: https://ivorysearch.com/
|
9 |
* License: GPL2+
|
@@ -106,8 +106,7 @@ final class Ivory_Search {
|
|
106 |
*/
|
107 |
private function define_constants() {
|
108 |
|
109 |
-
define( 'IS_VERSION', '4.4.
|
110 |
-
|
111 |
define( 'IS_PLUGIN_FILE', __FILE__ );
|
112 |
define( 'IS_PLUGIN_BASE', plugin_basename( IS_PLUGIN_FILE ) );
|
113 |
define( 'IS_PLUGIN_DIR', plugin_dir_path( IS_PLUGIN_FILE ) );
|
3 |
* Plugin Name: Ivory Search
|
4 |
* Plugin URI: https://ivorysearch.com
|
5 |
* Description: The WordPress Search plugin that includes Search Form Customizer, WooCommerce Search, Image Search, Search Shortcode, AJAX Search & Live Search support!
|
6 |
+
* Version: 4.4.3
|
7 |
* Author: Ivory Search
|
8 |
* Author URI: https://ivorysearch.com/
|
9 |
* License: GPL2+
|
106 |
*/
|
107 |
private function define_constants() {
|
108 |
|
109 |
+
define( 'IS_VERSION', '4.4.3' );
|
|
|
110 |
define( 'IS_PLUGIN_FILE', __FILE__ );
|
111 |
define( 'IS_PLUGIN_BASE', plugin_basename( IS_PLUGIN_FILE ) );
|
112 |
define( 'IS_PLUGIN_DIR', plugin_dir_path( IS_PLUGIN_FILE ) );
|
languages/default.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Ivory Search\n"
|
4 |
-
"POT-Creation-Date: 2019-
|
5 |
-
"PO-Revision-Date: 2019-
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: Ivory Search <admin@ivorysearch.com>\n"
|
8 |
"Language: en_US\n"
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Ivory Search\n"
|
4 |
+
"POT-Creation-Date: 2019-12-18 18:40+0530\n"
|
5 |
+
"PO-Revision-Date: 2019-12-18 18:40+0530\n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: Ivory Search <admin@ivorysearch.com>\n"
|
8 |
"Language: en_US\n"
|
public/class-is-ajax.php
CHANGED
@@ -78,7 +78,7 @@ class IS_Ajax {
|
|
78 |
$field = wp_parse_args( $stored_field, $defaults );
|
79 |
$posts_class = 'is-show-details-disabled';
|
80 |
|
81 |
-
if( $field['show_details_box'] ) {
|
82 |
$posts_class = 'is-show-details-enabled';
|
83 |
}
|
84 |
?>
|
@@ -87,7 +87,7 @@ class IS_Ajax {
|
|
87 |
<?php } ?>
|
88 |
<?php
|
89 |
// Show matching tags.
|
90 |
-
if( $field['show_matching_tags'] && 1 == $page ) {
|
91 |
$this->term_title_markup( array(
|
92 |
'taxonomy' => 'product_tag',
|
93 |
'search_term' => $search_term,
|
@@ -97,7 +97,7 @@ class IS_Ajax {
|
|
97 |
}
|
98 |
|
99 |
// Show matching categories.
|
100 |
-
if( $field['show_matching_categories'] && 1 == $page ) {
|
101 |
$this->term_title_markup( array(
|
102 |
'taxonomy' => 'product_cat',
|
103 |
'search_term' => $search_term,
|
@@ -130,7 +130,7 @@ class IS_Ajax {
|
|
130 |
if( 'product' === $post->post_type && function_exists( 'wc_get_product' ) ) {
|
131 |
$product = wc_get_product( $post->ID );
|
132 |
$product_class = 'is-product';
|
133 |
-
if ( $field['show_sale_badge'] ) {
|
134 |
$on_sale = ( $product->is_in_stock() ) ? $product->is_on_sale() : '';
|
135 |
if ( $on_sale ) {
|
136 |
$product_class .= ' is-has-badge';
|
@@ -211,13 +211,13 @@ class IS_Ajax {
|
|
211 |
?>
|
212 |
</div>
|
213 |
<?php } ?>
|
214 |
-
<?php if( $field['show_details_box'] ) { ?>
|
215 |
<div id="is-ajax-search-details-<?php echo $search_post_id; ?>" class="is-ajax-search-details">
|
216 |
<div class="is-ajax-search-items">
|
217 |
<?php
|
218 |
if ( 1 == $page ) {
|
219 |
// Show product details by "tags".
|
220 |
-
if( $field['show_matching_tags'] ) {
|
221 |
$this->product_details_markup( array(
|
222 |
'taxonomy' => 'product_tag',
|
223 |
'search_term' => $search_term,
|
@@ -229,7 +229,7 @@ class IS_Ajax {
|
|
229 |
|
230 |
<?php
|
231 |
// Show product details by "categories".
|
232 |
-
if( $field['show_matching_categories'] ) {
|
233 |
$this->product_details_markup( array(
|
234 |
'taxonomy' => 'product_cat',
|
235 |
'search_term' => $search_term,
|
@@ -247,7 +247,7 @@ class IS_Ajax {
|
|
247 |
$product_class = '';
|
248 |
if( 'product' === $post->post_type && function_exists( 'wc_get_product' ) ) {
|
249 |
$product = wc_get_product( $post->ID );
|
250 |
-
if ( $field['show_sale_badge'] ) {
|
251 |
$on_sale = ( $product->is_in_stock() ) ? $product->is_on_sale() : '';
|
252 |
if ( $on_sale ) {
|
253 |
$product_class .= ' is-has-badge';
|
@@ -572,7 +572,7 @@ class IS_Ajax {
|
|
572 |
} else if( has_post_thumbnail( $post->ID ) ) {
|
573 |
$image = get_the_post_thumbnail( $post->ID, $image_size );
|
574 |
}
|
575 |
-
if( $field['show_image'] && ! empty( $image ) ) { ?>
|
576 |
<div class="left-section">
|
577 |
<div class="thumbnail">
|
578 |
<a href="<?php echo get_the_permalink( $post->ID ); ?>"><?php echo $image; ?></a>
|
@@ -596,7 +596,7 @@ class IS_Ajax {
|
|
596 |
?>
|
597 |
<div class="is-title">
|
598 |
<a href="<?php echo get_the_permalink( $post->ID ); ?>">
|
599 |
-
<?php if( $product && $field['show_featured_icon'] && $product->is_featured() ) { ?>
|
600 |
<svg class="is-featured-icon" version="1.1" viewBox="0 0 20 21" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink">
|
601 |
<g fill-rule="evenodd" stroke="none" stroke-width="1"><g transform="translate(-296.000000, -422.000000)"><g transform="translate(296.000000, 422.500000)"><path d="M10,15.273 L16.18,19 L14.545,11.971 L20,7.244 L12.809,6.627 L10,0 L7.191,6.627 L0,7.244 L5.455,11.971 L3.82,19 L10,15.273 Z"></path></g></g></g>
|
602 |
</svg>
|
@@ -637,7 +637,7 @@ class IS_Ajax {
|
|
637 |
* @return void
|
638 |
*/
|
639 |
function date_markup( $field, $post ) {
|
640 |
-
if( $field['show_date'] ) { ?>
|
641 |
<span class="meta-date">
|
642 |
<span class="posted-on">
|
643 |
<?php
|
@@ -667,7 +667,7 @@ class IS_Ajax {
|
|
667 |
* @return void
|
668 |
*/
|
669 |
function tags_markup( $field, $post ) {
|
670 |
-
if ( $field['show_tags'] ) { ?>
|
671 |
<?php $terms = get_the_terms( $post->ID, $post->post_type.'_tag' );
|
672 |
if ( $terms && ! is_wp_error( $terms ) ) { ?>
|
673 |
<span class="is-meta-tag">
|
@@ -690,7 +690,7 @@ class IS_Ajax {
|
|
690 |
* @return void
|
691 |
*/
|
692 |
function categories_markup( $field, $post ) {
|
693 |
-
if ( $field['show_categories'] ) { ?>
|
694 |
<?php
|
695 |
$tax_name = ( 'post' === $post->post_type ) ? 'category' : $post->post_type.'_cat';
|
696 |
$terms = get_the_terms( $post->ID, $tax_name );
|
@@ -717,15 +717,15 @@ class IS_Ajax {
|
|
717 |
function description_markup( $field, $post, $single = false ) {
|
718 |
|
719 |
// Description either content or excerpt.
|
720 |
-
if ( $field['show_description'] ) {
|
721 |
|
722 |
-
$excerpt_length = ! empty( $field['description_length'] ) ? absint( $field['description_length'] ) : 20;
|
723 |
|
724 |
$content = strip_tags( strip_shortcodes( $post->post_content ) );
|
725 |
|
726 |
if ( $single ) {
|
727 |
$excerpt_length = 100;
|
728 |
-
} else if ( 'excerpt' === $field['description_source'] ) {
|
729 |
$content = get_the_excerpt( $post->ID );
|
730 |
}
|
731 |
|
@@ -755,7 +755,7 @@ class IS_Ajax {
|
|
755 |
|
756 |
if( $product ) {
|
757 |
// Show stock status.
|
758 |
-
if( $field['show_stock_status'] ) {
|
759 |
$stock_status = ( $product->is_in_stock() ) ? 'in-stock' : 'out-of-stock';
|
760 |
$stock_status_text = ( 'in-stock' == $stock_status ) ? __( 'In stock', 'ivory-search' ) : __( 'Out of stock', 'ivory-search' );
|
761 |
echo '<span class="stock-status is-'.$stock_status.'">'.$stock_status_text.'</span>';
|
@@ -775,7 +775,7 @@ class IS_Ajax {
|
|
775 |
function product_sku_markup( $field, $product ) {
|
776 |
if ( $product ) {
|
777 |
// Show SKU.
|
778 |
-
if( $field['show_sku'] ) {
|
779 |
$sku = $product->get_sku();
|
780 |
echo '<span class="sku"><i>SKU:</i> '.esc_html( $sku ).'</span>';
|
781 |
}
|
@@ -793,10 +793,10 @@ class IS_Ajax {
|
|
793 |
*/
|
794 |
function product_price_markup( $field, $product ) {
|
795 |
|
796 |
-
$hide_price_out_of_stock = ( $field['hide_price_out_of_stock'] ) ? $field['hide_price_out_of_stock'] : false;
|
797 |
|
798 |
if ( $product ) {
|
799 |
-
if ( $field['show_price'] ) {
|
800 |
if ( $product->is_in_stock() || false === $hide_price_out_of_stock ) {?>
|
801 |
<span class="is-prices">
|
802 |
<?php
|
@@ -819,9 +819,9 @@ class IS_Ajax {
|
|
819 |
* @return void
|
820 |
*/
|
821 |
function product_sale_badge_markup( $field, $product ) {
|
822 |
-
if( $product ) {
|
823 |
// Show sale badge.
|
824 |
-
if( $field['show_sale_badge'] ) {
|
825 |
$on_sale = ( $product->is_in_stock() ) ? $product->is_on_sale() : '';
|
826 |
if( $on_sale ) {
|
827 |
echo '<div class="is-sale-badge">'.__( 'Sale!', 'ivory-search' ) .'</div>';
|
78 |
$field = wp_parse_args( $stored_field, $defaults );
|
79 |
$posts_class = 'is-show-details-disabled';
|
80 |
|
81 |
+
if( isset( $field['show_details_box'] ) ) {
|
82 |
$posts_class = 'is-show-details-enabled';
|
83 |
}
|
84 |
?>
|
87 |
<?php } ?>
|
88 |
<?php
|
89 |
// Show matching tags.
|
90 |
+
if( isset( $field['show_matching_tags'] ) && 1 == $page ) {
|
91 |
$this->term_title_markup( array(
|
92 |
'taxonomy' => 'product_tag',
|
93 |
'search_term' => $search_term,
|
97 |
}
|
98 |
|
99 |
// Show matching categories.
|
100 |
+
if( isset( $field['show_matching_categories'] ) && 1 == $page ) {
|
101 |
$this->term_title_markup( array(
|
102 |
'taxonomy' => 'product_cat',
|
103 |
'search_term' => $search_term,
|
130 |
if( 'product' === $post->post_type && function_exists( 'wc_get_product' ) ) {
|
131 |
$product = wc_get_product( $post->ID );
|
132 |
$product_class = 'is-product';
|
133 |
+
if ( isset( $field['show_sale_badge'] ) ) {
|
134 |
$on_sale = ( $product->is_in_stock() ) ? $product->is_on_sale() : '';
|
135 |
if ( $on_sale ) {
|
136 |
$product_class .= ' is-has-badge';
|
211 |
?>
|
212 |
</div>
|
213 |
<?php } ?>
|
214 |
+
<?php if( isset( $field['show_details_box'] ) ) { ?>
|
215 |
<div id="is-ajax-search-details-<?php echo $search_post_id; ?>" class="is-ajax-search-details">
|
216 |
<div class="is-ajax-search-items">
|
217 |
<?php
|
218 |
if ( 1 == $page ) {
|
219 |
// Show product details by "tags".
|
220 |
+
if( isset( $field['show_matching_tags'] ) ) {
|
221 |
$this->product_details_markup( array(
|
222 |
'taxonomy' => 'product_tag',
|
223 |
'search_term' => $search_term,
|
229 |
|
230 |
<?php
|
231 |
// Show product details by "categories".
|
232 |
+
if( isset( $field['show_matching_categories'] ) ) {
|
233 |
$this->product_details_markup( array(
|
234 |
'taxonomy' => 'product_cat',
|
235 |
'search_term' => $search_term,
|
247 |
$product_class = '';
|
248 |
if( 'product' === $post->post_type && function_exists( 'wc_get_product' ) ) {
|
249 |
$product = wc_get_product( $post->ID );
|
250 |
+
if ( isset( $field['show_sale_badge'] ) ) {
|
251 |
$on_sale = ( $product->is_in_stock() ) ? $product->is_on_sale() : '';
|
252 |
if ( $on_sale ) {
|
253 |
$product_class .= ' is-has-badge';
|
572 |
} else if( has_post_thumbnail( $post->ID ) ) {
|
573 |
$image = get_the_post_thumbnail( $post->ID, $image_size );
|
574 |
}
|
575 |
+
if ( isset( $field['show_image'] ) && ! empty( $image ) ) { ?>
|
576 |
<div class="left-section">
|
577 |
<div class="thumbnail">
|
578 |
<a href="<?php echo get_the_permalink( $post->ID ); ?>"><?php echo $image; ?></a>
|
596 |
?>
|
597 |
<div class="is-title">
|
598 |
<a href="<?php echo get_the_permalink( $post->ID ); ?>">
|
599 |
+
<?php if( $product && isset( $field['show_featured_icon'] ) && $product->is_featured() ) { ?>
|
600 |
<svg class="is-featured-icon" version="1.1" viewBox="0 0 20 21" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink">
|
601 |
<g fill-rule="evenodd" stroke="none" stroke-width="1"><g transform="translate(-296.000000, -422.000000)"><g transform="translate(296.000000, 422.500000)"><path d="M10,15.273 L16.18,19 L14.545,11.971 L20,7.244 L12.809,6.627 L10,0 L7.191,6.627 L0,7.244 L5.455,11.971 L3.82,19 L10,15.273 Z"></path></g></g></g>
|
602 |
</svg>
|
637 |
* @return void
|
638 |
*/
|
639 |
function date_markup( $field, $post ) {
|
640 |
+
if ( $field['show_date'] ) { ?>
|
641 |
<span class="meta-date">
|
642 |
<span class="posted-on">
|
643 |
<?php
|
667 |
* @return void
|
668 |
*/
|
669 |
function tags_markup( $field, $post ) {
|
670 |
+
if ( isset( $field['show_tags'] ) ) { ?>
|
671 |
<?php $terms = get_the_terms( $post->ID, $post->post_type.'_tag' );
|
672 |
if ( $terms && ! is_wp_error( $terms ) ) { ?>
|
673 |
<span class="is-meta-tag">
|
690 |
* @return void
|
691 |
*/
|
692 |
function categories_markup( $field, $post ) {
|
693 |
+
if ( isset( $field['show_categories'] ) ) { ?>
|
694 |
<?php
|
695 |
$tax_name = ( 'post' === $post->post_type ) ? 'category' : $post->post_type.'_cat';
|
696 |
$terms = get_the_terms( $post->ID, $tax_name );
|
717 |
function description_markup( $field, $post, $single = false ) {
|
718 |
|
719 |
// Description either content or excerpt.
|
720 |
+
if ( isset( $field['show_description'] ) ) {
|
721 |
|
722 |
+
$excerpt_length = ( isset( $field['description_length'] ) && ! empty( $field['description_length'] ) ) ? absint( $field['description_length'] ) : 20;
|
723 |
|
724 |
$content = strip_tags( strip_shortcodes( $post->post_content ) );
|
725 |
|
726 |
if ( $single ) {
|
727 |
$excerpt_length = 100;
|
728 |
+
} else if ( isset( $field['description_source'] ) && 'excerpt' === $field['description_source'] ) {
|
729 |
$content = get_the_excerpt( $post->ID );
|
730 |
}
|
731 |
|
755 |
|
756 |
if( $product ) {
|
757 |
// Show stock status.
|
758 |
+
if( isset( $field['show_stock_status'] ) ) {
|
759 |
$stock_status = ( $product->is_in_stock() ) ? 'in-stock' : 'out-of-stock';
|
760 |
$stock_status_text = ( 'in-stock' == $stock_status ) ? __( 'In stock', 'ivory-search' ) : __( 'Out of stock', 'ivory-search' );
|
761 |
echo '<span class="stock-status is-'.$stock_status.'">'.$stock_status_text.'</span>';
|
775 |
function product_sku_markup( $field, $product ) {
|
776 |
if ( $product ) {
|
777 |
// Show SKU.
|
778 |
+
if( isset( $field['show_sku'] ) ) {
|
779 |
$sku = $product->get_sku();
|
780 |
echo '<span class="sku"><i>SKU:</i> '.esc_html( $sku ).'</span>';
|
781 |
}
|
793 |
*/
|
794 |
function product_price_markup( $field, $product ) {
|
795 |
|
796 |
+
$hide_price_out_of_stock = isset( $field['hide_price_out_of_stock'] ) ? $field['hide_price_out_of_stock'] : false;
|
797 |
|
798 |
if ( $product ) {
|
799 |
+
if ( isset( $field['show_price'] ) ) {
|
800 |
if ( $product->is_in_stock() || false === $hide_price_out_of_stock ) {?>
|
801 |
<span class="is-prices">
|
802 |
<?php
|
819 |
* @return void
|
820 |
*/
|
821 |
function product_sale_badge_markup( $field, $product ) {
|
822 |
+
if ( $product ) {
|
823 |
// Show sale badge.
|
824 |
+
if ( isset( $field['show_sale_badge'] ) ) {
|
825 |
$on_sale = ( $product->is_in_stock() ) ? $product->is_on_sale() : '';
|
826 |
if( $on_sale ) {
|
827 |
echo '<div class="is-sale-badge">'.__( 'Sale!', 'ivory-search' ) .'</div>';
|
public/class-is-public.php
CHANGED
@@ -612,7 +612,9 @@ class IS_Public
|
|
612 |
// skip processing
|
613 |
} else {
|
614 |
if ( is_array( $q['search_terms'] ) && 1 == count( $q['search_terms'] ) ) {
|
615 |
-
|
|
|
|
|
616 |
}
|
617 |
}
|
618 |
|
612 |
// skip processing
|
613 |
} else {
|
614 |
if ( is_array( $q['search_terms'] ) && 1 == count( $q['search_terms'] ) ) {
|
615 |
+
if ( 0 !== strpos( $q['s'], '"' ) ) {
|
616 |
+
$q['search_terms'] = explode( ' ', $q['search_terms'][0] );
|
617 |
+
}
|
618 |
}
|
619 |
}
|
620 |
|
public/js/ivory-ajax-search.js
CHANGED
@@ -46,18 +46,27 @@
|
|
46 |
var form_id = $( event.target ).closest('.is-ajax-search').attr('data-form-id');
|
47 |
var pos = $( event.target ).closest('.is-ajax-search').offset();
|
48 |
var height = $( event.target ).closest('.is-ajax-search').outerHeight();
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
$('#is-ajax-search-result-'+form_id).css({
|
50 |
top: (pos.top+height) + "px",
|
51 |
-
left: (pos.left) + "px"
|
52 |
});
|
53 |
$( '.is-ajax-search-result, .is-ajax-search-details' ).hide();
|
54 |
$('#is-ajax-search-result-'+form_id).show();
|
55 |
|
56 |
-
if ( 0 !== $( '#is-ajax-search-details-'+form_id )
|
57 |
-
var
|
|
|
|
|
|
|
58 |
$('#is-ajax-search-details-'+form_id).css({
|
59 |
top: (pos.top+height) + "px",
|
60 |
-
left: (
|
61 |
});
|
62 |
}
|
63 |
}
|
@@ -98,24 +107,34 @@
|
|
98 |
});
|
99 |
|
100 |
$(window).on('resize scroll', function(){
|
101 |
-
$(
|
102 |
-
|
103 |
-
var
|
104 |
-
var
|
|
|
105 |
if ( 0 !== $('#is-ajax-search-result-'+form_id).length ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
$('#is-ajax-search-result-'+form_id).css({
|
107 |
top: (pos.top+height) + "px",
|
108 |
-
left: (pos.left) + "px"
|
109 |
});
|
110 |
if ( 0 !== $('#is-ajax-search-details-'+form_id).length ) {
|
111 |
-
var
|
|
|
|
|
|
|
112 |
$('#is-ajax-search-details-'+form_id).css({
|
113 |
top: (pos.top+height) + "px",
|
114 |
-
left: (
|
115 |
});
|
116 |
}
|
117 |
}
|
118 |
-
}
|
119 |
});
|
120 |
|
121 |
$('.is-ajax-search .is-search-input').on('paste', function() {
|
@@ -195,12 +214,20 @@
|
|
195 |
if ( 1 === page ) {
|
196 |
var pos = search_form.offset();
|
197 |
var height = search_form.outerHeight();
|
|
|
198 |
if ( 0 === $('#is-ajax-search-result-'+form_id).length ) {
|
199 |
$('body').append( '<div id="is-ajax-search-result-'+form_id+'" class="is-ajax-search-result"></div>' );
|
200 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
$('#is-ajax-search-result-'+form_id).css({
|
202 |
top: (pos.top+height) + "px",
|
203 |
-
left: (pos.left) + "px"
|
204 |
});
|
205 |
$('#is-ajax-search-result-'+form_id).show().html( data );
|
206 |
if ( 0 !== $('#is-ajax-search-details-'+form_id).length ) {
|
@@ -209,10 +236,13 @@
|
|
209 |
if ( 0 !== $( '#is-ajax-search-result-'+form_id + ' .is-ajax-search-details' ) .length ) {
|
210 |
$('body').append( '<div id="is-ajax-search-details-'+form_id+'" class="is-ajax-search-details">' + $( '#is-ajax-search-result-'+form_id + ' .is-ajax-search-details' ).html() + '</div>' );
|
211 |
$( '#is-ajax-search-result-'+form_id + ' .is-ajax-search-details' ).remove();
|
212 |
-
var
|
|
|
|
|
|
|
213 |
$('#is-ajax-search-details-'+form_id).css({
|
214 |
top: (pos.top+height) + "px",
|
215 |
-
left: (
|
216 |
});
|
217 |
}
|
218 |
} else {
|
46 |
var form_id = $( event.target ).closest('.is-ajax-search').attr('data-form-id');
|
47 |
var pos = $( event.target ).closest('.is-ajax-search').offset();
|
48 |
var height = $( event.target ).closest('.is-ajax-search').outerHeight();
|
49 |
+
var result_width = $( '#is-ajax-search-result-'+form_id ).outerWidth();
|
50 |
+
var window_width = $(window).width();
|
51 |
+
var reduce_left_pos = 0;
|
52 |
+
if ( ( pos.left + result_width ) > window_width ) {
|
53 |
+
reduce_left_pos = ( pos.left + result_width ) - window_width;
|
54 |
+
}
|
55 |
$('#is-ajax-search-result-'+form_id).css({
|
56 |
top: (pos.top+height) + "px",
|
57 |
+
left: (pos.left-reduce_left_pos) + "px"
|
58 |
});
|
59 |
$( '.is-ajax-search-result, .is-ajax-search-details' ).hide();
|
60 |
$('#is-ajax-search-result-'+form_id).show();
|
61 |
|
62 |
+
if ( 0 !== $( '#is-ajax-search-details-'+form_id ).length ) {
|
63 |
+
var details_left = pos.left+result_width;
|
64 |
+
if ( 0 !== reduce_left_pos ) {
|
65 |
+
details_left = pos.left - ( reduce_left_pos + $( '#is-ajax-search-details-'+form_id ).outerWidth());
|
66 |
+
}
|
67 |
$('#is-ajax-search-details-'+form_id).css({
|
68 |
top: (pos.top+height) + "px",
|
69 |
+
left: (details_left) + "px"
|
70 |
});
|
71 |
}
|
72 |
}
|
107 |
});
|
108 |
|
109 |
$(window).on('resize scroll', function(){
|
110 |
+
var focused = $( document.activeElement ).closest('form');;
|
111 |
+
if ( $( focused ).hasClass( 'is-ajax-search' ) ) {
|
112 |
+
var form_id = $( focused ).attr( 'data-form-id' );
|
113 |
+
var pos = $( focused ).offset();
|
114 |
+
var height = $( focused ).outerHeight();
|
115 |
if ( 0 !== $('#is-ajax-search-result-'+form_id).length ) {
|
116 |
+
var result_width = $( '#is-ajax-search-result-'+form_id ).outerWidth();
|
117 |
+
var window_width = $(window).width();
|
118 |
+
var reduce_left_pos = 0;
|
119 |
+
if ( ( pos.left + result_width ) > window_width ) {
|
120 |
+
reduce_left_pos = ( pos.left + result_width ) - window_width;
|
121 |
+
}
|
122 |
$('#is-ajax-search-result-'+form_id).css({
|
123 |
top: (pos.top+height) + "px",
|
124 |
+
left: (pos.left-reduce_left_pos) + "px"
|
125 |
});
|
126 |
if ( 0 !== $('#is-ajax-search-details-'+form_id).length ) {
|
127 |
+
var details_left = pos.left+result_width;
|
128 |
+
if ( 0 !== reduce_left_pos ) {
|
129 |
+
details_left = pos.left - ( reduce_left_pos + $( '#is-ajax-search-details-'+form_id ).outerWidth());
|
130 |
+
}
|
131 |
$('#is-ajax-search-details-'+form_id).css({
|
132 |
top: (pos.top+height) + "px",
|
133 |
+
left: (details_left) + "px"
|
134 |
});
|
135 |
}
|
136 |
}
|
137 |
+
}
|
138 |
});
|
139 |
|
140 |
$('.is-ajax-search .is-search-input').on('paste', function() {
|
214 |
if ( 1 === page ) {
|
215 |
var pos = search_form.offset();
|
216 |
var height = search_form.outerHeight();
|
217 |
+
|
218 |
if ( 0 === $('#is-ajax-search-result-'+form_id).length ) {
|
219 |
$('body').append( '<div id="is-ajax-search-result-'+form_id+'" class="is-ajax-search-result"></div>' );
|
220 |
}
|
221 |
+
|
222 |
+
var result_width = $( '#is-ajax-search-result-'+form_id ).outerWidth();
|
223 |
+
var window_width = $(window).width();
|
224 |
+
var reduce_left_pos = 0;
|
225 |
+
if ( ( pos.left + result_width ) > window_width ) {
|
226 |
+
reduce_left_pos = ( pos.left + result_width ) - window_width;
|
227 |
+
}
|
228 |
$('#is-ajax-search-result-'+form_id).css({
|
229 |
top: (pos.top+height) + "px",
|
230 |
+
left: (pos.left-reduce_left_pos) + "px"
|
231 |
});
|
232 |
$('#is-ajax-search-result-'+form_id).show().html( data );
|
233 |
if ( 0 !== $('#is-ajax-search-details-'+form_id).length ) {
|
236 |
if ( 0 !== $( '#is-ajax-search-result-'+form_id + ' .is-ajax-search-details' ) .length ) {
|
237 |
$('body').append( '<div id="is-ajax-search-details-'+form_id+'" class="is-ajax-search-details">' + $( '#is-ajax-search-result-'+form_id + ' .is-ajax-search-details' ).html() + '</div>' );
|
238 |
$( '#is-ajax-search-result-'+form_id + ' .is-ajax-search-details' ).remove();
|
239 |
+
var details_left = pos.left+result_width;
|
240 |
+
if ( 0 !== reduce_left_pos ) {
|
241 |
+
details_left = pos.left - ( reduce_left_pos + $( '#is-ajax-search-details-'+form_id ).outerWidth());
|
242 |
+
}
|
243 |
$('#is-ajax-search-details-'+form_id).css({
|
244 |
top: (pos.top+height) + "px",
|
245 |
+
left: (details_left) + "px"
|
246 |
});
|
247 |
}
|
248 |
} else {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: search, woocommerce search, image search, ajax search, search shortcode, l
|
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.2.4
|
8 |
-
Stable tag: 4.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -192,6 +192,12 @@ Yes we do. We try our best to help free users with customisation requests and we
|
|
192 |
|
193 |
== Changelog ==
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
= 4.4.2 =
|
196 |
* Improved - Ajax search results scrolls with search form.
|
197 |
* Added - is_search_form_autocomplete filter to remove autocomplete from search field.
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.2.4
|
8 |
+
Stable tag: 4.4.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
192 |
|
193 |
== Changelog ==
|
194 |
|
195 |
+
= 4.4.3 =
|
196 |
+
* Fixed - AJAX search results displaying out of viewport.
|
197 |
+
* Fixed - AJAX search results Undefined index notices.
|
198 |
+
* Fixed - AJAX search results displays on wrong location on scroll.
|
199 |
+
* Fixed - Searching exact words with " " quote marks.
|
200 |
+
|
201 |
= 4.4.2 =
|
202 |
* Improved - Ajax search results scrolls with search form.
|
203 |
* Added - is_search_form_autocomplete filter to remove autocomplete from search field.
|