PageSourceSearch

https://swissolympic.ch/.resources/sow/js/lib/IFrameManager~1980-01-31-23-00-00-000~cache.js

js swissolympic.ch collected 2026-09-24 09:25:48 UTC 1,972 bytes, 63 lines download raw bytes

1var IFrameManager = function (margin, $header) {
2  
3    var self = this;
4    
5    this.iframes = [];
6    
7    this.$header = $header;
8    
9    this.margin = margin;
10    
11    this.init = function () {
12        window.addEventListener("message", self.processCommand, false);
13    };
14    
15    this.registerIFrame = function ($iframe, host) {
16        self.iframes.push({url: self.stripUrl(host), $iframe: $iframe});
17    };
18    
19    this.processCommand = function (event) {
20        var $iframe = self.getIFrame(self.stripUrl(event.origin || event.originalEvent.origin));
21        if (!event.data || !event.data.toLowerCase || event.data.toLowerCase().indexOf("iframeresizer") > -1) {
22            return;
23        }
24        var message = JSON.parse(event.data);
25        if (message.command === "RESIZE_IFRAME") {
26            self.resize($iframe, message.parameters['height']);
27        }
28        else if (message.command === "SCROLL_TOP") {
29            self.scrollToTop($iframe, message.parameters['offset'])
30        }
31    };
32    
33    this.getIFrame = function (host) {
34        var $iframe = null;
35        $.each(self.iframes, function (index, iframe) {
36            if (iframe.url.indexOf(host) === 0) {
37                $iframe = iframe.$iframe;
38            }
39        });
40        return $iframe;
41    };
42    
43    this.stripUrl = function (url) {
44      if (url.lastIndexOf("/") == url.length - 1) {
45          return url.substring(0, url.length - 1);
46      }
47      return url;
48    };
49    
50    this.resize = function ($iframe, height) {
51        $iframe.css("height", height + "px");
52    };
53    
54    this.scrollToTop = function ($iframe, offset) {
55        var iframeOffset = $iframe.offset().top;
56        var headerHeight = self.$header.height();
57        var scrollTarget = Math.round(iframeOffset - headerHeight - self.margin + offset);
58        console.log("Scrolling to: " + scrollTarget);
59        $('html, body').animate({scrollTop: scrollTarget}, 500);
60    };
61    
62    this.init();
63};

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.