// var netdataServer = "http://yourhost:19999"; // set your NetData server
//(function(window, document, undefined) {
+
+ // ------------------------------------------------------------------------
+ // compatibility fixes
+
// fix IE issue with console
- if(!window.console){ window.console = {log: function(){} }; }
+ if(!window.console) { window.console = { log: function(){} }; }
+
+ // if string.endsWith is not defined, define it
+ if(typeof String.prototype.endsWith !== 'function') {
+ String.prototype.endsWith = function(s) {
+ if(s.length > this.length) return false;
+ return this.slice(-s.length) === s;
+ };
+ }
+
+ // if string.startsWith is not defined, define it
+ if(typeof String.prototype.startsWith !== 'function') {
+ String.prototype.startsWith = function(s) {
+ if(s.length > this.length) return false;
+ return this.slice(s.length) === s;
+ };
+ }
// global namespace
var NETDATA = window.NETDATA || {};
NETDATA.serverDefault = netdataServer;
else {
var s = NETDATA._scriptSource();
- NETDATA.serverDefault = s.replace(/\/dashboard.js(\?.*)*$/g, "");
+ if(s) NETDATA.serverDefault = s.replace(/\/dashboard.js(\?.*)*$/g, "");
+ else {
+ console.log('WARNING: Cannot detect the URL of the netdata server.');
+ NETDATA.serverDefault = null;
+ }
}
if(NETDATA.serverDefault === null)
NETDATA.google_js = 'https://www.google.com/jsapi';
NETDATA.themes = {
- default: {
+ white: {
bootstrap_css: NETDATA.serverDefault + 'css/bootstrap.min.css',
dashboard_css: NETDATA.serverDefault + 'dashboard.css',
background: '#FFFFFF',
if(typeof netdataTheme !== 'undefined' && typeof NETDATA.themes[netdataTheme] !== 'undefined')
NETDATA.themes.current = NETDATA.themes[netdataTheme];
else
- NETDATA.themes.current = NETDATA.themes.default;
+ NETDATA.themes.current = NETDATA.themes.white;
NETDATA.colors = NETDATA.themes.current.colors;
NETDATA._loadjQuery(function() {
NETDATA.loadRequiredJs(0, function() {
- if(typeof $().emulateTransitionEnd == 'function') {
+ if(typeof $().emulateTransitionEnd !== 'function') {
// bootstrap is not available
NETDATA.options.current.show_help = false;
}
</script>
<!-- load the dashboard manager - it will do the rest -->
- <script type="text/javascript" src="dashboard.js?v32"></script>
+ <script type="text/javascript" src="dashboard.js?v33"></script>
</head>
<body data-spy="scroll" data-target="#sidebar">
// the Dom elements are initially zero-sized
NETDATA.parseDom();
- var before = 0, after = 0;
+ var before = 0, after = 0, nowelcome = 0;
after = getUrlParameter('force_after_ms');
before = getUrlParameter('force_before_ms');
+ nowelcome = (getUrlParameter('nowelcome') === true)?true:false;
- if(before > 0 && after > 0)
+ if(before > 0 && after > 0) {
+ nowelcome = true;
NETDATA.globalPanAndZoom.setMaster(NETDATA.options.targets[0], after, before);
+ }
// let it run (update the charts)
NETDATA.unpause();
// this has to be the last
// it reloads the page
$('#netdata_theme_control').change(function() {
- if(setTheme($(this).prop('checked')?'slate':'default'))
+ if(setTheme($(this).prop('checked')?'slate':'white'))
location.reload();
});
- if(isdemo()) {
+ if(!nowelcome && isdemo()) {
setTimeout(function() {
$('#welcomeModal').modal();
}, 1000);