/** * @author Steffen Hansen * @filesource /public/js/Settings/BookingToolIframe.js * * @copyright Copyright (c) 2018 secu-ring GmbH (http://www.secu-ring.de) * * @package BookingTool */ var BookingToolIframe = { /** * initialize the iframe for the booking tool */ 'initialize': function(oJson) { var self = this; var xhr = new XMLHttpRequest(); xhr.open('GET', oJson.url); xhr.onload = function() { if (xhr.status === 200) { var oResponse = JSON.parse(xhr.responseText); if (true === oResponse.success) { var oContainer = document.querySelector(oJson.target); oContainer.innerHTML = oContainer.innerHTML + oResponse.html; self.loadJs(oContainer, oJson.baseUrl); function checkFlag() { if('undefined' === typeof(iFrameResize)) { window.setTimeout(checkFlag, 750); } else { iFrameResize({heightCalculationMethod : 'lowestElement', tolerance: 51}, '#' + oContainer.querySelector("iframe").getAttribute('id')) } } checkFlag(); } else { console.log(oResponse); } } else { console.log('Request failed. Returned status of ' + xhr.status); } }; xhr.send(); }, /** * load js * * @param oContainer * @param smoobuBaseUrl */ 'loadJs': function (oContainer, smoobuBaseUrl) { var jsFiles = [ {url: "https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.16/iframeResizer.min.js"} ]; if ('undefined' == typeof jQuery) { jsFiles.push({'url': smoobuBaseUrl + '/js/limitless/core/libraries/jquery.min.js'}); } BookingToolIframe.loadJavascript(oContainer, jsFiles); }, /** * load all javascripts which are required * * @param oContainer * @param aFiles */ 'loadJavascript': function(oContainer, aFiles) { if ('undefined' == aFiles.pop || 0 == aFiles.length) { return; } var oFile = aFiles.pop(); var callback = function() { BookingToolIframe.loadJavascript(oContainer, aFiles); }; BookingToolIframe.initJavascriptElement(oContainer, oFile, callback); }, /** * initialize the javascript element and execute the callbakc on load * * @param oCalenderWidget * @param oFile * @param callback */ 'initJavascriptElement': function(oCalenderWidget, oFile, callback) { var oScript = document.createElement('script'); oScript.setAttribute('type', 'text/javascript'); if (undefined !== oFile.url) { oScript.onload = function() { callback(); }; } if (undefined !== oFile.url) { oScript.setAttribute('src', oFile.url); } else { oScript.textContent = oFile.text; } oCalenderWidget.appendChild(oScript); if (undefined === oFile.url) { callback(); } } };
top of page
Get in touch

Send us your request, specifying your desired dates and any specific requirements you may have or reach out to us via WhatsApp or email to receive the best rates and availability options. 

 

Book now to secure your discount!

Foinikia, Oia

84702, Santorini

  • Instagram
  • Whatsapp

Thanks for submitting!

bottom of page