From 93c3bf4e38a5b2be84c3808f915ae5ebc317aeda Mon Sep 17 00:00:00 2001 From: Hauke D Date: Wed, 10 Oct 2018 16:45:03 +0200 Subject: [PATCH] Implemented "copy URL" --- web/democode/perleditor.css | 19 ++++++++++++++++++- web/democode/perleditor.html | 26 +++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/web/democode/perleditor.css b/web/democode/perleditor.css index dcf9137..b2d553d 100644 --- a/web/democode/perleditor.css +++ b/web/democode/perleditor.css @@ -53,10 +53,27 @@ pre { /* also has a placeholder text */ min-width: 10em; } + +#misctools { + display: inline-block; + border: 1px solid grey; + padding: 1px 0.5em; + margin-top: 1px; + margin-right: 3px; + color: grey; +} +#misctools_reveal { + display: none; +} +#misctools:hover { + color: inherit; +} +#misctools:hover #misctools_reveal { + display: inline-block; +} #runnerstate { margin-top: 0.1em; margin-bottom: 0.3em; - font-size: 0.8em; } #runnererrors { background-color: rgba(255,200,200,255); diff --git a/web/democode/perleditor.html b/web/democode/perleditor.html index a03f896..7853d27 100644 --- a/web/democode/perleditor.html +++ b/web/democode/perleditor.html @@ -260,7 +260,6 @@ function setupInputFile (inp) { fetchUrl(inp.url, cfn.cm); } -//TODO: implement a "get URL" feature function getFileData () { var filedata = {}; // script @@ -291,6 +290,19 @@ $(function () { var hashdata = window.location.hash.substr(1); var hash = hashdata.length>0 ? JSON.parse(decodeURIComponent(hashdata)) : {}; + $('#copyurl').click(function () { + var pageurl = $('#pageurl'); + var data = getFileData(); + data.cmdline = $('#argv').val(); + var loc = new URL(window.location); + loc.hash = encodeURIComponent(JSON.stringify(data)); + pageurl.val(loc); + pageurl.show(); + pageurl[0].select(); + document.execCommand("copy"); + pageurl.hide(); + }); + $('#addinput').click(function () { setupInputFile( {} ); }); @@ -385,8 +397,16 @@ $(function () { -
- Loading... +
+ +
+ Tools +
+   + Copy Frame URL +
+
+ Loading...