// source --> https://www.degatec.com/wp-content/plugins/search-in-place/js/codepeople_shearch_in_place.js?ver=1.0.74 var codepeople_search_in_place_generator = function (){ var $ = jQuery; if('undefined' != typeof codepeople_search_in_place_generator_flag) return; codepeople_search_in_place_generator_flag = true; function isMobile() { try{ document.createEvent("TouchEvent"); return true; } catch(e){ return false; } } var popup_is_visible = false, clickOnLink = function(evt) { var url = $(this).find('a').attr('href'); if(url) { switch (evt.which) { case 2: let _win = window.open(url, '_blank'); _win.blur(); window.focus(); break; case 3: return; case 1: default: document.location = url; } } }, hideResultsPopUp = function(force) { if( force || (popup_is_visible && $('input[name="s"]:focus').length == 0 && $('.search-in-place:hover').length == 0) ) { $('.search-in-place-close-icon').remove(); $('.search-in-place').hide(); popup_is_visible = false; } }, scrollToTerm = function(e) { var y = e.offset().top - (window.innerHeight / 2); setTimeout( function() { window.scrollTo( { top: y, left: 0, behavior: 'smooth' } ), 100 } ); }, searchInPlace = function() { $('[data-search-in-page]') .data('enter-counter', 0) .on('click', function(){$(this).data('enter-counter', 0)}) .closest('form') .on('submit', function(evt){ evt.preventDefault();evt.stopPropagation(); var s = $('[data-search-in-page]', this), i = s.data('enter-counter'), e = $('.search-in-place-mark:eq('+i+')'); if(e.length) { scrollToTerm(e); s.data('enter-counter', i+1); } else s.data('enter-counter', 0); hideResultsPopUp(true); return false; }).each(function(){ if(!($('[data-display-button]', this).data('display-button')*1)) $(this).find('button,input[type="submit"],input[type="button"]') .remove(); }); if(jQuery.fn.on){ $(document).on('mouseover mouseout', '.search-in-place>.item', function(evt){$(this).toggleClass('active');}) .on('mousedown', '.search-in-place>.item', clickOnLink) .on('mousedown', '.search-in-place>.label.more', clickOnLink); }else{ $('.search-in-place>.item').live('mouseover mouseout', function(evt){$(this).toggleClass('active');}) .live('mousedown', clickOnLink) .live('mousedown', '.search-in-place>.label.more', clickOnLink); } }; searchInPlace.prototype = { active : null, search : '', config:{ min : codepeople_search_in_place.char_number, image_width : 50, image_height : 50, colors : ('highlight_colors' in codepeople_search_in_place) ? codepeople_search_in_place['highlight_colors'] : ['#B5DCE1', '#F4E0E9', '#D7E0B1', '#F4D9D0', '#D6CDC8', '#F4E3C9', '#CFDAF0', '#F4EFEC'], areas : ('areas' in codepeople_search_in_place) ? codepeople_search_in_place['areas'] : ['div.hentry', '#content', '#main', 'div.content', '#middle', '#container', '#wrapper', 'article', '.elementor', 'body'] }, autohide : function(){ var me = this, selector = 'input[name="s"]'; if( 'own_only' in codepeople_search_in_place && codepeople_search_in_place.own_only*1 ) selector += '[data-search-in-place]'; $(document).on('input keyup focus', selector, function(evt){ var s = $(this), v = s.val(), close_icon; // If search in page, display the result only if keyup or input and the key is not enter if( $(evt.currentTarget).data('search-in-page') == 1 && ( evt.type == 'focus' || evt.keyCode === 13 ) ) return; // Display close icon if($('.search-in-place-close-icon').length == 0 && !!!s.data('search-in-page') && isMobile()) { close_icon = $(''); s.after(close_icon); var o = s.offset(), w = s.outerWidth()-5, h = s.outerHeight(), ih = Math.min(close_icon.height(),h-5), iw = Math.min(close_icon.width(),ih); close_icon.height(ih); close_icon.width(iw); close_icon.offset({top:o.top + (h-ih)/2, left: o.left+(w-iw)}); } s.attr('autocomplete', 'off'); if(me.checkString(v)){ setTimeout( function(){ me.getResults(s); }, 500 ); popup_is_visible = true; }else{ me.clearAutocomplete(s); $('.search-in-place').hide(); popup_is_visible = false; } if(evt.type=='keyup' && evt.keyCode==39) me.fromAutocomplete(s); } ); $(document).on('click', '.search-in-place-close-icon', function(evt){ evt.stopPropagation(); evt.preventDefault(); hideResultsPopUp(true); }); $(document).on('mouseover', ':not(.search-in-place, .search-in-place *)', function(){ if(!isMobile()) setTimeout(hideResultsPopUp, 150); }); $(document).on('blur', 'input[name="s"]',function(){ // Remove the autocomplete var e = $(this), bg = e.data('background-color'); if(typeof bg != 'undefined') e.css('background-color', bg); $('[name="cpsp-autocomplete"]').remove(); }); $(document).on('click', ':not(input[name="s"])',function(){ // Remove the autocomplete setTimeout(hideResultsPopUp, 150); }); }, checkString : function(v){ return this.config.min <= v.length; }, getResults : function(e){ var me = this; function processResults(r) { if('object' == typeof r) { if('result' in r) { me.displayResult(r['result'], s); me.removeLoading(r['result'], s); } if('autocomplete' in r && r['autocomplete'].length) { me.autocomplete(r['autocomplete'][0], e); } else { me.clearAutocomplete(e); } } } if(e.data('search-in-page') == undefined || e.data('no-popup') == undefined) { var o = e.offset(), s = $('.search-in-place'), sw = e.outerWidth(), so = {'left' : o.left, 'top' : (parseInt(o.top) + e.outerHeight()+5)}; if(me.search == e.val() && s.length) { s.show().width(sw).offset(so); return; } // Remove results container inserted previously s.remove(); s = $('
'); s.appendTo('body'); s.width(sw).offset(so); me.displayLoading(s); } me.search = e.val(); if(e.data('search-in-page')) { // Search in page var terms = me.search.replace(/^\s+/, '').replace(/\s+$/, '').replace(/\s+/g, ' '); if('operator' in codepeople_search_in_place && codepeople_search_in_place['operator'] == 'and') terms = [terms]; else terms = terms.split(' '); $('.search-in-place-mark').each(function(){ var p = $(this).parent(); $(this).contents().filter(function() {return this.nodeType === 3;}).unwrap(); p[0].normalize(); }); var result = searchObj.highlightTerms(terms); if(e.data('no-popup') == undefined) { processResults(result); $('.search-in-place-more').remove(); $('.search-in-place .title a').mousedown(function(evt){ evt.preventDefault(); evt.stopPropagation(); e.blur(); scrollToTerm($($(evt.target).attr('href'))); hideResultsPopUp(true); }); } } else { // Search in website var p = {'s': me.search, action: 'search_in_place'}; if('lang' in codepeople_search_in_place) p.lang = codepeople_search_in_place.lang; // Stop all search actions if(me.active) me.active.abort(); me.active = jQuery.ajax({ url: codepeople_search_in_place.root + 'admin-ajax.php', data: p, cache: true, dataType: 'json', success: function(r){ processResults(r); } }); } }, autocomplete : function(o, e){ function colorValues(color) { if (!color) return; if (color.toLowerCase() === 'transparent') return [0, 0, 0, 0]; if (color[0] === '#') { if (color.length < 7) color = '#' + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : ''); return [parseInt(color.substr(1, 2), 16), parseInt(color.substr(3, 2), 16), parseInt(color.substr(5, 2), 16), color.length > 7 ? parseInt(color.substr(7, 2), 16)/255 : 1]; } if (color.indexOf('rgb') === -1) { var temp_elem = document.body.appendChild(document.createElement('fictum')), flag = 'rgb(1, 2, 3)'; temp_elem.style.color = flag; if (temp_elem.style.color !== flag) return; temp_elem.style.color = color; if (temp_elem.style.color === flag || temp_elem.style.color === '') return; color = getComputedStyle(temp_elem).color; document.body.removeChild(temp_elem); } if (color.indexOf('rgb') === 0) { if (color.indexOf('rgba') === -1) color += ',1'; return color.match(/[\.\d]+/g).map(function (a){ return +a }); } }; var b = e.data('background-color') || e.css('background-color'), c = colorValues(e.css('color')), n = e.clone(), a = {'position': 'absolute', 'background': b, 'border-color': 'transparent', 'box-shadow': 'none', 'zIndex': 1}; n.removeAttr('placeholder').removeAttr('required'); if(e.css('zIndex') == 'auto') e.css('zIndex', 10); if(e.css('position') == 'static') e.css('position', 'relative'); e.data('background-color', b); if(c) { c[3] = 0.5; a['color'] = 'rgba('+c.join(',')+')'; } $('[name="cpsp-autocomplete"]').remove(); e.css('backgroundColor', 'transparent').after(n.attr('name', 'cpsp-autocomplete').val(o).css(a)); n.width(e.width()); n.height(e.height()); n.offset(e.offset()); }, fromAutocomplete : function(e){ var n = e.next('[name="cpsp-autocomplete"]'); if(n.length && n.val().length) e.val(n.val()); }, clearAutocomplete: function(e){ var n = e.next('[name="cpsp-autocomplete"]'); if(n.length) n.val(''); }, displayResult : function(o, e){ var me = this, s = ''; for(var t in o){ s += '=0&&!c||x<0&&c?o-p:o+p),{size:l,base:o,head:s,center:s+l/2}},calculateBarIndexPixels:function(t,e,n,i){var a="flex"===i.barThickness?function(t,e,n){var i,a=e.pixels,r=a[t],o=t>0?a[t-1]:null,s=t0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&r&&(t.save(),t.globalAlpha=a,this.drawBackground(i,e,t,n),i.y+=e.yPadding,H.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),H.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e,n=this,i=n._options;return n._lastActive=n._lastActive||[],"mouseout"===t.type?n._active=[]:(n._active=n._chart.getElementsAtEventForMode(t,i.mode,i),i.reverse&&n._active.reverse()),(e=!H.arrayEquals(n._active,n._lastActive))&&(n._lastActive=n._active,(i.enabled||i.custom)&&(n._eventPosition={x:t.x,y:t.y},n.update(!0),n.pivot())),e}}),Ue=Ye,Ge=je;Ge.positioners=Ue;var qe=H.valueOrDefault;function Ze(){return H.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){if("xAxes"===t||"yAxes"===t){var a,r,o,s=n[t].length;for(e[t]||(e[t]=[]),a=0;a=e[t].length&&e[t].push({}),!e[t][a].type||o.type&&o.type!==e[t][a].type?H.merge(e[t][a],[Re.getScaleDefaults(r),o]):H.merge(e[t][a],o)}else H._merger(t,e,n,i)}})}function $e(){return H.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){var a=e[t]||{},r=n[t];"scales"===t?e[t]=Ze(a,r):"scale"===t?e[t]=H.merge(a,[Re.getScaleDefaults(r.type),r]):H._merger(t,e,n,i)}})}function Xe(t){var e=t.options;H.each(t.scales,(function(e){me.removeBox(t,e)})),e=$e(W.global,W[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Ke(t,e,n){var i,a=function(t){return t.id===i};do{i=e+n++}while(H.findIndex(t,a)>=0);return i}function Je(t){return"top"===t||"bottom"===t}function Qe(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}W._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var tn=function(t,e){return this.construct(t,e),this};H.extend(tn.prototype,{construct:function(t,e){var n=this;e=function(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=$e(W.global,W[t.type],t.options||{}),t}(e);var i=Ie.acquireContext(t,e),a=i&&i.canvas,r=a&&a.height,o=a&&a.width;n.id=H.uid(),n.ctx=i,n.canvas=a,n.config=e,n.width=o,n.height=r,n.aspectRatio=r?o/r:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,tn.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),i&&a?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return Le.notify(t,"beforeInit"),H.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),Le.notify(t,"afterInit"),t},clear:function(){return H.canvas.clear(this),this},stop:function(){return J.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,a=n.maintainAspectRatio&&e.aspectRatio||null,r=Math.max(0,Math.floor(H.getMaximumWidth(i))),o=Math.max(0,Math.floor(a?r/a:H.getMaximumHeight(i)));if((e.width!==r||e.height!==o)&&(i.width=e.width=r,i.height=e.height=o,i.style.width=r+"px",i.style.height=o+"px",H.retinaScale(e,n.devicePixelRatio),!t)){var s={width:r,height:o};Le.notify(e,"resize",[s]),n.onResize&&n.onResize(e,s),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;H.each(e.xAxes,(function(t,n){t.id||(t.id=Ke(e.xAxes,"x-axis-",n))})),H.each(e.yAxes,(function(t,n){t.id||(t.id=Ke(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},i=[],a=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(i=i.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&i.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),H.each(i,(function(e){var i=e.options,r=i.id,o=qe(i.type,e.dtype);Je(i.position)!==Je(e.dposition)&&(i.position=e.dposition),a[r]=!0;var s=null;if(r in n&&n[r].type===o)(s=n[r]).options=i,s.ctx=t.ctx,s.chart=t;else{var l=Re.getScaleConstructor(o);if(!l)return;s=new l({id:r,type:o,options:i,ctx:t.ctx,chart:t}),n[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)})),H.each(a,(function(t,e){t||delete n[e]})),t.scales=n,Re.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,i=[],a=n.data.datasets;for(t=0,e=a.length;t=0;t--)e=i.getDistanceFromCenterForValue(r.ticks.reverse?i.min:i.max),n=i.getPointPosition(t,e),a.beginPath(),a.moveTo(i.xCenter,i.yCenter),a.lineTo(n.x,n.y),a.stroke();a.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var i,a,r=t.getIndexAngle(0),o=H.options._parseFont(n),s=Yn(n.fontColor,W.global.defaultFontColor);e.save(),e.font=o.string,e.translate(t.xCenter,t.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",H.each(t.ticks,(function(r,l){(0!==l||n.reverse)&&(i=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),n.showLabelBackdrop&&(a=e.measureText(r).width,e.fillStyle=n.backdropColor,e.fillRect(-a/2-n.backdropPaddingX,-i-o.size/2-n.backdropPaddingY,a+2*n.backdropPaddingX,o.size+2*n.backdropPaddingY)),e.fillStyle=s,e.fillText(r,0,-i))})),e.restore()}},_drawTitle:H.noop}),$n=Vn;Zn._defaults=$n;var Xn=H._deprecated,Kn=H.options.resolve,Jn=H.valueOrDefault,Qn=Number.MIN_SAFE_INTEGER||-9007199254740991,ti=Number.MAX_SAFE_INTEGER||9007199254740991,ei={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ni=Object.keys(ei);function ii(t,e){return t-e}function ai(t){return H.valueOrDefault(t.time.min,t.ticks.min)}function ri(t){return H.valueOrDefault(t.time.max,t.ticks.max)}function oi(t,e,n,i){var a=function(t,e,n){for(var i,a,r,o=0,s=t.length-1;o>=0&&o<=s;){if(a=t[(i=o+s>>1)-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]=0;--n)(e=l[n].$filler)&&e.visible&&(a=(i=e.el)._view,r=i._children||[],o=e.mapper,s=a.backgroundColor||W.global.defaultColor,o&&s&&r.length&&(H.canvas.clipArea(u,t.chartArea),ki(u,r,o,a,s,i._loop),H.canvas.unclipArea(u)))}},Si=H.rtl.getRtlAdapter,Di=H.noop,Ci=H.valueOrDefault;function Pi(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}W._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},i=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var a=n.controller.getStyle(i?0:void 0);return{text:e[n.index].label,fillStyle:a.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,pointStyle:a.pointStyle,rotation:a.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,i,a=document.createElement("ul"),r=t.data.datasets;for(a.setAttribute("class",t.id+"-legend"),e=0,n=r.length;e