ASDSO Dam Safety Toolbox

Template: WhatLinksHere: Difference between revisions

From ASDSO Dam Safety Toolbox
Jump to: navigation, search
No edit summary
No edit summary
Tag: Reverted
Line 2: Line 2:
== Usage ==
== Usage ==
{{WhatLinksHere}}
{{WhatLinksHere}}
<script>
    document.querySelector("iframe").addEventListener( "load", function(e) {
      var iframeWin = document.getElementById("iframeWin");
      var content = (iframeWin.contentWindow || iframeWin.contentDocument);
      if (content.document)content = content.document;
      // Adjust padding/margin
      iframeWin.contentWindow.document.getElementById('maincontentwrapper').style.marginLeft = "0px";
      iframeWin.contentWindow.document.getElementById('maincontentwrapper').style.paddingLeft = "0px";
      // Hide header, heading, back link, special messages, form, filters, and footer
      content.body.getElementsByTagName("header")[0].style.display = "none";
      content.body.getElementsByClassName("firstHeading")[0].style.display = "none";
      iframeWin.contentWindow.document.getElementById('contentSub').style.display = "none";
      iframeWin.contentWindow.document.getElementsByClassName('usermessage')[0].style.display = "none";
      iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("fieldset")[0].style.display = "none";
      iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("fieldset")[1].style.display = "none";
      iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("p")[0].style.display = "none";
      iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("p")[1].style.display = "none";
      content.body.getElementsByTagName("footer")[0].style.display = "none";
      // Add parent to links
      var anchors = iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("a");
      for (var i=0; i<anchors.length; i++){
        anchors[i].setAttribute('target', '_parent');
      }
      // Show
      document.getElementById('iframeDiv').style.display="block";
    });
    window.onload = function() {
      var iframeWin = document.getElementById("iframeWin");
      // Set height
      iframeWin.height = iframeWin.contentWindow.document.body.scrollHeight;
    }
  </script>
</noinclude>
</noinclude>



Revision as of 18:49, 10 July 2023

Usage


<script>
   document.querySelector("iframe").addEventListener( "load", function(e) {
     var iframeWin = document.getElementById("iframeWin");
     var content = (iframeWin.contentWindow || iframeWin.contentDocument);
     if (content.document)content = content.document;
     // Adjust padding/margin
     iframeWin.contentWindow.document.getElementById('maincontentwrapper').style.marginLeft = "0px";
     iframeWin.contentWindow.document.getElementById('maincontentwrapper').style.paddingLeft = "0px";
     // Hide header, heading, back link, special messages, form, filters, and footer
     content.body.getElementsByTagName("header")[0].style.display = "none";
     content.body.getElementsByClassName("firstHeading")[0].style.display = "none";
     iframeWin.contentWindow.document.getElementById('contentSub').style.display = "none";
     iframeWin.contentWindow.document.getElementsByClassName('usermessage')[0].style.display = "none";
     iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("fieldset")[0].style.display = "none";
     iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("fieldset")[1].style.display = "none";
     iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("p")[0].style.display = "none";
     iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("p")[1].style.display = "none";
     content.body.getElementsByTagName("footer")[0].style.display = "none";
     // Add parent to links
     var anchors = iframeWin.contentWindow.document.getElementById('mw-content-text').getElementsByTagName("a");
     for (var i=0; i<anchors.length; i++){
       anchors[i].setAttribute('target', '_parent');
     }
     // Show
     document.getElementById('iframeDiv').style.display="block";
   });
   window.onload = function() {
     var iframeWin = document.getElementById("iframeWin");
     // Set height
     iframeWin.height = iframeWin.contentWindow.document.body.scrollHeight;
   }
 </script>