PageSourceSearch

https://www.iit-berlin.de/wp-content/themes/iit-fluks/infografik/responsiveIframe.js?ver=1789543998

js iit-berlin.de collected 2026-09-24 18:53:19 UTC 5,453 bytes, 143 lines download raw bytes

1/*! jQuery ResponsiveIframe - v0.0.3 - 2013-09-05
2* https://github.com/npr/responsiveiframe
3* Copyright (c) 2013 Irakli Nadareishvili; Licensed MIT, GPL */
4if (typeof jQuery !== 'undefined') {
5    (function( $ ){
6        var settings = {
7            xdomain: '*',
8            ie : navigator.userAgent.toLowerCase().indexOf('msie') > -1,
9            scrollToTop: true
10        };
11
12        var methods = {
13            // initialization for the parent, the one housing this
14            init: function() {
15                return this.each(function(self){
16                    var $this = $(this);
17
18                    if (window.postMessage) {
19                        if (window.addEventListener) {
20                            window.addEventListener('message', function(e) {
21                                privateMethods.messageHandler($this,e);
22                            } , false);
23                        } else if (window.attachEvent) {
24                            window.attachEvent('onmessage', function(e) {
25                                privateMethods.messageHandler($this,e);
26                            }, $this);
27                        }
28                    } else {
29                        setInterval(function () {
30                            var hash = window.location.hash, matches = hash.match(/^#h(\d+)(s?)$/);
31                            if (matches) {
32                                privateMethods.setHeight($this, matches[1]);
33                                if (settings.scrollToTop && matches[2] === 's'){
34                                    scroll(0,0);
35                                }
36                            }
37                        }, 150);
38                    }
39                });
40            }
41        };
42
43        var privateMethods = {
44            messageHandler: function (elem, e) {
45                var height,
46                    r,
47                    matches,
48                    strD;
49
50                if (settings.xdomain !== '*') {
51                    var regex = new RegExp(settings.xdomain + '$');
52                    if(e.origin == "null"){
53                        throw new Error("messageHandler( elem, e): There is no origin.  You are viewing the page from your file system.  Please run through a web server.");
54                    }
55                    if(e.origin.match(regex)){
56                        matches = true;
57                    }else{
58                        throw new Error("messageHandler( elem, e): The orgin doesn't match the responsiveiframe  xdomain.");
59                    }
60
61                }
62
63                if(settings.xdomain === '*' || matches ) {
64                    strD = e.data + "";
65                    r = strD.match(/^(\d+)(s?)$/);
66                    if(r && r.length === 3){
67                        height = parseInt(r[1], 10);
68                        //alert(height);
69                        if (!isNaN(height)) {
70                            try {
71                                privateMethods.setHeight(elem, height);
72                            } catch (ex) {}
73                        }
74                        if (settings.scrollToTop && r[2] === "s"){
75                            scroll(0,0);
76                        }
77                    }
78                }
79            },
80
81            // Sets the height of the iframe
82            setHeight : function (elem, height) {
83                elem.css('height', height + 'px');
84            },
85            getDocHeight: function () {
86                var D = document;
87                return Math.min(
88                    Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
89                    Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
90                    Math.max(D.body.clientHeight, D.documentElement.clientHeight)
91                );
92            }
93        };
94
95        $.fn.responsiveIframe = function( method ) {
96            if ( methods[method] ) {
97                return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
98            } else if ( typeof method === 'object' || ! method ) {
99                $.extend(settings, arguments[0]);
100                return methods.init.apply( this );
101            } else {
102                $.error( 'Method ' +  method + ' does not exist on jQuery.responsiveIframe' );
103            }
104        };
105    }( jQuery ));
106}
107
108;(function(){
109    var self,
110        module,
111        ResponsiveIframe = function () {self = this;};
112
113    ResponsiveIframe.prototype.allowResponsiveEmbedding = function() {
114        if (window.addEventListener) {
115            window.addEventListener("load", self.messageParent, false);
116            window.addEventListener("resize", self.messageParent, false);
117        } else if (window.attachEvent) {
118            window.attachEvent("onload", self.messageParent);
119            window.attachEvent("onresize", self.messageParent);
120        }
121    };
122
123    ResponsiveIframe.prototype.messageParent = function(scrollTop) {
124        var h = document.body.offsetHeight;
125        h = (scrollTop)? h+'s':h;
126        if(top.postMessage){
127            top.postMessage( h , '*');
128        } else {
129            window.location.hash = 'h'+h;
130        }
131    };
132
133    function responsiveIframe() {
134        return new ResponsiveIframe();
135    }
136
137    // expose
138    if ('undefined' === typeof exports) {
139        window.responsiveIframe = responsiveIframe;
140    } else {
141        module.exports.responsiveIframe = responsiveIframe;
142    }
143}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.