diff --git a/light9/subserver/effects.coffee b/light9/subserver/effects.coffee deleted file mode 100644 --- a/light9/subserver/effects.coffee +++ /dev/null @@ -1,68 +0,0 @@ -class Model - constructor: -> - @classes = ko.observable([]) - - @chases = ko.observable([]) - @moreExprs = [ - {label: "rainbow", expr: "hsv(t*1,1,1)"}, - {label: "pulserainbow", expr: "hsv(t*1,1,1)*nsin(t*2)"}, - {label: "stacrainbow", expr: "hsv(t*1,1,1)*(nsin(t*2)>.7)"}, - {label: "alternatergb", expr: "hsv(t*1,1,1, light='left')*nsin(t*3) + hsv(t*1,1,1,light='right')*(1-nsin(t*3))"}, - {label: "frontchase", expr: "chase(t, names=frontchase, ontime=.3, offset=-.11)"}, - {label: "bumpyhues", expr: "hsv(t*.5,.4,1)*notch(t*.01)"}, - ] - - subtermLink: (label, expr) => - "http://chase?"+$.param({ - subtermName: label - subtermExpr: label + '_env(t) * ' + expr - curve: label + '_env' - }) - subtermExprs: (chase) => - [ - 'chase(t, names=LABEL, ontime=0.5, offset=0.2)'.replace(/LABEL/g, chase.label) - ] - - -model = new Model() - -model.addToCurrentSong = (e) -> - $.ajax({ - type: 'POST' - url: '/effectEval/songEffects' - data: {drop: e.uri} - }) - -lastMomentaryNote = null - -model.addMomentary = (e) -> - $.ajax({ - type: 'POST' - url: '/effectEval/songEffects' - data: {drop: e.uri, event: 'start'} - success: (data) -> - lastMomentaryNote = JSON.parse(data)['note'] - - }) - -model.addMomentaryUp = (e) -> - $.ajax({ - type: 'POST' - url: '/effectEval/songEffects' - data: {drop: e.uri, event: 'end', note: lastMomentaryNote} - }) - - - - -reconnectingWebSocket "../effectsUpdates", (msg) -> - model.chases(msg.chases) if msg.chases? - model.classes(msg.classes) if msg.classes? - -# this sort of works to stop clicks in from following the -# submaster hyperlink, but it may make certain clicks act wrong -$(document).on('click', 'a', (ev) -> - return false if ev.target.tagName == 'INPUT' -) - -ko.applyBindings(model) \ No newline at end of file diff --git a/light9/subserver/effects.jade b/light9/subserver/effects.jade deleted file mode 100644 --- a/light9/subserver/effects.jade +++ /dev/null @@ -1,54 +0,0 @@ -doctype html -html - head - title effects - link(rel='stylesheet', href='/style.css') - style. - .headerRow { - display: flex; - justify-content: space-between; - } - body - #status starting... - h1 Effects - p: a(href='.') Go to Submasters - - - div(data-bind="foreach: moreExprs") - div.resource.chase - span(data-bind="text: label") - | - a.resource(data-bind="attr: {href: $root.subtermLink(label, expr)}, text: expr") - - div(data-bind="foreach: chases") - div.resource.chase - | Chase - a(data-bind="attr: {href: uri}, text: label") - ul(data-bind="foreach: $parent.subtermExprs($data)") - li: a.resource(data-bind="attr: {href: $root.subtermLink($parent.label, $data)}, text: $data") - - - div(data-bind="foreach: classes") - div.resource.effectClass - div.headerRow - span - h2 - | Effect class - | - resource-display(data-bind="attr: {uri: uri, graph: graph}") - a(data-bind="attr: {href: uri}, text: label") - button(data-bind="click: $root.onRename") Rename - span.rightTools - button(data-bind="click: $root.addToCurrentSong") Add to current song - button(data-bind="event: { mousedown: $root.addMomentary, mouseup: $root.addMomentaryUp }") Add momentary - div.rename - input - div - code(data-bind="text: code") - - #status - - script(src="/lib/jquery/dist/jquery.min.js") - script(src="/lib/knockout/dist/knockout.js") - script(src="/websocket.js") - script(src="effects.js") \ No newline at end of file diff --git a/light9/subserver/gui.coffee b/light9/subserver/gui.coffee deleted file mode 100644 --- a/light9/subserver/gui.coffee +++ /dev/null @@ -1,25 +0,0 @@ -class Model - constructor: -> - @subs = ko.observable([]) - @showLocal = ko.observable(false) - - snapshot: (sub) => - $.ajax({ - url: "snapshot" - type: "POST" - data: {about: sub.uri} - }) - -model = new Model() - -# this sort of works to stop clicks in from following the -# submaster hyperlink, but it may make certain clicks act wrong -$(document).on('click', 'a', (ev) -> - return false if ev.target.tagName == 'INPUT' -) - -reconnectingWebSocket "live", (msg) -> - model.subs(msg.subs) if msg.subs? - - -ko.applyBindings(model) \ No newline at end of file diff --git a/light9/subserver/index.jade b/light9/subserver/index.jade deleted file mode 100644 --- a/light9/subserver/index.jade +++ /dev/null @@ -1,35 +0,0 @@ -doctype html -html - head - title subs - link(rel='stylesheet', href='/style.css') - body - #status starting... - h1 Submasters - p: a(href='effects') Go to Effects - - div - input(type='checkbox', data-bind='checked: showLocal', id='showLocal') - label(for='showLocal') show local - - div(data-bind="foreach: subs") - // ko if: $parent.showLocal() || !isLocal - a.resource.sub(data-bind="css: {local: isLocal}, attr: {href: uri}") - div(data-bind="if: isLocal") (local) - div - | Label - input(type="text", data-bind="value: label") - div - img(data-bind="attr: {src: img}") - div - button(data-bind="click: $root.snapshot") - New snapshot - - // /ko - - #status - - script(src="/lib/jquery/dist/jquery.min.js") - script(src="/lib/knockout/dist/knockout.js") - script(src="/websocket.js") - script(src="gui.js") \ No newline at end of file