<?xml version='1.0' encoding='UTF-8'?><uidget><metadata><name>Recherche</name><api_version>1.0</api_version><size height='40' width='255' /><server>local://SearchCptServer</server><blog en='1136' /></metadata><view><content>&lt;div class=&quot;ui27_search&quot;&gt;&lt;/div&gt;</content><properties><option default='&apos;pages,products,store_categories,articles,blog_categories&apos;' display='Pages|FAQ|Textes|Modules Téléchargement|Sujets de forum|Produits de boutique|Catégories de boutique|Articles de blog|Catégories de blog' help='Dans quel contenu souhaitez-vous que ce module recherche' name='search_types' prop_switch='true' separator=',' title='Rechercher dans' values='pages|faqs|texts|files|forum_topics|products|store_categories|articles|blog_categories' /><inputText default='&apos;Rechercher...&apos;' name='placeholder' placeholder='Rechercher...' title='Texte d&apos;aide' /></properties><design_properties><trigger_preset class='gtsearchbox_prop_custom' gt_type='searchbox' help='Sélectionnez un style prédéfini pour le champ de recherche de la boutique' icon='palette' mode='select' name='searchbox_preset' text='Style de la recherche' /><checkbox default='true' name='display_submit' value='Afficher le bouton de validation' /><inputText class='prop_submit' default='&apos;&apos;' name='submit_text' placeholder='Texte du bouton' title='Texte du bouton' /><checkbox class='prop_submit' default='true' help='Choisissez une icône à afficher dans le bouton de validation' name='display_icon' value='Afficher une icône dans le bouton' /><icon_selector class='prop_submit prop_icon' default='{id: 2509, name: "search", service: "Google-material-icons", removable: false, tags: ""}' icon='folder' name='submit_icon' title='Icône' value='Icône du bouton' /></design_properties></view><script>UI_Search={suggestions:{},clear_suggestions:function(){
this.suggestions={}},custom_cache:function(t,e,s){
var i=this.suggestions[e.cache_key()],n=null
;if(i)s?i[t]=s||{}:n=i[t];else{
this.suggestions[e.cache_key()]={}
;s&amp;&amp;(this.suggestions[e.cache_key()][t]=s||{})}return n}}
;UI_List.UI_Search={initialize:function(t){this.cpt=t
;t.setOptions([&quot;locked&quot;,&quot;fixed&quot;,&quot;footer&quot;,&quot;sticky&quot;])},
onDisplay:function(t){$.extend(this,componentSearchBar);this.n={
node:t,
size_getter_el:$(&quot;&lt;div&gt;&lt;/div&gt;&quot;).appendTo(t).css(&quot;clear&quot;,&quot;both&quot;),
search:$(&quot;div.ui27_search&quot;,t)};this._buildSearchBar()
;this.n.node.css(&quot;overflow&quot;,&quot;visible&quot;);this._setButton()
;this._setAlignment();this.applyPreset()
;this.cpt.use_graphical_preset(&quot;searchbox&quot;,[&quot;searchbox_preset&quot;])
},onSelect:function(){this._showProp()},
onPropertyChanged:function(t){if(t.include(&quot;search_types&quot;)){
this._buildSearchBar();this._setButton()
;UI_Search.clear_suggestions()}
t.include(&quot;placeholder&quot;)&amp;&amp;this._setPlaceholder()
;if(t.include(&quot;display_submit&quot;)||t.include(&quot;submit_text&quot;)||t.include(&quot;display_icon&quot;)||t.include(&quot;submit_icon&quot;)){
this._showProp();this._setButton()}
t.include(&quot;searchbox_preset&quot;)&amp;&amp;this.applyPreset()},
onResizeStop:function(){this.cpt.setSize({
h:Math.max(this.cpt.H(),20),w:Math.max(this.cpt.W(),255)})
;this._searchBarSuggestionsDisplayed(!0);this._setAlignment()},
onMoveStop:function(){this._searchBarSuggestionsDisplayed(!0)
;this._setAlignment()},_refreshNodes:function(){
$.extend(this.n,{input:$(&quot;div.ui27_search input&quot;,this.n.node),
search_btn:$(&quot;div.ui_btn.ui27_btn&quot;,this.n.node),
search_close_btn:$(&quot;div.ui_close_search&quot;,this.n.node),
search_counter:$(&quot;div.ui27_nbr_search_results&quot;,this.n.node),
suggestions_list:$(&quot;div.ui_search_suggest&quot;,this.n.node)})},
_showProp:function(){if(&quot;viewer&quot;!=v.mode){
var t=$(this.cpt.propertyNode).add(this.cpt.propertyDesignNode)
;$(&quot;.prop_submit&quot;,t).toggle(this.cpt.data.display_submit)
;$(&quot;.prop_icon&quot;,t).toggle(this.cpt.data.display_icon&amp;&amp;this.cpt.data.display_submit)
}},_buildSearchBar:function(){var t={products:{
product:&quot;Produits de boutique&quot;},articles:{
article:&quot;Articles de blog&quot;},forum_topics:{
forum_topic:&quot;Forum topics&quot;},store_categories:{
store_category:&quot;Cat\xe9gories de boutique&quot;},blog_categories:{
blog_category:&quot;Cat\xe9gories de blog&quot;},pages:{page:&quot;Pages&quot;},
faqs:{faq:&quot;FAQ&quot;},texts:{text:&quot;Textes&quot;},files:{
file:&quot;Fichier \xe0 t\xe9l\xe9charger&quot;},words:{word:&quot;Mots&quot;}}
;0==this.cpt.data.search_types.length&amp;&amp;(this.cpt.data.search_types=&quot;pages,products,store_categories,articles,blog_categories&quot;)
;var e=this.cpt.data.search_types.split(&quot;,&quot;)
;e.include(&quot;texts&quot;)&amp;&amp;!e.include(&quot;pages&quot;)&amp;&amp;(e=e.insertAt(&quot;pages&quot;,0))
;var s=e.collect(function(e){return t[e]}),i={}
;$.each(s,function(e){
$.extend(i,t[Object.keys(t)[Object.values(t).indexOf(Object.values(t).find(function(t){
return Object.keys(t)[0]==Object.keys(s[e])[0]}))]])})
;var n=[[&quot;words&quot;,&quot;files&quot;,&quot;faqs&quot;,&quot;texts&quot;,&quot;pages&quot;,&quot;blog_categories&quot;,&quot;store_categories&quot;],[&quot;forum_topics&quot;,&quot;articles&quot;,&quot;products&quot;]],c=e.collect(function(t){
return[t,2*(n.indexOf(n.find(function(e){return e.include(t)
}))+1),n[0].concat(n[1]).indexOf(t)]}).sort(function(t,e){
return t[2]&lt;e[2]}),a={};c.forEach(function(t){
a[t[1]]=(a[t[1]]||0)+1;a.total=(a.total||0)+t[1]})
;if(a[2]%2&gt;0)if(a.total&lt;4)for(var r=0;c.map(function(t){
return t[1]}).reduce(function(t,e){return t+e})&lt;4;){
c[Math.min(r,c.length-1)][1]++;r++}else{
var o=c.find_all(function(t){return 2==t[1]}).map(function(t){
return t.concat(n[0].length-n[0].indexOf(t[0]))})
;(o=o.sort(function(t,e){return t[2]&gt;e[2]
}).slice(0,2)).each(function(t){c.find(function(e){
return e[0]==t[0]})[1]--})}
this.n.node.find(&quot;.ui27_search&quot;).html(&quot;&quot;).generateComponentSearchbar({
type:&quot;search&quot;,placeholder:this.cpt.data.placeholder,types:i,
sort:c.map(function(e){return[Object.keys(t[e[0]])[0],e[1]]}),
show_more_only:[&quot;article&quot;,&quot;product&quot;]});this._refreshNodes()
;this.bindSearch()},_setPlaceholder:function(){
this.n.input.attr(&quot;placeholder&quot;,this.cpt.data.placeholder)},
_setButton:function(){
var t=this.cpt.data.display_submit&amp;&amp;(this.cpt.data.submit_text.length&gt;0||this.cpt.data.display_icon)
;this.n.search_btn.toggle(t)
;this.n.search.toggleClass(&quot;ui27_no_btn&quot;,!t)
;this.n.search_close_btn.toggle(!1)
;this.n.search_btn.html(&quot;&quot;).append($(&apos;&lt;span class=&quot;fonticon&quot;&gt;&lt;/span&gt;&apos;).setIcon(this.cpt.data.submit_icon).toggle(this.cpt.data.display_icon)).append($(&quot;&lt;span&gt;&lt;/span&gt;&quot;).html(this.cpt.data.submit_text))
},_setAlignment:function(){
[&quot;mobile_tree&quot;,&quot;mobile&quot;].include(deviceController.device)&amp;&amp;this.n.suggestions_list.css({
left:&quot;auto&quot;,right:&quot;&quot;})
;var t=[this.cpt.X(),this.cpt.X()+this.cpt.W()]
;t[0]&lt;=0&amp;&amp;t[1]&gt;0?this.n.suggestions_list.css({
left:-(this.n.suggestions_list.width()-this.n.node.width())/2,
right:&quot;&quot;}):t[1]&lt;0?this.n.suggestions_list.css({right:&quot;&quot;,left:0
}):t[0]&gt;=0&amp;&amp;this.n.suggestions_list.css({right:0,left:&quot;&quot;})},
custom_suggestions_call:function(t){var e=this,s=[]
;this.cpt.data.search_types.split(&quot;,&quot;).each(function(i){
s.push(e.cpt.ask({request:&quot;search_suggest&quot;,query:t,
version_id:v.id,only:[i],all:&quot;editor&quot;==v.mode},function(t){
return t}).then(function(s){var n=UI_Search.custom_cache(t,e)
;if(n){[&quot;texts&quot;].includeOne([i])?s.results.each(function(t){
if(!n.results.find(function(e){
return&quot;page&quot;==e[1]&amp;&amp;e[2][1]==t[2][1]})){
var e=Math.max(0,n.results.findIndex(function(t){
return&quot;page&quot;==t[1]}));n.results=n.results.insertAt(t,e)}
}):n.results=n.results.concat(s.results)
;s.more&amp;&amp;$.extend(n.more,s.more)
}else UI_Search.custom_cache(t,e,s);return s}))});return s},
_searchBarSuggestionsDisplayed:function(t){var e={},s=[]
;t&amp;&amp;this.n.suggestions_list.show()
;var i=$(&quot;.ui_search_suggest &gt; div:visible&quot;,this.n.node)
;i.each(function(t,i){
$(i).removeClassMatch(/ui_suggest_length_(\d)/)
;var n=$(i).data(&quot;sort&quot;);e[n]=(e[n]||0)+1;e.total=(e.total||0)+n
;s.push(n)})
;if(e[2]%2&gt;0&amp;&amp;!t)if(e.total&lt;4)for(var n=0;s.reduce(function(t,e){
return t+e})&lt;4;){s[Math.min(n,s.length-1)]++;n++
}else for(;s.reduce(function(t,e){return t+e
})%2&gt;0;)s=s.slice().slice(0,s.length-2).concat(s.slice().slice(s.length-2,s.length).map(function(t){
return Math.max(1,t-1)}));i.each(function(t,e){
$(e).addClass(&quot;ui_suggest_length_&quot;+s[t])})
;var c,a=Math.max(0,s.length&gt;0?Math.ceil(s.reduce(function(t,e){
return t+e})/4):0),r=this.cpt.W()
;c=1==a?r:r&lt;450?Math.max(a*Math.min(200,r),r):Math.max(200*a,r)
;if([&quot;mobile_tree&quot;,&quot;mobile&quot;].include(deviceController.device))this.n.node.find(&quot;.ui_search_suggest&quot;).css({
width:&quot;100%&quot;,left:&quot;auto&quot;});else{
this.n.node.find(&quot;.ui_search_suggest&quot;).css({width:c,
gridTemplateColumns:&quot;repeat(&quot;+a+&quot;, 1fr)&quot;});this._setAlignment()}
t&amp;&amp;this.n.suggestions_list.hide()},cache_key:function(){
return this.cpt.data.search_types.split(&quot;,&quot;).map(function(t){
return t.slice(0,3)}).sort().join(&quot;&quot;)},applyPreset:function(){
if(GraphicalType.available){
var t=GraphicalType.graphical_types.searchbox.preset_data.prefix
;this.n.search.removeClassMatch(new RegExp(t))
;var e=this.cpt.getGTPreset(&quot;searchbox&quot;,&quot;searchbox_preset&quot;)
;e&amp;&amp;this.n.search.addClass(t+&quot; &quot;+t+&quot;_&quot;+e)}}};</script><style>.UI_Search .ui27_search div:first-child div:first-child{width:100%}
.UI_Search .ui27_search .ui_btn{float:none}
.UI_Search .ui27_search .ui_btn .ui27_btn{margin:8px}
.UI_Search input{width:100%;height:30px}
.UI_Search .ui_search_suggest&gt;div&gt;div{padding:10px 6px;background-color:#fff;transition:background-color .2s linear;position:relative;display:flex;align-items:center}
.UI_Search .ui_search_suggest&gt;div&gt;div:hover{background-color:#f4f4f4}
.UI_Search .ui_search_suggest{background-color:transparent;border-radius:0 0 5px 5px;display:grid;grid-template-rows:auto auto auto auto;grid-auto-flow:column}
.UI_Search .ui_search_suggest .ui_suggest_more{float:right;margin:2px;cursor:pointer}
.UI_Search .ui_search_suggest&gt;div{box-sizing:border-box}
.UI_Search .ui_suggest_length_4{grid-row-end:span 4}
.UI_Search .ui_suggest_length_2{grid-row-end:span 2}
.UI_Search .ui_suggest_length_1{grid-row-end:span 1}
.UI_Search .site_search{box-sizing:border-box}
.UI_Search .component_searchbar .ui_search_suggest h3{background-color:#f4f4f4;padding:10px 6px;cursor:default;font-size:16px;border-bottom:1px solid #dedede}
.UI_Search .component_searchbar .ui_search_suggest{border-color:transparent}
.UI_Search .component_searchbar .ui_suggest_product img,.UI_Search .component_searchbar .ui_suggest_article img{max-width:64px;max-height:64px;top:auto}
.UI_Search .component_searchbar .ui_search_suggest .highlight{color:#000}
.UI_Search .component_searchbar .ui27_price{font-weight:700}
.UI_Search .component_searchbar .ui_result_available{border-color:#f4f4f4;box-shadow:0 5px 25px rgba(175,175,175,.2);background:#fff}</style></uidget>