2
* @author <a href="mailto:patrick.schmiedel@gmx.net">Patrick Schmiedel</a>
3
* @fileOverview Provides basic debugging functionality to Helioviewer.
5
var Debug = Class.create(
6
/** @lends Debug.prototype */
9
* @description Creates a new Debug instance.
12
initialize: function () {
13
this.outputBuffer = "";
14
this.outputTimeout = null;
23
test: function (xIndex, yIndex, level) {
26
for (var l = 0; l <= level; l++) {
27
var x = (xIndex >> (level - l + 1)) / (1 << l);
28
var x2 = 1 / (1 << l + 1);
29
Debug.output(x, (1 << l), (xIndex >> (level - l)), x2);
34
* @description Outputs text to Firebug's console when available.
39
for (var i = 0; i < arguments.length; i++) {
41
if (i < arguments.length - 1) {
47
window.console.log(txt);
49
if (Debug.outputTimeout) {
50
clearTimeout(Debug.outputTimeout);
52
Debug.outputBuffer = txt + '\n' + Debug.outputBuffer;
53
Debug.outputTimeout = setTimeout(Debug.flush, 100);
58
* @description Outputs the contents of a JavaScript array.
59
* @param {Array} a Array to output
61
plotArray: function (a) {
62
Debug.output('----\n' + Debug.strArray(a, '', 0));
66
* @description Converts an array to a string.
71
strArray: function (a, indent, index) {
72
//Debug.output(typeof(a), a instanceof Array);
73
if (a instanceof Array) {
75
return indent + index + ': []\n';
77
var txt = indent + index + ': [\n';
80
txt += Debug.strArray(m, indent + ' ', c);
83
return txt + indent + ']\n';
85
return indent + index + ': ' + a + '\n';
90
* @description Flushes output buffer.
93
if ($('debugOutput')) {
94
$('debugOutput').innerHTML = '----\n' + Debug.outputBuffer + $('debugOutput').innerHTML;
95
Debug.outputBuffer = '';
100
* @description Outputs informative message when an AJAX request fails.
101
* @param {Object} transport
102
* @param {String} url
104
ajaxFailure: function (transport, url) {
105
Debug.output('Error getting file "' + url + '": ' + transport.status + ' ' + transport.statusText);
b'\\ No newline at end of file'