diff --git a/README.md b/README.md
index c4bdfa1..3ffda75 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
**Tags:** customizer, search
**Requires at least:** 4.4
**Tested up to:** 4.9.4
-**Stable tag:** 1.1.0
+**Stable tag:** 1.1.1
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
@@ -14,13 +14,7 @@ Search for settings in customizer.
Using a theme powered by the WordPress Customizer? Then you will love this plugin. Save the time and frustration finding options. Simply search for the setting you're looking for and get there instantly.
-Works with all WordPress theme. Tested with:
-
-1. Astra
-2. GeneratePress
-3. OceanWP
-4. Hestia
-5. Sydney
+Works with all WordPress theme.
https://www.youtube.com/watch?v=81LSHXHw058
@@ -32,6 +26,10 @@ https://www.youtube.com/watch?v=81LSHXHw058
## Changelog ##
+### 1.1.1 ###
+- Highlight the characters that are matched in the results.
+- Auto focus the search input when the search icon is clicked.
+
### 1.1.0 ###
- Rewrite the search logic to improve the search results.
- The search results are direct links to the customizer panel where the searched setting resides, This improves the required clicks to get to the search setting from old version.
diff --git a/assets/css/customizer-search-admin.css b/assets/css/customizer-search-admin.css
index 39dd445..a483478 100644
--- a/assets/css/customizer-search-admin.css
+++ b/assets/css/customizer-search-admin.css
@@ -125,4 +125,8 @@
#search-results .accordion-section h3:hover {
background: inherit;
+}
+
+#customize-controls .hl {
+ background: #ffc600;
}
\ No newline at end of file
diff --git a/assets/js/customizer-search-admin.compiled.js b/assets/js/customizer-search-admin.compiled.js
index 9175262..2598225 100644
--- a/assets/js/customizer-search-admin.compiled.js
+++ b/assets/js/customizer-search-admin.compiled.js
@@ -1 +1 @@
-(function(a){var b="";CustomizerSearchAdmin={_init:function _init(){this._bind();var c=a.map(_wpCustomizeSettings.controls,function(b){return a.map(_wpCustomizeSettings.sections,function(c){b.section==c.id&&a.map(_wpCustomizeSettings.panels,function(a){""==c.panel&&(b.panelName=c.title),c.panel==a.id&&(b.sectionName=c.title,b.panel=c.panel,b.panelName=a.title)})}),[b]});b=document.getElementById("customize-theme-controls"),customizePanelsParent=a("#customize-theme-controls"),customizePanelsParent.after("
"),a(document).on("keyup","#customizer-search-input",function(b){b.preventDefault(),$this=a("#customizer-search-input"),string=$this.val(),0\n \n ").concat(a.label,"\n Press return or enter to open this section\n
\n ").concat(b,"\n \n ")}}).join(""),b.classList.add("search-not-found"),document.getElementById("search-results").innerHTML="");var e=document.querySelectorAll("#search-results .accordion-section");e.forEach(function(a){return a.addEventListener("click",CustomizerSearchAdmin.expandSection)})}},findMatches:function findMatches(a,b){return b.filter(function(b){null==b.panelName&&(b.panelName=""),null==b.sectionName&&(b.sectionName="");var c=new RegExp(a,"gi");return b.label.match(c)||b.panelName.match(c)||b.sectionName.match(c)})},_bind:function _bind(){wp.customize.previewer.targetWindow.bind(a.proxy(this._showSearchButtonToggle,this))},_showSearchButtonToggle:function _showSearchButtonToggle(){var b=wp.template("search-button");0==a("#customize-info .accordion-section-title .customize-search-toggle").length&&a("#customize-info .accordion-section-title").append(b());var b=wp.template("search-form");0==a("#customize-info #accordion-section-customizer-search").length&&a("#customize-info .customize-panel-description").after(b())},_display_search_form:function _display_search_form(){a("#accordion-section-customizer-search").hasClass("open")?(a("#accordion-section-customizer-search").removeClass("open"),a("#accordion-section-customizer-search").slideUp("fast")):(a(".customize-panel-description").removeClass("open"),a(".customize-panel-description").slideUp("fast"),a("#accordion-section-customizer-search").addClass("open"),a("#accordion-section-customizer-search").slideDown("fast"))},_clearSearch:function _clearSearch(){var b=document.getElementById("customize-theme-controls");b.classList.remove("search-not-found"),document.getElementById("search-results").innerHTML="",document.getElementById("customizer-search-input").value="",a("#customizer-search-input").focus()}},a(function(){CustomizerSearchAdmin._init()})})(jQuery);
+(function(a){var b="";CustomizerSearchAdmin={_init:function _init(){this._bind();var c=a.map(_wpCustomizeSettings.controls,function(b){return a.map(_wpCustomizeSettings.sections,function(c){b.section==c.id&&a.map(_wpCustomizeSettings.panels,function(a){""==c.panel&&(b.panelName=c.title),c.panel==a.id&&(b.sectionName=c.title,b.panel=c.panel,b.panelName=a.title)})}),[b]});b=document.getElementById("customize-theme-controls"),customizePanelsParent=a("#customize-theme-controls"),customizePanelsParent.after(""),a(document).on("keyup","#customizer-search-input",function(b){b.preventDefault(),$this=a("#customizer-search-input"),string=$this.val(),0".concat(a,""));return c=c.replace(d,"".concat(a,"")),"\n \n \n ").concat(e,"\n Press return or enter to open this section\n
\n ").concat(c,"\n \n ")}}).join(""),b.classList.add("search-not-found"),document.getElementById("search-results").innerHTML="");var e=document.querySelectorAll("#search-results .accordion-section");e.forEach(function(a){return a.addEventListener("click",CustomizerSearchAdmin.expandSection)})}},findMatches:function findMatches(a,b){return b.filter(function(b){null==b.panelName&&(b.panelName=""),null==b.sectionName&&(b.sectionName="");var c=new RegExp(a,"gi");return b.label.match(c)||b.panelName.match(c)||b.sectionName.match(c)})},_bind:function _bind(){wp.customize.previewer.targetWindow.bind(a.proxy(this._showSearchButtonToggle,this))},_showSearchButtonToggle:function _showSearchButtonToggle(){var b=wp.template("search-button");0==a("#customize-info .accordion-section-title .customize-search-toggle").length&&a("#customize-info .accordion-section-title").append(b());var b=wp.template("search-form");0==a("#customize-info #accordion-section-customizer-search").length&&a("#customize-info .customize-panel-description").after(b())},_display_search_form:function _display_search_form(){a("#accordion-section-customizer-search").hasClass("open")?(a("#accordion-section-customizer-search").removeClass("open"),a("#accordion-section-customizer-search").slideUp("fast")):(a(".customize-panel-description").removeClass("open"),a(".customize-panel-description").slideUp("fast"),a("#accordion-section-customizer-search").addClass("open"),a("#accordion-section-customizer-search").slideDown("fast")),a("#customizer-search-input").focus()},_clearSearch:function _clearSearch(){var b=document.getElementById("customize-theme-controls");b.classList.remove("search-not-found"),document.getElementById("search-results").innerHTML="",document.getElementById("customizer-search-input").value="",a("#customizer-search-input").focus()}},a(function(){CustomizerSearchAdmin._init()})})(jQuery);
diff --git a/assets/js/customizer-search-admin.js b/assets/js/customizer-search-admin.js
index 06b8821..0942cd4 100644
--- a/assets/js/customizer-search-admin.js
+++ b/assets/js/customizer-search-admin.js
@@ -105,10 +105,15 @@
settingTrail = `${settingTrail} ▸ ${index.sectionName}`;
}
+ const regex = new RegExp(stringToMatch, 'gi');
+
+ const label = index.label.replace(regex, `${stringToMatch}`);
+ settingTrail = settingTrail.replace(regex, `${stringToMatch}`);
+
return `
- ${index.label}
+ ${label}
Press return or enter to open this section
${settingTrail}
@@ -125,10 +130,11 @@
findMatches: function (stringToMatch, controls) {
return controls.filter(control => {
- // here we need to figure out if the city or state matches what was searched.
+
if (control.panelName == null) control.panelName = '';
if (control.sectionName == null) control.sectionName = '';
+ // Search for the stringToMatch from control label, Panel Name, Section Name.
const regex = new RegExp(stringToMatch, 'gi');
return control.label.match(regex) || control.panelName.match(regex) || control.sectionName.match(regex)
});
@@ -178,6 +184,8 @@
$('#accordion-section-customizer-search').slideDown('fast');
}
+ $(searchInputSelector).focus();
+
},
/**
diff --git a/class-customizer-search.php b/class-customizer-search.php
index 8066ab6..5808c7b 100644
--- a/class-customizer-search.php
+++ b/class-customizer-search.php
@@ -53,7 +53,7 @@ private function hooks() {
*/
public function enqueue_scripts() {
wp_enqueue_style( 'customizer-search-admin', BSFCS_URL . 'assets/css/customizer-search-admin.css', array(), BSFCS_VER );
- wp_enqueue_script( 'customizer-search-admin', BSFCS_URL . 'assets/js/customizer-search-admin.compiled.js', array(), BSFCS_VER, true );
+ wp_enqueue_script( 'customizer-search-admin', BSFCS_URL . 'assets/js/customizer-search-admin.compiled.js', array(), filemtime( BSFCS_DIR . 'assets/js/customizer-search-admin.compiled.js' ), true );
}
/**
diff --git a/customizer-search.php b/customizer-search.php
index 454cf10..06aa940 100644
--- a/customizer-search.php
+++ b/customizer-search.php
@@ -7,12 +7,12 @@
* Author URI: https://www.brainstormforce.com/
* Text Domain: customizer-search
* Domain Path: /languages
- * Version: 1.1.0
+ * Version: 1.1.1
*
* @package Customizer_Search
*/
-define( 'BSFCS_VER', '1.1.0' );
+define( 'BSFCS_VER', '1.1.1' );
define( 'BSFCS_DIR', plugin_dir_path( __FILE__ ) );
define( 'BSFCS_URL', plugins_url( '/', __FILE__ ) );
define( 'BSFCS_PATH', plugin_basename( __FILE__ ) );
diff --git a/languages/customizer-search.pot b/languages/customizer-search.pot
index f4e36fc..bf12e5b 100644
--- a/languages/customizer-search.pot
+++ b/languages/customizer-search.pot
@@ -2,10 +2,10 @@
# This file is distributed under the same license as the Customizer Search package.
msgid ""
msgstr ""
-"Project-Id-Version: Customizer Search 1.1.0\n"
+"Project-Id-Version: Customizer Search 1.1.1\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/customizer-search\n"
-"POT-Creation-Date: 2018-03-03 10:43:17+00:00\n"
+"POT-Creation-Date: 2018-03-04 05:02:50+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/package.json b/package.json
index e8edc56..d0edbe0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "customizer-search",
- "version": "1.1.0",
+ "version": "1.1.1",
"main": "Gruntfile.js",
"author": "Nikhil Chavan",
"scripts": {
diff --git a/readme.txt b/readme.txt
index 845c07d..a1eb52e 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce
Tags: customizer, search
Requires at least: 4.4
Tested up to: 4.9.4
-Stable tag: 1.1.0
+Stable tag: 1.1.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -14,13 +14,7 @@ Search for settings in customizer.
Using a theme powered by the WordPress Customizer? Then you will love this plugin. Save the time and frustration finding options. Simply search for the setting you're looking for and get there instantly.
-Works with all WordPress theme. Tested with:
-
-1. Astra
-2. GeneratePress
-3. OceanWP
-4. Hestia
-5. Sydney
+Works with all WordPress theme.
https://www.youtube.com/watch?v=81LSHXHw058
@@ -32,6 +26,10 @@ https://www.youtube.com/watch?v=81LSHXHw058
== Changelog ==
+= 1.1.1 =
+- Highlight the characters that are matched in the results.
+- Auto focus the search input when the search icon is clicked.
+
= 1.1.0 =
- Rewrite the search logic to improve the search results.
- The search results are direct links to the customizer panel where the searched setting resides, This improves the required clicks to get to the search setting from old version.