PageSourceSearch

https://ias-icsd.org/live_tinc.js

js ias-icsd.org collected 2026-10-02 23:26:21 UTC 4,786 bytes, 132 lines download raw bytes

1var ResizeIframe = {   
2  wrapperId : "tinc_content",
3                
4  /**
5   * Resizes an iframe sId including oDoc to oDoc's content size.
6   * Can be called top-down, i.e. from the including iframe (or it's parents) or bottom-up, i.e. from the included document.
7   * In the latter case the iframe element is retrieved programmatically.
8   * 
9   * @param oDoc  Included page's document object
10   * @param sId   ID of including iframe
11   */               
12  resize : function ( oDoc, sId ) 
13  {
14    try
15    {
16      if ( typeof oDoc == "undefined" ) return;
17  
18      if ( typeof sId != "undefined" ) 
19      {
20        var iframe = oDoc.getElementById( sId );
21        var iframeDoc = iframe.contentWindow.document;
22      } else {
23        var iframeDoc = oDoc;
24        var iframeWindow = iframeDoc.parentWindow || iframeDoc.defaultView;
25        var iframe = iframeWindow.frameElement;
26      }
27      var wrapper = iframeDoc.getElementById( this.wrapperId );
28
29      // make sure we only resize once
30      if ( iframeDoc.isIntegrated == true ) { return; }
31      
32      // switch on transparency for iframe
33      iframeDoc.body.style.backgroundColor = "transparent";
34      iframe.allowTransparency = "true";
35            
36      iframeDoc.body.style.padding = "0px";
37      iframeDoc.body.style.border = "none";
38      
39      var tabs = iframeDoc.getElementsByTagName( "table" )
40      if ( tabs[0] && tabs[0].className == "dborder" )
41     	{		
42      	wrapper.setAttribute( "wfx:overridewidth", "true" );
43      } else if ( iframeDoc.forms[0] && iframeDoc.forms[0].elements["formname"] ) 
44      {
45      	wrapper.setAttribute( "wfx:overridewidth", "true" );
46      } 
47      
48      if ( window.addEventListener )
49      {   
50      	var gcs = iframeDoc.defaultView.getComputedStyle( iframeDoc.body, null);
51        var v_margin = parseInt( gcs.getPropertyValue( "margin-top" ) ) + parseInt( gcs.getPropertyValue( "margin-bottom" ) );
52        var h_margin = parseInt( gcs.getPropertyValue( "margin-left" ) ) + parseInt( gcs.getPropertyValue( "margin-right" ) );
53        var wrapper_width = wrapper.offsetWidth;
54        
55        var flex = wrapper.getAttribute( "wfx:overridewidth" );
56        if ( flex == "true" )
57        {
58        	wrapper.style.width = "100%";
59        } else {
60        	iframe.style.width = wrapper_width + h_margin + "px";
61        }
62        
63        // Setting the top padding of the wrapper avoids wrong calculation of the height due to collapsing margins behavior
64        wrapper.style.paddingTop = "1px";
65        
66        height = wrapper.offsetHeight + v_margin ;
67      } 
68      else if ( window.attachEvent ) 
69      {        
70        iframeDoc.body.style.margin = "0px";
71        var wrapper_width = wrapper.offsetWidth;
72        
73        var flex = wrapper.getAttribute( "wfx:overridewidth" );
74        if ( flex == "true" )
75        {
76        	wrapper.style.width = "100%";
77        } else {
78        	// We need to add this extra 20 pixel for some modules. Otherwise the width would not be big enough and we would get scrollbars.
79            // REMARK: In the script which is used for resizing the modules inside the editor we don't need this!
80            // Currently I don't know the reason for this difference!?
81        	iframe.style.width = wrapper_width + 20 + "px";
82        }
83        
84        height = wrapper.offsetHeight;
85      }
86
87      if ( iframe.scrolling != "yes" ) { height += 20; }
88      
89      iframe.style.height = height + "px";
90      iframeDoc.isIntegrated = true; 
91    } catch ( ex )
92    {
93      return; 
94    }
95    
96    WfxExtrasProcessor.process( oDoc, sId );
97  }
98}
99
100var WfxExtrasProcessor = {
101  process : function ( oDoc, sId)
102  {    
103    if ( typeof oDoc == "undefined" ) return;
104  
105    if ( typeof sId != "undefined" ) 
106    {
107      var iframe = oDoc.getElementById( sId );
108      var iframeDoc = iframe.contentWindow.document;
109    } else {
110      var iframeDoc = oDoc;
111      var iframeWindow = iframeDoc.parentWindow || iframeDoc.defaultView;
112      var iframe = iframeWindow.frameElement;
113    }
114    
115    // let non-tinc links load in the parent document. this might need some adjustment
116    var links = iframeDoc.getElementsByTagName( "a" );
117    for ( var i = 0; i < links.length; i++ )
118    {
119      if ( links[i].href.indexOf( "/tinc" ) == -1 ) links[i].target = "_parent";
120    }
121    
122    // Special case: WebElements forms might do redirection to another page after submission. That's indicated by a non-empty
123    // 'redirectionEnabled' attribute of a submit button. 
124    var inputs = iframeDoc.getElementsByTagName( "input" );
125    for ( var i = 0; i < inputs.length; i++ )
126    {
127      var input = inputs[i];
128      if ( input.getAttribute("redirection") != null && input.getAttribute("redirection") != '' ) 
129        input.form.target = "_parent";
130    }
131  }
132}

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.