From 29cb484c249be35c53b4ac336ec49049285b386c Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Wed, 4 Apr 2012 01:17:53 -0400 Subject: [PATCH] Edit in jsFiddle --- gallery/gallery.js | 63 +- gallery/index.html | 5 +- gallery/jquery-1.4.2.js | 6240 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 6296 insertions(+), 12 deletions(-) create mode 100644 gallery/jquery-1.4.2.js diff --git a/gallery/gallery.js b/gallery/gallery.js index e854a7a..f4b6e70 100644 --- a/gallery/gallery.js +++ b/gallery/gallery.js @@ -50,6 +50,14 @@ Gallery.start = function() { } Gallery.subtitle.innerHTML = ""; + Gallery.workareaChild.id = id; + location.hash = "g/" + id; + + Gallery.workareaChild.innerHTML=''; + if (demo.setup) { + demo.setup(Gallery.workareaChild); + } + Gallery.demotitle.textContent = demo.title ? demo.title : ""; demo.innerDiv.className = "selected"; @@ -59,35 +67,70 @@ Gallery.start = function() { var htmlLink = Gallery.create("a", codeSpan); htmlLink.textContent = "HTML"; - codeSpan.appendChild(document.createTextNode(" ")); + Gallery.create("span", codeSpan).textContent = " | "; var javascriptLink = Gallery.create("a", codeSpan); javascriptLink.textContent = "Javascript"; - codeSpan.appendChild(document.createTextNode(" ")); - var css = getCss(id); if (css) { + Gallery.create("span", codeSpan).textContent = " | "; var cssLink = Gallery.create("a", codeSpan); cssLink.textContent = "CSS"; } - Gallery.workareaChild.id = id; - location.hash = "g/" + id; + var jsFiddleForm = Gallery.create("form", codeSpan); + var jsfs = $(jsFiddleForm); + jsFiddleForm.method = "post"; + jsFiddleForm.action = "http://jsfiddle.net/api/post/jquery/1.4/"; - Gallery.workareaChild.innerHTML=''; - if (demo.setup) { - demo.setup(Gallery.workareaChild); - } + jsfs.html("\n" + + "\n" + + "\n" + + "\n"); + var javascript = demo.run.toString(); var html = Gallery.workareaChild.innerHTML; + // tweak for use in jsfiddle + javascript = " $(document).ready(" + javascript + "\n);" + jQuery('