From e00b0a148b92e5879445dbdcec3ffc75d417482d Mon Sep 17 00:00:00 2001 From: Hauke D Date: Wed, 10 Oct 2018 17:32:53 +0200 Subject: [PATCH] Added ability to add/remove script --- web/democode/perleditor.html | 56 ++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/web/democode/perleditor.html b/web/democode/perleditor.html index 5e52f8d..3bf24d8 100644 --- a/web/democode/perleditor.html +++ b/web/democode/perleditor.html @@ -164,7 +164,7 @@ function fetchUrl(url,cm) { // fetch the contents of a URL into a CodeMirror ins }); } -function makeCodeWithFn (fn,targ,ro,nodel) { +function makeCodeWithFn (fn,targ,ro,isscript) { var div = $('
',{class:"codewithfn"}); var fnfuncs = $('
',{class:"fnfuncs"}).appendTo(div); @@ -191,30 +191,31 @@ function makeCodeWithFn (fn,targ,ro,nodel) { var filefuncs = $('
',{class:"filefuncs"}).appendTo(fnfuncs); - if (!nodel) { - var conf = $('', {class:"text small"}) - .append( - " ", - "Are you sure?", - " ", - $('',{class:"fakelink",text:"Yes"}) - .click(function () { div.remove(); }), - " ", - $('',{class:"fakelink",text:"Cancel"}) - .click(function () { conf.hide(); }), - ); - $('',{class:"fakelink",text:"delete"}) - .appendTo(filefuncs).click(function () { - conf.show(); - }); - conf.hide(); - conf.appendTo(filefuncs); - } + var conf = $('', {class:"text small"}) + .append( + " ", + "Are you sure?", + " ", + $('',{class:"fakelink",text:"Yes"}) + .click(function () { + div.remove(); + if (isscript) $('#addscript').show(); + }), + " ", + $('',{class:"fakelink",text:"Cancel"}) + .click(function () { conf.hide(); }), + ); + $('',{class:"fakelink",text:"delete"}) + .appendTo(filefuncs).click(function () { + conf.show(); + }); + conf.hide(); + conf.appendTo(filefuncs); var ta = $('