var baseDir = "https://finishing.planoplastics.nl/"; var hoofdNav; var redirectActive = false; var device = { mobile: function() { return $j('body').data('device') == 'mobile' || window.innerWidth < 767; }, tablet: function() { return $j('body').data('device') == 'tablet'; }, desktop: function() { return $j('body').data('device') == 'desktop' && window.innerWidth > 767; } } function handelResizeAf() { hideMobileNav(); zetSubMenuMinBreedte(); } function zetSubMenuMinBreedte() { if(hoofdNav != undefined) { var maxBreedte = hoofdNav.width(); if(hoofdNav.offset() != undefined) { var hoofdNavOffsetLeft = hoofdNav.offset().left; hoofdNav.find("ul > li > ul").each(function(index) { var element = $j(this); var breedteUL = element.width(); var offsetParentUL =element.parent().offset().left-hoofdNavOffsetLeft; if (offsetParentUL+breedteUL>maxBreedte) { element.css({marginLeft:(maxBreedte-offsetParentUL-breedteUL-3)+"px"}); } element.css({minWidth:element.parent().width()+"px"}); }); } } } function generateUUID() { var d = new Date().getTime(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = (d + Math.random()*16)%16 | 0; d = Math.floor(d/16); return (c=='x' ? r : (r&0x3|0x8)).toString(16); }); return uuid; } function createPartialFunction(func /*, 0..n args */) { var args = Array.prototype.slice.call(arguments, 1); return function() { var allArguments = args.concat(Array.prototype.slice.call(arguments)); return func.apply(this, allArguments); }; } function hideMobileNav() { $j(".site").attr("style","left :0px"); $j(".mobile-nav").hide(); $j(".site").removeClass('site-uitklap'); $j("body").removeClass('body-uitklap'); } function showMobileNav() { if ($j(".site").hasClass('site-uitklap')) { hideMobileNav(); } else { $j(".mobile-nav").show(); $j(".site").addClass('site-uitklap'); $j("body").addClass('body-uitklap'); $j(".site").attr("style","left:-"+($j(window).width()-50)+"px"); } } var videoDefaults = { defaults: { autoplay: true, controls: false, loop: true, muted: true, poster: 'resources/img/visual-home.jpg', pauseonclick: false } } function iniVideo() { $j('.visual_video').each(function() { $j(this).addClass('canplay'); vid = $j(this).find('video'); vid.prop('autoplay', $j(this).data('autoplay') == undefined ? videoDefaults.defaults.autoplay : $j(this).data('autoplay')); vid.prop('controls', $j(this).data('controls') == undefined ? videoDefaults.defaults.controls : $j(this).data('controls')); vid.prop('loop', $j(this).data('loop') == undefined ? videoDefaults.defaults.loop : $j(this).data('loop')); vid.prop('muted', $j(this).data('muted') == undefined ? videoDefaults.defaults.muted : $j(this).data('muted')); vid.prop('poster', $j(this).data('poster') == undefined ? videoDefaults.defaults.poster : $j(this).data('poster')); vid.prop('pauseonclick', $j(this).data('pauseonclick') == undefined ? videoDefaults.defaults.pauseonclick : $j(this).data('pauseonclick')); if (device.mobile() || device.tablet() || $j('html').hasClass('no-video')) { $j(this).css({ 'background-image': 'url(' + vid.prop('poster') + ')' }); //vid.remove(); } else { vid.on('canplay', function() { $j(this).addClass('canplay'); }); if (vid.prop('pauseonclick')) { vid.on('click', function() { if ($j(this).prop('paused')) { $j(this)[0].play(); } else { $j(this)[0].pause(); } }); } } }); } function iniMenu() { $j('.hoofdnav > ul > li').each(function() { $j(this).css("min-width", $j(this).width()+10); }); } function deletePlaceholder(input, waarde) { if (input.value==waarde) { input.value=""; } } function setPlaceholder(input, waarde) { if (input.value=="") { input.value=waarde; } } function navigeerNaarAnchorOpPagina() { document.location.href=''; } function getAndShowDependentInputFields(prefix, parentId, elementId, veldId) { var selected = new Array(); // INPUTS $cf('input[name="'+prefix+elementId+'"]').each(function() { if ($cf(this).is(":checked")) { selected.push($cf(this).val()); } }); // SELECTS $cf('select[name="'+prefix+elementId+'"]').each(function() { selected.push($cf(this).find(":selected").val()); }); var ajaxRequest; try { // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e) { // Internet Explorer Browsers try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200) { $cf('#div'+prefix+veldId).remove(); $cf('#div'+prefix+parentId).after(ajaxRequest.responseText); } } ajaxRequest.open("GET","https://finishing.planoplastics.nl/resources/ajax/getDependentInputFieldsHTML.php?vid="+veldId+"&selected="+selected.join(),true); ajaxRequest.send(); } $j(function() { hoofdNav = $j(".hoofdnav"); zetSubMenuMinBreedte(); iniMenu(); iniVideo(); $j(window).resize(function(){ handelResizeAf(); }); // ROT13 encrypted mailto's decoderen $j('a[href^="znvygb"]').each(function() { $j(this).attr('href', $j(this).attr('href').replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);})); }); }); function redirect(url) { if(!redirectActive) { redirectActive = true; window.location.href = url; } } function stopRedirectAfterClick() { redirectActive = true; setTimeout("redirectActive = false;", 250); } function executeAjaxCall(url, completeFunction, postOrGet, data, transferFunction) { var call= new XMLHttpRequest(); if(transferFunction != undefined) { call.upload.addEventListener("progress", transferFunction, false); } call.onreadystatechange = function() { if(call.readyState == 4) { if(call.status == 200) { if(completeFunction != undefined) { completeFunction(call); } } } }; if(data != undefined && (postOrGet == "GET" || postOrGet == "get")) { var first = true; for(index in data) { if(first) { url+= "?"; first = false; } else { url+= "&"; } url+= index+"="+data[index]; } } call.open(postOrGet, url, true); if(data != undefined && (postOrGet == "POST" || postOrGet == "post")) { call.send(data); } else { call.send(); } } function changeHiddenInputs(form, attributeName, hide) { if(form != undefined && attributeName != undefined && hide != undefined) { form.find("["+attributeName+"=\"y\"]").each(function(i){ var jqueryElement = $j(this); if(hide) { jqueryElement.css({display:"none"}); } else { jqueryElement.css({display:""}); } changeVerplicht(jqueryElement.find(":input"), hide); }); } } function isInputHidden(form, attributeName) { if(form != undefined && attributeName != undefined) { return form.find("["+attributeName+"=\"y\"]").is(":hidden"); } return "test"; } function changeVerplicht(jqueryElementInput, hide) { if(jqueryElementInput != undefined && hide != undefined) { if(jqueryElementInput.attr('verplicht') != undefined) { if(!hide) { if(jqueryElementInput.attr('verplicht-hidden') != "") { jqueryElementInput.attr('verplicht', jqueryElementInput.attr('verplicht-hidden')); jqueryElementInput.attr('verplicht-hidden', ''); } } else if(hide) { if(jqueryElementInput.attr('verplicht') != "") { jqueryElementInput.attr('verplicht-hidden', jqueryElementInput.attr('verplicht')); jqueryElementInput.attr('verplicht', ''); } } } } } function clearDocumentQueue() { executeAjaxCall(baseDir+"resources/ajax/clearDocumentQueue.php", clearDocumentQueueCallback, "GET"); } function clearBarcodeQueue() { executeAjaxCall(baseDir+"resources/ajax/clearBarcodeQueue.php", clearBarcodeQueueCallback, "GET"); } function downloadTNTManifest() { redirect(baseDir+"DownloadTNTManifest.php"); redirectActive = false; } function clearDocumentQueueCallback(call) { if(call.responseText != "") { if(call.responseText == "1") { alert("Het legen van documenten / verzendetiketten printen is gelukt"); } else { alert("Het legen van documenten / verzendetiketten printen is mislukt"); } } } function clearBarcodeQueueCallback(call) { if(call.responseText != "") { if(call.responseText == "1") { alert("Het legen van barcode printen is gelukt"); } else { alert("Het legen van barcode printen is mislukt"); } } }