diff --git a/web/democode/perleditor.html b/web/democode/perleditor.html index c9fea0f..dfd86f8 100644 --- a/web/democode/perleditor.html +++ b/web/democode/perleditor.html @@ -165,10 +165,27 @@ function fetchUrl(url,cm) { // fetch the contents of a URL into a CodeMirror ins }); } -function fileRename () { - var div = $(this); - var newname = prompt("Please choose a new filename:",div.text()); - if (newname) div.text(newname); +function makeCodeWithFn (fn,targ,ro,nodel) { + var div = $('
',{class:"codewithfn"}); + //TODO: the "delete" and "rename" functions should probably be styled better + if (!nodel) { + $('
',{class:"fakelink",style:"float:right;",text:"delete"}) + .appendTo(div).click(function () { + if (confirm("Are you sure you want to remove this file?")) + div.remove() }); + } + $('
',{class:"filename",text:fn}) + .appendTo(div).click(function () { + var filename = $(this); + var newname = prompt("Please choose a new filename:", filename.text()); + if (newname) filename.text(newname); + }); + div.append( $('
',{style:"clear:both;"}) ); + var ta = $(' -
- -
+