Added "IFrame Resizer"

From 96a5016e22
gh-pages
Hauke D 7 years ago
parent adc0fa87ea
commit 7025c819f7

@ -34,12 +34,14 @@ pre,textarea,code {
}
iframe.perleditor {
display: block;
border: 1px solid black;
border: 1px dotted lightgrey;
width: 100%;
max-width: 50em;
margin: 0.2em 0;
}
</style>
<!-- Optional "IFrame Resizer": -->
<!--cacheable--><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.6.2/iframeResizer.min.js" integrity="sha256-aYf0FZGWqOuKNPJ4HkmnMZeODgj3DVslnYf+8dCN9/k=" crossorigin="anonymous"></script>
</head>
<body>
@ -95,7 +97,9 @@ tag, for example using the "Copy Frame URL" link shown in the editor.
Note that implementing an automatic resize of the IFrame to fit its
contents is nontrivial when sandboxing is enabled, which is why a
fixed height is used below.
fixed height is used below. However, see for example
http://davidjbradshaw.github.io/iframe-resizer/ - examples of how
to use this are included in the source files here.
-->
<iframe id="perl1" sandbox="allow-scripts" class="perleditor" style="height:20em;"></iframe>
@ -105,6 +109,8 @@ document.getElementById('perl1').src =
inputs: [ { fn:"in.txt", text:"Foo\nBar\nQuz" } ],
cmdline: "perl -CSD -pe 's/[aeiou]/_/g' in.txt",
} ));
// Example of how to use the Optional "IFrame Resizer":
iFrameResize({checkOrigin:false}, document.getElementById('perl1'));
</script>
<p>This example includes several files:</p>
@ -160,6 +166,7 @@ document.getElementById('perl2').src =
],
outputs: [ "vowels.txt" ],
} ));
iFrameResize({checkOrigin:false}, document.getElementById('perl2'));
</script>
</body>

@ -29,6 +29,8 @@ If not, see http://perldoc.perl.org/index-licence.html
<!--cacheable--><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.css" integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs=" crossorigin="anonymous" />
<link rel="stylesheet" href="perleditor.css" />
<!-- Optional "IFrame Resizer": -->
<!--cacheable--><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.6.2/iframeResizer.contentWindow.min.js" integrity="sha256-dEPtZVO6cj6PAmBeDzFskohUob+woyzF6TaNcYpAk84=" crossorigin="anonymous"></script>
<!--cacheable--><script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.js" integrity="sha256-uRIJ6Wfou5cTtmcCvQNA9lvsYl8sUbZXxnfG+P79ssY=" crossorigin="anonymous"></script>
<!--cacheable--><script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/mode/perl/perl.min.js" integrity="sha256-Uu9QBfi8gU6J/MzQunal8ewmY+i/BbCkBrcAXA5bcCM=" crossorigin="anonymous"></script>
<!--cacheable--><script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
@ -148,6 +150,7 @@ window.addEventListener('message', function (event) {
$('#runnererrors').show();
$('#runnererrors>pre').append(data.perlRunnerError+"\n");
}
else if (data.substring(0,13)=="[iFrameSizer]") {} // ignore quietly
else console.warn("Perl Editor ignoring unknown message:",data);
});

Loading…
Cancel
Save