From 9433b20670a1eada77e1a4372a8f8ccad6f499c3 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 25 Jan 2014 23:24:36 -0500 Subject: split out help and whatever else --- js/gallery.js | 12 +++++++++++- js/help.js | 19 +++++++++++++++++++ shader-api.html | 3 +++ shader-picker.html | 16 +++------------- 4 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 js/help.js diff --git a/js/gallery.js b/js/gallery.js index 16ecdd8..d114ec6 100644 --- a/js/gallery.js +++ b/js/gallery.js @@ -3,7 +3,10 @@ var gallery = {} -gallery.init = function(){ +gallery.init = function(choose){ + if (choose) { + galler.choose = choose; + } gallery.bind() } @@ -52,3 +55,10 @@ gallery.image = function(im){ gallery.click = function(){ gallery.choose() } + +// template for choose function.. bound to an image object +gallery.choose = function(){ + var img = this + var imageURL = this.src +} + diff --git a/js/help.js b/js/help.js new file mode 100644 index 0000000..5610794 --- /dev/null +++ b/js/help.js @@ -0,0 +1,19 @@ + +var help = {} + +help.init = function(){ + help.bind() +} + +help.bind = function(){ + $(window).on("scroll DOMMouseScroll mousewheel", function(){ scrolling = true }) + $("#help,#instructions .close").click(function(){ $("#instructions").toggle() }) + $("#instructions").draggable({ + start: drag_start, + stop: drag_stop + }) + $("#instructions").disableSelection(); +} + +function drag_start(){ dragging = true; $(this).addClass("dragging") } +function drag_stop(){ dragging = false; $(".dragging").removeClass("dragging") } diff --git a/shader-api.html b/shader-api.html index aa9d1a6..416f21a 100644 --- a/shader-api.html +++ b/shader-api.html @@ -86,6 +86,7 @@ a { color: #00f; } + @@ -109,6 +110,7 @@ function init(){ $("#pause").click(pause) user.init() + help.init() shader_gallery.init() document.getElementById('shader').addEventListener('input', shader_build); @@ -120,3 +122,4 @@ function init(){ +- \ No newline at end of file diff --git a/shader-picker.html b/shader-picker.html index d0d2625..0896609 100644 --- a/shader-picker.html +++ b/shader-picker.html @@ -128,6 +128,7 @@ a { color: #00f; } +