Skip to content

Commit

Permalink
Added Christmas Balls
Browse files Browse the repository at this point in the history
  • Loading branch information
olton committed Dec 27, 2021
1 parent d5cb1d0 commit 38a9965
Show file tree
Hide file tree
Showing 59 changed files with 155 additions and 4 deletions.
12 changes: 12 additions & 0 deletions client/css/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,16 @@ a {
#price-change-arrow {
}

.christmas-balls {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 2;
}

body {
padding-top: 48px;
}

@import "light";
8 changes: 5 additions & 3 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<title>Mina Node Monitor v1.0.0</title>
<link rel="stylesheet" href="vendor/metro4/css/metro-all.css">
<link rel="stylesheet" href="css/index.less">
<title></title>
</head>
<body>
<!-- Merry Christmas -->
<div data-role="christmas-balls" data-sound-path="https://metroui.org.ua/components/christmas-balls/sounds/"></div>
<!-- Merry Christmas -->

<header class="container-fluid">
<div class="row">
<div class="cell-md-3">
Expand Down
8 changes: 8 additions & 0 deletions client/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import 'regenerator-runtime/runtime' // this required for Parcel

import "../vendor/metro4/css/metro-all.css"
import "../css/index.less"
import "../vendor/metro4/js/metro"
import "../vendor/chart/chart"
import "../vendor/chrismas-balls/css/christmas-balls.css"
import "../vendor/chrismas-balls/js/christmas-balls"

import {processServerCpu, processServerInfo, processServerTime} from "./modules/server-info"
import {processDelegations} from "./modules/delegations"
import {processMinaPrice} from "./modules/price"
Expand Down
6 changes: 6 additions & 0 deletions client/vendor/chrismas-balls/css/christmas-balls.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added client/vendor/chrismas-balls/images/ball-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/ball-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/fir-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/fir-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/fir-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/fir-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/fir-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/fir-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/vendor/chrismas-balls/images/main-fir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 114 additions & 0 deletions client/vendor/chrismas-balls/js/christmas-balls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*!
* Christmas Balls - A Metro 4 Component v1.0.0 (https://github.com/olton/christmas-balls.git)
* Copyright 2020 Sergey Pimenov
* Built at 27/12/2021 20:07:18
* Licensed under MIT
!*/
(function(Metro, $) {
'use strict';

var partSize = 373;

var ChristmasBallsDefaultConfig = {
soundPath: "/sounds/",
soundVolume: 1,
onChristmasBallsCreate: Metro.noop
};

Metro.christmasBallsSetup = function (options) {
ChristmasBallsDefaultConfig = $.extend({}, ChristmasBallsDefaultConfig, options);
};

if (typeof window["metroChristmasBallsSetup"] !== undefined) {
Metro.christmasBallsSetup(window["metroChristmasBallsSetup"]);
}

Metro.Component('christmas-balls', {
init: function( options, elem ) {
this._super(elem, options, ChristmasBallsDefaultConfig, {
});
return this;
},

_create: function(){
var that = this, element = this.element, o = this.options;

this._preloadSounds();
this._createStructure();
this._createEvents();

this._fireEvent('christmas-balls-create');

element.click();
},

_preloadSounds: function(){
for (var i = 1; i <= 36; i++) {
new Audio(this.options.soundPath + "sound"+i+".mp3");
}
},

_createStructure: function(){
var element = this.element, o = this.options;
var inner;
var i, f, b;
var note = 1;

element.addClass("christmas-balls");

for (i = 0; i < 10; i++) {
element.append(inner = $("<div>").addClass("christmas-balls-inner").css({
left: i * partSize
}));
for(b = 1; b <= 9; b++) {
$("<div>").addClass("ball ball-" + b).attr("data-note", note++).appendTo(inner);
}
for(f = 1; f <= 6; f++) {
$("<div>").addClass("fir fir-" + f).appendTo(inner);
}

if (note === 37) note = 1;
}

},

_playSound: function(note){
var o = this.options;
var audioSrc = o.soundPath + "sound"+note+".mp3";
var sound = new Audio(audioSrc);

sound.volume = parseFloat(o.soundVolume);
sound.addEventListener("loadeddata", function(){
sound.play();
});
},

_createEvents: function(){
var that = this, element = this.element, o = this.options;
var balls = element.find(".ball");

balls.on(Metro.events.enter, function(e){
var ball = $(this);
var x = Metro.utils.pageXY(e).x - ball.offset().left;
var w = ball.width();
var left = x - w / 2 < 0;

that._playSound(ball.attr("data-note"));

if (!ball.data("animated")) {
ball.data("animated", true).addClass("bounce-" + (left ? "left" : "right"));
ball.on("animationend", function () {
ball.data("animated", false).removeClass("bounce-" + (left ? "left" : "right"));
})
}
})
},

changeAttribute: function(attr, newValue){
},

destroy: function(){
this.element.remove();
}
});
}(Metro, m4q));
10 changes: 10 additions & 0 deletions client/vendor/chrismas-balls/js/christmas-balls.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added client/vendor/chrismas-balls/sounds/sound1.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound10.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound11.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound12.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound13.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound14.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound15.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound16.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound17.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound18.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound19.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound2.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound20.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound21.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound22.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound23.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound24.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound25.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound26.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound27.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound28.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound29.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound3.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound30.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound31.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound32.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound33.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound34.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound35.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound36.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound4.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound5.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound6.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound7.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound8.mp3
Binary file not shown.
Binary file added client/vendor/chrismas-balls/sounds/sound9.mp3
Binary file not shown.
1 change: 0 additions & 1 deletion server/modules/alerter.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const processAlerter = async () => {
const exDiffBlocks = Math.abs(exDiff)

if (exDiff !== 0 && exDiffBlocks >= blockDiff) {
console.log("Explorer check: ", explorerHeight, nHeight, exDiff, blockDiff, exDiffBlocks >= blockDiff)
sendMessage("EXPLORER", `Node height \`${exDiff > 0 ? 'more' : 'less'}\` then Explorer by \`${exDiffBlocks}\` blocks.`)
}
}
Expand Down

0 comments on commit 38a9965

Please sign in to comment.