diff --git a/app/config.json b/app/config.json index 9571a948..d5a6d449 100644 --- a/app/config.json +++ b/app/config.json @@ -2,7 +2,7 @@ "presetPath": "/home/bordun/oscwork/oschtmlgui/presets/", "sessionPath": "/home/bordun/oscwork/oschtmlgui/sessions/", "recentSessions": [ - "/home/bordun/oscwork/oschtmlgui/sessions/demo-full.js", - "/home/bordun/oscwork/oschtmlgui/sessions/demo.js" + "/home/bordun/oscwork/oschtmlgui/sessions/demo.js", + "/home/bordun/oscwork/oschtmlgui/sessions/demo-full.js" ] } \ No newline at end of file diff --git a/browser/index.html b/browser/index.html index 1eb4c5da..241d17d6 100644 --- a/browser/index.html +++ b/browser/index.html @@ -1,123 +1,34 @@ -OSCGUI - - - + body { + opacity:0; + } + + + -
-
-
- Session selection -
-
+
+
+
+ Session selection +
+
+
-
-
-
+
+
+ diff --git a/browser/js/app/oschtmlgui.js b/browser/js/app/app.js similarity index 100% rename from browser/js/app/oschtmlgui.js rename to browser/js/app/app.js diff --git a/browser/js/app/callbacks.js b/browser/js/app/callbacks.js index 089430b3..a1af1bda 100644 --- a/browser/js/app/callbacks.js +++ b/browser/js/app/callbacks.js @@ -11,3 +11,35 @@ ipc.on('receiveOsc',function(data){ ipc.on('load',function(preset){ setState(preset) }) + + +ipc.on('listSessions',function(data){ + for (i in data) { + $('#lobby .list').append('
  • '+data[i]+'x
  • ') + } + $('#lobby .list').append('...') + $('#lobby a').click(function(){ + ipc.send('loadSession',$(this).data('session')) + }) + $('#lobby a span').click(function(e){ + ipc.send('removeSessionFromHistory',$(this).parent().data('session')) + $(this).parents('li').hide() + e.stopPropagation() + }) +}) + + +ipc.on('openSession',function(data){ + TABS=false + require(data) + if (TABS!=false) { + $('#lobby').hide() + $('#container').append('
    ') + setTimeout(function(){ + init(function(){$('#container .spinner').hide()}); + },1) + + } else { + console.log('ERROR: invalid session file (TABS must be defined)') + } +}) diff --git a/browser/js/browser.js b/browser/js/browser.js new file mode 100644 index 00000000..f859145b --- /dev/null +++ b/browser/js/browser.js @@ -0,0 +1,52 @@ + +// mainProcess & renderProcess communication engine +ipc = require('ipc'); + +// filesystem +fs = require('fs'); + +// jquery +window.$ = window.jQuery = require( __dirname + "/jquery/jquery.min.js") + + + +// third-party js libraries +require( __dirname + "/jquery/jquery.nouislider.all.js") +require( __dirname + "/jquery/jquery-ui.draggable.min.js") +require( __dirname + "/jquery/jquery.mousewheel.min.js") + +// mouse to touch emulation +require( __dirname + "/jquery/jquery.ui.touch-punch.min.js") + + + +// main js +require( __dirname + "/app/app.js") + + + +// Sass (add stylesheets to var styles) +var Sass = require( __dirname + "/sass/sass.js") + Sass.setWorkerUrl(__dirname + "/sass/sass.worker.js"); + var sass = new Sass() + sass.options({style: Sass.style.compact}) + +var styles = ["/../css/style.scss","/../css/jquery.nouislider.scss"] + , stylesdata = '' + , done = 0; + +for (i in styles) { + + fs.readFile(__dirname + styles[i], 'utf8', function (err,data) { + if (err) {return console.log(err);} + stylesdata += "\n" + data; + done += 1; + if (done==styles.length) { + sass.compile(stylesdata,function(d){ + $('body').append('