Blame view

Vrh.Web.OneReport.Lib/ReportViewerForMVC/Scripts/ReceiveMessage.js 960 Bytes
ab9f2fbe   Schwirg László   Add project files.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  var ReportViewerForMvc = ReportViewerForMvc || (new function () {
  
      var _iframeId = {};
  
      var resizeIframe = function (msg) {
          var height = msg.source.document.body.scrollHeight;
          var width = msg.source.document.body.scrollWidth;
  
          $(ReportViewerForMvc.getIframeId()).height(height);
          $(ReportViewerForMvc.getIframeId()).width(width);
      }
  
      var addEvent = function (element, eventName, eventHandler) {
          if (element.addEventListener) {
              element.addEventListener(eventName, eventHandler);
          } else if (element.attachEvent) {
              element.attachEvent('on' + eventName, eventHandler);
          }
      }
  
      this.setIframeId = function (value) {
          _iframeId = '#' + value;
      };
  
      this.getIframeId = function () {
          return _iframeId;
      };
  
      this.setAutoSize = function () {
          addEvent(window, 'message', resizeIframe);
      }
  
  }());
  
  ReportViewerForMvc.setAutoSize();