kaco.js muss dir ja auch zugänglich sein
Super Tip!
http://192.168.0.100/kaco.js
gibt aus:
var l = [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ];
if (!String.pad) {
String.prototype.pad = function(l, s, t) {
return s || (s = " "), (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length) + 1).join(s)).substr(0, t = !t ? l
: t == 1 ? 0 : Math.ceil(l / 2))
+ this + s.substr(0, l - t) : this;
};
}
if (!String.trim) {
String.prototype.trim = function() {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
}
}
function num_format(num) {
var n = num.toString();
var nums = n.split('.');
var newNum = "";
if (nums.length > 1) {
var dec = nums[1].substring(0, 2);
newNum = nums[0] + "," + dec;
} else {
newNum = num;
}
return newNum;
}
var kaco = {
usr : '',
csv : '',
initCount : 0,
mode : '',
current : null,
view : null,
tstamp : null,
dcCount : 2,
acCount : 3,
override : false,
dataIndex : null,
data : {},
state : {},
noDataMode : false,
start : function() {
$.ajax({
url : this.csv + '/metadata.csv',
context : this,
success : kaco.parseMeta
});
$.ajax({
url : this.csv + '/pstatus.txt',
context : this,
success : kaco.parseStatus
});
/*
$.ajax({
url : this.csv + '/initlog.txt',
context : this,
success : kaco.parseInitlog
});
*/
this.tstamp = new Date();
$("#chartContainer").bind("plotclick", function(event, pos, item) {
if (item) {
var val = item.datapoint[0];
switch (kaco.mode) {
case 'ETERNAL': {
kaco.tstamp.setYear(val);
kaco.switchToYearView();
break;
}
case 'YEAR': {
kaco.tstamp.setMonth(val - 1);
kaco.switchToMonthView();
break;
}
case 'MONTH': {
kaco.tstamp.setDate(val);
kaco.switchToDayView();
break;
}
}
}
});
$("#chartContainer").bind("plothover", function(event, pos, item) {
if (item) {
kaco.showHover(item);
} else {
$("#tooltip").remove();
kaco.dataIndex = null;
}
});
// start updater threat
setInterval(function() {
kaco.triggerRealtimeUpdate();
}, 30000);
// init graph
this.switchToDayView();
},
showHover : function(item) {
var x = item.pageX + 10;
var y = item.pageY + 10;
var contents = item.datapoint[1].toFixed(2);
if (this.dataIndex != item.dataIndex) {
this.dataIndex = item.dataIndex;
$("#tooltip").remove();
$('<div id="tooltip">' + contents + '</div>').css({
position : 'absolute',
display : 'none',
top : y,
left : x,
border : '1px solid #fdd',
padding : '2px',
'background-color' : '#ccc',
opacity : 0.9
}).appendTo("body").fadeIn(200);
}
},
parseInitlog: function(data) {
kaco.initCount++;
/*
var fields = data.split('.usr');
fields[0].trim()
*/
},
parseStatus : function(data) {
kaco.initCount++;
var lines = data.split('\r');
for ( var x = 0; x < lines.length; x++) {
var entry = lines[x].split(' ');
this.state[entry[0].trim()] = entry[1].trim();
}
this.triggerRealtimeUpdate();
},
parseMeta : function(data) {
kaco.initCount++;
this.triggerRealtimeUpdate();
/*
* 0.) Seriennummer
* 1.) Gerätetyp
* 2.) MAC-Adresse
* 3.) IP-Adresse
* 4.) Wechselrichter RS485 Adresse
* 5.) Anzahl AC-Phasen
* 6.) Anzahl DC-Eingänge
* 7.) AC Nennleistung [W]
* 8.) DC Nennleistung [W]
*/
var fields = data.split(';');
$('#serial').html(fields[0]);
$('#name').html(fields[1]);
$('#mac').html(fields[2]);
$('#network').html(fields[3]);
$('#rsid').html(fields[4]);
this.acCount = parseInt(fields[5]);
this.dcCount = parseInt(fields[6]);
this.acPower = parseInt(fields[7]);
this.dcPower = parseInt(fields[8]);
var type = this.acPower / 1000 + ' kW Nennleistung, ';
if (this.acCount == 3) {
type += 'dreiphasig';
$("input.a3").css( {
display : 'block'
});
} else {
type += 'einphasig';
}
$('#type').html(type);
if (this.dcCount == 3) {
$("input.d3").css( {
display : 'block'
});
}
$("#calendar").datepicker( {
buttonImage : '/btn_cal.gif',
buttonImageOnly : true,
gotoCurrent : true,
showOn : 'button',
changeYear : true,
maxDate : new Date(),
minDate : '-1M',
beforeShow : function(input, inst) {
$("#calendar").datepicker("setDate", kaco.tstamp);
},
onSelect : function(dateText, inst) {
kaco.tstamp = $("#calendar").datepicker("getUTCDate");
kaco.switchToDayView();
}
});
},
triggerRealtimeUpdate : function() {
// dump('InitCount: '+this.initCount+'
');
if (this.initCount != 2)
return;
$.ajax( {
url : this.csv + '/realtime.csv',
context : this,
success : kaco.refreshStatus
});
},
refreshStatus : function(data) {
// dump('got status data:
'+data+'
');
var fields = data.split(';');
$('#today').html((new Date(fields[0] * 1000)).toUTCString());
var gen = [];
var offset = this.dcCount + 1;
// dump('Offset:'+offset+'
Count:'+this.dcCount+'
');
for ( var t = 1; t <= this.dcCount; t++) {
gen.push(num_format((fields[t] / (65535.0 / 1600.0)) * ((fields[t + this.dcCount + this.acCount]) / (65535.0 / 200.0))
/ 1000.0));
}
$('#nowValueGen').html(gen.join(' kW <br/>') + ' kW');
$('#nowValueIn').html(num_format(fields[fields.length - 3] / (65535.0 / 100000.0) / 1000.0) + ' kW');
var st = fields[fields.length - 1].trim();
// dump('St:'+st+'
');
if (this.state[st]) {
$('#nowValueState').html(this.state[st]);
} else {
$('#nowValueState').html('Unbekannt');
}
},
goBack : function() {
this.loadData(this.view.getPrevious(this.tstamp));
this.updateCurrentLabel();
},
goForward : function() {
this.loadData(this.view.getNext(this.tstamp));
this.updateCurrentLabel();
},
goFastForward : function() {
this.loadData(this.view.getNextFast(this.tstamp));
this.updateCurrentLabel();
},
goFastBack : function() {
this.loadData(this.view.getPreviousFast(this.tstamp));
this.updateCurrentLabel();
},
updateCurrentLabel : function() {
var label;
switch (this.mode) {
case 'DAY': {
label = 'Heute';
if ((new Date).getUTCMonth() != this.tstamp.getUTCMonth() || (new Date).getUTCFullYear() != this.tstamp.getUTCFullYear() || (new Date).getUTCDate() != this.tstamp.getUTCDate()) {
label = this.tstamp.getUTCDate() + '. ' + l[this.tstamp.getUTCMonth()] + ' ' + this.tstamp.getUTCFullYear();
}
break;
}
case 'MONTH': {
label = 'Aktueller Monat';
if ((new Date).getUTCMonth() != this.tstamp.getUTCMonth() || (new Date).getUTCFullYear() != this.tstamp.getUTCFullYear()) {
label = l[this.tstamp.getUTCMonth()] + ' ' + this.tstamp.getUTCFullYear();
}
break;
}
case 'YEAR': {
label = 'Aktuelles Jahr';
if ((new Date).getUTCFullYear() != this.tstamp.getUTCFullYear()) {
label = this.tstamp.getUTCFullYear();
}
break;
}
}
$('#dayLabel').html(label);
},
switchToDayView : function() {
this.mode = 'DAY';
this.view = dayView;
$('#axisLabel').html('Uhrzeit');
$('#chartBarNavi').show();
$('#graphselector').show();
$('#calenderLink').show();
$('.fastfwd').show();
this.loadData(this.view.getCurrent(this.tstamp));
this.updateCurrentLabel();
},
switchToMonthView : function() {
this.mode = 'MONTH';
this.view = monthView;
$('#axisLabel').html('Tag');
$('#chartBarNavi').show();
$('.fastfwd').show();
$('#graphselector').hide();
$('#calenderLink').hide();
this.loadData(this.view.getCurrent(this.tstamp));
this.updateCurrentLabel();
},
switchToYearView : function() {
this.mode = 'YEAR';
this.view = yearView;
$('#axisLabel').html('Monat');
$('#chartBarNavi').show();
$('#calenderLink').hide();
$('#graphselector').hide();
$('.fastfwd').hide();
this.loadData(this.view.getCurrent(this.tstamp));
this.updateCurrentLabel();
},
switchToEternalView : function() {
this.mode = 'ETERNAL';
this.view = eternalView;
$('#axisLabel').html('Jahr');
$('#dayLabel').html('Gesamtübersicht');
$('#graphselector').hide();
$('#chartBarNavi').hide();
this.loadData('eternal');
},
updateVisibleDayGraphs : function() {
this.drawGraph(this.data);
},
loadData : function(src) {
try {
var path = this.csv + '/' + src + '.csv';
// dump('Requesting: '+path+'
');
$('#currentScreenTitle').html(this.view.getTitle(this.tstamp));
$.ajax( {
url : path,
context : this,
success : kaco.parseData,
error : kaco.noData
});
$('#downloadLink').attr('href', this.usr + '/' + src + '.USR');
return true;
} catch (e) {
this.noData();
return false;
}
},
noData : function() {
kaco.noDataMode = true;
$('#downloadLink').attr('href', 'javascript:alert("Keine Daten verfügbar");');
$('#graphselector').hide();
$('#axisLabel').hide();
$('#chartContainer').html('<p class="nodata">Keine Daten verfügbar</p>');
$('#dayValue').html('');
$('#dayLabel').html('');
},
parseData : function(res) {
var lines = res.split('\r');
var values = [];
for ( var t = 1; t < lines.length; t++) {
values[t - 1] = lines[t].split(';');
}
switch (this.mode) {
case 'ETERNAL':
case 'MONTH':
case 'YEAR': {
this.data = this.parseGrouped(values);
break;
}
case 'DAY': {
this.data = this.parseDay(values);
$('#graphselector').show();
break;
}
}
this.drawGraph(this.data);
if (this.noDataMode) {
this.noDataMode = false;
var map = {
'ETERNAL' : this.switchToEternalView,
'MONTH' : this.switchToMonthView,
'YEAR' : this.switchToYearView,
'DAY' : this.switchToDayView
}
map[this.mode].call(this);
}
},
parseGrouped : function(values) {
var curValue = 0;
var flag = false;
var tmp = [];
for ( var x = 0; x < values.length - 1; x++) {
var data = values[x];
var d = new Date();
d.setTime(data[0] * 1000);
curValue += parseInt(data[1]);
var tick;
switch (this.mode) {
case 'YEAR': {
tick = d.getUTCMonth() + 1;
break;
}
case 'MONTH': {
tick = d.getUTCDate();
break;
}
case 'ETERNAL': {
tick = d.getUTCFullYear();
break;
}
default: {
tick = d;
}
}
// dump(this.mode + ': ' + tick + ' -> '+ Math.round(data[1] / 1000,2)
// + '
');
tmp.push( [ tick, Math.round(data[1] / 1000, 2) ]);
if (flag)
break;
}
$('#dayValue').html(Math.round(curValue / 1000) + ' kWh');
return tmp;
},
parseDay : function(values) {
var tmp = {
'pvsp1' : {
label : 'Generatorspannung 1 U [V]',
data : [],
yaxis : 1,
color : 'rgb(255,0,0)'
},
'pvsp2' : {
label : 'Generatorspannung 2 U [V]',
data : [],
yaxis : 1,
color : 'rgb(255,128,128)'
},
'pvsp3' : {
label : 'Generatorspannung 3 U [V]',
data : [],
yaxis : 1,
color : 'rgb(255,192,192)'
},
'nsp1' : {
label : 'Netzspannung 1 U [V]',
data : [],
yaxis : 2,
color : 'rgb(0,0,255)'
},
'nsp2' : {
label : 'Netzspannung 2 U [V]',
data : [],
yaxis : 2,
color : 'rgb(128,128,255)'
},
'nsp3' : {
label : 'Netzspannung 3 U [V]',
data : [],
yaxis : 2,
color : 'rgb(192,192,255)'
},
'pvl1' : {
label : 'Generatorleistung 1 P [kW]',
data : [],
yaxis : 3,
color : 'rgb(255,128,0)'
},
'pvl2' : {
label : 'Generatorleistung 2 P [kW]',
data : [],
yaxis : 3,
color : 'rgb(255,192,64)'
},
'pvl3' : {
label : 'Generatorleistung 3 P [kW]',
data : [],
yaxis : 3,
color : 'rgb(255,255,0)'
},
'temp' : {
label : 'Gerätetemperatur T [°C]',
data : [],
yaxis : 4,
color : 'rgb(0,0,0)'
},
'nl' : {
label : 'Netzleistung P [kW]',
data : [],
yaxis : 5,
color : 'rgb(0,255,255)'
}
};
/*
* 3P:
*
* 0.) Zeitstempel [s] (in Sekunden vom 01.01.1970)
* 1.) DC-Spannung [V] (2 bzw. 3 Werte)
* 2.)
* 3.)
* 4.) AC-Spannung [V] (3 Werte)
* 5.)
* 6.)
* 7.) DC-Strom [A] (2 bzw. 3 Werte)
* 8.)
* 9.)
* 10.) AC-Strom [A] (3 Werte)
* 11.)
* 12.)
* 13.) AC-Leistung [W]
* 14.) Systemtemperatur [°C]
* 15.) Wechselrichterstatus
*
* 2P:
*
* 0.) Zeitstempel [s] (in Sekunden vom 01.01.1970)
* 1.) DC-Spannung [V] (2 bzw. 3 Werte)
* 2.)
* 3.) AC-Spannung [V] (3 Werte)
* 4.)
* 5.)
* 6.) DC-Strom [A] (2 bzw. 3 Werte)
* 7.)
* 8.) AC-Strom [A] (3 Werte)
* 9.)
* 10.)
* 11.) AC-Leistung [W]
* 12.) Systemtemperatur [°C]
* 13.) Wechselrichterstatus
*
*/
if ((this.dcCount == 2) && (this.acCount == 3)) {
for ( var x = 0; x < values.length; x++) {
var data = values[x];
if (data[0] == 0)
continue;
var tstamp = new Date();
tstamp.setTime(data[0] * 1000);
// DC Spannung
tmp.pvsp1.data.push( [ tstamp, data[1] / (65535.0 / 1600.0) ]);
tmp.pvsp2.data.push( [ tstamp, data[2] / (65535.0 / 1600.0) ]);
// AC Spannung
tmp.nsp1.data.push( [ tstamp, data[3] / (65535.0 / 1600.0) ]);
tmp.nsp2.data.push( [ tstamp, data[4] / (65535.0 / 1600.0) ]);
tmp.nsp3.data.push( [ tstamp, data[5] / (65535.0 / 1600.0) ]);
// DC Leistung
tmp.pvl1.data.push( [ tstamp, (data[6] / (65535.0 / 200.0) * (data[1] / (65535.0 / 1600.0))) / 1000 ]);
tmp.pvl2.data.push( [ tstamp, (data[7] / (65535.0 / 200.0) * (data[2] / (65535.0 / 1600.0))) / 1000 ]);
// AC Leistung
tmp.nl.data.push( [ tstamp, data[11] / (65535.0 / 100000.0) / 1000 ]);
tmp.temp.data.push( [ tstamp, data[12] / 100.0 ]);
}
} else if ((this.dcCount == 3) && (this.acCount == 3)) {
for ( var x = 0; x < values.length; x++) {
var data = values[x];
if (data[0] == 0)
continue;
var tstamp = new Date();
tstamp.setTime(data[0] * 1000);
// DC Spannung
tmp.pvsp1.data.push( [ tstamp, data[1] / (65535.0 / 1600.0) ]);
tmp.pvsp2.data.push( [ tstamp, data[2] / (65535.0 / 1600.0) ]);
tmp.pvsp3.data.push( [ tstamp, data[3] / (65535.0 / 1600.0) ]);
// AC Spannung
tmp.nsp1.data.push( [ tstamp, data[4] / (65535.0 / 1600.0) ]);
tmp.nsp2.data.push( [ tstamp, data[5] / (65535.0 / 1600.0) ]);
tmp.nsp3.data.push( [ tstamp, data[6] / (65535.0 / 1600.0) ]);
// DC Leistung
tmp.pvl1.data.push( [ tstamp, (data[7] / (65535.0 / 200.0) * (data[1] / (65535.0 / 1600.0))) / 1000 ]);
tmp.pvl2.data.push( [ tstamp, (data[8] / (65535.0 / 200.0) * (data[2] / (65535.0 / 1600.0))) / 1000 ]);
tmp.pvl3.data.push( [ tstamp, (data[9] / (65535.0 / 200.0) * (data[3] / (65535.0 / 1600.0))) / 1000 ]);
// AC Leistung
tmp.nl.data.push( [ tstamp, data[13] / (65535.0 / 100000.0) / 1000 ]);
tmp.temp.data.push( [ tstamp, data[14] / 100.0 ]);
}
}
var curValue = 0;
var diff = 5;
for ( var xx = 0; xx < tmp.nl.data.length; xx++) {
// dump('NL-Value '+xx+': '+tmp.nl[xx]+'
');
if (xx>0) {
diff = parseInt((tmp.nl.data[xx][0].getTime() - tmp.nl.data[xx-1][0].getTime())/60000);
//dump('DIFF:'+diff+'
');
}
curValue += tmp.nl.data[xx][1] * diff;
// dump('CUR: '+curValue+'
');
}
//dump('setting day value
');
$('#dayValue').html(Math.round(curValue / 60.0) + ' kWh');
return tmp;
},
drawGraph : function(data) {
if (this.override) {
$("outOfBoundInfo").show();
} else {
$("outOfBoundInfo").hide();
}
this.override = false;
var config = this.view.getChartConfig(data);
$.plot($("#chartContainer"), config.chart, config.options);
$('#axisLabel').show();
}
}
var eternalView = {
range : {
min : (new Date()).getTime(),
max : (new Date()).getTime()
},
getTitle : function(tstamp) {
return 'Gesamtansicht ';
},
getChartConfig : function(data) {
var ticks = [];
var min = 0;
var max = 15000;
return {
chart : [ {
label : 'E [kWh]',
data : data,
bars : {
show : true,
barWidth : 0.5,
align : 'center'
}
} ],
options : {
grid : {
clickable : true,
hoverable : true,
autoHighlight : true
},
legend : {
position : 'nw'
},
xaxis : {
ticks : ticks,
tickDecimals : 0,
max : max + 1,
min : min - 1
},
colors : [ "#003871" ]
}
};
},
getCurrent : function(tstamp) {
if (tstamp.getTime() < this.range.min) {
kaco.override = true;
tstamp.setTime(this.range.min);
}
if (tstamp.getTime() > this.range.max) {
kaco.override = true;
tstamp.setTime(this.range.max);
}
return tstamp.getUTCFullYear();
},
getPrevious : function(tstamp) {
tstamp.setFullYear(tstamp.getUTCFullYear() - 1);
return this.getCurrent(tstamp);
},
getNext : function(tstamp) {
tstamp.setFullYear(tstamp.getUTCFullYear() + 1);
return this.getCurrent(tstamp);
}
}
var yearView = {
range : {
min : (new Date(2008, 0, 1, 0, 0, 0)).getTime(),
max : (new Date()).getTime()
},
getTitle : function(tstamp) {
return 'Jahresansicht ' + tstamp.getUTCFullYear();
},
getChartConfig : function(data) {
return {
chart : [ {
label : 'E [kWh]',
data : data,
bars : {
show : true,
barWidth : 0.5,
align : 'center'
}
} ],
options : {
grid : {
clickable : true,
hoverable : true,
autoHighlight : true
},
legend : {
position : 'nw',
opacity:0.4,
style:'bar'
},
xaxis : {
ticks : [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ],
tickDecimals : 0,
max : 13,
min : 0
},
colors : [ "#003871" ]
}
};
},
getCurrent : function(tstamp) {
if (tstamp.getTime() < this.range.min) {
kaco.override = true;
tstamp.setTime(this.range.min);
}
if (tstamp.getTime() > this.range.max) {
kaco.override = true;
tstamp.setTime(this.range.max);
}
return tstamp.getUTCFullYear();
},
getPrevious : function(tstamp) {
tstamp.setFullYear(tstamp.getUTCFullYear() - 1);
return this.getCurrent(tstamp);
},
getNext : function(tstamp) {
tstamp.setFullYear(tstamp.getUTCFullYear() + 1);
return this.getCurrent(tstamp);
}
}
var monthView = {
range : {
min : (new Date(2009, 0, 1, 0, 0, 0)).getTime(),
max : (new Date()).getTime()
},
getTitle : function(tstamp) {
return 'Monatsansicht ' + l[tstamp.getUTCMonth()] + ' ' + tstamp.getUTCFullYear();
},
getChartConfig : function(data) {
var tmp = yearView.getChartConfig(data);
tmp.options.xaxis = {
ticks : [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31 ],
tickDecimals : 0,
max : 32,
min : 0
}
return tmp;
},
getCurrent : function(tstamp) {
if (tstamp.getTime() < this.range.min) {
kaco.override = true;
tstamp.setTime(this.range.min);
}
if (tstamp.getTime() > this.range.max) {
kaco.override = true;
tstamp.setTime(this.range.max);
}
var m = (tstamp.getUTCMonth() + 1) + '';
return tstamp.getUTCFullYear() + '' + m.pad(2, '0');
},
getPrevious : function(tstamp) {
tstamp.setMonth(tstamp.getUTCMonth() - 1);
return this.getCurrent(tstamp);
},
getNext : function(tstamp) {
tstamp.setMonth(tstamp.getUTCMonth() + 1);
return this.getCurrent(tstamp);
},
getPreviousFast : function(tstamp) {
tstamp.setYear(tstamp.getUTCFullYear() - 1);
return this.getCurrent(tstamp);
},
getNextFast : function(tstamp) {
tstamp.setYear(tstamp.getUTCFullYear() + 1);
return this.getCurrent(tstamp);
}
};
var dayView = {
range : {
min : (new Date(2010, 4, 1, 0, 0, 0)).getTime(),
max : (new Date()).getTime()
},
getTitle : function(tstamp) {
var l = [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November',
'Dezember' ];
return 'Tagesansicht ' + tstamp.getUTCDate() + '. ' + l[tstamp.getUTCMonth()] + ' ' + tstamp.getUTCFullYear();
},
getChartConfig : function(data) {
/*
* var label; switch (kaco.dayGraph) { case 'pvsp1': case 'pvsp2': case
* 'pvsp3': { label = 'U [V]'; break; }
*
* case 'pvst1': case 'pvst2': case 'pvst3': { label = 'I [A]'; break; }
*
* case 'nsp1': case 'nsp2': case 'nsp3': { label = 'U [V]'; break; }
*
* case 'nst1': case 'nst2': case 'nst3': { label = 'I [A]'; break; }
*
* case 'nfr': { label = 'F [Hz]'; break; } case 'temp': { label = 'T
* [°C]'; break; } case 'nl': { label = "P [kW]"; break; } }
*/
var showData = [];
$('#graphselector').find("input:checked").each(function() {
var key = $(this).attr("value");
if (key && data[key])
// dump('Adding '+key+' to list of graphs
');
showData.push(data[key]);
});
return {
chart : showData,
/*
* { label: label, data: data, lines: { show: true } },
*/
options : {
grid : {
clickable : true,
hoverable : true,
autoHighlight : true
},
legend : {
position : 'nw'
},
xaxis : {
mode : 'time',
timeformat : '%h'
},
yaxis : {
min : 0
},
yaxes : [ {
position : "left",
color: 'rgb(255,0,0)'
}, {
position : "left",
color: 'rgb(0,0,255)'
}, {
position : "left",
color: 'rgb(255,128,0)'
}, {
position : "left",
color: 'rgb(0,0,0)',
max : 80
}, {
position : "left",
color: 'rgb(0,255,255)'
} ]
// colors: ["#003871"]
}
};
},
getCurrent : function(tstamp) {
if (tstamp.getTime() < this.range.min) {
kaco.override = true;
tstamp.setTime(this.range.min);
}
if (tstamp.getTime() > this.range.max) {
kaco.override = true;
tstamp.setTime(this.range.max);
}
var m = (tstamp.getUTCMonth() + 1) + '';
var d = tstamp.getUTCDate() + '';
return tstamp.getUTCFullYear() + '' + m.pad(2, '0') + d.pad(2, '0');
},
getPrevious : function(tstamp) {
tstamp.setDate(tstamp.getUTCDate() - 1);
return this.getCurrent(tstamp);
},
getNext : function(tstamp) {
tstamp.setDate(tstamp.getUTCDate() + 1);
return this.getCurrent(tstamp);
},
getPreviousFast : function(tstamp) {
tstamp.setMonth(tstamp.getUTCMonth() - 1);
return this.getCurrent(tstamp);
},
getNextFast : function(tstamp) {
tstamp.setMonth(tstamp.getUTCMonth() + 1);
return this.getCurrent(tstamp);
}
};
Aber leider immer noch keine Werte…