|
5579 | 5579 | NETDATA.requiredJs = [ |
5580 | 5580 | { |
5581 | 5581 | url: NETDATA.serverDefault + 'lib/bootstrap-3.3.7.min.js', |
| 5582 | + async: false, |
5582 | 5583 | isAlreadyLoaded: function() { |
5583 | 5584 | // check if bootstrap is loaded |
5584 | 5585 | if(typeof $().emulateTransitionEnd == 'function') |
|
5594 | 5595 | { |
5595 | 5596 | url: NETDATA.serverDefault + 'lib/jquery.nanoscroller.min.js', |
5596 | 5597 | isAlreadyLoaded: function() { return false; } |
5597 | | - }, |
5598 | | - { |
5599 | | - url: NETDATA.serverDefault + 'lib/bootstrap-toggle.min.js', |
5600 | | - isAlreadyLoaded: function() { return false; } |
5601 | 5598 | } |
5602 | 5599 | ]; |
5603 | 5600 |
|
|
5627 | 5624 |
|
5628 | 5625 | NETDATA.loadedRequiredJs = 0; |
5629 | 5626 | NETDATA.loadRequiredJs = function(index, callback) { |
5630 | | - if(index >= NETDATA.requiredJs.length) return; |
| 5627 | + if(index >= NETDATA.requiredJs.length) { |
| 5628 | + if(typeof callback === 'function') |
| 5629 | + callback(); |
| 5630 | + return; |
| 5631 | + } |
5631 | 5632 |
|
5632 | 5633 | if(NETDATA.requiredJs[index].isAlreadyLoaded()) { |
5633 | 5634 | NETDATA.loadedRequiredJs++; |
|
5638 | 5639 | if(NETDATA.options.debug.main_loop === true) |
5639 | 5640 | console.log('loading ' + NETDATA.requiredJs[index].url); |
5640 | 5641 |
|
| 5642 | + var async = true; |
| 5643 | + if(typeof NETDATA.requiredJs[index].async !== 'undefined' && NETDATA.requiredJs[index].async === false) |
| 5644 | + async = false; |
| 5645 | + |
5641 | 5646 | $.ajax({ |
5642 | 5647 | url: NETDATA.requiredJs[index].url, |
5643 | 5648 | cache: true, |
5644 | | - async: true, |
5645 | 5649 | dataType: "script", |
5646 | 5650 | xhrFields: { withCredentials: true } // required for the cookie |
5647 | 5651 | }) |
|
5654 | 5658 | }) |
5655 | 5659 | .always(function() { |
5656 | 5660 | NETDATA.loadedRequiredJs++; |
5657 | | - if(typeof callback === 'function' && NETDATA.loadedRequiredJs >= NETDATA.requiredJs.length) |
5658 | | - callback(); |
| 5661 | + |
| 5662 | + if(async === false) |
| 5663 | + NETDATA.loadRequiredJs(++index, callback); |
5659 | 5664 | }) |
5660 | 5665 |
|
5661 | | - NETDATA.loadRequiredJs(++index, callback); |
| 5666 | + if(async === true) |
| 5667 | + NETDATA.loadRequiredJs(++index, callback); |
5662 | 5668 | }; |
5663 | 5669 |
|
5664 | 5670 | NETDATA.loadRequiredCSS = function(index) { |
|
0 commit comments