publish: Convert to object oriented ES6 syntax

generated from commit c09369a7dc
This commit is contained in:
Joshua Seigler 2019-04-05 22:30:52 -04:00
parent 781775d27b
commit b9779c990d
2 changed files with 16 additions and 22 deletions

View file

@ -18908,8 +18908,8 @@ function () {
this.currentBlock.style.setProperty('--private-color', _constants.COLORS["private"]); this.currentBlock.style.setProperty('--private-color', _constants.COLORS["private"]);
this.currentBlock.style.setProperty('--instant-color', _constants.COLORS.instant); this.currentBlock.style.setProperty('--instant-color', _constants.COLORS.instant);
if (domRefList.unshift(this.currentBlock) > 16) { if (this.domRefList.unshift(this.currentBlock) > 16) {
var toDelete = domRefList.pop(); var toDelete = this.domRefList.pop();
toDelete.remove(); toDelete.remove();
} }
@ -18918,29 +18918,16 @@ function () {
}, { }, {
key: "onTransaction", key: "onTransaction",
value: function onTransaction(data) { value: function onTransaction(data) {
var transactions = data.vout; var isMixing = App.isPrivateSend(data.vout);
var isPrivateSend = true;
for (var i = 0; i < transactions.length; i++) {
var _tx = transactions[i];
var outputSatoshis = _tx[Object.keys(_tx)[0]];
if (!_constants.psInputSatoshis.includes(outputSatoshis)) {
isPrivateSend = false;
break;
}
}
var tx = { var tx = {
"private": isPrivateSend, mixing: isMixing,
instant: data.txlock, instant: data.txlock,
value: data.valueOut, value: data.valueOut,
x: parseInt(data.txid.slice(0, 4), 16) / 65536, x: parseInt(data.txid.slice(0, 4), 16) / 65536,
y: parseInt(data.txid.slice(4, 8), 16) / 65536, y: parseInt(data.txid.slice(4, 8), 16) / 65536,
rotation: parseInt(data.txid.slice(16, 17), 16) / 16, rotation: parseInt(data.txid.slice(16, 17), 16) / 16,
paintIndex: parseInt(data.txid.slice(17, 21), 16) / 65536, paintIndex: parseInt(data.txid.slice(17, 21), 16) / 65536,
color: isPrivateSend ? _constants.COLORS["private"] : data.txlock ? _constants.COLORS.instant : this.blockColors[Math.floor(parseInt(data.txid.slice(21, 23), 16) / 256 * this.blockColors.length)] color: isMixing ? _constants.COLORS["private"] : data.txlock ? _constants.COLORS.instant : this.blockColors[Math.floor(parseInt(data.txid.slice(21, 23), 16) / 256 * this.blockColors.length)]
}; };
console.log('tx: ' + tx.value + (tx["private"] ? ' private' : '') + (tx.instant ? ' instant' : '')); console.log('tx: ' + tx.value + (tx["private"] ? ' private' : '') + (tx.instant ? ' instant' : ''));
var paint = document.createElement('div'); var paint = document.createElement('div');
@ -18968,6 +18955,13 @@ function () {
console.log('New color scheme: ' + scheme + ' based on %chue ' + hue, 'background-color:#' + colors[0]); console.log('New color scheme: ' + scheme + ' based on %chue ' + hue, 'background-color:#' + colors[0]);
return colors; return colors;
} }
}, {
key: "isPrivateSend",
value: function isPrivateSend(components) {
return components.every(function (i) {
return _constants.PSDENOMINATIONS.includes(Object.values(i)[0]);
});
}
}]); }]);
return App; return App;
@ -18983,9 +18977,9 @@ require.register("constants.js", function(exports, require, module) {
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.PAINT = exports.COLORS = exports.psInputSatoshis = void 0; exports.PAINT = exports.COLORS = exports.PSDENOMINATIONS = void 0;
var psInputSatoshis = [1000010000, 100001000, 10000100, 1000010, 100001]; var PSDENOMINATIONS = [1000010000, 100001000, 10000100, 1000010, 100001];
exports.psInputSatoshis = psInputSatoshis; exports.PSDENOMINATIONS = PSDENOMINATIONS;
var COLORS = { var COLORS = {
"private": '000000', "private": '000000',
instant: 'ffffff' instant: 'ffffff'

File diff suppressed because one or more lines are too long