if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } NickolaS_Solutions['alert']={ 'config':{ 'loaded':false } ,'data':{} ,'confirm':function(message,action){ var message=message,action=action,_this=this; document.querySelector('#_NS_confirmationAlert ._NS_confirmationButton').setAttribute('onclick','NickolaS_Solutions.alert.close(\'confirmation\');'+action); _this.open('confirmation',message); } ,'open':function(code,body,duration,title,header,callback){ var code=code,body=body,duration=duration,title=title,header=header,callback=callback,_this=this; _this.register(code,title,header); if (body!=null){ document.querySelector('#_NS_'+code+'Alert ._NS_alertBody').innerHTML=body; } //console.log('alert div display: '+document.querySelector('#_NS_'+code+'Alert').style.display); //document.querySelector('#_NS_alertBackground').style.display='block'; document.querySelector('#_NS_'+code+'Alert').style.display='flex'; if (document.querySelector('#_NS_'+code+'Alert').style.display!=='flex'){ document.querySelector('#_NS_'+code+'Alert').style.display='block'; } if (duration>0){ setTimeout(function(code,callback){_this.close(code);if(typeof(callback)!='undefined'){eval(callback);}},(duration*1000),code,callback); } } ,'close':function(code){ document.querySelector('#_NS_'+code+'Alert').style.display='none'; document.querySelector('#_NS_alertBackground').style.display='none'; } ,'register':function(code,title,header){ var _this=this,code=code,ID='_NS_'+code+'Alert',title=title,header=header,container=null,blocker=null,styleData={}; if (typeof(_this['data'][code])!='undefined'){ return true; } if (!(_this['config']['loaded'])){ blocker=document.createElement('div'); blocker.id='_NS_alertBackground'; styleData={'position':'fixed','top':'0px','bottom':'0px','left':'0px','right':'0px','background-color':'#000000','opacity':'0.5','display':'none','z-index':'100000'}; for (var k in styleData){ blocker.style[k]=styleData[k]; } document.body.appendChild(blocker); _this['config']['loaded']=true; } container=document.querySelector('#'+ID); if (container===null){ container=document.createElement('div'); container.id=ID; container.className='_NS_alert'; styleData={'position':'fixed','top':'0px','bottom':'0px','left':'0px','right':'0px','display':'none','z-index':'100001','overflow-y':'auto'}; for (var k in styleData){ container.style[k]=styleData[k]; } container.innerHTML='
'+((typeof(header)!='undefined' && header)?header.replace('{TITLE}',title):('
'+title+'
'))+'
'; document.body.appendChild(container); } } };if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } NickolaS_Solutions['inputError']={ 'targets':{} ,'run':function(inputContainer,selector,error){ var inputContainer=inputContainer,selector=selector,error=error ,target=null,_this=this; target=_this.getTarget(inputContainer,selector); //console.log(inputContainer+' .NS_inputError.'+_this['map'][ID]); console.log(arguments); target['eb'].innerHTML=error; target['eb'].style.display='block'; //target['eb'].style.backgroundColor='#FFAAAA'; //target['eb'].classList.remove('d-none'); //document.querySelector(inputContainer+' .NS_inputError.'+ID).innerHTML=error; } ,'getTarget':function(inputContainer,selector){ var inputContainer=inputContainer,selector=selector,_this=this ,initialInputField=null,inputField=null,errorBlock=null ,ID=(inputContainer+' | '+selector),timestamp=(new Date()).getTime() ,igc=''; if (typeof(_this['targets'][ID])=='undefined'){ initialInputField=document.querySelector(inputContainer+' *[name="'+selector+'"]'); //console.log('error '+errorID); //console.log('initialInputField'); //console.log(initialInputField); //initialInputField.classList.add('inputField'+timestamp); if (initialInputField.classList.contains('inGroup')){ inputField=initialInputField; igc=initialInputField.dataset['in_group']; //console.log(initialInputField); } else { inputField=initialInputField; } document.querySelectorAll(inputContainer+' *[name="'+selector+'"]').forEach(function(el){ var el=el,alias=null; el.dataset['error_id']=ID; if (el.dataset['alias']!=null){ alias=el.dataset['alias']; document.querySelector(inputContainer+' .'+alias).dataset['error_id']=ID; document.querySelector(inputContainer+' .'+alias).addEventListener('focus',function(){ NickolaS_Solutions.inputError.hide(this.dataset['error_id']); }); } else { el.dataset['error_id']=ID; el.addEventListener('input',function(){ NickolaS_Solutions.inputError.hide(this.dataset['error_id']); }); } //el.setAttribute('oninput','NickolaS_Solutions.inputError.hide(\''+ID+'\');'); }); //initialInputField; //initialInputField.addEventListener('input') errorBlock=document.createElement('div'); errorBlock.classList.add('NS_inputError','alert','alert-danger','px-2','py-1','mb-0','invalid_'+igc); //errorBlock.classList.add(_this['map'][key]); _this['targets'][ID]={ 'ib':inputField ,'eb':errorBlock }; if (igc!=''){ document.querySelector(inputContainer+' div.'+igc).insertAdjacentElement('afterend',errorBlock); } else { inputField.insertAdjacentElement('afterend',errorBlock); } //_this['targets'][ID]['eb'].style.backgroundColor='#FF9999'; /** / _this['map'][key]=selector+'_'+timestamp; inputField.classList.add(_this['map'][key]); inputField.insertAdjacentHTML('afterend','
');/**/ } return _this['targets'][ID]; } ,'hide':function(ID){ var ID=ID,_this=this; //_this['targets'][ID]['eb'].add('d-none'); _this['targets'][ID]['eb'].style.display='none'; _this['targets'][ID]['ib'].classList.remove('invalid'); } ,'reset':function(inputContainer){ var inputContainer=inputContainer,_this=this,ID='',IDParts=[],IDx=''; for (ID in _this['targets']){ if (ID.substr(0,inputContainer.length)==inputContainer){ _this.hide(ID); } } } };if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } NickolaS_Solutions['request']={ 'run':function (method,URL,data,actions,returnJSON){ var xhr = new XMLHttpRequest(),method=method,URL=URL,data=data,actions=actions,returnJSON=returnJSON; if (URL.substr(0,4)!='http'){ //URL=NS_BASE_URL+URL; } xhr.open(method, URL, true); xhr.setRequestHeader('X-Requested-With','XMLHttpRequest'); //xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); if (returnJSON){ xhr.setRequestHeader("Accept","application/json"); } else { xhr.setRequestHeader("Accept","text/html"); } xhr.onload = function (e) { if (xhr.readyState === 4) { var reply=''; try { reply=JSON.parse(xhr.responseText); } catch (e) { if (returnJSON){ return xhr.onerror(e); } return actions.load(xhr.responseText,false); } switch(xhr.status){ case 200: if (reply.status=='success' && reply.errors.length>0){ reply.status='fail'; } if (typeof(actions[reply.status])=='undefined'){ switch(reply.status){ case 'fail': NickolaS_Solutions.defaultReplyActions['fail'](reply,actions['customFail']); break; default: if (typeof(NickolaS_Solutions.defaultReplyActions[reply.status])!='undefined'){ return NickolaS_Solutions.defaultReplyActions[reply.status](reply); } else { alert('undefined action '+reply['status']); } break; } } else { return actions[reply.status](reply); } break; case 500: if (returnJSON){ return NickolaS_Solutions.alert.open('systemError','
'+JSON.stringify(reply['systemErrors'],null,2)+'
',2,'','System Error'); } else { xhr.onerror(); } break; default: if (typeof(actions.onError)!=='undefined'){ actions.onError(xhr); } console.error(xhr.statusText); break; } } }; xhr.onerror = function (e) { if (typeof(actions.onError)!=='undefined'){ actions.onError(xhr); } //console.dir(xhr); NickolaS_Solutions.alert.open('systemError',xhr.responseText,3,'','System Error'); //console.log('error'); //console.error(xhr.statusText); }; if (typeof(data)=='object'){/** / var dataParams=[],dataKey=''; for (dataKey in data){ dataParams.push(dataKey+'='+encodeURIComponent(data[dataKey])); }/**/ //xhr.send(dataParams.join('&')); xhr.send(JSON.stringify(data)); } else { xhr.send(data); } } ,'defaultReplyActions':{ 'redirect':function(reply){ setTimeout(function(){document.location.replace(reply.redirect_url);},2000); } ,'success':function(reply){ NickolaS_Solutions.alert.open('success','

'+reply.success_message+'

',2,'Success'); } ,'fail':function(reply,inputErrorConfig){ var reply=reply,inputErrorConfig=inputErrorConfig,_that=NickolaS_Solutions ,inputContainer='',errorKey='',result=[]; if (typeof(inputErrorConfig)=='undefined'){ inputErrorConfig={}; inputContainer=''; } else { inputContainer=inputErrorConfig['_container']; } reply['errorMap'].forEach(function(errorSet){ var selector=errorSet[0],errors=[]; errorSet[1].forEach(function(i){ errors.push(reply.errors[i]); }); //result.push({selector:errors}); if (typeof(inputErrorConfig[selector])!='undefined'){ inputErrorConfig[selector][0](inputErrorConfig[selector][1],errors); } else { if (selector!='global'){ if (inputContainer!=''){ if (typeof(_that.inputError)!='undefined'){ _that.inputError.run(inputContainer,selector,errors.join('
')); } else { result.push(''+selector+':
'+errors.join('
')); } } else { result.push(''+selector+':
'+errors.join('
')); } } else { if (errors.length>0){ result.push(errors.join('
')); } } } /** / /**/ }); /** / for (errorKey in reply['error_fields']){ reply.errors.push(errorKey+': '+reply['error_fields'][errorKey]); } NickolaS_Solutions.alert.open('fail','Fail','

'+reply.errors.join('

')+'

',2); /**/ //console.log(JSON.stringify(result,null,2)); if (result.length>0){ NickolaS_Solutions.alert.open('fail','

'+result.join('

')+'

',2,'Fail'); } //console.dir(reply.errors); } ,'__fail':function(reply,targetSelectors){ var reply=reply,targetSelectors=targetSelectors, errorKey='',result=[]; if (typeof(targetSelectors)=='undefined'){ targetSelectors={}; } reply['errorMap'].forEach(function(errorSet){ var selector=errorSet[0],errors=[]; errorSet[1].forEach(function(i){ errors.push(reply.errors[i]); }); //result.push({selector:errors}); if (typeof(targetSelectors[selector])!='undefined'){ targetSelectors[selector][0](targetSelectors[selector][1],errors); } else { if (selector!='global'){ //document.querySelector('#'+selector+'Input').setCustomValidity(errors.join("\n")); } result.push(''+selector+':
'+errors.join('
')); } /** / /**/ }); /** / for (errorKey in reply['error_fields']){ reply.errors.push(errorKey+': '+reply['error_fields'][errorKey]); } NickolaS_Solutions.alert.open('fail','Fail','

'+reply.errors.join('

')+'

',2); /**/ NickolaS_Solutions.alert.open('fail','

'+result.join('

')+'

',2,'Fail'); console.dir(reply.errors) } ,'_not_allowed':function(reply){ //'alert' //login('request'); //NickolaS_Solutions.alert.open('forbidden',null,3,'','','login(\'request\');'); NickolaS_Solutions.alert.open('forbidden',null,3); } ,'forbidden':function(reply){ NickolaS_Solutions['defaultReplyActions']['not_allowed'](reply); } } ,'setReplyAction':function(code,callback){ this['defaultReplyActions'][code]=callback; } }; NickolaS_Solutions['defaultReplyActions']=NickolaS_Solutions['request']['defaultReplyActions']; NickolaS_Solutions['runRequest']=NickolaS_Solutions['request']['run']; NickolaS_Solutions['post']=function(URL,params,actions,returnJSON){ this['request']['run']('POST',URL,params,actions,returnJSON); }; NickolaS_Solutions['get']=function(URL,params,actions,returnJSON){ this['request']['run']('GET',URL,params,actions,returnJSON); }; if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } NickolaS_Solutions['DOM']={ 'getElements':function(list){ var elements=[]; //console.dir(list); //console.log(typeof(list)); switch(typeof(list)){ case 'string': return document.querySelectorAll(list); break; case 'object': if (list instanceof NodeList){ return list; } elements.push(list); return elements; break; case 'array': return list; break; } } ,'addClass':function(list,newClass){ var newClass=newClass; this.getElements(list).forEach(function(e){ var fullClassName=' '+e.className.trim()+' '; //console.log('oldClass: '+e.className); if (fullClassName.indexOf(newClass)==-1){ e.className+=(' '+newClass); } //console.log('newClass: '+e.className); /** / var classNameParts=e.className.split(' '),valid=true; classNameParts.forEach(function(cp){ if (cp==newClass){ valid=false; } }); e.className+=(' '+className); /**/ }); } ,'removeClass':function(list,classNameToRemove){ var classNameToRemove=classNameToRemove; this.getElements(list).forEach(function(e){ var fullClassName=' '+e.className.trim()+' '; e.className=fullClassName.replace(' '+classNameToRemove+' ',' ').trim(); /** / var classParts=e.className.split(' '),finalClasses=[]; classParts.forEach(function(c){ if (c!=className){ finalClasses.push(c); } }); e.className=finalClasses.join(' '); /**/ }); } ,'disable':function(list){ var _this=this; //console.log('disabled');console.dir(_this.getElements(list)); _this.getElements(list).forEach(function(e){ e.disabled=true; _this.addClass(e,'disabled'); }); } ,'enable':function(list){ var _this=this; //console.log('enable');console.dir(_this.getElements(list)); _this.getElements(list).forEach(function(e){ e.disabled=false; _this.removeClass(e,'disabled'); }); } ,'cleanSelect':function(el){ var el=el; if (typeof(el)=='string'){ el=document.querySelectorAll(el)[0]; } el.querySelectorAll('option').forEach(function(o){ switch(o.value){ case '': o.selected=true; break; case '0': o.selected=false; break; default: o.remove(); break; } }); } ,'resetFields__':function(selector){ var container=document.querySelector(selector); switch(container.tagName){ case 'DIV': break; } console.log(container.tagName+': '+selector); /**/ document.querySelectorAll(selector).forEach(function(f){ var i=0, varNameParts=[], vnpi=0, vnpx=0, vnpy=0, el, value=''; if (typeof(f.elements)!='undefined'){ for(i=0;i0){ for (vnpi=0;vnpi<=vnpy;vnpi++){ if (vnpi==vnpy){ if (varNameParts[vnpx]==''){ if (typeof(dataParts[varNameParts[vnpy]])=='undefined'){ dataParts[varNameParts[vnpy]]=[]; } dataParts[varNameParts[vnpy]].push(value); } else { if (typeof(dataParts[varNameParts[vnpy]])=='undefined'){ dataParts[varNameParts[vnpy]]={}; } dataParts[varNameParts[vnpy]][varNameParts[vnpx]]=value; } } else { if (typeof(dataParts[varNameParts[vnpi]])=='undefined'){ dataParts[varNameParts[vnpi]]={}; } dataParts=dataParts[varNameParts[vnpi]]; } } } else { data[varNameParts[vnpx]]=value; } //console.log(el.tagName+' '+el.name); } } } } }/** / foundList.forEach(function(f){ var f=f,i=0, varNameParts=[], vnpi=0, vnpx=0, vnpy=0, elt=null, value='',o=0; alert(JSON.stringify(f,null,2)); if (typeof(f.elements)!='undefined'){ for(i=0;i0){ for (vnpi=0;vnpi<=vnpy;vnpi++){ if (vnpi==vnpy){ if (varNameParts[vnpx]==''){ if (typeof(dataParts[varNameParts[vnpy]])=='undefined'){ dataParts[varNameParts[vnpy]]=[]; } dataParts[varNameParts[vnpy]].push(value); } else { if (typeof(dataParts[varNameParts[vnpy]])=='undefined'){ dataParts[varNameParts[vnpy]]={}; } dataParts[varNameParts[vnpy]][varNameParts[vnpx]]=value; } } else { if (typeof(dataParts[varNameParts[vnpi]])=='undefined'){ dataParts[varNameParts[vnpi]]={}; } dataParts=dataParts[varNameParts[vnpi]]; } } } else { data[varNameParts[vnpx]]=value; } //console.log(el.tagName+' '+el.name); } } } } });/**/ //console.dir(data); return data; //console.dir(data); } };if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } if (typeof(NickolaS_Solutions['jQuery'])=='undefined'){ NickolaS_Solutions['jQuery']={}; } NickolaS_Solutions['jQuery']['dataTable']=function(config){ var config=config; NickolaS_Solutions['dataPage'].load('#'+config['dataID'],config); }; NickolaS_Solutions['dataPage']={ 'list':{} ,'load':function(selector,config,reset){ var selector=selector,config=config,reset=reset,_this=this,ID=null ,dataFilters={},isNew=true; if (typeof(reset)=='undefined'){ reset=false; } if (typeof(_this['list'][selector])!='undefined'){ ID=selector; isNew=false; } else { ID=document.querySelector(selector).dataset['dataPage']; if (!ID){ ID=_this['uniqid'](); } else { isNew=false; } } if (typeof(config)=='undefined'){ config=_this['list'][ID]; } else { if (typeof(_this['list'][ID])=='undefined' || reset==true){ _this['list'][ID]=config; _this['list'][ID]['__container']=document.querySelector(selector); _this['list'][ID]['__selector']=selector; _this['list'][ID]['pagination']={ 'next':1 ,'current btn-primary':1 ,'length':0 }; switch(_this['list'][ID]['__container'].tagName.toLowerCase()){ case 'table': if (document.querySelector(selector+' > tbody')==null){ document.querySelector(selector+' > thead') .insertAdjacentHTML('afterend',''); } _this['list'][ID]['__dataContainer']=document .querySelector(selector+' > tbody'); break; default: _this['list'][ID]['__dataContainer']=_this['list'][ID]['__container']; break; } document.querySelector(selector).dataset['dataPage']=ID; var lt=typeof(_this['list'][ID]['lengths']); if (lt=='string'){ _this['list'][ID]['lengths']=_this['list'][ID]['lengths'].split(','); } if (lt=='undefined'){ _this['list'][ID]['lengths']=[10,25,50,100]; } var lx=0,lengthOptions=''; lx=_this['list'][ID]['lengths'].length; _this['list'][ID]['lengths'].forEach(function(l){ lengthOptions+=(''); }); if (isNew){ if (typeof(config['ignoreTop'])=='undefined'){ _this['list'][ID]['__container'].insertAdjacentHTML('beforebegin','
' +((lx>1)?('
' +'' +'
'):'
') +'
' +'
'); } else { _this['list'][ID]['__container'].insertAdjacentHTML('beforebegin', '' +'' ); } if (typeof(_this['list'][ID]['skipPagination'])=='undefined'){ _this['list'][ID]['skipPagination']=false; } if (!_this['list'][ID]['skipPagination']){ _this['list'][ID]['__container'].insertAdjacentHTML('afterend','
'); } } } config=_this['list'][ID]; } if (typeof(config['filters'])!='undefined'){ dataFilters=config['filters'](); } var searchElement=document.getElementById(ID+'Search'); if (searchElement!=null){ dataFilters['search']={'value':(searchElement.value.length>2)?searchElement.value:''}; } if (typeof(dataFilters['length'])=='undefined'){ //dataFilters['length']=1; if (typeof(config['skipLength'])=='undefined'){ //dataFilters['__length']=document.getElementById(ID+'Length').value; } } if (typeof(dataFilters['__length'])=='undefined'){ var lengthElement=document.getElementById(ID+'Length'); if (lengthElement!=null){ dataFilters['__length']=lengthElement.value; } else { dataFilters['__length']=_this['list'][ID]['pagination']['length']; } //_this['list'][ID]['pagination']['length']=document.getElementById(ID+'Length').value; } //else { _this['list'][ID]['pagination']['length']=dataFilters['__length']; //} dataFilters['__offset']=(_this['list'][ID]['pagination']['next']-1)*dataFilters['__length']; /** / config['__dataContainer'].style['background-color']='#ff9999'; if (typeof(config['__loader'])=='undefined'){ var loaderID='loader'+(new Date()).getTime(); document.querySelector('body').insertAdjacentHTML('beforeend','
'+'
'); config['__loader']=document.querySelector('#'+loaderID+' pre'); } config['__loader'].textContent=JSON.stringify(config['__dataContainer'].getBoundingClientRect(),null,2); config['__dataContainer'].style['max-height']='200px'; config['__dataContainer'].style['overflow-y']='scroll'; console.dir(config['__dataContainer']); console.dir(window); /**/ switch(typeof(config['startPlaceholder'])){ case 'function': config['__dataContainer'].innerHTML=config['startPlaceholder'](); break; case 'string': config['__dataContainer'].innerHTML=config['startPlaceholder']; break; } //setTimeout(function(config){config['__dataContainer'].innerHTML='';},2000,config); NickolaS_Solutions[(typeof(config['WPAJAX'])!='undefined')?'wp_ajax':'post'](((typeof(config['customURL'])!='undefined')?config['customURL']():config['URL']),dataFilters,{'success':function(reply){ var reply=reply,e=0,finalData={'data':[]},parserConfig=null,dataDOM='',isValid=true; finalData['recordsTotal']=reply.data['total']; finalData['recordsFiltered']=reply.data['filtered']; if (typeof(config['validateFirst'])!='undefined'){ isValid=config.validateFirst(reply); } if (isValid){ if (typeof(config['beforeParsing'])!='undefined'){ config.beforeParsing(reply); } if (typeof(config.parserConfig)!='undefined'){ parserConfig=config.parserConfig(reply); } reply.data.entries.forEach(function(e){ var e=e,r=null; r=config.parser(e,parserConfig); if (typeof(r)=='string'){ dataDOM+=r; } else { dataDOM+=(''+r.join('')+''); } //console.log(typeof(r));console.log(r); //finalData.data.push(config.parser(e,parserConfig)); }); if(dataDOM==''){ switch(typeof(config['zeroPlaceholder'])){ case 'function': dataDOM=config['zeroPlaceholder'](); break; case 'string': dataDOM=config['zeroPlaceholder']; break; } } //console.log(finalData); config['__dataContainer'].innerHTML=dataDOM; if (!config['skipPagination']){ _this['list'][ID]['pagination']['current btn-primary']=_this['list'][ID]['pagination']['next']; _this.updatePagination(ID,reply['data']['filtered']); } //console.log('after load '+ID+JSON.stringify(_this['list'][ID]['pagination'],null,2)); if (typeof(config['afterLoad'])!='undefined'){ config['afterLoad'](reply); } } },'required_action':((typeof(config['requiredActions'])!='undefined')?config['requiredActions']:{})},1); } ,'run':function(offset){ } ,'updatePagination':function(ID,total){ var ID=ID, total=total, px=0, pi=0, pj=0, _this=this, resultDOM='' ,pc=parseInt(_this['list'][ID]['pagination']['current btn-primary']),pn=0,py=0; console.log(ID+': '+total); px=Math.ceil(total/_this['list'][ID]['pagination']['length']); if (px>1){ if (px<8){ for(pi=1;pi<=px;pi++){ resultDOM+=''+pi+''; } } else { resultDOM+='1'; if (pc<5){ for (pi=2;pi<=5;pi++){ resultDOM+=''+pi+''; } resultDOM+=' ... '; } else { resultDOM+=' ... '; if (pc>(px-4)){ for (pi=(px-4);pi'+pi+''; } } else { for (pi=(pc-1);pi<=(pc+1);pi++){ resultDOM+=''+pi+''; } resultDOM+=' ... '; } } //if () resultDOM+=''+px+''; } } document.querySelector('#'+ID+'Pagination').innerHTML=resultDOM; //_this['list'][ID] } ,'loadPage':function(ID,page){ var ID=ID,page=page,_this=this; _this['list'][ID]['pagination']['next']=parseInt(page); _this.load(ID); } ,'uniqid':function(){ var result = '',i=0,j=0,_this=this; for (i=0;i<5;i++){ j=Math.ceil(Math.random()*26); result+=String.fromCharCode((j+64)); } result+=Math.floor(Math.random()*1000000); if (typeof(_this['list'][result])=='undefined'){ return result; } else { return _this.uniqid(); } } ,'updateLength':function(ID){ var ID=ID,_this=this,length=document.querySelector('#'+ID+'Length').value ,offset=((_this['list'][ID]['pagination']['current btn-primary']-1)*_this['list'][ID]['pagination']['length']); _this['list'][ID]['pagination']['next']=((offset % length == 0)?1:0)+Math.ceil(offset/length); _this['list'][ID]['pagination']['length']=length; _this.load(ID); } ,'updateFilter':function(ID){ var ID=ID,encodedFilter='',_this=this; _this['list'][ID]['pagination']['next']=1; _this.load(ID); } };if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } NickolaS_Solutions['objectBlock']={ 'current':'homeBlock' ,'show':function(code,scrollTo){ var code=code, elementByID=(code!='')?document.querySelector('#'+code+'.objectBlock'):null ,scrollTo=scrollTo; if (scrollTo=='undefined'){ scrollTo=0; } //console.log('show object block '+code); //alert(code); document.querySelectorAll('.objectBlock').forEach(function(e){ if (!e.classList.contains(code+'Block') && e['id']!=code){ e.classList.add('d-none'); } }); if (elementByID==null){ document.querySelector('.objectBlock.'+code+'Block').classList.remove('d-none'); } else { elementByID.classList.remove('d-none'); } window.scroll(0,scrollTo); this.current=code; } ,'saved':null ,'save':function(){ this['saved']=[(this.current+''),window.scrollY]; } ,'restore':function(){ this.show(this['saved'][0],this['saved'][1]); //window.scroll(0,this['saved'][1]); } };if (typeof(NickolaS_Solutions)=='undefined'){ var NickolaS_Solutions={}; } NickolaS_Solutions['wp_ajax']=function(URL,data,replyConfig,isJSON){ return NickolaS_Solutions.post(ajaxurl+'?action=nickolas_solutions&command='+URL,data,replyConfig,isJSON); };var _NS=NickolaS_Solutions;