Ethereum network status dashboard for PoW and PoA networks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ethstats-server/public/js/directives.js

74 lines
1.5 KiB

10 years ago
'use strict';
/* Directives */
angular.module('netStatsApp.directives', []).
directive('appVersion', ['version', function(version) {
return function(scope, elm, attrs) {
elm.text(version);
};
}]).
directive('nodemap', ['$compile', function($compile) {
return {
restrict: 'EA',
scope: {
data: '='
},
link: function(scope, element, attrs) {
10 years ago
scope.init = function() {
element.empty();
scope.map = new Datamap({
element: element[0],
scope: 'world',
responsive: true,
fills: {
success: '#7bcc3a',
info: '#10a0de',
warning: '#FFD162',
danger: '#F74B4B',
defaultFill: '#282828'
},
geographyConfig: {
borderWidth: 0,
borderColor: '#000',
highlightOnHover: false,
popupOnHover: false
},
bubblesConfig: {
borderWidth: 0,
popupOnHover: false,
highlightOnHover: false
}
});
scope.map.bubbles(scope.data, {
borderWidth: 0,
popupOnHover: false,
highlightOnHover: false
10 years ago
});
}
scope.init();
10 years ago
window.onresize = function() {
scope.$apply();
};
scope.$watch('data', function() {
scope.map.bubbles(scope.data, {
borderWidth: 0,
popupOnHover: false,
highlightOnHover: false
});
}, true);
10 years ago
scope.$watch(function() {
return angular.element(window)[0].innerWidth;
}, function() {
scope.init();
});
}
};
}]);