From 7025c819f7c46ace577e8f8e5a772e225e591016 Mon Sep 17 00:00:00 2001 From: Hauke D Date: Thu, 11 Oct 2018 16:17:56 +0200 Subject: [PATCH] Added "IFrame Resizer" From 96a5016e22e9d84cbd06ba8c1e56f316d8fd0e0e --- democode/index.html | 11 +++++++++-- democode/perleditor.html | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/democode/index.html b/democode/index.html index 37e33b4..3f77aee 100644 --- a/democode/index.html +++ b/democode/index.html @@ -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; } + + @@ -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. --> @@ -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'));

This example includes several files:

@@ -160,6 +166,7 @@ document.getElementById('perl2').src = ], outputs: [ "vowels.txt" ], } )); +iFrameResize({checkOrigin:false}, document.getElementById('perl2')); diff --git a/democode/perleditor.html b/democode/perleditor.html index 364468b..6ef528a 100644 --- a/democode/perleditor.html +++ b/democode/perleditor.html @@ -29,6 +29,8 @@ If not, see http://perldoc.perl.org/index-licence.html + + @@ -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); });