mirror of
https://github.com/seigler/dash-visualizer
synced 2025-07-27 09:46:09 +00:00
publish: 📺 lip service modularization to get things working
generated from commit 43f98d98fc
This commit is contained in:
parent
f08a3a0e49
commit
aa1f915ce3
3 changed files with 180 additions and 177 deletions
124
bundle.js
124
bundle.js
|
@ -6700,11 +6700,13 @@ yeast.decode = decode;
|
||||||
module.exports = yeast;
|
module.exports = yeast;
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
require.register("initialize.js", function(exports, require, module) {
|
require.register("application.js", function(exports, require, module) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const io = require('socket.io-client');
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
var App = {
|
||||||
|
init: function init() {
|
||||||
var socket = io("https://insight.dash.org:443/");
|
var socket = io("https://insight.dash.org:443/");
|
||||||
var transactionList = document.getElementById('transactionList');
|
var transactionList = document.getElementById('transactionList');
|
||||||
var muteButton = document.getElementById('muteToggle');
|
var muteButton = document.getElementById('muteToggle');
|
||||||
|
@ -6717,66 +6719,6 @@ var soundBuffers = {
|
||||||
'block': null
|
'block': null
|
||||||
};
|
};
|
||||||
var domRefList = [];
|
var domRefList = [];
|
||||||
window.addEventListener('load', init, false);
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
if (localStorage) {
|
|
||||||
muted = localStorage.getItem('muted');
|
|
||||||
if (muted === null) {
|
|
||||||
muted = false;
|
|
||||||
localStorage.setItem('muted', muted);
|
|
||||||
} else {
|
|
||||||
muted = (muted == 'true'); // localStorage stores strings not objects?
|
|
||||||
}
|
|
||||||
muteButton.className = (muted === true ? 'is-muted' : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
muteButton.onclick = toggleMute;
|
|
||||||
|
|
||||||
try {
|
|
||||||
window.AudioContext = window.AudioContext||window.webkitAudioContext;
|
|
||||||
audioContext = new AudioContext();
|
|
||||||
audioGainNode = audioContext.createGain();
|
|
||||||
audioGainNode.connect(audioContext.destination);
|
|
||||||
audioGainNode.gain.value = 0.6;
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
console.error('Unable to use Web Audio API');
|
|
||||||
document.getElementById('muteToggle').remove();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
loadSound('assets/whoosh.mp3', 'block');
|
|
||||||
loadSound('assets/bell.mp3', 'tx-sm');
|
|
||||||
loadSound('assets/wood-hit-glass.mp3', 'tx-md');
|
|
||||||
loadSound('assets/metallophone.mp3', 'tx-lg');
|
|
||||||
loadSound('assets/creek.mp3', 'background', function() {
|
|
||||||
backgroundSound = audioContext.createBufferSource();
|
|
||||||
backgroundSound.buffer = soundBuffers['background'];
|
|
||||||
backgroundSound.connect(audioGainNode);
|
|
||||||
backgroundSound.loop = true;
|
|
||||||
if (!muted) {
|
|
||||||
backgroundSound.start();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
console.error('Couldn\'t load sounds.');
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.on('connect', function() {
|
|
||||||
document.getElementById('connectionStatus').className = 'is-connected';
|
|
||||||
// Join the room.
|
|
||||||
socket.emit('subscribe', 'inv');
|
|
||||||
})
|
|
||||||
socket.on('tx', onTransaction);
|
|
||||||
socket.on('block', onBlock);
|
|
||||||
socket.on('disconnect', function() {
|
|
||||||
document.getElementById('connectionStatus').className = 'is-disconnected';
|
|
||||||
});
|
|
||||||
socket.on('reconnecting', function() {
|
|
||||||
document.getElementById('connectionStatus').className = 'is-connecting';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadSound(url, bufferName, callback) {
|
function loadSound(url, bufferName, callback) {
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
@ -6889,6 +6831,66 @@ var onBlock = function(data) {
|
||||||
transactionList.insertBefore(newBlock, transactionList.firstChild);
|
transactionList.insertBefore(newBlock, transactionList.firstChild);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (localStorage) {
|
||||||
|
muted = localStorage.getItem('muted');
|
||||||
|
if (muted === null) {
|
||||||
|
muted = false;
|
||||||
|
localStorage.setItem('muted', muted);
|
||||||
|
} else {
|
||||||
|
muted = (muted == 'true'); // localStorage stores strings not objects?
|
||||||
|
}
|
||||||
|
muteButton.className = (muted === true ? 'is-muted' : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
muteButton.onclick = toggleMute;
|
||||||
|
|
||||||
|
try {
|
||||||
|
window.AudioContext = window.AudioContext||window.webkitAudioContext;
|
||||||
|
audioContext = new AudioContext();
|
||||||
|
audioGainNode = audioContext.createGain();
|
||||||
|
audioGainNode.connect(audioContext.destination);
|
||||||
|
audioGainNode.gain.value = 0.6;
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.error('Unable to use Web Audio API');
|
||||||
|
document.getElementById('muteToggle').remove();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
loadSound('assets/whoosh.mp3', 'block');
|
||||||
|
loadSound('assets/bell.mp3', 'tx-sm');
|
||||||
|
loadSound('assets/wood-hit-glass.mp3', 'tx-md');
|
||||||
|
loadSound('assets/metallophone.mp3', 'tx-lg');
|
||||||
|
loadSound('assets/creek.mp3', 'background', function() {
|
||||||
|
backgroundSound = audioContext.createBufferSource();
|
||||||
|
backgroundSound.buffer = soundBuffers['background'];
|
||||||
|
backgroundSound.connect(audioGainNode);
|
||||||
|
backgroundSound.loop = true;
|
||||||
|
if (!muted) {
|
||||||
|
backgroundSound.start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.error('Couldn\'t load sounds.');
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on('connect', function() {
|
||||||
|
document.getElementById('connectionStatus').className = 'is-connected';
|
||||||
|
// Join the room.
|
||||||
|
socket.emit('subscribe', 'inv');
|
||||||
|
})
|
||||||
|
socket.on('tx', onTransaction);
|
||||||
|
socket.on('block', onBlock);
|
||||||
|
socket.on('disconnect', function() {
|
||||||
|
document.getElementById('connectionStatus').className = 'is-disconnected';
|
||||||
|
});
|
||||||
|
socket.on('reconnecting', function() {
|
||||||
|
document.getElementById('connectionStatus').className = 'is-connecting';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = App;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -12,5 +12,6 @@
|
||||||
<div id="transactionList"></div>
|
<div id="transactionList"></div>
|
||||||
|
|
||||||
<script src="bundle.js"></script>
|
<script src="bundle.js"></script>
|
||||||
|
<script>require('application').init();</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue