@cryptotaxi247 / netdata-1 / commits / 490ae1393

older browsers compatibility fix; fixed a bug introduced with #290 due to #286 that resulted in online help being always disabled;

Costa Tsaousis (ktsaou) committed Apr 22, 2016 at 03:30 UTC 490ae1393e49d63fb99e7da94a337c3925823512
3 files changed +39 -10
CMakeLists.txt
+2
@@ -88,6 +88,8 @@ set(APPS_PLUGIN_SOURCE_FILES
88 src/log.h
89 config.h)
90
91 +include_directories(AFTER .)
92 +
93 add_definitions(-DHAVE_CONFIG_H -DNETDATA_INTERNAL_CHECKS=1 -DCACHE_DIR="/tmp" -DCONFIG_DIR="/tmp" -DLOG_DIR="/tmp" -DPLUGINS_DIR="/tmp" -DWEB_DIR="/tmp")
94
95 add_executable(netdata ${NETDATA_SOURCE_FILES})
web/dashboard.js
+29 -5
@@ -19,8 +19,28 @@
19 // var netdataServer = "http://yourhost:19999"; // set your NetData server
20
21 //(function(window, document, undefined) {
22 +
23 + // ------------------------------------------------------------------------
24 + // compatibility fixes
25 +
26 // fix IE issue with console
23 - if(!window.console){ window.console = {log: function(){} }; }
27 + if(!window.console) { window.console = { log: function(){} }; }
28 +
29 + // if string.endsWith is not defined, define it
30 + if(typeof String.prototype.endsWith !== 'function') {
31 + String.prototype.endsWith = function(s) {
32 + if(s.length > this.length) return false;
33 + return this.slice(-s.length) === s;
34 + };
35 + }
36 +
37 + // if string.startsWith is not defined, define it
38 + if(typeof String.prototype.startsWith !== 'function') {
39 + String.prototype.startsWith = function(s) {
40 + if(s.length > this.length) return false;
41 + return this.slice(s.length) === s;
42 + };
43 + }
44
45 // global namespace
46 var NETDATA = window.NETDATA || {};
@@ -53,7 +73,11 @@
73 NETDATA.serverDefault = netdataServer;
74 else {
75 var s = NETDATA._scriptSource();
56 - NETDATA.serverDefault = s.replace(/\/dashboard.js(\?.*)*$/g, "");
76 + if(s) NETDATA.serverDefault = s.replace(/\/dashboard.js(\?.*)*$/g, "");
77 + else {
78 + console.log('WARNING: Cannot detect the URL of the netdata server.');
79 + NETDATA.serverDefault = null;
80 + }
81 }
82
83 if(NETDATA.serverDefault === null)
@@ -80,7 +104,7 @@
104 NETDATA.google_js = 'https://www.google.com/jsapi';
105
106 NETDATA.themes = {
83 - default: {
107 + white: {
108 bootstrap_css: NETDATA.serverDefault + 'css/bootstrap.min.css',
109 dashboard_css: NETDATA.serverDefault + 'dashboard.css',
110 background: '#FFFFFF',
@@ -124,7 +148,7 @@
148 if(typeof netdataTheme !== 'undefined' && typeof NETDATA.themes[netdataTheme] !== 'undefined')
149 NETDATA.themes.current = NETDATA.themes[netdataTheme];
150 else
127 - NETDATA.themes.current = NETDATA.themes.default;
151 + NETDATA.themes.current = NETDATA.themes.white;
152
153 NETDATA.colors = NETDATA.themes.current.colors;
154
@@ -5407,7 +5431,7 @@
5431
5432 NETDATA._loadjQuery(function() {
5433 NETDATA.loadRequiredJs(0, function() {
5410 - if(typeof $().emulateTransitionEnd == 'function') {
5434 + if(typeof $().emulateTransitionEnd !== 'function') {
5435 // bootstrap is not available
5436 NETDATA.options.current.show_help = false;
5437 }
web/index.html
+8 -5
@@ -330,7 +330,7 @@
330 </script>
331
332 <!-- load the dashboard manager - it will do the rest -->
333 - <script type="text/javascript" src="dashboard.js?v32"></script>
333 + <script type="text/javascript" src="dashboard.js?v33"></script>
334 </head>
335
336 <body data-spy="scroll" data-target="#sidebar">
@@ -1841,12 +1841,15 @@ function finalizePage() {
1841 // the Dom elements are initially zero-sized
1842 NETDATA.parseDom();
1843
1844 - var before = 0, after = 0;
1844 + var before = 0, after = 0, nowelcome = 0;
1845 after = getUrlParameter('force_after_ms');
1846 before = getUrlParameter('force_before_ms');
1847 + nowelcome = (getUrlParameter('nowelcome') === true)?true:false;
1848
1848 - if(before > 0 && after > 0)
1849 + if(before > 0 && after > 0) {
1850 + nowelcome = true;
1851 NETDATA.globalPanAndZoom.setMaster(NETDATA.options.targets[0], after, before);
1852 + }
1853
1854 // let it run (update the charts)
1855 NETDATA.unpause();
@@ -1939,11 +1942,11 @@ function finalizePage() {
1942 // this has to be the last
1943 // it reloads the page
1944 $('#netdata_theme_control').change(function() {
1942 - if(setTheme($(this).prop('checked')?'slate':'default'))
1945 + if(setTheme($(this).prop('checked')?'slate':'white'))
1946 location.reload();
1947 });
1948
1946 - if(isdemo()) {
1949 + if(!nowelcome && isdemo()) {
1950 setTimeout(function() {
1951 $('#welcomeModal').modal();
1952 }, 1000);