Use classes over ids. Only allow promp value to change counter.
This commit is contained in:
parent
c827f64510
commit
d19caed973
|
@ -18,14 +18,14 @@
|
|||
}
|
||||
body{
|
||||
}
|
||||
#app,
|
||||
#settings{
|
||||
.page{
|
||||
padding: 5px 10% 0 10%;
|
||||
}
|
||||
#settings{
|
||||
display: none;
|
||||
}
|
||||
#settings h2{
|
||||
.page.selected{
|
||||
display: block;
|
||||
}
|
||||
h2{
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
|
@ -129,16 +129,16 @@
|
|||
color: #212121;
|
||||
font-weight: bold;
|
||||
}
|
||||
#fwdLabel,#bwdLabel{
|
||||
.icon{
|
||||
display: block;
|
||||
line-height: 34px;
|
||||
height: 33px;
|
||||
color: #444;
|
||||
}
|
||||
#fwdLabel.selected,
|
||||
#bwdLabel.selected{
|
||||
opacity: 0.5;
|
||||
color: #fff;
|
||||
}
|
||||
.icon.selected{
|
||||
opacity: 1.0;
|
||||
}
|
||||
#fwdLabel{
|
||||
float: left;
|
||||
}
|
||||
|
@ -151,9 +151,6 @@
|
|||
color: #666;
|
||||
margin-top: 6px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
.icon{
|
||||
|
||||
}
|
||||
#exposure,
|
||||
#delay{
|
||||
|
@ -175,10 +172,10 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="app" class="page selected">
|
||||
<div>
|
||||
<div class="label">Counter</div>
|
||||
<input type="number" id="counter" oninput="setCounter();" value="0" step="1" />
|
||||
<input type="number" id="counter" onclick="setCounter();" value="0" step="1" readonly />
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">Direction</div>
|
||||
|
@ -216,7 +213,7 @@
|
|||
<button id="frame" onclick="frame();">FRAME</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settings">
|
||||
<div id="settings" class="page">
|
||||
<h2>SETTINGS</h2>
|
||||
<div>
|
||||
<div class="label">Rex-o-fader</div>
|
||||
|
@ -238,11 +235,25 @@
|
|||
<input type="password" id="password" placeholder="Wifi Password" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="sequencer" class="page">
|
||||
<h2>Sequence</h2>
|
||||
</div>
|
||||
<div id="mscript" class="page">
|
||||
<h2>mscript</h2>
|
||||
</div>
|
||||
<footer>
|
||||
<div>
|
||||
<img id="settingsIcon" onclick="settingsPage();" class="icon" src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDU0IDU0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1NCA1NDsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiPgo8Zz4KCTxwYXRoIGQ9Ik01MS4yMiwyMWgtNS4wNTJjLTAuODEyLDAtMS40ODEtMC40NDctMS43OTItMS4xOTdzLTAuMTUzLTEuNTQsMC40Mi0yLjExNGwzLjU3Mi0zLjU3MSAgIGMwLjUyNS0wLjUyNSwwLjgxNC0xLjIyNCwwLjgxNC0xLjk2NmMwLTAuNzQzLTAuMjg5LTEuNDQxLTAuODE0LTEuOTY3bC00LjU1My00LjU1M2MtMS4wNS0xLjA1LTIuODgxLTEuMDUyLTMuOTMzLDBsLTMuNTcxLDMuNTcxICAgYy0wLjU3NCwwLjU3My0xLjM2Niww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42NCwyLjQzMmg1LjA1MkM1MS42NSwyMyw1MiwyMy4zNSw1MiwyMy43OFYzMC4yMnoiIGZpbGw9IiNGRkZGRkYiLz4KCTxwYXRoIGQ9Ik0yNywxOGMtNC45NjMsMC05LDQuMDM3LTksOXM0LjAzNyw5LDksOXM5LTQuMDM3LDktOVMzMS45NjMsMTgsMjcsMTh6IE0yNywzNGMtMy44NTksMC03LTMuMTQxLTctN3MzLjE0MS03LDctNyAgIHM3LDMuMTQxLDcsN1MzMC44NTksMzQsMjcsMzR6IiBmaWxsPSIjRkZGRkZGIi8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+Cg==" />
|
||||
<h1 class="selected"><span onclick="appPage();" class="icon">INTVAL</span></h1>
|
||||
</div>
|
||||
<div>
|
||||
<h1><span onclick="appPage();" id="appIcon" class="icon selected">INTVAL</span></h1>
|
||||
</div>
|
||||
<div>
|
||||
<img src="" id="sequencerIcon" onclick="sequencerPage();" class="icon" />
|
||||
</div>
|
||||
<div>
|
||||
<img id="mscriptIcon" onclick="mscriptPage();" class="icon" src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2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LDI1OC43NTUsNTIxLjUxNywyNTYuNTY1LDUxOS42MTQsMjU0LjY2M3oiIGZpbGw9IiNGRkZGRkYiLz4KCTwvZz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K" />
|
||||
</div>
|
||||
</footer>
|
||||
<script>
|
||||
'use strict';
|
||||
|
@ -260,18 +271,18 @@
|
|||
counter : 0
|
||||
}
|
||||
//functions
|
||||
var frame;
|
||||
var getState;
|
||||
var setDir;
|
||||
var setExposure;
|
||||
var setDelay;
|
||||
var setCounter;
|
||||
let frame;
|
||||
let getState;
|
||||
let setDir;
|
||||
let setExposure;
|
||||
let setDelay;
|
||||
let setCounter;
|
||||
//ms
|
||||
var shutter = function (exposure) {
|
||||
var fraction = BOLEX.expected / 1000;
|
||||
var speed;
|
||||
var corrected;
|
||||
var str;
|
||||
let fraction = BOLEX.expected / 1000;
|
||||
let speed;
|
||||
let corrected;
|
||||
let str;
|
||||
if (exposure > BOLEX.expected) {
|
||||
//if exposure is explicitly set
|
||||
fraction = exposure / 1000;
|
||||
|
@ -340,7 +351,7 @@
|
|||
|
||||
var setDelayScale = function () {
|
||||
const scale = document.getElementById('scale').value;
|
||||
const elem = document.getElementsById('delay');
|
||||
const elem = document.getElementById('delay');
|
||||
if (scale === 'ms') {
|
||||
elem.value = STATE.delay;
|
||||
} else if (scale === 'sec') {
|
||||
|
@ -370,22 +381,39 @@
|
|||
elem.value = (parseInt(current) + val);
|
||||
STATE.counter += val;
|
||||
};
|
||||
var unsetPages = function () {
|
||||
const pages = document.getElementsByClassName('page');
|
||||
const icons = document.getElementsByClassName('icon');
|
||||
for (let icon of icons) {
|
||||
if (icon.classList.contains('selected')) icon.classList.remove('selected');
|
||||
}
|
||||
for (let page of pages){
|
||||
if (page.classList.contains('selected')) page.classList.remove('selected');
|
||||
}
|
||||
};
|
||||
var appPage = function () {
|
||||
'use strict';
|
||||
$('#app').show();
|
||||
$('#settings').hide();
|
||||
$('#settingsIcon').removeClass('selected');
|
||||
$('#mscriptIcon').removeClass('selected');
|
||||
$('#bar h1').addClass('selected');
|
||||
unsetPages();
|
||||
document.getElementById('app').classList.add('selected');
|
||||
document.getElementById('appIcon').classList.add('selected');
|
||||
};
|
||||
var settingsPage = function () {
|
||||
'use strict';
|
||||
$('#settings').show();
|
||||
$('#app').hide();
|
||||
$('#bar h1').removeClass('selected');
|
||||
$('#mscriptIcon').removeClass('selected');
|
||||
$('#settingsIcon').addClass('selected');
|
||||
unsetPages();
|
||||
document.getElementById('settings').classList.add('selected');
|
||||
document.getElementById('settingsIcon').classList.add('selected');
|
||||
};
|
||||
var sequencerPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('sequencer').classList.add('selected');
|
||||
document.getElementById('sequencerIcon').classList.add('selected');
|
||||
};
|
||||
var mscriptPage = function () {
|
||||
unsetPages();
|
||||
document.getElementById('mscript').classList.add('selected');
|
||||
document.getElementById('mscriptIcon').classList.add('selected');
|
||||
};
|
||||
var isNumeric = function (n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
'use strict'
|
||||
|
@ -528,10 +556,12 @@
|
|||
};
|
||||
web.setCounter = function () {
|
||||
const counter = document.getElementById('counter').value;
|
||||
const change = prompt(`Change counter value?`, counter);
|
||||
if (change === null || !isNumeric(change)) return false
|
||||
const opts = {
|
||||
method : 'POST',
|
||||
headers : web._header,
|
||||
data : JSON.stringify({ counter : counter })
|
||||
data : JSON.stringify({ counter : change })
|
||||
}
|
||||
fetch('/counter', opt)
|
||||
.then(web.useJson)
|
||||
|
|
Loading…
Reference in New Issue