publish: Delay block tx request, make leftover txes gray and fade out, remove unneeded assets and one paint blob

generated from commit faaaf51a5b
This commit is contained in:
Joshua Seigler 2019-04-09 17:32:42 -04:00
parent 12a0a5a4f3
commit a924f77e5e
5 changed files with 36 additions and 49 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 21 KiB

View file

@ -13,7 +13,6 @@ body {
background-color: #bbb; background-color: #bbb;
color: black; color: black;
height: 100vh; height: 100vh;
overflow: hidden;
} }
* { * {
-webkit-box-sizing: inherit; -webkit-box-sizing: inherit;
@ -45,7 +44,7 @@ a {
overflow: hidden; overflow: hidden;
} }
#hero { #hero {
position: absolute; position: fixed;
left: 41.125%; left: 41.125%;
top: 50%; top: 50%;
width: 77.5vw; width: 77.5vw;
@ -100,6 +99,10 @@ a {
-webkit-mask-position: center; -webkit-mask-position: center;
mask-position: center; mask-position: center;
} }
#hero .paint.stale {
background-color: gray;
opacity: calc(1.1 - var(--age) / 10);
}
#muteToggle, #connectionStatus { #muteToggle, #connectionStatus {
position: fixed; position: fixed;

File diff suppressed because one or more lines are too long

View file

@ -18864,8 +18864,6 @@ function () {
function App() { function App() {
_classCallCheck(this, App); _classCallCheck(this, App);
this.blockRefs = [];
this.mempoolRefs = [];
this.blockList = document.getElementById('blockList'); this.blockList = document.getElementById('blockList');
this.connectionStatus = document.getElementById('connectionStatus'); this.connectionStatus = document.getElementById('connectionStatus');
this.hero = document.getElementById('hero'); this.hero = document.getElementById('hero');
@ -19027,54 +19025,41 @@ function () {
blockLink.target = '_blank'; blockLink.target = '_blank';
blockLink.setAttribute('rel', 'noopener'); blockLink.setAttribute('rel', 'noopener');
blockLink.appendChild(document.createTextNode('🗗')); blockLink.appendChild(document.createTextNode('🗗'));
setTimeout(function () {
// to prevent 404 when WS is ahead of regular API
fetch('https://insight.dash.org/insight-api/block/' + data).then(function (resp) { fetch('https://insight.dash.org/insight-api/block/' + data).then(function (resp) {
return resp.json(); return resp.json();
}).then(function (data) { }).then(function (data) {
var mined = []; var leftovers = [];
for (var i in data.tx) { for (var i in data.tx) {
var txid = data.tx[i]; var txid = data.tx[i];
var paint = document.getElementById(txid); var paint = document.getElementById(txid);
if (paint) { if (paint) {
mined.push(paint);
completedBlock.insertBefore(paint, completedBlock.firstChild); completedBlock.insertBefore(paint, completedBlock.firstChild);
} }
} }
_this2.mempoolRefs = _this2.mempoolRefs.filter(function (item) { Array.from(_this2.hero.children).forEach(function (item) {
return !mined.includes(item); var age = 1 * item.style.getPropertyValue('--age'); // 1 * null = 0
});
_this2.mempoolRefs.forEach(function (item) { if (age > 10) {
item.remove();
} else {
item.classList.add('stale'); item.classList.add('stale');
item.data_ignored = item.data_ignored ? item.data_ignored + 1 : 1; item.style.setProperty('--age', age + 1);
});
_this2.mempoolRefs.filter(function (item) {
if (item.data_ignored > 4) {
try {
_this2.hero.removeChild(item);
} catch (err) {}
return false;
} }
return true;
}); });
completedBlock.appendChild(blockLink); completedBlock.appendChild(blockLink);
if (_this2.blockRefs.unshift(_this2.completedBlock) > 8) {
var toDelete = _this2.blockRefs.pop();
if (toDelete) {
toDelete.remove();
}
}
_this2.blockList.insertBefore(completedBlock, _this2.blockList.firstChild); _this2.blockList.insertBefore(completedBlock, _this2.blockList.firstChild);
if (_this2.blockList.children.length > 8) {
_this2.blockList.lastChild.remove();
}
}); });
}, 200);
} }
}, { }, {
key: "onTransactionBuilder", key: "onTransactionBuilder",
@ -19157,8 +19142,8 @@ var COLORS = {
}; };
exports.COLORS = COLORS; exports.COLORS = COLORS;
var PAINT = { var PAINT = {
big: ['paint-big01.svg', 'paint-big02.svg', 'paint-big03.svg', 'paint-big04.svg', 'paint-big05.svg', 'paint-big06.svg', 'paint-big07.svg', 'paint-big08.svg', 'paint-big09.svg', 'paint-big00.svg', 'paint-big01.svg', 'paint-big11.svg', 'paint-big12.svg'], big: ['paint-big01.svg', 'paint-big02.svg', 'paint-big03.svg', 'paint-big04.svg', 'paint-big05.svg', 'paint-big06.svg', 'paint-big07.svg', 'paint-big08.svg', 'paint-big09.svg', 'paint-big10.svg', 'paint-big11.svg', 'paint-big12.svg'],
small: ['paint01.svg', 'paint02.svg', 'paint03.svg', 'paint04.svg', 'paint05.svg', 'paint06.svg', 'paint07.svg', 'paint08.svg', 'paint09.svg', 'paint00.svg', 'paint01.svg', 'paint11.svg'] small: ['paint01.svg', 'paint02.svg', 'paint03.svg', 'paint04.svg', 'paint05.svg', 'paint06.svg', 'paint07.svg', 'paint08.svg', 'paint09.svg', 'paint10.svg']
}; };
exports.PAINT = PAINT; exports.PAINT = PAINT;
}); });

File diff suppressed because one or more lines are too long