summaryrefslogtreecommitdiff
path: root/js/help.js
diff options
context:
space:
mode:
authorjules <jules@okfoc.us>2014-02-02 18:58:46 -0500
committerjules <jules@okfoc.us>2014-02-02 18:58:46 -0500
commitb125e3106727e0acb627f17f4de0a1c3a1cf6f49 (patch)
tree36a2be85ac7ee402cd78fe9d53e4dc7da8d9c023 /js/help.js
parentc1e6c0c182102e5d61a8ac26b403b42c5fd40591 (diff)
parent2c0ddba2dab715a7c81a106edcfdd9f5be0592a2 (diff)
Merge branch 'master' into pepper
Diffstat (limited to 'js/help.js')
-rw-r--r--js/help.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/js/help.js b/js/help.js
new file mode 100644
index 0000000..db0ac6d
--- /dev/null
+++ b/js/help.js
@@ -0,0 +1,47 @@
+
+var help = {}
+
+help.init = function(){
+ help.bind()
+}
+
+help.bind = function(){
+ $(window).on("scroll DOMMouseScroll mousewheel", function(){ scrolling = true })
+ $("#show-commands").click(function(){ $("#tutorial").hide(); $("#commands").toggle() })
+ $("#show-tutorial").click(function(){ $("#commands").hide(); $("#tutorial").toggle() })
+ $("#commands .close").click(function(){ $("#commands").toggle() })
+ $("#tutorial .close").click(function(){ $("#tutorial").toggle() })
+ $("#commands,#tutorial").draggable({
+ start: drag_start,
+ stop: drag_stop
+ })
+ $("#commands,#tutorial").disableSelection();
+
+ $("#examples").change(function(){
+ help.load_example($(this).val())
+ $("#toggle-images").trigger("click")
+ })
+
+ if ('EXAMPLE_SHADERS' in window) {
+ help.examples = {}
+ window.EXAMPLE_SHADERS.forEach(function(s){
+ help.examples[ s.name ] = s.shader
+ var $option = $("<option value='" + s.name +"'>" + s.name + "</option>")
+ $("#examples").append($option)
+ })
+ }
+}
+
+help.examples = {}
+
+help.load_example = function(name){
+ var s = help.examples[name]
+ $("#shader").html(s)
+ new_shader({ name: name, shader: s })
+}
+
+function drag_start(){ dragging = true; $(this).addClass("dragging") }
+function drag_stop(){ dragging = false; $(".dragging").removeClass("dragging") }
+
+function status(s){ $(".status").html(s); console.log(s) }
+function quiet_status(s){ $(".status").html(s) }