zentech.ads={
adsStore:null,
isAdBlockEnabled:null,
construct:function() {
this.checkAdBlock();
},
display:function(identifier) {
document.getElementsByClassName(identifier)[0].innerHTML="";
},
checkAdBlock:function() {
// this is not working correctly
if(document.getElementById('YuIRJlKrpTmS')){
this.isAdBlockEnabled=false;
} else {
this.isAdBlockEnabled=true;
}
}
}
/*
*/
zentech.ads.dfp = {
options:null,
dfpAccountId:null,
dfpFolder:null,
dfpSizeMappings:null,
dfpAdUnits:{},
pageSlots:new Array(),
handlersSlotLoad:new Array(),
refreshVidibleAdUnitsSeconds:null,
enableRefreshFunctionality:true,
construct: function(dfpAccountId, dfpFolder, dfpSizeMappings, options)
{
this.dfpAccountId=dfpAccountId;
this.dfpFolder=dfpFolder;
this.dfpSizeMappings=dfpSizeMappings;
if (options==null) { options={} }
if (options.monitorTags == null ) {options.monitorTags=true}
if (options.scanPageAdUnits == null) {options.scanPageAdUnits=true}
if (options.setCentering == null) {options.setCentering=true}
if (options.collapseEmptyDivs == null) {options.collapseEmptyDivs=true}
if (options.enableSingleRequest == null) {options.enableSingleRequest=true}
if (options.disableInitialLoad == null) {options.disableInitialLoad=false}
this.options=options;
try
{
$(window).resize(function(){
zentech.ads.dfp.onPageResize();
});
} catch(e) {
zentech.debug.log('jQuery not found' , 'zentech.ads.dfp.construct');
}
/* MAKE ASYNC */
if (options.monitorTags) {
this.onGoogleTagLoad(function() {
googletag.pubads().addEventListener('slotRenderEnded', function(event) {
zentech.ads.dfp.handleSlotLoad(event);
});
});
}
if (options.scanPageAdUnits) {
zentech.document.events.onload( function(event) {
zentech.ads.dfp.constructPageAdUnits();
});
}
if (options.refreshVisible!=null) {
this.setRefreshVisibleAdUnits();
}
},
setRefreshVisibleAdUnits:function() {
if (this.enableRefreshFunctionality) {
window.setInterval( function() { zentech.ads.dfp.scanVisibleAdUnits() } , 1000);
}
},
scanVisibleAdUnits:function() {
// zentech.debug.disable();
// zentech.debug.log('scanVisibleAdUnits');
var refreshAdUnits=[];
for(var adUnitId in this.dfpAdUnits) {
var adUnit=this.dfpAdUnits[adUnitId];
if (adUnit.options.disableRefresh==null) {
if ( zentech.document.utils.inView(adUnit.domId) ) {
if (adUnit.inview==null) {
adUnit.inview=Date.now();
} else {
var refreshVisible=this.options.refreshVisible;
if (adUnit.options.refreshVisible!=null) {
refreshVisible=adUnit.options.refreshVisible;
}
if ( (Date.now()-adUnit.inview )>(refreshVisible * 1000) ) {
zentech.debug.log('refresh in view adunit ' + adUnitId);
adUnit.inview=null; // this is for safety just in case something goes wrong on reload
refreshAdUnits.push(adUnitId);
}
}
} else {
adUnit.inview=null;
}
}
}
if (refreshAdUnits.length>0) {
this.refreshPageAdUnits(refreshAdUnits);
}
},
refreshPageAdUnits: function(dfpAdUnitsArray) {
return this.constructPageAdUnits( dfpAdUnitsArray, {refreshExisting:true} )
},
constructPageAdUnits: function(dfpAdUnitsArray, options) {
// zentech.debug.disable();
// initialize
var allAdUnits=true;
if (dfpAdUnitsArray!=null) {
allAdUnits=false;
if ( !Array.isArray(dfpAdUnitsArray) ) { dfpAdUnitsArray=Array(dfpAdUnitsArray) }
}
if (options==null) { options={} }
var adUnitsDisplayCommands=[];
var adUnits = document.querySelectorAll('[data-adunitname]');
for (var i=0, len=adUnits.length|0; i0) {
// build the tag object
if (this.options.collapseEmptyDivs) { googletag.pubads().collapseEmptyDivs() }
if (this.options.setCentering) { googletag.pubads().setCentering(true) }
if (this.options.enableSingleRequest) { googletag.pubads().enableSingleRequest() }
if (this.options.disableInitialLoad) { googletag.pubads().disableInitialLoad() }
googletag.enableServices();
// display the adunits
for (var i=0; i0)
{
// found containers
var googleContainerDiv=googleContainerDivs[0];
var googleIframes=googleContainerDiv.querySelectorAll('*[id*="google_ads_iframe"]');
if (googleIframes.length>0)
{
var googleIframe=googleIframes[0];
var nScale=(Billboard.clientWidth)/googleContainerDiv.scrollWidth;
console.log(nScale);
if (nScale>1) {
nScale=1
}
googleIframe.style.cssText='style="border: 0px; vertical-align: bottom; -ms-zoom: ' + nScale + '; \
-ms-transform: scale(' + nScale + '); -moz-transform: scale(' + nScale + '); \
-moz-transform-origin: 0 0; -o-transform: scale(' + nScale + '); \
-o-transform-origin: 0 0; -webkit-transform: scale(' + nScale + '); -webkit-transform-origin: 0 0;'
if ( (googleIframe.height*nScale) < googleContainerDiv.style.height )
{
// googleContainerDiv.style.height=googleIframe.height*nScale + 'px';
// Billboard.style.height=googleIframe.height*nScale + 'px';
}
}
}
}
},
renderAdUnitInText:function(cTextDiv, cAdUnitId, nMinParagraphSize) {
// initialize
if (!nMinParagraphSize) {
nMinParagraphSize=400;
}
console.log("renderAdUnitInText : " + cAdUnitId)
var articles=$('.' + cTextDiv + ':not([dfp-parsed="true"])');
articles.each( function(i, article) {
$(article).attr("dfp-parsed", "true");
var paragraphs=$(article).children();
var eligibleParagraph;
var eligibleParagraphCharactersCount;
var bParagraphFound=false;
paragraphs.each( function(i, paragraph) {
if ($(paragraph)[0].tagName=="P" && $(paragraph).children('div,img,iframe,ul,li,embed,twitter-widget').length<1 && $(paragraph).text().length>10 ) {
if (eligibleParagraph==null) {
eligibleParagraph=paragraph;
eligibleParagraphCharactersCount=$(paragraph).text().length;
} else {
eligibleParagraphCharactersCount+=$(paragraph).text().length;
}
if (eligibleParagraphCharactersCount>nMinParagraphSize) {
bParagraphFound=true;
// exit paragraph found
return false;
}
} else {
eligibleParagraph=null;
}
});
if (bParagraphFound) {
// console.log( $(eligibleParagraph).text() );
$(eligibleParagraph).prepend('');
googletag.cmd.push(function() { googletag.display(cAdUnitId); });
}
});
},
refreshPageSlotByAdUnitPath:function(path, interval){
window.setInterval(
function() {
var pageSlot = zentech.ads.dfp.getPageSlotByAdUnitPath(path);
if (pageSlot!=null) {
googletag.pubads().refresh([pageSlot.slot]);
}
}, interval);
},
getPageSlotByAdUnitPath:function(path) {
for (var i=0; i0) {
googletag.destroySlots(aDestroySlots);
}
},
// Slot Events
onSlotLoad:function(fHandler)
{
this.handlersSlotLoad.push(fHandler);
},
onSlotLoadById:function(cSlotId, fHandler)
{
this.onSlotLoad( function(event) {
if (event.slot.getSlotId().getId()===cSlotId) {
fHandler(event);
}
});
},
onEmptySlotLoadById:function(cSlotId, fHandler)
{
this.onSlotLoad( function(event) {
if (event.slot.getSlotId().getId()===cSlotId && event.isEmpty) {
fHandler(event);
}
});
},
// slot load event handler
handleSlotLoadEvents:function(event) {
for (var index = 0; (index < this.handlersSlotLoad.length) ; index++) {
try {
this.handlersSlotLoad[index](event);
} catch(exp) {
console.log(exp)
}
}
}
}
// compatibility create the window dfp object
window.dfp=zentech.ads.dfp;
var oArticleInfiniteScroll=
{
nArticleInfinitePageNum:1,
isArticleLoading:false,
oArticlesStack:[],
nActiveArticle:0,
bReloadAdmanSkin:true,
bDisableInfiniteScroll:false,
cDisableForIp:null,
bDisableForRobots:true,
bCheckForPageDom:false,
nChildPageElementId:null,
nSkinWebSpaceId:null,
cSkinNodeId:null,
nHeightOffset:null,
nHeightCreateOffset:null,
bUseMultiplePagesPatch:false,
isRobot: /bot|googlebot|crawler|spider|lighthouse|robot|crawling/i.test(navigator.userAgent),
fRenderAddElement:null,
construct: function (nChildPageElementIdparam, nSkinWebSpaceIdparam, cSkinNodeIdparam ,
nHeightOffsetparam,nHeightCreateOffsetparam, bUseMultiplePagesPatchparam , cDisableForIpparam, cClientIp ,
bCheckForPageDomparam, fRenderAddElementparam) {
this.nChildPageElementId=nChildPageElementIdparam;
this.nSkinWebSpaceId=nSkinWebSpaceIdparam;
this.cSkinNodeId=cSkinNodeIdparam;
this.nHeightOffset=nHeightOffsetparam;
this.nHeightCreateOffset=nHeightCreateOffsetparam;
this.cDisableForIp=cDisableForIpparam;
this.fRenderAddElement=fRenderAddElementparam;
if (bCheckForPageDomparam!=null) {
this.bCheckForPageDom=bCheckForPageDomparam;
}
if (bUseMultiplePagesPatchparam!=null) {
this.bUseMultiplePagesPatch=bUseMultiplePagesPatchparam;
}
if (this.cDisableForIp!= null) {
if (cClientIp==null) {
cClientIp="%RPROXY.CLIENTIP%"; // this is give by reverse proxy replace
}
var aDisableForIp=this.cDisableForIp.split(",");
for (var i=0;i(this.oArticlesStack[i].nHeightStart+nHeightOffset)) {
nNewActiveArticle=i;
}
}
if (this.nActiveArticle!=nNewActiveArticle) {
// this.handleAdverts();
this.handleCurrentArticleChange(nNewActiveArticle);
}
},
handleCurrentArticleChange:function(nChangedArticleId) {
this.nActiveArticle=nChangedArticleId;
window.history.replaceState(null,
this.oArticlesStack[nChangedArticleId].cTitle,
this.oArticlesStack[nChangedArticleId].cURL);
document.title = this.oArticlesStack[nChangedArticleId].cTitle;
if (!this.oArticlesStack[nChangedArticleId].bIsInitialized) {
this.currentArticleConstruct(nChangedArticleId);
}
},
handleAdverts:function() {
if (this.nSkinWebSpaceId) {
// destruct Advert Skin
oBannerManager.destructAdv('destruct.skin.bannerManager');
// Reload skin
oBannerManager.createAdv(this.nSkinWebSpaceId, this.cSkinNodeId);
}
},
currentArticleConstruct:function(nArticleId) {
console.log('Write Statistics and Banners');
this.oArticlesStack[nArticleId].bIsInitialized=true;
//Google Analytics
ga('send', 'pageview', (location.pathname+location.search));
if($('.entry-content').length>0){
$('a[rel*=lightbox-group1]').magnificPopup({
gallery: {
// options for gallery
enabled: true
},
type:'image',
titleSrc: 'title'
});
}
},
checkNewInfiniteArticle:function(nCurrentHeight) {
if (nCurrentHeight > (this.oArticlesStack[this.oArticlesStack.length-1].nHeightEnd-this.nHeightCreateOffset) ) {
this.createInfiniteArticle();
}
},
pushArticle:function(cURLparam, cTitleparam, cUrlNextparam ,nHeightStartparam, nHeightEndparam, bIsInitializedparam) {
if (bIsInitializedparam==null) {
bIsInitializedparam=false;
}
var bArticleNotExists=true;
for( var nArticle=0; nArticleAdman.ws(' + nWebSpaceId + ',"' + cAdvertSize + '",false,"ads.e-go.gr", "", "", "", "", null, ppn);', oAdvertNode);
} catch (exep) {
console.log('exception in banner manager createAdv');
}
}
}
}
// the sticky column object
var oStickyColumns=
{
// Construction properties
cStickyColumnWrapperSelector:null,
cDocumentTopOffsetSelector:null,
nDocumentTopOffsetAdditional:0,
// Sticky column class names
cAdditionalClassSticky: 'sc_sticky',
cAdditionalClassBottom: 'sc_bottom',
construct: function(cStickyColumnWrapperSelector_param,
cDocumentTopOffsetSelector_param,
nDocumentTopOffsetAdditional_param) {
// Initialize construction properties
this.cStickyColumnWrapperSelector=cStickyColumnWrapperSelector_param;
this.cDocumentTopOffsetSelector=cDocumentTopOffsetSelector_param;
if (nDocumentTopOffsetAdditional_param) {
this.nDocumentTopOffsetAdditional=nDocumentTopOffsetAdditional_param;
}
// Attach the event handler
$(window).scroll(function() { oStickyColumns.eventHandler() });
$(window).resize(function() { oStickyColumns.eventHandler() });
},
eventHandler:function() {
oStickyColumns.main();
},
main:function() {
// Initialize the actual top offset of document
var nTopOffset=0;
if (this.cDocumentTopOffsetSelector) {
nTopOffset=$(this.cDocumentTopOffsetSelector).height();
if (nTopOffset>150) {
nTopOffset=0;
}
}
if (this.nDocumentTopOffsetAdditional) {
nTopOffset+=this.nDocumentTopOffsetAdditional;
}
// Get The scrolling position
nScrollTop=$(window).scrollTop();
// debugging
// console.log('---------- Scrolling Position : ' + nScrollTop);
// For each column
$(this.cStickyColumnWrapperSelector).each(
function(nIndexRightColumn, oElementRightColumn) {
// debugging
// console.log('---- Column -----');
$(oElementRightColumn).children().each(
function(nIndexRightColumnArea, oElementRightColumnArea) {
// get the floating area
var oArea=$(oElementRightColumnArea);
// get the floating box
var oBox=$(oElementRightColumnArea).children().first();
// calculate offsetop and offsetbottom area
var nAreaTopOffset=oArea.offset().top - nScrollTop;
var nAreaBottomOffset=nAreaTopOffset + oArea.outerHeight();
var nAreaHeight=oArea.outerHeight();
var nAreaLeftPosition=oArea.offset().left;
// calculate offsetbottom box
var nBoxHeight=oBox.outerHeight();
var bStyleModified=false;
if (nAreaHeight>nBoxHeight) {
// debugging
// console.log('---- Area : ' + nAreaBottomOffset);
// this is the decision making
if (nAreaBottomOffset<=nTopOffset) {
// do nothing it area is out of usefull display
oBox.addClass(oStickyColumns.cAdditionalClassBottom);
// debugging
// console.log('1. do nothing it area is out of usefull display');
bStyleModified=true;
}
else if (nAreaTopOffset<=nTopOffset && nAreaBottomOffset>=(nBoxHeight+nTopOffset)) {
// this is sticky
oBox.removeClass(oStickyColumns.cAdditionalClassBottom);
oBox.addClass(oStickyColumns.cAdditionalClassSticky);
oBox.css({ 'top': nTopOffset + 8, 'left': nAreaLeftPosition }); // 4 should be parametrical offset fromtop
// debugging
// console.log('2. this is sticky');
bStyleModified=true;
} else if (nAreaTopOffset>nTopOffset) {
// remove all classes
oBox.removeClass(oStickyColumns.cAdditionalClassBottom);
oBox.removeClass(oStickyColumns.cAdditionalClassSticky);
oBox.css({ 'top': '', 'left': ''});
// debugging
// console.log('3. remove all classes');
bStyleModified=true;
}
else if ( nAreaBottomOffset<(nBoxHeight+nTopOffset) && nAreaBottomOffset>=nTopOffset) {
// this is bottom
oBox.removeClass(oStickyColumns.cAdditionalClassSticky);
oBox.css({ 'top': '','left': ''});
oBox.addClass(oStickyColumns.cAdditionalClassBottom);
// debugging
// console.log('4. this is bottom');
bStyleModified=true;
}
else {
// debugging
// console.log('5. bad decision');
}
if (bStyleModified) {
oBox.css({ 'width': oArea.parent().width() });
}
} // nAreaHeight>nBoxHeight
});
});
}
}
var oEqualizeColumnsHeight=
{
// Construction properties
cEqualColumnSourceSelector: null,
cEqualColumnTargetSelector: null,
cSourceChildrenHeightSelector: null,
// private properties
nPreviousDocumentHeight : 0,
construct: function ( cEqualColumnTargetSelector_param,
cEqualColumnSourceSelector_param,
cSourceChildrenHeightSelector_param) {
this.cEqualColumnSourceSelector=cEqualColumnSourceSelector_param;
this.cEqualColumnTargetSelector=cEqualColumnTargetSelector_param;
this.cSourceChildrenHeightSelector=cSourceChildrenHeightSelector_param;
$(window).on('load', function() {oEqualizeColumnsHeight.main() });
$(window).resize(function() {oEqualizeColumnsHeight.main() });
$(window).scroll(function() {oEqualizeColumnsHeight.main() });
var imgs = document.images,
len = imgs.length,
counter = 0;
[].forEach.call( imgs, function( img ) {
if(!img.complete)
img.addEventListener( 'load', function() {oEqualizeColumnsHeight.main(true) }, false );
});
},
main: function(bForce){
// get the document height
var nDocumentHeight=$(document).height();
if (this.nPreviousDocumentHeight!=nDocumentHeight || bForce) {
this.equalize();
this.nPreviousDocumentHeight=nDocumentHeight;
}
},
equalize: function() {
$(this.cEqualColumnTargetSelector).each(
function(nIndexTarget, oElementTarget) {
// Get the Parent
oParent=$(oElementTarget).parent();
// Equivalent Source
oSource=oParent.children(oEqualizeColumnsHeight.cEqualColumnSourceSelector).first();
// If source found
if (oSource) {
// Create the default value
var bColumnsAreSideBySide=false;
try {
// Get the Source offset Top of source and target to deside if they are side by side
var nSourceOffsetTop=oSource.offset().top
var nTargetOffsetTop=$(oElementTarget).offset().top
if (Math.abs(nSourceOffsetTop-nTargetOffsetTop)<50) {
bColumnsAreSideBySide=true;
}
} catch(err) {
console.log('There is an error at side by side checking, disable it' + err.message);
}
// Expantion add percentage in the calculation
if (bColumnsAreSideBySide) {
// Get the source height
var nSourceHeight=oSource.outerHeight();
if (oEqualizeColumnsHeight.cSourceChildrenHeightSelector!='') {
nSourceHeight=oSource.children(oEqualizeColumnsHeight.cSourceChildrenHeightSelector).outerHeight();
// console.log(oEqualizeColumnsHeight.cSourceChildrenHeightSelector + ":" + nSourceHeight);
}
// Calculate available height for children
var nStaticHeight=0;
var nTotalSubElementsHeight=0;
$(oElementTarget).children().each(
// Get each of the children
function(nIndexTargetChild, oElementTargetChild) {
$(oElementTargetChild).css({'height': ''});
var nElementHeight=$(oElementTargetChild).outerHeight();
nTotalSubElementsHeight+=nElementHeight;
if ($(oElementTargetChild).data("equalized-height")==null) {
nStaticHeight+=nElementHeight;
}
});
//
if (nTotalSubElementsHeight>=nSourceHeight) {
// donnot do anything source column is smaller than the target
// you must delete the height
$(oElementTarget).css({'height': ''});
} else {
// Set the height of the target column
$(oElementTarget).css({'height':nSourceHeight});
// calculate the available for equalizing height
var nEqualizedHeightTotal=nSourceHeight-nStaticHeight;
// divide the children
$(oElementTarget).children().each(
// Get each of the children
function(nIndexTargetChild, oElementTargetChild) {
var cCSSPercentage=$(oElementTargetChild).data("equalized-height");
if (cCSSPercentage!=null) {
var nCSSPercentage=parseInt(cCSSPercentage);
var nEqualizedHeight=parseInt(nEqualizedHeightTotal * nCSSPercentage /100);
if ($(oElementTargetChild).outerHeight() $(window).height() ) {
docViewBottom = docViewTop + $(elem).height() + 10;
}
return (
(elemBottom <= docViewBottom) && (elemTop >= docViewTop)
);
},
insertElementInText:function(cTextDiv, cNewElementId, nAfterParagraphsCount, nMinParagraphSize) {
// initialize
if (!nMinParagraphSize) {
nMinParagraphSize=400;
}
var articles=$(cTextDiv + ':not([ieit-parsed="true"])');
articles.each( function(i, article) {
$(article).attr("ieit-parsed", "true");
var paragraphs=$(article).children();
var eligibleParagraph;
var eligibleParagraphCharactersCount;
var bParagraphFound=false;
var nParagraphsCount=0;
paragraphs.each( function(i, paragraph) {
if ($(paragraph)[0].tagName=="P" && $(paragraph).children('div,img,iframe,ul,li,embed,twitter-widget').length<1 && $(paragraph).text().length>10 ) {
nParagraphsCount++;
if (nParagraphsCount>=nAfterParagraphsCount) {
if (eligibleParagraph==null) {
eligibleParagraph=paragraph;
eligibleParagraphCharactersCount=$(paragraph).text().length;
} else {
eligibleParagraphCharactersCount+=$(paragraph).text().length;
}
if (eligibleParagraphCharactersCount>nMinParagraphSize) {
bParagraphFound=true;
return false;
}
}
} else {
eligibleParagraph=null;
}
});
if (bParagraphFound) {
// console.log( $(eligibleParagraph).text() );
$(eligibleParagraph).prepend('');
}
});
if (document.getElementById(cNewElementId)!=null) {
return true;
} else {
return false;
}
},
}
zentech.document.forms={
validate: {
email:function(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
},
name:function(name) {
// unicode sucks at regular expressions
var allowed="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
allowed+="αβγδεζηθικλμνξοπρστυφχψωΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩάέήίόύώΆΈΉΊΌΎΏϊϋς";
allowed+=" -."
for (var i = 0; i < name.length; i++) {
var letter=name.charAt(i);
if ( allowed.indexOf(letter)==-1 ) {
return false;
}
}
return true;
}
}
}
// --------------------------------------------------------------------------------------------------------
// Put it in another file future
zentech.portal = {
getSiteUrl: function() {
if( this.isDevelopment() ) {
return zentech.url.getHostNameByUrl() + '/' + zentech.url.getPathByUrl()[0];
} else {
return zentech.url.getHostNameByUrl();
}
},
isDevelopment: function() {
var url=window.location.href;
if (url.indexOf('extranet')!=-1){
return true;
} else {
return false;
}
}
}
zentech.http={
post:function(path, params, method) {
method = method || "post"; // Set method to post by default if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for(var key in params) {
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params[key]);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
}
}
zentech.url={
getPathByUrl: function(url) {
if (url==null) { url=window.location.href };
var path;
if (url.indexOf("//") > -1) {
path = url.substring(url.indexOf("//") +2);
path = path.substring(path.indexOf("/") + 1);
} else {
path = url.substring(url.indexOf("/") + 1);
}
return path.split('/');
},
getHostNameByUrl: function(url, inludeProtocol) {
var hostname;
var protocol;
if (url==null) { url=window.location.href };
if (inludeProtocol==null) { inludeProtocol=true };
if (url.indexOf("//") > -1) {
protocol = url.split('/')[0];
hostname = url.split('/')[2];
}
else {
hostname = url.split('/')[0];
}
hostname = hostname.split(':')[0];
hostname = hostname.split('?')[0];
if (inludeProtocol) {
hostname=protocol + '//' + hostname;
}
return hostname;
},
setUrlParam: function(cURL,cParam,cValue) {
if (cURL!=null) {
var cURLOut="";
var cParamName=cParam + "=";
var nParamPos=cURL.indexOf(cParamName);
var cParamString=cParam + "=" + cValue;
if (nParamPos==-1) {
if (cURL.indexOf("?")!=0) {
cURLOut=cURL + "&" + cParamString;
} else {
cURLOut=cURL + "?" + cParamString;
}
} else {
nParamPosTo=cURL.indexOf("&",nParamPos);
if (nParamPosTo==-1) {
cURLOut=cURL.substring(0,nParamPos) + cParamString;
} else {
cURLOut=cURL.substring(0,nParamPos) + cParamString + cURL.substring(nParamPosTo);
}
}
return cURLOut;
} else {
return "";
}
},
getUrlParam: function(cURL,cParam) {
if (cURL!=null) {
var cValue="";
var cParamName=cParam + "=";
var nParamPos=cURL.indexOf(cParamName);
if (nParamPos!=-1) {
nParamPos=nParamPos + cParam.length + 1;
nParamPosTo=cURL.indexOf("&",nParamPos);
if (nParamPosTo==-1) {
cValue=cURL.substring(nParamPos);
} else {
cValue=cURL.substring(nParamPos,nParamPosTo);
}
}
return cValue;
} else {
return "";
}
}
}
zentech.cipher={
encrypt:function(key, value) {
var result="";
for(i=0;i
*/
active:false,
setBySelector:function(selector, loadInitial, offset) {
if (loadInitial==null) { loadInitial = true }
document.addEventListener("scroll", function() {
zentech.images.lazy.
load(selector, offset);
});
if (loadInitial) { this.load(selector, loadInitial, 0); }
},
load:function(selector, offset) {
if (selector==null) {
selector = ".lazy";
}
if (offset==null) {
offset = 300;
}
let lazyImages = [].slice.call(document.querySelectorAll("img" + selector));
if (this.active === false) {
this.active = true;
setTimeout(function() {
lazyImages.forEach(function(lazyImage) {
if (( lazyImage.getBoundingClientRect().top - offset <= window.innerHeight &&
lazyImage.getBoundingClientRect().bottom > 0) &&
getComputedStyle(lazyImage).display !== "none") {
lazyImage.src = lazyImage.dataset.src;
// lazyImage.srcset = lazyImage.dataset.srcset;
lazyImage.classList.remove( selector.replace(".","") );
lazyImages = lazyImages.filter(function(image) {
return image !== lazyImage;
});
if (lazyImages.length === 0) {
// no due to infinite scroll
//document.removeEventListener("scroll", lazyLoad);
//window.removeEventListener("resize", lazyLoad);
//window.removeEventListener("orientationchange", lazyLoad);
}
}
});
zentech.images.lazy.active = false;
}, 200);
}
}
}
zentech.cookies={
set:function(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
},
get:function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
},
erase:function(name) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';
}
};
zentech.cookies.consent={
set: function(cDomain, cUrl) {
var cDescription='Το ' + cDomain + ' χρησιμοποιεί cookies για βελτιστοποίηση της εμπειρίας του χρήστη. \
Με τη χρήση αυτού του ιστοτόπου, αποδέχεστε τη χρήση των cookies. \
Όροι Χρήσης. \
Αποδέχομαι ';
this.setByDescription(cDescription);
},
setByDescription: function(cDescription) {
var cTemplate='';
cTemplate=cTemplate.replaceAll("%DESCRIPTION%",cDescription)
$('body').append(cTemplate);
this.enable();
},
enable: function() {
if (zentech.cookies.get("consent")!="true") {
$(document).ready(function(){
setTimeout(function () {
$("#cookieConsent").fadeIn(200);
}, 4000);
$(".cookieConsentOK").click(function() {
zentech.cookies.consent.storeConsent();
$("#cookieConsent").fadeOut(200);
});
$("#closeCookieConsent").click(function() {
$("#cookieConsent").fadeOut(200);
});
});
}
},
storeConsent:function() {
zentech.cookies.set("consent", "true", 365);
}
}