!function(t,o){"function"==typeof define&&define.amd?define(o):"object"==typeof exports&&(module.exports=o()),t.tingle=o()}(this,function(){function t(t){var o={onClose:null,onOpen:null,beforeOpen:null,beforeClose:null,stickyFooter:!1,footer:!1,cssClass:[],closeLabel:"Close",closeMethods:["overlay","button","escape"]};this.opts=r({},o,t),this.init()}function o(){this.modalBoxFooter&&(this.modalBoxFooter.style.width=this.modalBox.clientWidth+"px",this.modalBoxFooter.style.left=this.modalBox.offsetLeft+"px")}function e(){this.modal=document.createElement("div"),this.modal.classList.add("tingle-modal"),0!==this.opts.closeMethods.length&&-1!==this.opts.closeMethods.indexOf("overlay")||this.modal.classList.add("tingle-modal--noOverlayClose"),this.modal.style.display="none",this.opts.cssClass.forEach(function(t){"string"==typeof t&&this.modal.classList.add(t)},this),-1!==this.opts.closeMethods.indexOf("button")&&(this.modalCloseBtn=document.createElement("button"),this.modalCloseBtn.classList.add("tingle-modal__close"),this.modalCloseBtnIcon=document.createElement("span"),this.modalCloseBtnIcon.classList.add("tingle-modal__closeIcon"),this.modalCloseBtnIcon.innerHTML="×",this.modalCloseBtnLabel=document.createElement("span"),this.modalCloseBtnLabel.classList.add("tingle-modal__closeLabel"),this.modalCloseBtnLabel.innerHTML=this.opts.closeLabel,this.modalCloseBtn.appendChild(this.modalCloseBtnIcon),this.modalCloseBtn.appendChild(this.modalCloseBtnLabel)),this.modalBox=document.createElement("div"),this.modalBox.classList.add("tingle-modal-box"),this.modalBoxContent=document.createElement("div"),this.modalBoxContent.classList.add("tingle-modal-box__content"),this.modalBox.appendChild(this.modalBoxContent),-1!==this.opts.closeMethods.indexOf("button")&&this.modal.appendChild(this.modalCloseBtn),this.modal.appendChild(this.modalBox)}function s(){this.modalBoxFooter=document.createElement("div"),this.modalBoxFooter.classList.add("tingle-modal-box__footer"),this.modalBox.appendChild(this.modalBoxFooter)}function i(){this._events={clickCloseBtn:this.close.bind(this),clickOverlay:l.bind(this),resize:this.checkOverflow.bind(this),keyboardNav:n.bind(this)},-1!==this.opts.closeMethods.indexOf("button")&&this.modalCloseBtn.addEventListener("click",this._events.clickCloseBtn),this.modal.addEventListener("mousedown",this._events.clickOverlay),window.addEventListener("resize",this._events.resize),document.addEventListener("keydown",this._events.keyboardNav)}function n(t){-1!==this.opts.closeMethods.indexOf("escape")&&27===t.which&&this.isOpen()&&this.close()}function l(t){-1!==this.opts.closeMethods.indexOf("overlay")&&!d(t.target,"tingle-modal")&&t.clientX=t},t.prototype.checkOverflow=function(){this.modal.classList.contains("tingle-modal--visible")&&(this.isOverflow()?this.modal.classList.add("tingle-modal--overflow"):this.modal.classList.remove("tingle-modal--overflow"),!this.isOverflow()&&this.opts.stickyFooter?this.setStickyFooter(!1):this.isOverflow()&&this.opts.stickyFooter&&(o.call(this),this.setStickyFooter(!0)))},{modal:t}}); /*! iFrame Resizer (iframeSizer.min.js ) - v4.1.1 - 2019-04-10 * Desc: Force cross domain iframes to size to content. * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame. * Copyright: (c) 2019 David J. Bradshaw - dave@bradshaw.net * License: MIT */ !function(f){if("undefined"!=typeof window){var e,l=0,m=!1,n=!1,p="message".length,b="[iFrameSizer]",y=b.length,v=null,r=window.requestAnimationFrame,g={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},F={},i=null,h={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,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClosed:function(){},onInit:function(){},onMessage:function(){O("onMessage function not defined")},onResized:function(){},onScroll:function(){return!0}},I={};window.jQuery&&((e=window.jQuery).fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(i){return this.filter("iframe").each(function(e,n){d(n,i)}).end()}):z("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof define&&define.amd?define([],B):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=B()),window.iFrameResize=window.iFrameResize||B()}function w(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function M(e,n,i){e.addEventListener(n,i,!1)}function x(e,n,i){e.removeEventListener(n,i,!1)}function o(e){return b+"["+(i="Host page: "+(n=e),window.top!==window.self&&(i=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+n:"Nested host page: "+n),i)+"]";var n,i}function t(e){return F[e]?F[e].log:m}function k(e,n){a("log",e,n,t(e))}function z(e,n){a("info",e,n,t(e))}function O(e,n){a("warn",e,n,!0)}function a(e,n,i,t){!0===t&&"object"==typeof window.console&&console[e](o(n),i)}function s(n){function a(){e("Height"),e("Width"),j(function(){S(h),N(w),l("onResized",h)},h,"init")}function e(e){var n=Number(F[w]["max"+e]),i=Number(F[w]["min"+e]),t=e.toLowerCase(),o=Number(h[t]);k(w,"Checking "+t+" is in range "+i+"-"+n),oF[u]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(F[u]&&F[u].bodyMargin)&&"0"!==(F[u]&&F[u].bodyMargin)||(F[u].bodyMarginV1=F[u].bodyMargin,F[u].bodyMargin=F[u].bodyMargin+"px"),r=A(u),(s=w())&&(a=s,i.parentNode&&new a(function(e){e.forEach(function(e){Array.prototype.slice.call(e.removedNodes).forEach(function(e){e===i&&T(i)})})}).observe(i.parentNode,{childList:!0})),M(i,"load",function(){var e,n;P("iFrame.onload",r,i,f,!0),e=F[u]&&F[u].firstRun,n=F[u]&&F[u].heightCalculationMethod in g,!e&&n&&H({iframe:i,height:0,width:0,type:"init"})}),P("init",r,i,f,!0),F[u]&&(F[u].iframe.iFrameResizer={close:T.bind(null,F[u].iframe),removeListeners:E.bind(null,F[u].iframe),resize:P.bind(null,"Window resize","resize",F[u].iframe),moveToAnchor:function(e){P("Move to anchor","moveToAnchor:"+e,F[u].iframe,u)},sendMessage:function(e){P("Send Message","message:"+(e=JSON.stringify(e)),F[u].iframe,u)}}))}function c(e,n){null===i&&(i=setTimeout(function(){i=null,e()},n))}function u(){"hidden"!==document.visibilityState&&(k("document","Trigger event: Visiblity change"),c(function(){q("Tab Visable","resize")},16))}function q(i,t){Object.keys(F).forEach(function(e){var n;F[n=e]&&"parent"===F[n].resizeFrom&&F[n].autoResize&&!F[n].firstRun&&P(i,t,document.getElementById(e),e)})}function L(){M(window,"message",s),M(window,"resize",function(){var e;k("window","Trigger event: "+(e="resize")),c(function(){q("Window "+e,"resize")},16)}),M(document,"visibilitychange",u),M(document,"-webkit-visibilitychange",u)}function B(){function t(e,n){n&&(!function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected '); modalSurprise.open(); }); bindEvent(window, 'message', function (e) { if (e.data=='rtrs') { if (document.getElementById('rtif'+pid)) { document.getElementById('rtif'+pid).height="562"; } } }); } else if ( viewType == "fullwidth" ) { //newstylesheet.insertRule(".reviewtube:after { display: block;content: '';width: 100%; padding-bottom: 56.25%;}", 0); //newstylesheet.insertRule(".reviewtube {width: 100%; position: relative; height: 1000px;}", 0); newstylesheet.insertRule(".reviewtube {width: 100%; position: relative;}", 0); /* newstylesheet.insertRule("@media only screen and (max-width: 420px) { .reviewtube { height: 1350px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 768px) { .reviewtube { height: 1475px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 1024px) { .reviewtube { height: 940px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 1400px) { .reviewtube { height: 980px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 420px) { .reviewtube iframe { height: 1350px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 768px) { .reviewtube iframe { height: 1475px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 1024px) { .reviewtube iframe { height: 940px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 1200px) { .reviewtube iframe { height: 970px !important; } }", 0); newstylesheet.insertRule("@media only screen and (max-width: 1400px) { .reviewtube iframe { height: 980px !important; } }", 0); */ var iframe = thatDoc.createElement( "iframe" ); iframe.setAttribute( "id", 'rtif'+pid); iframe.setAttribute( "frameborder", "0"); iframe.setAttribute( "allowfullscreen", ""); iframe.setAttribute( "webkitallowfullscreen", ""); iframe.setAttribute( "mozallowfullscreen", ""); iframe.setAttribute( "src", "https://www.reviewtube.com/proc/business_profile.php?pid=" + vidid ); iframe.setAttribute( "width", "100%"); tubes[i].innerHTML = ""; tubes[i].appendChild( iframe ); bindEvent(window, 'message', function (e) { if (e.data=='rtrs') { if (window.matchMedia("(max-width: 700px)").matches) { //newstylesheet.insertRule(".reviewtube, .reviewtube iframe { max-height: 1030px !important;}", 0); var rtSingleVid = document.getElementById('rtFrame'); rtSingleVid.setAttribute("style", "height: 1030px !important;"); } else { //newstylesheet.insertRule(".reviewtube, .reviewtube iframe { max-height: 750px !important;}", 0); var rtSingleVid = document.getElementById('rtFrame'); rtSingleVid.setAttribute("style", "height: 750px !important;"); } } }); }// if viewType }//for tubes.length iFrameResize({ log: false, onResized: function(messageData) { var div = document.querySelector('.reviewtube'); div.style.height = messageData.height+'px'; } }, '#rtif77477'); })(window, document);