- git add missing stuff...

- js code cleaning
- session loading and history, last used path stored in config file
This commit is contained in:
jean-emmanuel 2015-08-20 14:46:57 +02:00 • committed by bordun
parent e767fd8af6
commit 385c52f732
9 changed files with 3117 additions and 176 deletions

106
index.js
View file

@ -1,3 +1,10 @@
var defaultConfig = {
presetPath : __dirname,
sessionPath: __dirname,
recentSessions: []
}
// dependencies
var app = require('app')
, BrowserWindow = require('browser-window')
@ -6,7 +13,8 @@ var app = require('app')
, osc = require("osc")
, fs = require("fs")
, ipc = require('ipc')
, renderProcess = []
, renderProcess = {}
, config = require(__dirname + '/lib-dev/config/config.json')
// static files serving
@ -37,15 +45,11 @@ app.on('ready', function() {
width: 800,
height: 600,
'auto-hide-menu-bar':true,
});
// and load the index.html of the app.
window.loadUrl('file://' + __dirname + '/lib-dev/index.html');
// Open the devtools.
//window.openDevTools();
// Emitted when the window is closed.
window.on('closed', function() {
// Dereference the window object, usually you would store windows
@ -85,15 +89,52 @@ renderProcess.send = function(name,data) {
}
ipc.on('init',function(event, data){
fs.readFile(__dirname + '/lib-dev/js/demo.js','utf-8', function read(err, data) {
if (err) {
throw err;
}
renderProcess.send('init',data);
})
ipc.on('loadSession',function(event, data){
var sessionlist = readConfig('recentSessions')
if (data == 'browse') {
dialog.showOpenDialog(window,{title:'Load session file',defaultPath:readConfig('sessionPath'),filters: [ { name: 'OSC Session file', extensions: ['js'] }]},function(file){
if (file==undefined) {return}
writeConfig({sessionPath:file[0].replace(file[0].split('/').pop(),'')})
renderProcess.send('openSession',file[0]);
sessionlist.unshift(file[0])
sessionlist = sessionlist.filter(function(elem, index, self) {
return index == self.indexOf(elem);
})
writeConfig({recentSessions:sessionlist})
})
} else {
renderProcess.send('openSession',sessionlist[data]);
sessionlist.unshift(sessionlist[data])
sessionlist = sessionlist.filter(function(elem, index, self) {
return index == self.indexOf(elem);
})
writeConfig({recentSessions:sessionlist})
}
})
ipc.on('removeSessionFromHistory',function(event, data){
var sessionlist = readConfig('recentSessions')
sessionlist.splice(data,1)
writeConfig({recentSessions:sessionlist})
})
ipc.on('ready',function(){
var recentSessions = readConfig('recentSessions')
renderProcess.send('listSessions',recentSessions)
})
ipc.on('sendOsc', function (event,data) {
@ -110,30 +151,51 @@ ipc.on('sendOsc', function (event,data) {
ipc.on('save', function(event, data){
dialog.showSaveDialog(window,{title:'Save current state to preset file',defaultPath:__dirname,filters: [ { name: 'OSC Preset', extensions: ['preset'] }]},function(file){
dialog.showSaveDialog(window,{title:'Save current state to preset file',defaultPath:readConfig('presetPath'),filters: [ { name: 'OSC Preset', extensions: ['preset'] }]},function(file){
if (file==undefined) {return}
writeConfig({presetPath:file[0].replace(file[0].split('/').pop(),'')})
if (file.indexOf('.preset')==-1){file+='.preset'}
fs.writeFile(file,data, function (err, data) {
if (err) {
throw err;
}
if (err) throw err;
console.log("The current state was saved in "+file);
});
})
})
ipc.on('load', function(event, data){
dialog.showOpenDialog(window,{title:'Load preset file',defaultPath:__dirname,filters: [ { name: 'OSC Preset', extensions: ['preset'] }]},function(file){
dialog.showOpenDialog(window,{title:'Load preset file',defaultPath:readConfig('presetPath'),filters: [ { name: 'OSC Preset', extensions: ['preset'] }]},function(file){
if (file==undefined) {return}
writeConfig({presetPath:file[0].replace(file[0].split('/').pop(),'')})
fs.readFile(file[0],'utf-8', function read(err, data) {
if (err) {
throw err;
}
if (err) throw err;
renderProcess.send('load',data);
});
})
})
ipc.on('fullscreen', function(event, data){
window.setFullScreen(data)
ipc.on('fullscreen', function(event){
window.setFullScreen(!window.isFullScreen())
})
writeConfig = function(newconfig) {
for (i in newconfig) {
config[i] = newconfig[i]
}
fs.writeFile(__dirname + '/lib-dev/config/config.json',JSON.stringify(config), function (err, data) {
if (err) throw err;
});
}
readConfig = function(key) {
return config[key] || defaultConfig[key]
}

View file

@ -0,0 +1 @@
{"presetPath":"/home/bordun/oscwork/oschtmlgui/lib-dev/presets/","sessionPath":"/home/bordun/oscwork/oschtmlgui/lib-dev/js/","recentSessions":["/home/bordun/oscwork/oschtmlgui/lib-dev/js/demo.js"]}

View file

@ -3,7 +3,7 @@
$color-text:rgba(white,.9);
$color-text-fade:transparentize($color-text,.4);
$color-title:rgba(white,.05);
$color-fg:#282c34;
$color-bg:mix($color-fg,black,85);
@ -11,6 +11,20 @@ $color-accent:#528bff;
$color-border:mix($color-fg,black,55);
$nav-height:50px;
$bg-title:rgba(white,.05);
$bg-button:linear-gradient(#3a3f4b, #353b45);
$sidepanel-size:300px;
@mixin layer {
position: absolute;
top:0;
left:0;
right: 0;
bottom:0;
}
/////////////
@ -43,7 +57,6 @@ html, body {
height:100%;
overflow:hidden;
position:relative;
background:$color-bg;
}
body {
@ -52,19 +65,60 @@ body {
font-family:'Open Sans';
color:$color-text;
white-space:nowrap;
}
.content {
background:$color-fg;
opacity:1
}
$sidepanel-size:300px;
#lobby {
background: $color-bg;
@include layer();
z-index: 2;
border:1px solid $color-border;
display: flex;
align-items: center;
justify-content: center;
.main {
width:600px;
}
.header {
background: $bg-button;
padding:20px;
font-weight:bold;
box-shadow: 0 0 0 1px $color-border inset;
}
a {
display: block;
padding:10px;
padding-right:25px;
overflow: hidden;
background: $bg-button;
margin-top:10px;
box-shadow: 0 0 0 1px $color-border inset;
position: relative;
span {
position: absolute;
right:1px;
top:1px;
bottom:1px;
padding:9px;
background: $bg-button;
}
}
}
#container {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
background: $color-bg;
@include layer();
overflow:hidden;
transition:right .3s;
&.sidepanel-open {
@ -148,7 +202,7 @@ $sidepanel-size:300px;
li {
display:block;
margin-bottom:15px;
background:$color-title;
background:$bg-button;
border:1px solid $color-border;
> div {
padding:10px;
@ -218,7 +272,7 @@ a {
list-style:none;
display: flex;
padding-left:5px;
li.on + li {border:0;}
li.on + li {border-image:none;border-left:1px solid transparent;}
li {
display:block;
max-width:250px;
@ -227,7 +281,8 @@ a {
border-width:0 0 0 1px;
border-image: linear-gradient($color-bg, $color-border 20px) 0 0 0 1 stretch;
&:first-child, &.on {
border:0;
border-image:none;
border-left:1px solid transparent;
}
@ -251,6 +306,7 @@ a {
border:1px solid $color-border;
border-bottom-color:$color-fg;
color:$color-text;
&:before {
content:"";
position: absolute;
@ -258,6 +314,7 @@ a {
left:0;
right:0;
bottom:0;
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.06);
background:linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0))
}
&:after {
@ -287,6 +344,7 @@ a {
bottom:0;
padding:10px 5px 5px;
border-top:1px solid $color-border;
background:$color-fg;
.tab {
//height:100%;
@ -307,6 +365,7 @@ a {
height:0px;
width: 0px;
overflow: hidden;
position: relative;
&.on {
height:100%;
width:auto;
@ -341,6 +400,9 @@ a {
vertical-align:top;
overflow: hidden;
margin-right: 10px;
&:last-child {
margin-right: 0
}
.title {
padding:10px 10px;
@ -351,8 +413,8 @@ a {
text-overflow:ellipsis;
overflow:hidden;
height:35px;
border-radius:2px 2px 0 0 ;
background:linear-gradient(#3a3f4b, #353b45);
//border-radius:2px 2px 0 0 ;
background:$bg-button;
box-shadow: 0 0 0 1px $color-bg inset;
}
input {
@ -387,15 +449,17 @@ a {
$button-size:20px;
.button-wrapper {
height:100%;
width:95px;
overflow:hidden;
padding-left: 10px;
padding: 10px 0 40px;
position: relative;
.button {
width:100%;
height:100%;
position:relative;
outline:1px solid $color-bg;
outline-offset: -10px;
background:linear-gradient(#3a3f4b, #353b45);
background:$bg-button;
box-shadow: 0 0 0 1px $color-bg inset;
&:after{
content:"";
@ -415,6 +479,7 @@ $button-size:20px;
input {
position:absolute;
bottom:0;
box-shadow: 0 0 1px 0 $color-border inset;
}
}
@ -467,6 +532,8 @@ width:400px;
float:right;
width:70%;
height:70px;
padding: 0 0 0 10px;
position: static;
}
.stack .widget .title {
width:30%;
@ -487,6 +554,7 @@ width:400px;
width:70%;
height:300px;
padding-top:0;
padding-left:10px;
}
/* STRIP (vertical fader) */
@ -519,11 +587,11 @@ width:400px;
.xy-wrapper {
width:400px;
padding: 10px 10px 140px;
padding: 10px 0px 140px;
height:540px;
overflow: hidden;
.value {
margin-top:30px;
margin-top:10px;
width:100%;
}
input {
@ -541,7 +609,7 @@ width:400px;
width:100%;
height: 100%;
border:1px solid $color-border;
background: $color-bg;
//background: $color-bg;
overflow: hidden;
.handle {
position:absolute;
@ -553,12 +621,13 @@ width:400px;
position:absolute;
top:-.5px;
left:-1px;
box-shadow:0 0 10px 0px #aaa inset,0 0 1px 1px rgba(0,0,0,.5),0 0 0 3px rgba(255,255,255,.2)!important;
//box-shadow:0 0 10px 0px #aaa inset,0 0 1px 1px rgba(0,0,0,.5),0 0 0 3px rgba(255,255,255,.2)!important;
border-radius:100%!important;
background:$color-accent!important;
width: 11px;
height: 11px;
margin:-5px 0 0 -5px;
//background:$color-accent!important;
width: 20px;
height: 20px;
margin:-10px 0 0 -10px;
box-shadow: 0 0 0 1000px rgba(black,.5), 0 0 0 1px rgba(white,.2);
}
span {
@ -568,24 +637,8 @@ width:400px;
width:2000px;
height:2000px;
margin:-1000px 0 0 -1000px;
opacity:.5;
&:after {
content:"";
position: absolute;
width:100%;
height:1px;
top:50%;
background: $color-accent
}
&:before {
content:"";
position: absolute;
height:100%;
width:1px;
top:0;
left:50%;
background: $color-accent
}
-webkit-mask: radial-gradient(circle,rgba(black,0) 0px , rgba(black,1) 1%);
opacity:.2;
}
}
}
@ -614,6 +667,11 @@ width:400px;
&:after {
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* W3C */
}
.handle {
span {
//background: rgba(black,.35)
}
}
}
.hue {
width:100%;
@ -621,7 +679,7 @@ width:400px;
border:1px solid $color-border;
margin-top:10px;
background:transparent linear-gradient(to left, #F00, #FF0080, #F0F, #8000FF, #00F, #0080FF, #0FF, #00FF80, #0F0, #80FF00, #FF0, #FF8000, #F00) repeat scroll 0% 0%;
overflow: hidden;
.handle {
position:absolute;
height:100%;
@ -630,23 +688,13 @@ width:400px;
&:after {
content:"";
position:absolute;
top:100%;
top:50%;
left:-1px;
box-shadow:0 0 10px 0px #aaa inset,0 0 1px 1px rgba(0,0,0,.5),0 0 0 3px rgba(255,255,255,.2)!important;
box-shadow: 0 0 0 1000px rgba(black,.5), 0 0 0 1px rgba(white,.2);
border-radius:100%!important;
background:$color-accent!important;
width: 11px;
height: 11px;
margin:4px 0 0 -5px;
}
&:before {
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
width:1px;
background:$color-accent;
margin:-5px 0 0 -4px;
}
span {
position:absolute;
@ -655,7 +703,6 @@ width:400px;
width:2000px;
height:100%;
margin-left:-1000px;
opacity:.5;
}
}

View file

@ -23,28 +23,6 @@ var fs = require('fs');
// jquery
window.$ = window.jQuery = require( __dirname + "/js/jquery.min.js")
// Sass (add stylesheets to var styles)
var Sass = require( __dirname + "/js/sass.js")
Sass.setWorkerUrl(__dirname + "/js/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){
$('head').append('<style>body{opacity:1}'+d.text+'<\/style>')
})
}
});
}
// third-party js libraries
@ -56,34 +34,80 @@ require( __dirname + "/js/jquery-ui.draggable.min.js")
require( __dirname + "/js/oschtmlgui.js")
ipc.on('init',function(data){
$('body').append('<script>'+data+'<\/script>')
init();
// Sass (add stylesheets to var styles)
var Sass = require( __dirname + "/js/sass.js")
Sass.setWorkerUrl(__dirname + "/js/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('<style>'+d.text+'<\/style>')
ipc.send('ready');
})
}
});
}
ipc.on('listSessions',function(data){
for (i in data) {
$('#lobby .list').append('<li><a data-session="'+i+'">'+data[i]+'<span>x</span></a></li>')
}
$('#lobby .list').append('<a data-session="browse">...</a>')
$('#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.send('init');
ipc.on('openSession',function(data){
TABS=false
require(data)
if (TABS!=false) {
init();
} else {
console.log('ERROR: invalid session file (TABS must be defined)')
}
})
</script>
</head>
<body>
<div id="container"></div>
<div id="sidepanel">
<div class="open-toggle">
<span class="bars"></span>
<div id="lobby">
<div class="main">
<div class="header">
Session selection
</div>
<div class="list">
</div>
</div>
<ul id="options">
<li><div class="saveState">Save</div></li>
<li><div href="#" class="loadState">Load</div></li>
<li><div href="#" class="sendState">Send ALL</div></li>
<li><div href="#" class="goFullscreen">Fullscreen</div></li>
<li>
<div class="inspector">
Inspector
<div class="result"><em>Click on a widget's title to inspect</em></div>
</div>
</li>
</ul>
</div>
<div id="container"></div>
<div id="sidepanel"></div>
</body>
</html>

2765
lib-dev/js/demo-full.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -28,9 +28,9 @@ TABS = {
target:nmPorts['MainMix']+' 127.0.0.1:125',
path:'/test2',
},
xypad_test: {
xypad_test2: {
title:'XY Pad',
type:'rgb',
type:'xy',
target:nmPorts['MainMix'],
path:'/pad'
},
@ -56,12 +56,17 @@ TABS = {
target:nmPorts['MainMix'],
path:'/pad'
},
button1: {
type:'button',
target:'localhost:6666',
path:'/osc/path/',
color:'#555522'
},
xypad_test2: {
title:'XY Pad',
type:'xy',
target:nmPorts['MainMix'],
path:'/SHIT',
range:{x:{min:-10,max:10},y:{min:2,max:-4}}
},
}
},

6
lib-dev/js/jquery-ui.draggable.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -4,14 +4,9 @@ defaultTarget = 'localhost:9999'
// jQuery loaded
$(document).ready(function(){
init = function() {
createWidget={}
createWidget= {}
__widgets__ = {}
@ -58,7 +53,7 @@ function parsewidgets(widgets,parent) {
$.each(widgets,function(widgetId,widgetData){// parse widgets
var color = widgetData.color?'style="background-color:'+widgetData.color+'"':'';
var color = widgetData.color?'style="background:'+widgetData.color+'"':'';
var title = widgetData.title || widgetId;
var type = widgetData.type || 'fader'
widgetData.path = widgetData.path || '/' + widgetId
@ -120,7 +115,7 @@ createWidget.button = function(widgetData) {
$widget.getValue = function() {
return $widget.button.hasClass('on')?widgetData.args.on||1:widgetData.args.off||0
}
$widget.setValue = function(v,send) {
$widget.setValue = function(v,send,sync) {
var on = widgetData.args.on||1,
off= widgetData.args.off||0
if (v==on) {
@ -131,6 +126,7 @@ createWidget.button = function(widgetData) {
if (send) $widget.sendValue(v)
}
$widget.input.val($widget.getValue())
if (send) $widget.trigger('sync')
}
$widget.sendValue = function(v) {
@ -167,25 +163,29 @@ createWidget.xy = function(widgetData) {
$widget.xy.on('drag',function(e, data){
var v = $widget.getValue();
$widget.sendValue(v);
$widget.showValue(v)
$widget.trigger('sync')
})
widgetData.range = widgetData.range || {x:{min:0,max:1},y:{min:0,max:1}}
$widget.getValue = function() {
var x = parseFloat($widget.xy.handle.css('left'))/$widget.xy.innerWidth(),
x = widgetData.range.x.min + x *(widgetData.range.x.max - widgetData.range.x.min),
y = 1 - (parseFloat($widget.xy.handle.css('top'))/$widget.xy.innerHeight()),
y = widgetData.range.y.min + y *(widgetData.range.y.max - widgetData.range.y.min)
var x = mapToScale($widget.xy.handle.css('left'),[0,$widget.xy.innerWidth()],[widgetData.range.x.min,widgetData.range.x.max]),
y = mapToScale($widget.xy.handle.css('top'),[0,$widget.xy.innerHeight()],[widgetData.range.y.min,widgetData.range.y.max],true)
return [x,y]
}
$widget.setValue = function(v,send) {
$widget.setValue = function(v,send,sync) {
if (v[1]==undefined) var v = [v,v]
var x = (v[0]-widgetData.range.x.min)/(widgetData.range.x.max-widgetData.range.x.min)*$widget.xy.innerWidth(),
y = $widget.xy.innerHeight()-(v[1]-widgetData.range.y.min)/(widgetData.range.y.max-widgetData.range.y.min)*$widget.xy.innerHeight()
$widget.xy.handle.css({'top':y+'px','left':x+'px'})
var left = mapToScale(v[0],[widgetData.range.x.min,widgetData.range.x.max],[0,$widget.xy.innerWidth()])
ytop = mapToScale(v[1],[widgetData.range.y.min,widgetData.range.y.max],[0,$widget.xy.innerHeight()],true),
$widget.xy.handle.css({'top':ytop+'px','left':left+'px'})
$widget.showValue(v)
if (sync) $widget.trigger('sync')
if (send) $widget.sendValue(v);
}
$widget.sendValue = function(v) {
@ -199,6 +199,18 @@ createWidget.xy = function(widgetData) {
$widget.xy.value.y.val(v[1])
}
$widget.xy.value.x.change(function(){
var v = $widget.getValue();
v[0] = limit($(this).val(),[widgetData.range.x.min,widgetData.range.x.max])
$widget.setValue(v,true,true)
})
$widget.xy.value.y.change(function(){
var v = $widget.getValue();
v[1] = limit($(this).val(),[widgetData.range.y.min,widgetData.range.y.max])
$widget.setValue(v,true,true)
})
return $widget;
}
@ -246,25 +258,31 @@ var rgbToHsb = function (rgb) {
};
var limit = function(value,range) {
var max = Math.max,
min = Math.min
return max(min(range[0],range[1]),min(parseFloat(value),max(range[0],range[1])))
}
// map a value from a scale to another input and output must be range arrays
var mapToScale = function(value,rangeIn,rangeOut) {
var mapToScale = function(value,rangeIn,rangeOut,reverse) {
var reverse = false;
if (rangeIn[0]>rangeIn[1]) {
reverse = true;
rangeIn = [rangeIn[1],rangeIn[0]]
}
var value = Math.max(rangeIn[0],Math.min(parseFloat(value),rangeIn[1]))
var max = Math.max,
min = Math.min,
round = Math.round
value = max(min(rangeIn[0],rangeIn[1]),min(parseFloat(value),max(rangeIn[0],rangeIn[1])))
value = (value/rangeIn[1]-rangeIn[0]) * (rangeOut[1]-rangeOut[0]) + rangeOut[0]
if (reverse) value = Math.abs(rangeOut[1] - value)
if (reverse) value = max(rangeOut[0],rangeOut[1])+min(rangeOut[0],rangeOut[1])-value
value = Math.max(rangeOut[0],Math.min(value,rangeOut[1]))
value = max(min(rangeOut[0],rangeOut[1]),min(value,max(rangeOut[0],rangeOut[1])))
value = round(value*100)/100
value = Math.round(value)
return value
}
@ -335,13 +353,13 @@ createWidget.rgb = function(widgetData) {
})
widgetData.range = {x:{min:0,max:100},y:{min:0,max:100}}
widgetData.range = {r:{min:0,max:255},g:{min:0,max:255},b:{min:255}}
$widget.getValue = function() {
var s = mapToScale($widget.xy.saturation.css('left'),[0,$widget.xy.innerWidth()],[0,100]),
l = mapToScale($widget.xy.saturation.css('top'),[$widget.xy.innerHeight(),0],[0,100]),
l = mapToScale($widget.xy.saturation.css('top'),[0,$widget.xy.innerHeight()],[0,100],true),
h = mapToScale($widget.xy.hue.css('left'),[0,$widget.xy.innerWidth()],[0,360]),
rgb = hsbToRgb({h:h,s:s,b:l})
return [rgb.r,rgb.g,rgb.b]
@ -358,7 +376,7 @@ createWidget.rgb = function(widgetData) {
var hsb = rgbToHsb({r:v[0],g:v[1],b:v[2]})
var left = mapToScale(hsb.s,[0,100],[0,$widget.xy.innerWidth()]),
top = mapToScale(hsb.b,[100,0],[0,$widget.xy.innerHeight()]),
top = mapToScale(hsb.b,[0,100],[0,$widget.xy.innerHeight()],true),
leftHue = mapToScale(hsb.h,[0,360],[0,$widget.xy.innerWidth()])
$widget.xy.saturation.css({'top':top+'px','left':left+'px'})
$widget.xy.hue.css({'left':leftHue+'px'})
@ -512,7 +530,7 @@ createWidget.fader = function(widgetData,parent) {
parsetabs(TABS,false,false)
$('#lobby').hide()
@ -561,13 +579,12 @@ $('.content .tab').niceScroll({
});
// Tabs...
$('.tablist a').click(function(e){
$('.tablist a').click(function(){
$('.tab').getNiceScroll().hide();
$('.tab.on').getNiceScroll().hide();
e.preventDefault();
var id = $(this).attr('href');
$(id).siblings().removeClass('on');
$(id).siblings('.on').removeClass('on');
$(id).addClass('on');
$(this).parents('ul').find('.on').removeClass('on');
$(this).addClass('on');$(this).parent().addClass('on');
@ -583,15 +600,15 @@ $('.tablist a').click(function(e){
function updateScrollbar(){
// update scrollbar
$('.content .tab').each(function(){
$('.tab.on').getNiceScroll().resize();
})
$('.tab.on').getNiceScroll().resize();
}
// Activate first tabs
setTimeout(function(){
$('.tablist li:first-child a').click();
},1500)
$('.tablist li:first-child a').click();
@ -600,6 +617,25 @@ setTimeout(function(){
// sidepanel
$('#sidepanel').append('\
<div class="open-toggle">\
<span class="bars"></span>\
</div>\
<ul id="options">\
<li><div class="saveState">Save</div></li>\
<li><div href="#" class="loadState">Load</div></li>\
<li><div href="#" class="sendState">Send ALL</div></li>\
<li><div href="#" class="goFullscreen">Fullscreen</div></li>\
<li>\
<div class="inspector">\
Inspector\
<div class="result"><em>Click on a widges\'s title to inspect</em></div>\
</div>\
</li>\
</ul>\
')
$('#sidepanel .open-toggle').click(function(){
$('#sidepanel .open-toggle, #sidepanel .open-toggle .bars, #sidepanel, #container').toggleClass('sidepanel-open');
setTimeout(function(){
@ -615,12 +651,7 @@ $('.showOptions a').click(function(e){
})
$('.goFullscreen').click(function(e){
e.preventDefault();
$(this).toggleClass('on');
if ($(this).hasClass('on')) {
ipc.send('fullscreen',true)
} else {
ipc.send('fullscreen',false)
}
ipc.send('fullscreen')
updateScrollbar();
})
@ -723,5 +754,3 @@ ipc.on('load',function(preset){
})
}// END INIT
});

View file

@ -10,7 +10,9 @@
"dependencies": {
"osc": "1.2.1",
"express": "4.x",
"socket.io": "1.x" },
"socket.io": "1.x",
"electron-compile": "0.8.3"
},
"keywords": [
"osc"
],