allow dashboard.js to work under wordpress; fixes #2595
Costa Tsaousis (ktsaou) committed
Aug 15, 2017 at 03:29 UTC
b2c5043f4ae8f9588fd0164a7302d8cda7a4d78f
3 files changed
+13
-7
web/dashboard.html
+1
-1
@@ -652,4 +652,4 @@ So, to avoid flashing the charts, we destroy and re-create the charts on each up
652
<!-- <script> netdataServer = "http://box:19999"; </script> -->
653
654
<!-- load the dashboard manager - it will do the rest -->
655
-<script type="text/javascript" src="dashboard.js?v20170724-1"></script>
655
+<script type="text/javascript" src="dashboard.js?v20170815-15"></script>
web/dashboard.js
+11
-5
@@ -51,7 +51,7 @@
51
52
var NETDATA = window.NETDATA || {};
53
54
-(function(window, document) {
54
+(function(window, document, $, undefined) {
55
// ------------------------------------------------------------------------
56
// compatibility fixes
57
@@ -3932,14 +3932,20 @@ var NETDATA = window.NETDATA || {};
3932
3933
// script.onabort = onError;
3934
script.onerror = function() { NETDATA.error(101, NETDATA.jQuery); };
3935
- if(typeof callback === "function")
3936
- script.onload = callback;
3935
+ if(typeof callback === "function") {
3936
+ script.onload = function () {
3937
+ $ = jQuery;
3938
+ return callback();
3939
+ };
3940
+ }
3941
3942
var s = document.getElementsByTagName('script')[0];
3943
s.parentNode.insertBefore(script, s);
3944
}
3941
- else if(typeof callback === "function")
3945
+ else if(typeof callback === "function") {
3946
+ $ = jQuery;
3947
return callback();
3948
+ }
3949
};
3950
3951
NETDATA._loadCSS = function(filename) {
@@ -7086,4 +7092,4 @@ var NETDATA = window.NETDATA || {};
7092
}
7093
});
7094
});
7089
-})(window, document);
7095
+})(window, document, (typeof jQuery === 'function')?jQuery:undefined);
web/index.html
+1
-1
@@ -3589,4 +3589,4 @@
3589
</div>
3590
</body>
3591
</html>
3592
-<script type="text/javascript" src="dashboard.js?v20170810-1"></script>
3592
+<script type="text/javascript" src="dashboard.js?v20170815-14"></script>