]> arthur.barton.de Git - netdata.git/commitdiff
layout trashing prevention is problematic on IE and safari - the display is out of...
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 5 Jan 2017 00:55:52 +0000 (02:55 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 5 Jan 2017 00:55:52 +0000 (02:55 +0200)
web/dashboard.js
web/index.html

index 02c5ce427fae9ee496982fc9c1687a6a55e7f5cc..23c8cfbccf5e2a343be5ae8af8295c12165659e5 100644 (file)
@@ -1160,35 +1160,6 @@ var NETDATA = window.NETDATA || {};
         }
     };
 
-    // ----------------------------------------------------------------------------------------------------------------
-    // http://wilsonpage.co.uk/preventing-layout-thrashing/
-
-    NETDATA.noLayoutTrashing = {
-        set: false,
-        callbacks: [],
-
-        add: function(callback) {
-            // console.log('adding...');
-            this.callbacks.unshift(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
 
@@ -1421,29 +1392,27 @@ var NETDATA = window.NETDATA || {};
             }
             that.element_legend_childs.series = null;
 
-            NETDATA.noLayoutTrashing.add(function() {
-                if(typeof(that.width) === 'string')
-                    $(that.element).css('width', that.width);
-                else if(typeof(that.width) === 'number')
-                    $(that.element).css('width', that.width + 'px');
-
-                if(typeof(that.library.aspect_ratio) === 'undefined') {
-                    if(typeof(that.height) === 'string')
-                        that.element.style.height = that.height;
-                    else if(typeof(that.height) === 'number')
-                        that.element.style.height = that.height.toString() + 'px';
-                }
-                else {
-                    var w = that.element.offsetWidth;
-                    if(w === null || w === 0) {
-                        // the div is hidden
-                        // this will resize the chart when next viewed
-                        that.tm.last_resized = 0;
-                    }
-                    else
-                        that.element.style.height = (w * that.library.aspect_ratio / 100).toString() + 'px';
+            if(typeof(that.width) === 'string')
+                $(that.element).css('width', that.width);
+            else if(typeof(that.width) === 'number')
+                $(that.element).css('width', that.width + 'px');
+
+            if(typeof(that.library.aspect_ratio) === 'undefined') {
+                if(typeof(that.height) === 'string')
+                    that.element.style.height = that.height;
+                else if(typeof(that.height) === 'number')
+                    that.element.style.height = that.height.toString() + 'px';
+            }
+            else {
+                var w = that.element.offsetWidth;
+                if(w === null || w === 0) {
+                    // the div is hidden
+                    // this will resize the chart when next viewed
+                    that.tm.last_resized = 0;
                 }
-            });
+                else
+                    that.element.style.height = (w * that.library.aspect_ratio / 100).toString() + 'px';
+            }
 
             if(NETDATA.chartDefaults.min_width !== null)
                 $(that.element).css('min-width', NETDATA.chartDefaults.min_width);
@@ -1534,12 +1503,10 @@ var NETDATA = window.NETDATA || {};
         };
 
         var showMessageIcon = function(icon) {
-            NETDATA.noLayoutTrashing.add(function() {
-                that.element_message.innerHTML = icon;
-                maxMessageFontSize();
-                $(that.element_message).removeClass('hidden');
-                that.___messageHidden___ = undefined;
-            });
+            that.element_message.innerHTML = icon;
+            maxMessageFontSize();
+            $(that.element_message).removeClass('hidden');
+            that.___messageHidden___ = undefined;
         };
 
         var hideMessage = function() {
@@ -1706,7 +1673,7 @@ var NETDATA = window.NETDATA || {};
                     if(that.element_legend_childs.perfect_scroller !== null)
                         Ps.update(that.element_legend_childs.perfect_scroller);
 
-                    NETDATA.noLayoutTrashing.add(maxMessageFontSize);
+                    maxMessageFontSize();
                 }
 
                 that.tm.last_resized = Date.now();
index e1a9f040624ccd44173b98032852e5e4bb8a787a..e601937b0eb63b3fff838227354da54139e2254f 100644 (file)
     </div>
 </body>
 </html>
-<script type="text/javascript" src="dashboard.js?v20170105-1"></script>
+<script type="text/javascript" src="dashboard.js?v20170105-7"></script>