Changeset 3211925
- Timestamp:
- 12/22/2024 10:31:06 PM (16 months ago)
- Location:
- eveeno
- Files:
-
- 4 edited
-
tags/2.0/assets/js/embed.js (modified) (6 diffs)
-
tags/2.0/assets/js/embed.min.js (modified) (1 diff)
-
trunk/assets/js/embed.js (modified) (6 diffs)
-
trunk/assets/js/embed.min.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eveeno/tags/2.0/assets/js/embed.js
r3211923 r3211925 24 24 25 25 window.onload = function() { 26 console.log('script version ' + SCRIPT_VERSION);26 //logconsole.log('script version ' + SCRIPT_VERSION); 27 27 evInitializeWidgets(); 28 28 }; … … 30 30 function evInitializeWidgets() { 31 31 const widgets = document.querySelectorAll('.eveenoWidget'); 32 console.log('evInitializeWidgets', widgets);32 //console.log('evInitializeWidgets', widgets); 33 33 widgets.forEach(evCreateWidget); 34 34 }; … … 41 41 function evCreateWidget(widget, i) { 42 42 43 console.log('evCreateWidget', i, widget);43 //console.log('evCreateWidget', i, widget); 44 44 45 // read parameters 46 45 47 var data = widget.dataset; 46 48 47 49 var apikey = data.apikey; 50 var event = data.event; 48 51 var lang = data.lang; 49 52 var scope = data.scope; 50 53 var server = data.server; 51 54 var style = data.style; 55 var type = data.type; 56 var user = data.user; 52 57 var version = data.version || 'none'; 58 var wp_plugin_version = data.wp_plugin_version || 'none'; 53 59 54 // add fallbacks for WP plugin version < 1.8 55 var type = data.show ? data.show : data.type; 56 var user = data.userid ? data.userid : data.user; 57 var event = data.eventid ? data.eventid : data.event; 60 // overwrite some by fallbacks for WP plugin version < 1.8 61 62 if (data.show) { 63 if (data.show == 'form') { 64 type = 'booking'; 65 } 66 else if (data.show == 'grid' || data.show == 'table' || data.show == 'list') { 67 type = 'booking'; style = data.show; 68 } 69 } 70 if (data.eventid) event = data.eventid; 71 if (data.userid) user = data.userid; 58 72 73 // build widget url 74 59 75 switch (server) { 60 76 case 'dev': var serverurl = 'http://localhost'; break; … … 64 80 } 65 81 66 // build widget url67 68 82 switch (type) { 69 83 … … 104 118 url.searchParams.append('format', 'embedded'); 105 119 url.searchParams.append('version', SCRIPT_VERSION); 120 url.searchParams.append('wp_plugin_version', wp_plugin_version); 121 106 122 107 123 // create iframe … … 129 145 onMessage: function(data){ 130 146 131 console.log('Message received', data);147 //console.log('Message received', data); 132 148 133 149 // receive commands from the iframed page -
eveeno/tags/2.0/assets/js/embed.min.js
r3211923 r3211925 5 5 * Copyright: (c) 2023 David J. Bradshaw - dave@bradshaw.net 6 6 * License: MIT 7 */function evInitializeWidgets(){ const e=document.querySelectorAll(".eveenoWidget");console.log("evInitializeWidgets",e),e.forEach(evCreateWidget)}function evCreateWidget(e,n){console.log("evCreateWidget",n,e);var t=e.dataset,i=t.apikey,o=t.lang,r=t.scope,a=t.server,s=t.style,d=(t.version,t.show?t.show:t.type),c=t.userid?t.userid:t.user,l=t.eventid?t.eventid:t.event;switch(a){case"dev":var u="http://localhost";break;case"tst":u="https://tst.eveeno.com";break;case"int":u="https://int.eveeno.com";break;default:u="https://eveeno.com"}switch(d){case"booking":if(!l)return void evWidgetShowError(e,"Für das widget 'booking' ist der parameter 'event' Pflicht");var f=new URL(u+"/"+l);break;case"calendar":if(!c)return void evWidgetShowError(e,"Für das widget 'calendar' ist der parameter 'user' Pflicht");f=new URL(u+"/de/event-cal/"+c);break;default:return void evWidgetShowError(e,"Der Widget-Typ 'type' fehlt oder ist falsch")}i&&f.searchParams.append("apikey",i),l&&f.searchParams.append("eventid",l),o&&f.searchParams.append("lang",o),r&&f.searchParams.append("scope",r),s&&f.searchParams.append("style",s),c&&f.searchParams.append("userid",c),i&&f.searchParams.append("apikey",i),f.searchParams.append("format","embedded"),f.searchParams.append("version",SCRIPT_VERSION);let m="evFrame"+n;const g=document.createElement("iframe");g.setAttribute("id",m),g.setAttribute("src",f.href),g.setAttribute("width","100%"),g.setAttribute("minWidth","100%"),g.setAttribute("scrolling","no"),g.setAttribute("frameborder","0"),e.replaceWith(g),iFrameResize({log:!1,checkOrigin:!1,heightCalculationMethod:"taggedElement",onMessage:function(e){if(console.log("Message received",e),e.message.cmd)switch(e.message.cmd){case"forceReload":location.reload(!0);break;case"scrollTo":e.message.pos&&window.scrollTo({top:document.getElementById(m).offsetTop+e.message.pos-10,left:0,behavior:"smooth"})}}},"#"+m)}function evWidgetShowError(e,n){html="Fehler in diesem Widget, bitte überprüfen Sie die Parameter:",html+="<br><br>",html+=n,e.innerHTML=html,e.setAttribute("style","background-color:#FAEAE9; color: #D9534F; text-align: center; padding: 20px;")}!function(e){var n,t,i,o,r,a,s,d,c,l,u,f,m;function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function h(e,n,t){e.addEventListener(n,t,!1)}function p(e,n,t){e.removeEventListener(n,t,!1)}function w(e){return l[e]?l[e].log:t}function b(e,n){k("log",e,n,w(e))}function y(e,n){k("info",e,n,w(e))}function v(e,n){k("warn",e,n,!0)}function k(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return r+"["+(n="Host page: "+e,(n=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e:n)+"]");var n}(n),t)}function I(e){function n(){t("Height"),t("Width"),W((function(){T(P),E(A),k("onResized",P)}),P,"init")}function t(e){var n=Number(l[A]["max"+e]),t=Number(l[A]["min"+e]),i=(e=e.toLowerCase(),Number(P[e]));b(A,"Checking "+e+" is in range "+t+"-"+n),i<t&&(i=t,b(A,"Set "+e+" to min value")),n<i&&(i=n,b(A,"Set "+e+" to max value")),P[e]=""+i}function i(e){return N.slice(N.indexOf(":")+o+e)}function d(e,n){var t,i;t=function(){var t,i;S("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=P.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},m[i=n]||(m[i]=setTimeout((function(){m[i]=null,t()}),32))}function c(e){return e=e.getBoundingClientRect(),z(A),{x:Math.floor(Number(e.left)+Number(s.x)),y:Math.floor(Number(e.top)+Number(s.y))}}function u(e){var n=e?c(P.iframe):{x:0,y:0},t={x:Number(P.width)+n.x,y:Number(P.height)+n.y};b(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(s=t,f(),b(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):v(A,"Unable to scroll to requested position, window.parentIFrame not found")}function f(){!1===k("onScroll",s)?R():E(A)}function g(e){e=e.split("#")[1]||"";var n=decodeURIComponent(e);(n=document.getElementById(n)||document.getElementsByName(n)[0])?(n=c(n),b(A,"Moving to in page link (#"+e+") at x: "+n.x+" y: "+n.y),s={x:n.x,y:n.y},f(),b(A,"--")):window.top===window.self?b(A,"In page link #"+e+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(e):b(A,"In page link #"+e+" not found and window.parentIFrame not found")}function w(e){var n,t;t=0===Number(P.width)&&0===Number(P.height)?{x:(n=i(9).split(":"))[1],y:n[0]}:{x:P.width,y:P.height},k(e,{iframe:P.iframe,screenX:Number(t.x),screenY:Number(t.y),type:P.type})}function k(e,n){return F(A,e,n)}var I,M,N=e.data,P={},A=null;if("[iFrameResizerChild]Ready"===N)for(var j in l)S("iFrame requested init",C(j),l[j].iframe,j);else r===(""+N).slice(0,a)&&N.slice(a).split(":")[0]in l?(P=function(){var e=N.slice(a).split(":"),n=e[1]?parseInt(e[1],10):0,t=l[e[0]]&&l[e[0]].iframe,i=getComputedStyle(t);return{iframe:t,id:e[0],height:n+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e=e.paddingBottom?parseInt(e.paddingBottom,10):0)}(i)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(i),width:e[2],type:e[3]}}(),A=P.id,l[A]&&(l[A].loaded=!0),(M=P.type in{true:1,false:1,undefined:1})&&b(A,"Ignoring init message from meta parent page"),!M&&(M=!0,l[I=A]||(M=!1,v(P.type+" No settings for "+I+". Message was: "+N)),M)&&(b(A,"Received: "+N),I=!0,null===P.iframe&&(v(A,"IFrame ("+P.id+") not found"),I=!1),I&&function(){var n=e.origin,t=l[A]&&l[A].checkOrigin;if(t&&""+n!="null"&&!function(){if(t.constructor!==Array)return e=l[A]&&l[A].remoteHost,b(A,"Checking connection is from: "+e),n===e;var e,i=0,o=!1;for(b(A,"Checking connection is from allowed list of origins: "+t);i<t.length;i++)if(t[i]===n){o=!0;break}return o}())throw new Error("Unexpected message received from: "+n+" for "+P.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return 1}()&&function(){switch(l[A]&&l[A].firstRun&&l[A]&&(l[A].firstRun=!1),P.type){case"close":x(P.iframe);break;case"message":r=i(6),b(A,"onMessage passed: {iframe: "+P.iframe.id+", message: "+r+"}"),k("onMessage",{iframe:P.iframe,message:JSON.parse(r)}),b(A,"--");break;case"mouseenter":w("onMouseEnter");break;case"mouseleave":w("onMouseLeave");break;case"autoResize":l[A].autoResize=JSON.parse(i(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":d(l[A]&&l[A].iframe,A),o=A,e("Add ",h),l[o]&&(l[o].stopPageInfo=t);break;case"pageInfoStop":l[A]&&l[A].stopPageInfo&&(l[A].stopPageInfo(),delete l[A].stopPageInfo);break;case"inPageLink":g(i(9));break;case"reset":O(P);break;case"init":n(),k("onInit",P.iframe);break;default:0===Number(P.width)&&0===Number(P.height)?v("Unsupported message received ("+P.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}function e(e,n){function i(){l[o]?d(l[o].iframe,o):t()}["scroll","resize"].forEach((function(t){b(o,e+t+" listener for sendPageInfo"),n(window,t,i)}))}function t(){e("Remove ",p)}var o,r}())):y(A,"Ignored: "+N)}function F(e,n,t){var i=null,o=null;if(l[e]){if("function"!=typeof(i=l[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function M(e){e=e.id,delete l[e]}function x(e){var n=e.id;if(!1===F(n,"onClose",n))b(n,"Close iframe cancelled by onClose event");else{b(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){v(e)}F(n,"onClosed",n),b(n,"--"),M(e)}}function z(n){null===s&&b(n,"Get page position: "+(s={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+s.y)}function E(e){null!==s&&(window.scrollTo(s.x,s.y),b(e,"Set page position: "+s.x+","+s.y),R())}function R(){s=null}function O(e){b(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),z(e.id),W((function(){T(e),S("reset","reset",e.iframe,e.id)}),e,"reset")}function T(e){function n(n){var o;o=n,e.id?(e.iframe.style[o]=e[o]+"px",b(e.id,"IFrame ("+t+") "+o+" set to "+e[o]+"px")):b("undefined","messageData id not set"),function(n){var o;function r(){Object.keys(l).forEach((function(e){function n(e){return"0px"===(l[t]&&l[t].iframe.style[e])}var t;l[t=e]&&null!==l[t].iframe.offsetParent&&(n("height")||n("width"))&&S("Visibility change","resize",l[t].iframe,t)}))}!i&&"0"===e[n]&&(i=!0,b(t,"Hidden iFrame detected, creating visibility listener"),n=g())&&(o=document.querySelector("body"),new n((function(e){b("window","Mutation observed: "+e[0].target+" "+e[0].type),P(r,16)})).observe(o,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}(n)}var t=e.iframe.id;l[t]&&(l[t].sizeHeight&&n("height"),l[t].sizeWidth)&&n("width")}function W(e,n,t){t!==n.type&&d&&!window.jasmine?(b(n.id,"Requesting animation frame"),d(e)):e()}function S(e,n,t,i,o){var a=!1;i=i||t.id,l[i]&&(function(){var o;t&&"contentWindow"in t&&null!==t.contentWindow?(o=l[i]&&l[i].targetOrigin,b(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+o),t.contentWindow.postMessage(r+n,o)):v(i,"["+e+"] IFrame("+i+") not found")}(),o&&l[i]&&l[i].warningTimeout&&(l[i].msgTimeout=setTimeout((function(){!l[i]||l[i].loaded||a||(a=!0,v(i,"IFrame has not responded within "+l[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),l[i].warningTimeout)))}function C(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod+":"+l[e].mouseEvents}function N(i,o){function r(e){var n=e.split("Callback");2===n.length&&(this[n="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1)]=this[e],delete this[e],v(a,"Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version."))}var a=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var r;return""===e&&(i.id=(r=o&&o.id||f.id+n++,null!==document.getElementById(r)&&(r+=n++),e=r),t=(o||{}).log,b(e,"Added missing iframe ID: "+e+" ("+i.src+")")),e}(i.id);if(a in l&&"iFrameResizer"in i)v(a,"Ignored iFrame, already setup.");else{switch(function(e){if(e=e||{},l[a]=Object.create(null),l[a].iframe=i,l[a].firstRun=!0,l[a].remoteHost=i.src&&i.src.split("/").slice(0,3).join("/"),"object"!=typeof e)throw new TypeError("Options is not an object");Object.keys(e).forEach(r,e);var n,t=e;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(l[a][n]=(Object.prototype.hasOwnProperty.call(t,n)?t:f)[n]);l[a]&&(l[a].targetOrigin=!0!==l[a].checkOrigin||""===(e=l[a].remoteHost)||null!==e.match(/^(about:blank|javascript:|file:\/\/)/)?"*":e)}(o),b(a,"IFrame scrolling "+(l[a]&&l[a].scrolling?"enabled":"disabled")+" for "+a),i.style.overflow=!1===(l[a]&&l[a].scrolling)?"hidden":"auto",l[a]&&l[a].scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=l[a]?l[a].scrolling:"no"}d("Height"),d("Width"),s("maxHeight"),s("minHeight"),s("maxWidth"),s("minWidth"),"number"!=typeof(l[a]&&l[a].bodyMargin)&&"0"!==(l[a]&&l[a].bodyMargin)||(l[a].bodyMarginV1=l[a].bodyMargin,l[a].bodyMargin=l[a].bodyMargin+"px"),function(n){var t=g();t&&i.parentNode&&new t((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===i&&x(i)}))}))})).observe(i.parentNode,{childList:!0}),h(i,"load",(function(){var t,o;S("iFrame.onload",n,i,e,!0),t=l[a]&&l[a].firstRun,o=l[a]&&l[a].heightCalculationMethod in c,!t&&o&&O({iframe:i,height:0,width:0,type:"init"})})),S("init",n,i,e,!0)}(C(a)),l[a]&&(l[a].iframe.iFrameResizer={close:x.bind(null,l[a].iframe),removeListeners:M.bind(null,l[a].iframe),resize:S.bind(null,"Window resize","resize",l[a].iframe),moveToAnchor:function(e){S("Move to anchor","moveToAnchor:"+e,l[a].iframe,a)},sendMessage:function(e){S("Send Message","message:"+(e=JSON.stringify(e)),l[a].iframe,a)}})}function s(e){var n=l[a][e];1/0!==n&&0!==n&&(i.style[e]="number"==typeof n?n+"px":n,b(a,"Set "+e+" = "+i.style[e]))}function d(e){if(l[a]["min"+e]>l[a]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}}function P(e,n){null===u&&(u=setTimeout((function(){u=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(b("document","Trigger event: Visibility change"),P((function(){j("Tab Visible","resize")}),16))}function j(e,n){Object.keys(l).forEach((function(t){var i;l[i=t]&&"parent"===l[i].resizeFrom&&l[i].autoResize&&!l[i].firstRun&&S(e,n,l[t].iframe,t)}))}function H(){h(window,"message",I),h(window,"resize",(function(){b("window","Trigger event: "+"resize"),P((function(){j("Window resize","resize")}),16)})),h(document,"visibilitychange",A),h(document,"-webkit-visibilitychange",A)}function L(){function n(e,n){if(n){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">");N(n,e),t.push(n)}}for(var t,i=["moz","webkit","o","ms"],o=0;o<i.length&&!d;o+=1)d=window[i[o]+"RequestAnimationFrame"];return d?d=d.bind(window):b("setup","RequestAnimationFrame not supported"),H(),function(i,o){var r;switch(t=[],(r=i)&&r.enablePublicMethods&&v("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}"undefined"!=typeof window&&(n=0,i=t=!1,o=7,a=(r="[iFrameSizer]").length,s=null,d=window.requestAnimationFrame,c=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),l={},u=null,f=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){v("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),m={},window.jQuery!==e&&function(e){e.fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){N(t,e)})).end()}):y("","Unable to bind to jQuery, it is not fully loaded.")}(window.jQuery),"function"==typeof define&&define.amd?define([],L):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=L()),window.iFrameResize=window.iFrameResize||L())}(),window.onload=function(){console.log("script version "+SCRIPT_VERSION),evInitializeWidgets()};7 */function evInitializeWidgets(){document.querySelectorAll(".eveenoWidget").forEach(evCreateWidget)}function evCreateWidget(e,n){var t=e.dataset,i=t.apikey,o=t.event,r=t.lang,a=t.scope,s=t.server,d=t.style,c=t.type,l=t.user,u=(t.version,t.wp_plugin_version||"none");switch(t.show&&("form"==t.show?c="booking":"grid"!=t.show&&"table"!=t.show&&"list"!=t.show||(c="booking",d=t.show)),t.eventid&&(o=t.eventid),t.userid&&(l=t.userid),s){case"dev":var f="http://localhost";break;case"tst":f="https://tst.eveeno.com";break;case"int":f="https://int.eveeno.com";break;default:f="https://eveeno.com"}switch(c){case"booking":if(!o)return void evWidgetShowError(e,"Für das widget 'booking' ist der parameter 'event' Pflicht");var m=new URL(f+"/"+o);break;case"calendar":if(!l)return void evWidgetShowError(e,"Für das widget 'calendar' ist der parameter 'user' Pflicht");m=new URL(f+"/de/event-cal/"+l);break;default:return void evWidgetShowError(e,"Der Widget-Typ 'type' fehlt oder ist falsch")}i&&m.searchParams.append("apikey",i),o&&m.searchParams.append("eventid",o),r&&m.searchParams.append("lang",r),a&&m.searchParams.append("scope",a),d&&m.searchParams.append("style",d),l&&m.searchParams.append("userid",l),i&&m.searchParams.append("apikey",i),m.searchParams.append("format","embedded"),m.searchParams.append("version",SCRIPT_VERSION),m.searchParams.append("wp_plugin_version",u);let g="evFrame"+n;const h=document.createElement("iframe");h.setAttribute("id",g),h.setAttribute("src",m.href),h.setAttribute("width","100%"),h.setAttribute("minWidth","100%"),h.setAttribute("scrolling","no"),h.setAttribute("frameborder","0"),e.replaceWith(h),iFrameResize({log:!1,checkOrigin:!1,heightCalculationMethod:"taggedElement",onMessage:function(e){if(e.message.cmd)switch(e.message.cmd){case"forceReload":location.reload(!0);break;case"scrollTo":e.message.pos&&window.scrollTo({top:document.getElementById(g).offsetTop+e.message.pos-10,left:0,behavior:"smooth"})}}},"#"+g)}function evWidgetShowError(e,n){html="Fehler in diesem Widget, bitte überprüfen Sie die Parameter:",html+="<br><br>",html+=n,e.innerHTML=html,e.setAttribute("style","background-color:#FAEAE9; color: #D9534F; text-align: center; padding: 20px;")}!function(e){var n,t,i,o,r,a,s,d,c,l,u,f,m;function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function h(e,n,t){e.addEventListener(n,t,!1)}function p(e,n,t){e.removeEventListener(n,t,!1)}function w(e){return l[e]?l[e].log:t}function b(e,n){k("log",e,n,w(e))}function y(e,n){k("info",e,n,w(e))}function v(e,n){k("warn",e,n,!0)}function k(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return r+"["+(n="Host page: "+e,(n=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e:n)+"]");var n}(n),t)}function I(e){function n(){t("Height"),t("Width"),W((function(){T(C),E(A),k("onResized",C)}),C,"init")}function t(e){var n=Number(l[A]["max"+e]),t=Number(l[A]["min"+e]),i=(e=e.toLowerCase(),Number(C[e]));b(A,"Checking "+e+" is in range "+t+"-"+n),i<t&&(i=t,b(A,"Set "+e+" to min value")),n<i&&(i=n,b(A,"Set "+e+" to max value")),C[e]=""+i}function i(e){return N.slice(N.indexOf(":")+o+e)}function d(e,n){var t,i;t=function(){var t,i;S("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=C.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},m[i=n]||(m[i]=setTimeout((function(){m[i]=null,t()}),32))}function c(e){return e=e.getBoundingClientRect(),z(A),{x:Math.floor(Number(e.left)+Number(s.x)),y:Math.floor(Number(e.top)+Number(s.y))}}function u(e){var n=e?c(C.iframe):{x:0,y:0},t={x:Number(C.width)+n.x,y:Number(C.height)+n.y};b(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(s=t,f(),b(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):v(A,"Unable to scroll to requested position, window.parentIFrame not found")}function f(){!1===k("onScroll",s)?R():E(A)}function g(e){e=e.split("#")[1]||"";var n=decodeURIComponent(e);(n=document.getElementById(n)||document.getElementsByName(n)[0])?(n=c(n),b(A,"Moving to in page link (#"+e+") at x: "+n.x+" y: "+n.y),s={x:n.x,y:n.y},f(),b(A,"--")):window.top===window.self?b(A,"In page link #"+e+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(e):b(A,"In page link #"+e+" not found and window.parentIFrame not found")}function w(e){var n,t;t=0===Number(C.width)&&0===Number(C.height)?{x:(n=i(9).split(":"))[1],y:n[0]}:{x:C.width,y:C.height},k(e,{iframe:C.iframe,screenX:Number(t.x),screenY:Number(t.y),type:C.type})}function k(e,n){return F(A,e,n)}var I,x,N=e.data,C={},A=null;if("[iFrameResizerChild]Ready"===N)for(var j in l)S("iFrame requested init",P(j),l[j].iframe,j);else r===(""+N).slice(0,a)&&N.slice(a).split(":")[0]in l?(C=function(){var e=N.slice(a).split(":"),n=e[1]?parseInt(e[1],10):0,t=l[e[0]]&&l[e[0]].iframe,i=getComputedStyle(t);return{iframe:t,id:e[0],height:n+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e=e.paddingBottom?parseInt(e.paddingBottom,10):0)}(i)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(i),width:e[2],type:e[3]}}(),A=C.id,l[A]&&(l[A].loaded=!0),(x=C.type in{true:1,false:1,undefined:1})&&b(A,"Ignoring init message from meta parent page"),!x&&(x=!0,l[I=A]||(x=!1,v(C.type+" No settings for "+I+". Message was: "+N)),x)&&(b(A,"Received: "+N),I=!0,null===C.iframe&&(v(A,"IFrame ("+C.id+") not found"),I=!1),I&&function(){var n=e.origin,t=l[A]&&l[A].checkOrigin;if(t&&""+n!="null"&&!function(){if(t.constructor!==Array)return e=l[A]&&l[A].remoteHost,b(A,"Checking connection is from: "+e),n===e;var e,i=0,o=!1;for(b(A,"Checking connection is from allowed list of origins: "+t);i<t.length;i++)if(t[i]===n){o=!0;break}return o}())throw new Error("Unexpected message received from: "+n+" for "+C.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return 1}()&&function(){switch(l[A]&&l[A].firstRun&&l[A]&&(l[A].firstRun=!1),C.type){case"close":M(C.iframe);break;case"message":r=i(6),b(A,"onMessage passed: {iframe: "+C.iframe.id+", message: "+r+"}"),k("onMessage",{iframe:C.iframe,message:JSON.parse(r)}),b(A,"--");break;case"mouseenter":w("onMouseEnter");break;case"mouseleave":w("onMouseLeave");break;case"autoResize":l[A].autoResize=JSON.parse(i(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":d(l[A]&&l[A].iframe,A),o=A,e("Add ",h),l[o]&&(l[o].stopPageInfo=t);break;case"pageInfoStop":l[A]&&l[A].stopPageInfo&&(l[A].stopPageInfo(),delete l[A].stopPageInfo);break;case"inPageLink":g(i(9));break;case"reset":O(C);break;case"init":n(),k("onInit",C.iframe);break;default:0===Number(C.width)&&0===Number(C.height)?v("Unsupported message received ("+C.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}function e(e,n){function i(){l[o]?d(l[o].iframe,o):t()}["scroll","resize"].forEach((function(t){b(o,e+t+" listener for sendPageInfo"),n(window,t,i)}))}function t(){e("Remove ",p)}var o,r}())):y(A,"Ignored: "+N)}function F(e,n,t){var i=null,o=null;if(l[e]){if("function"!=typeof(i=l[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function x(e){e=e.id,delete l[e]}function M(e){var n=e.id;if(!1===F(n,"onClose",n))b(n,"Close iframe cancelled by onClose event");else{b(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){v(e)}F(n,"onClosed",n),b(n,"--"),x(e)}}function z(n){null===s&&b(n,"Get page position: "+(s={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+s.y)}function E(e){null!==s&&(window.scrollTo(s.x,s.y),b(e,"Set page position: "+s.x+","+s.y),R())}function R(){s=null}function O(e){b(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),z(e.id),W((function(){T(e),S("reset","reset",e.iframe,e.id)}),e,"reset")}function T(e){function n(n){var o;o=n,e.id?(e.iframe.style[o]=e[o]+"px",b(e.id,"IFrame ("+t+") "+o+" set to "+e[o]+"px")):b("undefined","messageData id not set"),function(n){var o;function r(){Object.keys(l).forEach((function(e){function n(e){return"0px"===(l[t]&&l[t].iframe.style[e])}var t;l[t=e]&&null!==l[t].iframe.offsetParent&&(n("height")||n("width"))&&S("Visibility change","resize",l[t].iframe,t)}))}!i&&"0"===e[n]&&(i=!0,b(t,"Hidden iFrame detected, creating visibility listener"),n=g())&&(o=document.querySelector("body"),new n((function(e){b("window","Mutation observed: "+e[0].target+" "+e[0].type),C(r,16)})).observe(o,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}(n)}var t=e.iframe.id;l[t]&&(l[t].sizeHeight&&n("height"),l[t].sizeWidth)&&n("width")}function W(e,n,t){t!==n.type&&d&&!window.jasmine?(b(n.id,"Requesting animation frame"),d(e)):e()}function S(e,n,t,i,o){var a=!1;i=i||t.id,l[i]&&(function(){var o;t&&"contentWindow"in t&&null!==t.contentWindow?(o=l[i]&&l[i].targetOrigin,b(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+o),t.contentWindow.postMessage(r+n,o)):v(i,"["+e+"] IFrame("+i+") not found")}(),o&&l[i]&&l[i].warningTimeout&&(l[i].msgTimeout=setTimeout((function(){!l[i]||l[i].loaded||a||(a=!0,v(i,"IFrame has not responded within "+l[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),l[i].warningTimeout)))}function P(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod+":"+l[e].mouseEvents}function N(i,o){function r(e){var n=e.split("Callback");2===n.length&&(this[n="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1)]=this[e],delete this[e],v(a,"Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version."))}var a=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var r;return""===e&&(i.id=(r=o&&o.id||f.id+n++,null!==document.getElementById(r)&&(r+=n++),e=r),t=(o||{}).log,b(e,"Added missing iframe ID: "+e+" ("+i.src+")")),e}(i.id);if(a in l&&"iFrameResizer"in i)v(a,"Ignored iFrame, already setup.");else{switch(function(e){if(e=e||{},l[a]=Object.create(null),l[a].iframe=i,l[a].firstRun=!0,l[a].remoteHost=i.src&&i.src.split("/").slice(0,3).join("/"),"object"!=typeof e)throw new TypeError("Options is not an object");Object.keys(e).forEach(r,e);var n,t=e;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(l[a][n]=(Object.prototype.hasOwnProperty.call(t,n)?t:f)[n]);l[a]&&(l[a].targetOrigin=!0!==l[a].checkOrigin||""===(e=l[a].remoteHost)||null!==e.match(/^(about:blank|javascript:|file:\/\/)/)?"*":e)}(o),b(a,"IFrame scrolling "+(l[a]&&l[a].scrolling?"enabled":"disabled")+" for "+a),i.style.overflow=!1===(l[a]&&l[a].scrolling)?"hidden":"auto",l[a]&&l[a].scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=l[a]?l[a].scrolling:"no"}d("Height"),d("Width"),s("maxHeight"),s("minHeight"),s("maxWidth"),s("minWidth"),"number"!=typeof(l[a]&&l[a].bodyMargin)&&"0"!==(l[a]&&l[a].bodyMargin)||(l[a].bodyMarginV1=l[a].bodyMargin,l[a].bodyMargin=l[a].bodyMargin+"px"),function(n){var t=g();t&&i.parentNode&&new t((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===i&&M(i)}))}))})).observe(i.parentNode,{childList:!0}),h(i,"load",(function(){var t,o;S("iFrame.onload",n,i,e,!0),t=l[a]&&l[a].firstRun,o=l[a]&&l[a].heightCalculationMethod in c,!t&&o&&O({iframe:i,height:0,width:0,type:"init"})})),S("init",n,i,e,!0)}(P(a)),l[a]&&(l[a].iframe.iFrameResizer={close:M.bind(null,l[a].iframe),removeListeners:x.bind(null,l[a].iframe),resize:S.bind(null,"Window resize","resize",l[a].iframe),moveToAnchor:function(e){S("Move to anchor","moveToAnchor:"+e,l[a].iframe,a)},sendMessage:function(e){S("Send Message","message:"+(e=JSON.stringify(e)),l[a].iframe,a)}})}function s(e){var n=l[a][e];1/0!==n&&0!==n&&(i.style[e]="number"==typeof n?n+"px":n,b(a,"Set "+e+" = "+i.style[e]))}function d(e){if(l[a]["min"+e]>l[a]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}}function C(e,n){null===u&&(u=setTimeout((function(){u=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(b("document","Trigger event: Visibility change"),C((function(){j("Tab Visible","resize")}),16))}function j(e,n){Object.keys(l).forEach((function(t){var i;l[i=t]&&"parent"===l[i].resizeFrom&&l[i].autoResize&&!l[i].firstRun&&S(e,n,l[t].iframe,t)}))}function H(){h(window,"message",I),h(window,"resize",(function(){b("window","Trigger event: "+"resize"),C((function(){j("Window resize","resize")}),16)})),h(document,"visibilitychange",A),h(document,"-webkit-visibilitychange",A)}function L(){function n(e,n){if(n){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">");N(n,e),t.push(n)}}for(var t,i=["moz","webkit","o","ms"],o=0;o<i.length&&!d;o+=1)d=window[i[o]+"RequestAnimationFrame"];return d?d=d.bind(window):b("setup","RequestAnimationFrame not supported"),H(),function(i,o){var r;switch(t=[],(r=i)&&r.enablePublicMethods&&v("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}"undefined"!=typeof window&&(n=0,i=t=!1,o=7,a=(r="[iFrameSizer]").length,s=null,d=window.requestAnimationFrame,c=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),l={},u=null,f=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){v("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),m={},window.jQuery!==e&&function(e){e.fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){N(t,e)})).end()}):y("","Unable to bind to jQuery, it is not fully loaded.")}(window.jQuery),"function"==typeof define&&define.amd?define([],L):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=L()),window.iFrameResize=window.iFrameResize||L())}(),window.onload=function(){evInitializeWidgets()}; -
eveeno/trunk/assets/js/embed.js
r3211923 r3211925 24 24 25 25 window.onload = function() { 26 console.log('script version ' + SCRIPT_VERSION);26 //logconsole.log('script version ' + SCRIPT_VERSION); 27 27 evInitializeWidgets(); 28 28 }; … … 30 30 function evInitializeWidgets() { 31 31 const widgets = document.querySelectorAll('.eveenoWidget'); 32 console.log('evInitializeWidgets', widgets);32 //console.log('evInitializeWidgets', widgets); 33 33 widgets.forEach(evCreateWidget); 34 34 }; … … 41 41 function evCreateWidget(widget, i) { 42 42 43 console.log('evCreateWidget', i, widget);43 //console.log('evCreateWidget', i, widget); 44 44 45 // read parameters 46 45 47 var data = widget.dataset; 46 48 47 49 var apikey = data.apikey; 50 var event = data.event; 48 51 var lang = data.lang; 49 52 var scope = data.scope; 50 53 var server = data.server; 51 54 var style = data.style; 55 var type = data.type; 56 var user = data.user; 52 57 var version = data.version || 'none'; 58 var wp_plugin_version = data.wp_plugin_version || 'none'; 53 59 54 // add fallbacks for WP plugin version < 1.8 55 var type = data.show ? data.show : data.type; 56 var user = data.userid ? data.userid : data.user; 57 var event = data.eventid ? data.eventid : data.event; 60 // overwrite some by fallbacks for WP plugin version < 1.8 61 62 if (data.show) { 63 if (data.show == 'form') { 64 type = 'booking'; 65 } 66 else if (data.show == 'grid' || data.show == 'table' || data.show == 'list') { 67 type = 'booking'; style = data.show; 68 } 69 } 70 if (data.eventid) event = data.eventid; 71 if (data.userid) user = data.userid; 58 72 73 // build widget url 74 59 75 switch (server) { 60 76 case 'dev': var serverurl = 'http://localhost'; break; … … 64 80 } 65 81 66 // build widget url67 68 82 switch (type) { 69 83 … … 104 118 url.searchParams.append('format', 'embedded'); 105 119 url.searchParams.append('version', SCRIPT_VERSION); 120 url.searchParams.append('wp_plugin_version', wp_plugin_version); 121 106 122 107 123 // create iframe … … 129 145 onMessage: function(data){ 130 146 131 console.log('Message received', data);147 //console.log('Message received', data); 132 148 133 149 // receive commands from the iframed page -
eveeno/trunk/assets/js/embed.min.js
r3211923 r3211925 5 5 * Copyright: (c) 2023 David J. Bradshaw - dave@bradshaw.net 6 6 * License: MIT 7 */function evInitializeWidgets(){ const e=document.querySelectorAll(".eveenoWidget");console.log("evInitializeWidgets",e),e.forEach(evCreateWidget)}function evCreateWidget(e,n){console.log("evCreateWidget",n,e);var t=e.dataset,i=t.apikey,o=t.lang,r=t.scope,a=t.server,s=t.style,d=(t.version,t.show?t.show:t.type),c=t.userid?t.userid:t.user,l=t.eventid?t.eventid:t.event;switch(a){case"dev":var u="http://localhost";break;case"tst":u="https://tst.eveeno.com";break;case"int":u="https://int.eveeno.com";break;default:u="https://eveeno.com"}switch(d){case"booking":if(!l)return void evWidgetShowError(e,"Für das widget 'booking' ist der parameter 'event' Pflicht");var f=new URL(u+"/"+l);break;case"calendar":if(!c)return void evWidgetShowError(e,"Für das widget 'calendar' ist der parameter 'user' Pflicht");f=new URL(u+"/de/event-cal/"+c);break;default:return void evWidgetShowError(e,"Der Widget-Typ 'type' fehlt oder ist falsch")}i&&f.searchParams.append("apikey",i),l&&f.searchParams.append("eventid",l),o&&f.searchParams.append("lang",o),r&&f.searchParams.append("scope",r),s&&f.searchParams.append("style",s),c&&f.searchParams.append("userid",c),i&&f.searchParams.append("apikey",i),f.searchParams.append("format","embedded"),f.searchParams.append("version",SCRIPT_VERSION);let m="evFrame"+n;const g=document.createElement("iframe");g.setAttribute("id",m),g.setAttribute("src",f.href),g.setAttribute("width","100%"),g.setAttribute("minWidth","100%"),g.setAttribute("scrolling","no"),g.setAttribute("frameborder","0"),e.replaceWith(g),iFrameResize({log:!1,checkOrigin:!1,heightCalculationMethod:"taggedElement",onMessage:function(e){if(console.log("Message received",e),e.message.cmd)switch(e.message.cmd){case"forceReload":location.reload(!0);break;case"scrollTo":e.message.pos&&window.scrollTo({top:document.getElementById(m).offsetTop+e.message.pos-10,left:0,behavior:"smooth"})}}},"#"+m)}function evWidgetShowError(e,n){html="Fehler in diesem Widget, bitte überprüfen Sie die Parameter:",html+="<br><br>",html+=n,e.innerHTML=html,e.setAttribute("style","background-color:#FAEAE9; color: #D9534F; text-align: center; padding: 20px;")}!function(e){var n,t,i,o,r,a,s,d,c,l,u,f,m;function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function h(e,n,t){e.addEventListener(n,t,!1)}function p(e,n,t){e.removeEventListener(n,t,!1)}function w(e){return l[e]?l[e].log:t}function b(e,n){k("log",e,n,w(e))}function y(e,n){k("info",e,n,w(e))}function v(e,n){k("warn",e,n,!0)}function k(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return r+"["+(n="Host page: "+e,(n=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e:n)+"]");var n}(n),t)}function I(e){function n(){t("Height"),t("Width"),W((function(){T(P),E(A),k("onResized",P)}),P,"init")}function t(e){var n=Number(l[A]["max"+e]),t=Number(l[A]["min"+e]),i=(e=e.toLowerCase(),Number(P[e]));b(A,"Checking "+e+" is in range "+t+"-"+n),i<t&&(i=t,b(A,"Set "+e+" to min value")),n<i&&(i=n,b(A,"Set "+e+" to max value")),P[e]=""+i}function i(e){return N.slice(N.indexOf(":")+o+e)}function d(e,n){var t,i;t=function(){var t,i;S("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=P.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},m[i=n]||(m[i]=setTimeout((function(){m[i]=null,t()}),32))}function c(e){return e=e.getBoundingClientRect(),z(A),{x:Math.floor(Number(e.left)+Number(s.x)),y:Math.floor(Number(e.top)+Number(s.y))}}function u(e){var n=e?c(P.iframe):{x:0,y:0},t={x:Number(P.width)+n.x,y:Number(P.height)+n.y};b(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(s=t,f(),b(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):v(A,"Unable to scroll to requested position, window.parentIFrame not found")}function f(){!1===k("onScroll",s)?R():E(A)}function g(e){e=e.split("#")[1]||"";var n=decodeURIComponent(e);(n=document.getElementById(n)||document.getElementsByName(n)[0])?(n=c(n),b(A,"Moving to in page link (#"+e+") at x: "+n.x+" y: "+n.y),s={x:n.x,y:n.y},f(),b(A,"--")):window.top===window.self?b(A,"In page link #"+e+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(e):b(A,"In page link #"+e+" not found and window.parentIFrame not found")}function w(e){var n,t;t=0===Number(P.width)&&0===Number(P.height)?{x:(n=i(9).split(":"))[1],y:n[0]}:{x:P.width,y:P.height},k(e,{iframe:P.iframe,screenX:Number(t.x),screenY:Number(t.y),type:P.type})}function k(e,n){return F(A,e,n)}var I,M,N=e.data,P={},A=null;if("[iFrameResizerChild]Ready"===N)for(var j in l)S("iFrame requested init",C(j),l[j].iframe,j);else r===(""+N).slice(0,a)&&N.slice(a).split(":")[0]in l?(P=function(){var e=N.slice(a).split(":"),n=e[1]?parseInt(e[1],10):0,t=l[e[0]]&&l[e[0]].iframe,i=getComputedStyle(t);return{iframe:t,id:e[0],height:n+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e=e.paddingBottom?parseInt(e.paddingBottom,10):0)}(i)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(i),width:e[2],type:e[3]}}(),A=P.id,l[A]&&(l[A].loaded=!0),(M=P.type in{true:1,false:1,undefined:1})&&b(A,"Ignoring init message from meta parent page"),!M&&(M=!0,l[I=A]||(M=!1,v(P.type+" No settings for "+I+". Message was: "+N)),M)&&(b(A,"Received: "+N),I=!0,null===P.iframe&&(v(A,"IFrame ("+P.id+") not found"),I=!1),I&&function(){var n=e.origin,t=l[A]&&l[A].checkOrigin;if(t&&""+n!="null"&&!function(){if(t.constructor!==Array)return e=l[A]&&l[A].remoteHost,b(A,"Checking connection is from: "+e),n===e;var e,i=0,o=!1;for(b(A,"Checking connection is from allowed list of origins: "+t);i<t.length;i++)if(t[i]===n){o=!0;break}return o}())throw new Error("Unexpected message received from: "+n+" for "+P.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return 1}()&&function(){switch(l[A]&&l[A].firstRun&&l[A]&&(l[A].firstRun=!1),P.type){case"close":x(P.iframe);break;case"message":r=i(6),b(A,"onMessage passed: {iframe: "+P.iframe.id+", message: "+r+"}"),k("onMessage",{iframe:P.iframe,message:JSON.parse(r)}),b(A,"--");break;case"mouseenter":w("onMouseEnter");break;case"mouseleave":w("onMouseLeave");break;case"autoResize":l[A].autoResize=JSON.parse(i(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":d(l[A]&&l[A].iframe,A),o=A,e("Add ",h),l[o]&&(l[o].stopPageInfo=t);break;case"pageInfoStop":l[A]&&l[A].stopPageInfo&&(l[A].stopPageInfo(),delete l[A].stopPageInfo);break;case"inPageLink":g(i(9));break;case"reset":O(P);break;case"init":n(),k("onInit",P.iframe);break;default:0===Number(P.width)&&0===Number(P.height)?v("Unsupported message received ("+P.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}function e(e,n){function i(){l[o]?d(l[o].iframe,o):t()}["scroll","resize"].forEach((function(t){b(o,e+t+" listener for sendPageInfo"),n(window,t,i)}))}function t(){e("Remove ",p)}var o,r}())):y(A,"Ignored: "+N)}function F(e,n,t){var i=null,o=null;if(l[e]){if("function"!=typeof(i=l[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function M(e){e=e.id,delete l[e]}function x(e){var n=e.id;if(!1===F(n,"onClose",n))b(n,"Close iframe cancelled by onClose event");else{b(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){v(e)}F(n,"onClosed",n),b(n,"--"),M(e)}}function z(n){null===s&&b(n,"Get page position: "+(s={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+s.y)}function E(e){null!==s&&(window.scrollTo(s.x,s.y),b(e,"Set page position: "+s.x+","+s.y),R())}function R(){s=null}function O(e){b(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),z(e.id),W((function(){T(e),S("reset","reset",e.iframe,e.id)}),e,"reset")}function T(e){function n(n){var o;o=n,e.id?(e.iframe.style[o]=e[o]+"px",b(e.id,"IFrame ("+t+") "+o+" set to "+e[o]+"px")):b("undefined","messageData id not set"),function(n){var o;function r(){Object.keys(l).forEach((function(e){function n(e){return"0px"===(l[t]&&l[t].iframe.style[e])}var t;l[t=e]&&null!==l[t].iframe.offsetParent&&(n("height")||n("width"))&&S("Visibility change","resize",l[t].iframe,t)}))}!i&&"0"===e[n]&&(i=!0,b(t,"Hidden iFrame detected, creating visibility listener"),n=g())&&(o=document.querySelector("body"),new n((function(e){b("window","Mutation observed: "+e[0].target+" "+e[0].type),P(r,16)})).observe(o,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}(n)}var t=e.iframe.id;l[t]&&(l[t].sizeHeight&&n("height"),l[t].sizeWidth)&&n("width")}function W(e,n,t){t!==n.type&&d&&!window.jasmine?(b(n.id,"Requesting animation frame"),d(e)):e()}function S(e,n,t,i,o){var a=!1;i=i||t.id,l[i]&&(function(){var o;t&&"contentWindow"in t&&null!==t.contentWindow?(o=l[i]&&l[i].targetOrigin,b(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+o),t.contentWindow.postMessage(r+n,o)):v(i,"["+e+"] IFrame("+i+") not found")}(),o&&l[i]&&l[i].warningTimeout&&(l[i].msgTimeout=setTimeout((function(){!l[i]||l[i].loaded||a||(a=!0,v(i,"IFrame has not responded within "+l[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),l[i].warningTimeout)))}function C(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod+":"+l[e].mouseEvents}function N(i,o){function r(e){var n=e.split("Callback");2===n.length&&(this[n="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1)]=this[e],delete this[e],v(a,"Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version."))}var a=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var r;return""===e&&(i.id=(r=o&&o.id||f.id+n++,null!==document.getElementById(r)&&(r+=n++),e=r),t=(o||{}).log,b(e,"Added missing iframe ID: "+e+" ("+i.src+")")),e}(i.id);if(a in l&&"iFrameResizer"in i)v(a,"Ignored iFrame, already setup.");else{switch(function(e){if(e=e||{},l[a]=Object.create(null),l[a].iframe=i,l[a].firstRun=!0,l[a].remoteHost=i.src&&i.src.split("/").slice(0,3).join("/"),"object"!=typeof e)throw new TypeError("Options is not an object");Object.keys(e).forEach(r,e);var n,t=e;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(l[a][n]=(Object.prototype.hasOwnProperty.call(t,n)?t:f)[n]);l[a]&&(l[a].targetOrigin=!0!==l[a].checkOrigin||""===(e=l[a].remoteHost)||null!==e.match(/^(about:blank|javascript:|file:\/\/)/)?"*":e)}(o),b(a,"IFrame scrolling "+(l[a]&&l[a].scrolling?"enabled":"disabled")+" for "+a),i.style.overflow=!1===(l[a]&&l[a].scrolling)?"hidden":"auto",l[a]&&l[a].scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=l[a]?l[a].scrolling:"no"}d("Height"),d("Width"),s("maxHeight"),s("minHeight"),s("maxWidth"),s("minWidth"),"number"!=typeof(l[a]&&l[a].bodyMargin)&&"0"!==(l[a]&&l[a].bodyMargin)||(l[a].bodyMarginV1=l[a].bodyMargin,l[a].bodyMargin=l[a].bodyMargin+"px"),function(n){var t=g();t&&i.parentNode&&new t((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===i&&x(i)}))}))})).observe(i.parentNode,{childList:!0}),h(i,"load",(function(){var t,o;S("iFrame.onload",n,i,e,!0),t=l[a]&&l[a].firstRun,o=l[a]&&l[a].heightCalculationMethod in c,!t&&o&&O({iframe:i,height:0,width:0,type:"init"})})),S("init",n,i,e,!0)}(C(a)),l[a]&&(l[a].iframe.iFrameResizer={close:x.bind(null,l[a].iframe),removeListeners:M.bind(null,l[a].iframe),resize:S.bind(null,"Window resize","resize",l[a].iframe),moveToAnchor:function(e){S("Move to anchor","moveToAnchor:"+e,l[a].iframe,a)},sendMessage:function(e){S("Send Message","message:"+(e=JSON.stringify(e)),l[a].iframe,a)}})}function s(e){var n=l[a][e];1/0!==n&&0!==n&&(i.style[e]="number"==typeof n?n+"px":n,b(a,"Set "+e+" = "+i.style[e]))}function d(e){if(l[a]["min"+e]>l[a]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}}function P(e,n){null===u&&(u=setTimeout((function(){u=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(b("document","Trigger event: Visibility change"),P((function(){j("Tab Visible","resize")}),16))}function j(e,n){Object.keys(l).forEach((function(t){var i;l[i=t]&&"parent"===l[i].resizeFrom&&l[i].autoResize&&!l[i].firstRun&&S(e,n,l[t].iframe,t)}))}function H(){h(window,"message",I),h(window,"resize",(function(){b("window","Trigger event: "+"resize"),P((function(){j("Window resize","resize")}),16)})),h(document,"visibilitychange",A),h(document,"-webkit-visibilitychange",A)}function L(){function n(e,n){if(n){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">");N(n,e),t.push(n)}}for(var t,i=["moz","webkit","o","ms"],o=0;o<i.length&&!d;o+=1)d=window[i[o]+"RequestAnimationFrame"];return d?d=d.bind(window):b("setup","RequestAnimationFrame not supported"),H(),function(i,o){var r;switch(t=[],(r=i)&&r.enablePublicMethods&&v("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}"undefined"!=typeof window&&(n=0,i=t=!1,o=7,a=(r="[iFrameSizer]").length,s=null,d=window.requestAnimationFrame,c=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),l={},u=null,f=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){v("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),m={},window.jQuery!==e&&function(e){e.fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){N(t,e)})).end()}):y("","Unable to bind to jQuery, it is not fully loaded.")}(window.jQuery),"function"==typeof define&&define.amd?define([],L):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=L()),window.iFrameResize=window.iFrameResize||L())}(),window.onload=function(){console.log("script version "+SCRIPT_VERSION),evInitializeWidgets()};7 */function evInitializeWidgets(){document.querySelectorAll(".eveenoWidget").forEach(evCreateWidget)}function evCreateWidget(e,n){var t=e.dataset,i=t.apikey,o=t.event,r=t.lang,a=t.scope,s=t.server,d=t.style,c=t.type,l=t.user,u=(t.version,t.wp_plugin_version||"none");switch(t.show&&("form"==t.show?c="booking":"grid"!=t.show&&"table"!=t.show&&"list"!=t.show||(c="booking",d=t.show)),t.eventid&&(o=t.eventid),t.userid&&(l=t.userid),s){case"dev":var f="http://localhost";break;case"tst":f="https://tst.eveeno.com";break;case"int":f="https://int.eveeno.com";break;default:f="https://eveeno.com"}switch(c){case"booking":if(!o)return void evWidgetShowError(e,"Für das widget 'booking' ist der parameter 'event' Pflicht");var m=new URL(f+"/"+o);break;case"calendar":if(!l)return void evWidgetShowError(e,"Für das widget 'calendar' ist der parameter 'user' Pflicht");m=new URL(f+"/de/event-cal/"+l);break;default:return void evWidgetShowError(e,"Der Widget-Typ 'type' fehlt oder ist falsch")}i&&m.searchParams.append("apikey",i),o&&m.searchParams.append("eventid",o),r&&m.searchParams.append("lang",r),a&&m.searchParams.append("scope",a),d&&m.searchParams.append("style",d),l&&m.searchParams.append("userid",l),i&&m.searchParams.append("apikey",i),m.searchParams.append("format","embedded"),m.searchParams.append("version",SCRIPT_VERSION),m.searchParams.append("wp_plugin_version",u);let g="evFrame"+n;const h=document.createElement("iframe");h.setAttribute("id",g),h.setAttribute("src",m.href),h.setAttribute("width","100%"),h.setAttribute("minWidth","100%"),h.setAttribute("scrolling","no"),h.setAttribute("frameborder","0"),e.replaceWith(h),iFrameResize({log:!1,checkOrigin:!1,heightCalculationMethod:"taggedElement",onMessage:function(e){if(e.message.cmd)switch(e.message.cmd){case"forceReload":location.reload(!0);break;case"scrollTo":e.message.pos&&window.scrollTo({top:document.getElementById(g).offsetTop+e.message.pos-10,left:0,behavior:"smooth"})}}},"#"+g)}function evWidgetShowError(e,n){html="Fehler in diesem Widget, bitte überprüfen Sie die Parameter:",html+="<br><br>",html+=n,e.innerHTML=html,e.setAttribute("style","background-color:#FAEAE9; color: #D9534F; text-align: center; padding: 20px;")}!function(e){var n,t,i,o,r,a,s,d,c,l,u,f,m;function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function h(e,n,t){e.addEventListener(n,t,!1)}function p(e,n,t){e.removeEventListener(n,t,!1)}function w(e){return l[e]?l[e].log:t}function b(e,n){k("log",e,n,w(e))}function y(e,n){k("info",e,n,w(e))}function v(e,n){k("warn",e,n,!0)}function k(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return r+"["+(n="Host page: "+e,(n=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e:n)+"]");var n}(n),t)}function I(e){function n(){t("Height"),t("Width"),W((function(){T(C),E(A),k("onResized",C)}),C,"init")}function t(e){var n=Number(l[A]["max"+e]),t=Number(l[A]["min"+e]),i=(e=e.toLowerCase(),Number(C[e]));b(A,"Checking "+e+" is in range "+t+"-"+n),i<t&&(i=t,b(A,"Set "+e+" to min value")),n<i&&(i=n,b(A,"Set "+e+" to max value")),C[e]=""+i}function i(e){return N.slice(N.indexOf(":")+o+e)}function d(e,n){var t,i;t=function(){var t,i;S("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=C.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},m[i=n]||(m[i]=setTimeout((function(){m[i]=null,t()}),32))}function c(e){return e=e.getBoundingClientRect(),z(A),{x:Math.floor(Number(e.left)+Number(s.x)),y:Math.floor(Number(e.top)+Number(s.y))}}function u(e){var n=e?c(C.iframe):{x:0,y:0},t={x:Number(C.width)+n.x,y:Number(C.height)+n.y};b(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(s=t,f(),b(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):v(A,"Unable to scroll to requested position, window.parentIFrame not found")}function f(){!1===k("onScroll",s)?R():E(A)}function g(e){e=e.split("#")[1]||"";var n=decodeURIComponent(e);(n=document.getElementById(n)||document.getElementsByName(n)[0])?(n=c(n),b(A,"Moving to in page link (#"+e+") at x: "+n.x+" y: "+n.y),s={x:n.x,y:n.y},f(),b(A,"--")):window.top===window.self?b(A,"In page link #"+e+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(e):b(A,"In page link #"+e+" not found and window.parentIFrame not found")}function w(e){var n,t;t=0===Number(C.width)&&0===Number(C.height)?{x:(n=i(9).split(":"))[1],y:n[0]}:{x:C.width,y:C.height},k(e,{iframe:C.iframe,screenX:Number(t.x),screenY:Number(t.y),type:C.type})}function k(e,n){return F(A,e,n)}var I,x,N=e.data,C={},A=null;if("[iFrameResizerChild]Ready"===N)for(var j in l)S("iFrame requested init",P(j),l[j].iframe,j);else r===(""+N).slice(0,a)&&N.slice(a).split(":")[0]in l?(C=function(){var e=N.slice(a).split(":"),n=e[1]?parseInt(e[1],10):0,t=l[e[0]]&&l[e[0]].iframe,i=getComputedStyle(t);return{iframe:t,id:e[0],height:n+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e=e.paddingBottom?parseInt(e.paddingBottom,10):0)}(i)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(i),width:e[2],type:e[3]}}(),A=C.id,l[A]&&(l[A].loaded=!0),(x=C.type in{true:1,false:1,undefined:1})&&b(A,"Ignoring init message from meta parent page"),!x&&(x=!0,l[I=A]||(x=!1,v(C.type+" No settings for "+I+". Message was: "+N)),x)&&(b(A,"Received: "+N),I=!0,null===C.iframe&&(v(A,"IFrame ("+C.id+") not found"),I=!1),I&&function(){var n=e.origin,t=l[A]&&l[A].checkOrigin;if(t&&""+n!="null"&&!function(){if(t.constructor!==Array)return e=l[A]&&l[A].remoteHost,b(A,"Checking connection is from: "+e),n===e;var e,i=0,o=!1;for(b(A,"Checking connection is from allowed list of origins: "+t);i<t.length;i++)if(t[i]===n){o=!0;break}return o}())throw new Error("Unexpected message received from: "+n+" for "+C.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return 1}()&&function(){switch(l[A]&&l[A].firstRun&&l[A]&&(l[A].firstRun=!1),C.type){case"close":M(C.iframe);break;case"message":r=i(6),b(A,"onMessage passed: {iframe: "+C.iframe.id+", message: "+r+"}"),k("onMessage",{iframe:C.iframe,message:JSON.parse(r)}),b(A,"--");break;case"mouseenter":w("onMouseEnter");break;case"mouseleave":w("onMouseLeave");break;case"autoResize":l[A].autoResize=JSON.parse(i(9));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":d(l[A]&&l[A].iframe,A),o=A,e("Add ",h),l[o]&&(l[o].stopPageInfo=t);break;case"pageInfoStop":l[A]&&l[A].stopPageInfo&&(l[A].stopPageInfo(),delete l[A].stopPageInfo);break;case"inPageLink":g(i(9));break;case"reset":O(C);break;case"init":n(),k("onInit",C.iframe);break;default:0===Number(C.width)&&0===Number(C.height)?v("Unsupported message received ("+C.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}function e(e,n){function i(){l[o]?d(l[o].iframe,o):t()}["scroll","resize"].forEach((function(t){b(o,e+t+" listener for sendPageInfo"),n(window,t,i)}))}function t(){e("Remove ",p)}var o,r}())):y(A,"Ignored: "+N)}function F(e,n,t){var i=null,o=null;if(l[e]){if("function"!=typeof(i=l[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function x(e){e=e.id,delete l[e]}function M(e){var n=e.id;if(!1===F(n,"onClose",n))b(n,"Close iframe cancelled by onClose event");else{b(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){v(e)}F(n,"onClosed",n),b(n,"--"),x(e)}}function z(n){null===s&&b(n,"Get page position: "+(s={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+s.y)}function E(e){null!==s&&(window.scrollTo(s.x,s.y),b(e,"Set page position: "+s.x+","+s.y),R())}function R(){s=null}function O(e){b(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),z(e.id),W((function(){T(e),S("reset","reset",e.iframe,e.id)}),e,"reset")}function T(e){function n(n){var o;o=n,e.id?(e.iframe.style[o]=e[o]+"px",b(e.id,"IFrame ("+t+") "+o+" set to "+e[o]+"px")):b("undefined","messageData id not set"),function(n){var o;function r(){Object.keys(l).forEach((function(e){function n(e){return"0px"===(l[t]&&l[t].iframe.style[e])}var t;l[t=e]&&null!==l[t].iframe.offsetParent&&(n("height")||n("width"))&&S("Visibility change","resize",l[t].iframe,t)}))}!i&&"0"===e[n]&&(i=!0,b(t,"Hidden iFrame detected, creating visibility listener"),n=g())&&(o=document.querySelector("body"),new n((function(e){b("window","Mutation observed: "+e[0].target+" "+e[0].type),C(r,16)})).observe(o,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}(n)}var t=e.iframe.id;l[t]&&(l[t].sizeHeight&&n("height"),l[t].sizeWidth)&&n("width")}function W(e,n,t){t!==n.type&&d&&!window.jasmine?(b(n.id,"Requesting animation frame"),d(e)):e()}function S(e,n,t,i,o){var a=!1;i=i||t.id,l[i]&&(function(){var o;t&&"contentWindow"in t&&null!==t.contentWindow?(o=l[i]&&l[i].targetOrigin,b(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+o),t.contentWindow.postMessage(r+n,o)):v(i,"["+e+"] IFrame("+i+") not found")}(),o&&l[i]&&l[i].warningTimeout&&(l[i].msgTimeout=setTimeout((function(){!l[i]||l[i].loaded||a||(a=!0,v(i,"IFrame has not responded within "+l[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),l[i].warningTimeout)))}function P(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod+":"+l[e].mouseEvents}function N(i,o){function r(e){var n=e.split("Callback");2===n.length&&(this[n="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1)]=this[e],delete this[e],v(a,"Deprecated: '"+e+"' has been renamed '"+n+"'. The old method will be removed in the next major version."))}var a=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var r;return""===e&&(i.id=(r=o&&o.id||f.id+n++,null!==document.getElementById(r)&&(r+=n++),e=r),t=(o||{}).log,b(e,"Added missing iframe ID: "+e+" ("+i.src+")")),e}(i.id);if(a in l&&"iFrameResizer"in i)v(a,"Ignored iFrame, already setup.");else{switch(function(e){if(e=e||{},l[a]=Object.create(null),l[a].iframe=i,l[a].firstRun=!0,l[a].remoteHost=i.src&&i.src.split("/").slice(0,3).join("/"),"object"!=typeof e)throw new TypeError("Options is not an object");Object.keys(e).forEach(r,e);var n,t=e;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(l[a][n]=(Object.prototype.hasOwnProperty.call(t,n)?t:f)[n]);l[a]&&(l[a].targetOrigin=!0!==l[a].checkOrigin||""===(e=l[a].remoteHost)||null!==e.match(/^(about:blank|javascript:|file:\/\/)/)?"*":e)}(o),b(a,"IFrame scrolling "+(l[a]&&l[a].scrolling?"enabled":"disabled")+" for "+a),i.style.overflow=!1===(l[a]&&l[a].scrolling)?"hidden":"auto",l[a]&&l[a].scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=l[a]?l[a].scrolling:"no"}d("Height"),d("Width"),s("maxHeight"),s("minHeight"),s("maxWidth"),s("minWidth"),"number"!=typeof(l[a]&&l[a].bodyMargin)&&"0"!==(l[a]&&l[a].bodyMargin)||(l[a].bodyMarginV1=l[a].bodyMargin,l[a].bodyMargin=l[a].bodyMargin+"px"),function(n){var t=g();t&&i.parentNode&&new t((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===i&&M(i)}))}))})).observe(i.parentNode,{childList:!0}),h(i,"load",(function(){var t,o;S("iFrame.onload",n,i,e,!0),t=l[a]&&l[a].firstRun,o=l[a]&&l[a].heightCalculationMethod in c,!t&&o&&O({iframe:i,height:0,width:0,type:"init"})})),S("init",n,i,e,!0)}(P(a)),l[a]&&(l[a].iframe.iFrameResizer={close:M.bind(null,l[a].iframe),removeListeners:x.bind(null,l[a].iframe),resize:S.bind(null,"Window resize","resize",l[a].iframe),moveToAnchor:function(e){S("Move to anchor","moveToAnchor:"+e,l[a].iframe,a)},sendMessage:function(e){S("Send Message","message:"+(e=JSON.stringify(e)),l[a].iframe,a)}})}function s(e){var n=l[a][e];1/0!==n&&0!==n&&(i.style[e]="number"==typeof n?n+"px":n,b(a,"Set "+e+" = "+i.style[e]))}function d(e){if(l[a]["min"+e]>l[a]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}}function C(e,n){null===u&&(u=setTimeout((function(){u=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(b("document","Trigger event: Visibility change"),C((function(){j("Tab Visible","resize")}),16))}function j(e,n){Object.keys(l).forEach((function(t){var i;l[i=t]&&"parent"===l[i].resizeFrom&&l[i].autoResize&&!l[i].firstRun&&S(e,n,l[t].iframe,t)}))}function H(){h(window,"message",I),h(window,"resize",(function(){b("window","Trigger event: "+"resize"),C((function(){j("Window resize","resize")}),16)})),h(document,"visibilitychange",A),h(document,"-webkit-visibilitychange",A)}function L(){function n(e,n){if(n){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">");N(n,e),t.push(n)}}for(var t,i=["moz","webkit","o","ms"],o=0;o<i.length&&!d;o+=1)d=window[i[o]+"RequestAnimationFrame"];return d?d=d.bind(window):b("setup","RequestAnimationFrame not supported"),H(),function(i,o){var r;switch(t=[],(r=i)&&r.enablePublicMethods&&v("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}"undefined"!=typeof window&&(n=0,i=t=!1,o=7,a=(r="[iFrameSizer]").length,s=null,d=window.requestAnimationFrame,c=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),l={},u=null,f=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){v("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),m={},window.jQuery!==e&&function(e){e.fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){N(t,e)})).end()}):y("","Unable to bind to jQuery, it is not fully loaded.")}(window.jQuery),"function"==typeof define&&define.amd?define([],L):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=L()),window.iFrameResize=window.iFrameResize||L())}(),window.onload=function(){evInitializeWidgets()};
Note: See TracChangeset
for help on using the changeset viewer.