1!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict"; 2var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];// Substring before ... 1x 3u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded:function(){}};function A(t){t.setAttribute("data-loaded",!0)}var m=function(t){return"true"===t.getAttribute("data-loaded")},v=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;return t instanceof Element?[t]:t instanceof NodeList?t:e.querySelectorAll(t)};return function(){var r,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:".lozad",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign({},f,t),i=e.root,n=e.rootMargin,d=e.threshold,u=e.load,g=e.loaded,s=void 0;"undefined"!=typeof window&&window.IntersectionObserver&&(s=new IntersectionObserver((r=u,a=g,function(t,e){t.forEach(function(t){(0<t.intersectionRatio||t.isIntersecting)&&(e.unobserve(t.target),m(t.target)||(r(t.target),A(t.target),a(t.target)))})}),{root:i,rootMargin:n,threshold:d}));for(var c,l=v(o,i),b=0;b<l.length;b++)(c=l[b]).getAttribute("data-placeholder-background")&&(c.style.background=c.getAttribute("data-placeholder-background"));return{observe:function(){for(var t=v(o,i),e=0;e<t.length;e++)m(t[e])||(s?s.observe(t[e]):(u(t[e]),A(t[e]),g(t[e])))},triggerLoad:function(t){m(t)||(u(t),A(t),g(t))},observer:s}}}); 4 5var $ = jQuery.noConflict(); 6jQuery(document).ready(function($) { 7 8 var m_debug = false; 9 10 var m_html = $(document).find( 'html' ); 11 var m_body = m_html.find( 'body' ); 12 13 var m_blv_commercants = null; 14 var m_blv_commercantsTable = null; 15 var m_blv_displayLength = 5; 16 var m_blv_current_cat = null; 17 var m_blv_reset = null; 18 var m_com_filters = null; 19 var m_blv_list = null; 20 var m_blv_searchCustom = null; 21 var m_blv_searchCustomCat = null; 22 23 if( 24 m_body.hasClass( 'page-template-page-commercants' ) 25 && m_body.find( '#blv-table-commercants' ).length > 0 26 && m_body.find( '#commercants-current-category' ).length > 0 27 && m_body.find( '#blv-commercants-reset' ).length > 0 28 ) 29 { 30 m_com_filters = m_body.find( '.commercants-filter ul.filters-list' ); 31 m_blv_commercantsTable = m_body.find( '#blv-table-commercants' ); 32 m_blv_current_cat = m_body.find( '#commercants-current-category' ); 33 m_blv_reset = m_body.find( '#blv-commercants-reset'); 34 m_blv_list = m_body.find( '.commercants-listing' ); 35 m_blv_searchCustom = m_body.find( '.blv-search-custom' ); 36 37 if( m_blv_commercantsTable.data( 'displaylength' ) !== undefined ) 38 { 39 m_blv_displayLength = parseInt( m_blv_commercantsTable.data( 'displaylength' ) ); 40 } 41 42 if( m_com_filters.length > 0 ) 43 { 44 init_commercants(); 45 } 46 } 47 48 function init_commercants() 49 { 50 if( m_debug ) console.log( "** init commercants", m_blv_displayLength ) 51 52 m_html.addClass( 'blv-commercants' ); 53 54 const observer = lozad(); // lazy loads elements with default selector as '.lozad' 55 observer.observe(); 56 57 m_blv_commercants = new DataTable( '#blv-table-commercants', { 58 iDisplayLength: m_blv_displayLength, 59 lengthMenu: [ 60 [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, -1], 61 [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 'All'] 62 ], 63 order: [ [0, "asc"] ], 64 ordering: false, 65 bLengthChange: false, 66 bInfo : false, 67 language: {
68 "url": window['base_url'] + "wp-content/themes/ktemplates/assets/lang/dataTables.french.lang" 69 } 70 }); 71 72 m_blv_searchCustomCat = $(document).find( 'input#search-commercants-cat' ); 73 74 m_blv_searchCustom.find( 'input[type="search"]' ).on( 'keyup', function( e ) { 75 blv_custom_search( $(this) ); 76 } ); 77 78 m_blv_searchCustom.find( 'input[type="search"]' ).on( 'change', function( e ) { 79 blv_custom_search( $(this) ); 80 } ); 81 82 function blv_custom_search( input ) 83 { 84 var t_customSearch = input.val(); 85 86 if( m_blv_commercants !== null ) 87 { 88 if( 89 m_blv_searchCustomCat.length > 0 90 && m_blv_searchCustomCat.val() !== "" 91 ) 92 { 93 t_customSearch = m_blv_searchCustomCat.val() + " " + t_customSearch; 94 } 95 96 m_blv_commercants.search( t_customSearch ).draw(); 97 m_blv_reset.addClass( 'enabled' ); 98 } 99 } 100 101 $(document).on( 'click', '#blv-commercants-reset', function( e) { 102 e.preventDefault(); 103 104 m_blv_searchCustom.find( 'input[type="search"]' ).val( '' ); 105 m_blv_searchCustomCat.val( '' ); 106 m_blv_commercants.search( "" ).draw(); 107 m_com_filters.find( '.term-child-item.active' ).removeClass( 'active' ); 108 m_blv_current_cat.html( "" ); 109 m_blv_current_cat.addClass( 'category-disabled' ); 110 m_blv_reset.removeClass( 'enabled' ); 111 } ); 112 113 // parent click 114 $(document).on( 'click', 'body.page-template-page-commercants .commercants-filter ul.filters-list > li > a.term-parent-item', function( e ) { 115 e.preventDefault(); 116 117 var t_parent_link = $(this); 118 var t_parent_button = t_parent_link.parent(); 119 if( t_parent_button.length > 0 ) 120 { 121 if( 122 t_parent_button.data( 'termid' ) !== undefined 123 && t_parent_link.attr( 'href' ) !== undefined 124 ) 125 { 126 var t_parent_id = t_parent_button.data( 'termid' ); 127 var t_parent_slug = t_parent_link.attr( 'href' ).replace( '#', '' ); 128 var t_parent_fullname = t_parent_button.data( 'fullname' ); 129 var t_parent_search = t_parent_button.data( 'search' ); 130 131 if( m_debug ) console.log( "** com parent id : " + t_parent_id ) 132 133 m_com_filters.find( '.term-child-item.active' ).removeClass( 'active' ); 134 135 if( t_parent_button.hasClass( 'opened' ) ) 136 { 137 // close it 138 t_parent_button.removeClass( 'opened' ); 139 140 //window.location.hash = ""; 141 } 142 else 143 { 144 m_com_filters.find( '> li.term-parent.opened' ).removeClass( 'opened' ); 145 t_parent_button.addClass( 'opened' ); 146 147 if( m_blv_commercants !== null ) 148 { 149 m_blv_searchCustom.find( 'input[type="search"]' ).val( '' ); 150 m_blv_searchCustomCat.val( t_parent_search ); 151 m_blv_commercants.search( t_parent_search ).draw(); 152 153 m_blv_current_cat.html( t_parent_fullname ); 154 m_blv_current_cat.removeClass( 'category-disabled' ); 155 m_blv_reset.addClass( 'enabled' ); 156 } 157 158 window.location.hash = t_parent_slug; 159 160 //blv_commercants_scroll_top(); 161 } 162 } 163 } 164 } ); 165 166 function blv_commercants_scroll_top() 167 { 168 if( 169 m_blv_list.length > 0 170 && m_blv_list !== null 171 ) 172 { 173 $( 'body, html' ).animate( { scrollTop: m_blv_list.offset().top }, 200 ); 174 } 175 } 176 177 // child click 178 $(document).on( 'click', 'body.page-template-page-commercants .commercants-filter ul.filters-list > li > ul.term-submenu > li.term-child-item > a', function( e ) { 179 e.preventDefault(); 180 181 var t_child_link = $(this); 182 var t_child_button = t_child_link.parent(); 183 if( t_child_button.length > 0 ) 184 { 185 if( 186 t_child_button.data( 'termid' ) !== undefined 187 && t_child_button.data( 'parentid' ) !== undefined 188 && t_child_button.data( 'fullname' ) !== undefined 189 && t_child_button.data( 'search' ) !== undefined 190 && t_child_link.attr( 'href' ) !== undefined 191 ) 192 { 193 var t_child_id = t_child_button.data( 'termid' ); 194 var t_child_parent_id = t_child_button.data( 'parentid' ); 195 var t_child_fullname = t_child_button.data( 'fullname' ); 196 var t_child_search = t_child_button.data( 'search' ); 197 198 var t_child_slug = t_child_link.attr( 'href' ).replace( '#', '' ); 199 200 if( m_debug ) console.log( "** com child id : " + t_child_id + " / " + "com child parent id : " + t_child_parent_id ) 201 202 if( t_child_button.hasClass( 'active' ) ) 203 { 204 // do nothing 205 } 206 else 207 { 208 m_com_filters.find( 'li.term-child-item.active' ).removeClass( 'active' ); 209 t_child_button.addClass( 'active' ); 210 211 if( m_blv_commercants !== null ) 212 {
213 m_blv_searchCustom.find( 'input[type="search"]' ).val( '' ); 214 m_blv_searchCustomCat.val( t_child_search ); 215 m_blv_commercants.search( t_child_search ).draw(); 216 217 m_blv_current_cat.html( t_child_fullname ); 218 m_blv_current_cat.removeClass( 'category-disabled' ); 219 m_blv_reset.addClass( 'enabled' ); 220 } 221 222 window.location.hash = t_child_slug; 223 224 blv_commercants_scroll_top(); 225 } 226 } 227 } 228 } ); 229 } 230 231});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.