From 6a6af0cb53322e93aa5f3c633aeff2a19454629b Mon Sep 17 00:00:00 2001 From: Thomas Skerbis Date: Mon, 5 Aug 2019 00:22:58 +0200 Subject: =?UTF-8?q?Adds=20the=20newest=20iframeSizer.min.js=20and=20?= =?UTF-8?q?=E2=80=A6contentWindow.js=20(#14724)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adding iFrameResizer.contentWindow.min.js fixes: https://github.com/matomo-org/matomo/issues/14716 * Adding: iframeResizer.contentWindow.min.js fixes: https://github.com/matomo-org/matomo/issues/14716 * adding newest version of iframeResizer.min.js * Mention iframe resizer in the legal notice Was forgotten to be added there previously --- LEGALNOTICE | 4 ++++ plugins/CoreHome/CoreHome.php | 1 + .../CoreHome/javascripts/iframeResizer.contentWindow.min.js | 10 ++++++++++ plugins/CoreHome/javascripts/iframeResizer.min.js | 6 +++--- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 plugins/CoreHome/javascripts/iframeResizer.contentWindow.min.js diff --git a/LEGALNOTICE b/LEGALNOTICE index 295ff6bcac..9df6888551 100644 --- a/LEGALNOTICE +++ b/LEGALNOTICE @@ -217,6 +217,10 @@ THIRD-PARTY COMPONENTS AND LIBRARIES Link: http://raphaeljs.com/ License: MIT (Expat) + Name: iFrame Resizer + Link: https://github.com/davidjbradshaw/iframe-resizer + License: MIT + Name: lessphp Link: http://leafo.net/lessphp License: GPL3, MIT (Expat) diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index db12b29606..fbcb7537b2 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -303,6 +303,7 @@ class CoreHome extends \Piwik\Plugin $jsFiles[] = "plugins/CorePluginsAdmin/angularjs/plugins/plugin-management.directive.js"; $jsFiles[] = "plugins/CorePluginsAdmin/angularjs/plugins/plugin-upload.directive.js"; $jsFiles[] = "plugins/CoreHome/javascripts/iframeResizer.min.js"; + $jsFiles[] = "plugins/CoreHome/javascripts/iframeResizer.contentWindow.min.js"; } public function getClientSideTranslationKeys(&$translationKeys) diff --git a/plugins/CoreHome/javascripts/iframeResizer.contentWindow.min.js b/plugins/CoreHome/javascripts/iframeResizer.contentWindow.min.js new file mode 100644 index 0000000000..c4dcf7d1d0 --- /dev/null +++ b/plugins/CoreHome/javascripts/iframeResizer.contentWindow.min.js @@ -0,0 +1,10 @@ +/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v4.1.1 - 2019-04-10 + * Desc: Include this file in any page being loaded into an iframe + * to force the iframe to resize to the content size. + * Requires: iframeResizer.min.js on host page. + * Copyright: (c) 2019 David J. Bradshaw - dave@bradshaw.net + * License: MIT + */ + +!function(l){if("undefined"!=typeof window){var n=!0,o=10,i="",r=0,a="",t=null,u="",c=!1,s={resize:1,click:1},d=128,f=!0,m=1,h="bodyOffset",g=h,p=!0,v="",y={},b=32,e=null,w=!1,T="[iFrameSizer]",E=T.length,O="",S={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="child",I=!0,N=window.parent,A="*",C=0,k=!1,z=null,R=16,x=1,L="scroll",F=L,P=window,D=function(){ue("onMessage function not defined")},j=function(){},q=function(){},H={height:function(){return ue("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return ue("Custom width calculation function not defined"),document.body.scrollWidth}},W={},B=!1;try{var U=Object.create({},{passive:{get:function(){B=!0}}});window.addEventListener("test",te,U),window.removeEventListener("test",te,U)}catch(e){}var J,V,K,Q,X,Y,G,Z=Date.now||function(){return(new Date).getTime()},$={bodyOffset:function(){return document.body.offsetHeight+be("marginTop")+be("marginBottom")},offset:function(){return $.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return H.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,Te($))},min:function(){return Math.min.apply(null,Te($))},grow:function(){return $.max()},lowestElement:function(){return Math.max($.bodyOffset()||$.documentElementOffset(),we("bottom",Oe()))},taggedElement:function(){return Ee("bottom","data-iframe-height")}},_={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return H.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(_.bodyScroll(),_.documentElementScroll())},max:function(){return Math.max.apply(null,Te(_))},min:function(){return Math.min.apply(null,Te(_))},rightMostElement:function(){return we("right",Oe())},taggedElement:function(){return Ee("right","data-iframe-width")}},ee=(J=Se,X=null,Y=0,G=function(){Y=Z(),X=null,Q=J.apply(V,K),X||(V=K=null)},function(){var e=Z();Y||(Y=e);var t=R-(e-Y);return V=this,K=arguments,t<=0||Re&&(e=c,h(W,"Set "+d+" to min value")),e>b&&(e=b,h(W,"Set "+d+" to max value")),V[d]=""+e}function k(){function a(){function a(){var a=0,d=!1;for(h(W,"Checking connection is from allowed list of origins: "+c);aP[w]["max"+a])throw new Error("Value for min"+a+" can not be greater than max"+a)}c("Height"),c("Width"),b("maxHeight"),b("minHeight"),b("maxWidth"),b("minWidth")}function e(){var a=c&&c.id||S.id+F++;return null!==document.getElementById(a)&&(a+=F++),a}function f(b){return R=b,""===b&&(a.id=b=e(),G=(c||{}).log,R=b,h(b,"Added missing iframe ID: "+b+" ("+a.src+")")),b}function g(){h(w,"IFrame scrolling "+(P[w].scrolling?"enabled":"disabled")+" for "+w),a.style.overflow=!1===P[w].scrolling?"hidden":"auto",a.scrolling=!1===P[w].scrolling?"no":"yes"}function i(){("number"==typeof P[w].bodyMargin||"0"===P[w].bodyMargin)&&(P[w].bodyMarginV1=P[w].bodyMargin,P[w].bodyMargin=""+P[w].bodyMargin+"px")}function k(){var b=P[w].firstRun,c=P[w].heightCalculationMethod in O;!b&&c&&r({iframe:a,height:0,width:0,type:"init"})}function l(){Function.prototype.bind&&(P[w].iframe.iFrameResizer={close:n.bind(null,P[w].iframe),resize:u.bind(null,"Window resize","resize",P[w].iframe),moveToAnchor:function(a){u("Move to anchor","inPageLink:"+a,P[w].iframe,w)},sendMessage:function(a){a=JSON.stringify(a),u("Send Message","message:"+a,P[w].iframe,w)}})}function m(c){function d(){u("iFrame.onload",c,a),k()}b(a,"load",d),u("init",c,a)}function o(a){if("object"!=typeof a)throw new TypeError("Options is not an object")}function p(a){for(var b in S)S.hasOwnProperty(b)&&(P[w][b]=a.hasOwnProperty(b)?a[b]:S[b])}function q(a){return""===a||"file://"===a?"*":a}function s(b){b=b||{},P[w]={firstRun:!0,iframe:a,remoteHost:a.src.split("/").slice(0,3).join("/")},o(b),p(b),P[w].targetOrigin=!0===P[w].checkOrigin?q(P[w].remoteHost):"*"}function t(){return w in P&&"iFrameResizer"in a}var w=f(a.id);t()?j(w,"Ignored iFrame, already setup."):(s(c),g(),d(),i(),m(v(w)),l())}function x(a,b){null===Q&&(Q=setTimeout(function(){Q=null,a()},b))}function y(){function b(){function a(a){function b(b){return"0px"===P[a].iframe.style[b]}function c(a){return null!==a.offsetParent}c(P[a].iframe)&&(b("height")||b("width"))&&u("Visibility change","resize",P[a].iframe,a)}for(var b in P)a(b)}function c(a){h("window","Mutation observed: "+a[0].target+" "+a[0].type),x(b,16)}function d(){var a=document.querySelector("body"),b={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},d=new e(c);d.observe(a,b)}var e=a.MutationObserver||a.WebKitMutationObserver;e&&d()}function z(a){function b(){B("Window "+a,"resize")}h("window","Trigger event: "+a),x(b,16)}function A(){function a(){B("Tab Visable","resize")}"hidden"!==document.visibilityState&&(h("document","Trigger event: Visiblity change"),x(a,16))}function B(a,b){function c(a){return"parent"===P[a].resizeFrom&&P[a].autoResize&&!P[a].firstRun}for(var d in P)c(d)&&u(a,b,document.getElementById(d),d)}function C(){b(a,"message",l),b(a,"resize",function(){z("resize")}),b(document,"visibilitychange",A),b(document,"-webkit-visibilitychange",A),b(a,"focusin",function(){z("focus")}),b(a,"focus",function(){z("focus")})}function D(){function a(a,c){function d(){if(!c.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==c.tagName.toUpperCase())throw new TypeError("Expected