}
};
+ // ----------------------------------------------------------------------------------------------------------------
+ // http://wilsonpage.co.uk/preventing-layout-thrashing/
+
+ NETDATA.noLayoutTrashing = {
+ set: false,
+ callbacks: [],
+
+ add: function(callback) {
+ // console.log('adding...');
+ this.callbacks.push(callback);
+
+ if(this.set === false) {
+ this.set = true;
+ var that = this;
+
+ window.requestAnimationFrame(function() {
+ var len = that.callbacks.length;
+ // console.log('running... ' + len.toString());
+ while(len--) {
+ that.callbacks[len]();
+ }
+
+ that.callbacks = new Array();
+ that.set = false;
+ });
+ }
+ }
+ };
+
// ----------------------------------------------------------------------------------------------------------------
// Our state object, where all per-chart values are stored
};
var maxMessageFontSize = function() {
+ var screenHeight = screen.height;
+ var el = that.element_message;
+
// normally we want a font size, as tall as the element
- var h = that.element_message.clientHeight;
+ var h = el.clientHeight;
// but give it some air, 20% let's say, or 5 pixels min
var lost = Math.max(h * 0.2, 5);
// but check the width too
// it should fit 10 characters in it
- var w = that.element_message.clientWidth / 10;
+ var w = el.clientWidth / 10;
if(h > w) {
paddingTop += (h - w) / 2;
h = w;
// and don't make it too huge
// 5% of the screen size is good
- if(h > screen.height / 20) {
- paddingTop += (h - (screen.height / 20)) / 2;
- h = screen.height / 20;
+ if(h > screenHeight / 20) {
+ paddingTop += (h - (screenHeight / 20)) / 2;
+ h = screenHeight / 20;
}
// set it
- that.element_message.style.fontSize = h.toString() + 'px';
- that.element_message.style.paddingTop = paddingTop.toString() + 'px';
+ el.style.fontSize = h.toString() + 'px';
+ el.style.paddingTop = paddingTop.toString() + 'px';
};
var showMessage = function(msg) {
};
var showMessageIcon = function(icon) {
- that.element_message.innerHTML = icon;
- that.element_message.className = 'netdata-message icon';
- maxMessageFontSize();
- that.___messageHidden___ = undefined;
+ NETDATA.noLayoutTrashing.add(function() {
+ that.element_message.innerHTML = icon;
+ that.element_message.className = 'netdata-message icon';
+ maxMessageFontSize();
+ that.___messageHidden___ = undefined;
+ });
};
var hideMessage = function() {
.on('hidden.bs.dropdown', function () {
NETDATA.unpause();
});
+
+ // var netdataEnded = performance.now();
+ // console.log('start up time: ' + (netdataEnded - netdataStarted).toString() + ' ms');
}
function resetDashboardOptions() {
};
// our entry point
+ // var netdataStarted = performance.now();
var netdataCallback = initializeDynamicDashboard;
</script>
</head>
</div>
</body>
</html>
-<script type="text/javascript" src="dashboard.js?v20161229-4"></script>
+<script type="text/javascript" src="dashboard.js?v20170104-25"></script>