00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 var Debug = Debug || {};
00022
00023 Debug.mode = 1;
00024 Debug.simple = 0;
00025 Debug.level = 100;
00026
00027
00028 Debug.lastLog = "";
00029 Debug.lastLogger = "";
00030
00031 Debug.prependMessage = "";
00032
00033
00034 Debug.HIGH_PRIORITY = 0;
00035 Debug.WARN_PRIORITY = 1;
00036 Debug.INFO_PRIORITY = 2;
00037 Debug.TIP_PRIORITY = 3;
00038 Debug.MED_PRIORITY = 50;
00039 Debug.LOW_PRIORITY = 100;
00040
00041
00042
00043
00044 Debug.BROWSER_TYPE = 0;
00045 {
00046 var tmp = (new Error).stack;
00047 if(tmp[0] == 'E')
00048 Debug.BROWSER_TYPE = 1;
00049 else if(tmp[0] == '@')
00050 Debug.BROWSER_TYPE = 2;
00051 }
00052
00053
00054 if (Debug.mode)
00055 {
00056
00057 try
00058 {
00059 Debug.FontInconsolata = new FontFace('Inconsolata', 'url(/WebPath/fonts/inconsolata/Inconsolata-Regular.ttf)');
00060 document.fonts.add(Debug.FontInconsolata);
00061 } catch(e){console.log("Ignoring font errors: " + e);}
00062 try
00063 {
00064 Debug.FontComfortaa = new FontFace('Comfortaa', 'url(/WebPath/fonts/comfortaa/Comfortaa-Regular.ttf)');
00065 document.fonts.add(Debug.FontComfortaa);
00066 } catch(e){console.log("Ignoring font errors: " + e);}
00067 try
00068 {
00069 Debug.FontInconsolataBold = new FontFace('Inconsolata-Bold', 'url(/WebPath/fonts/inconsolata/Inconsolata-Bold.ttf)');
00070 document.fonts.add(Debug.FontInconsolataBold);
00071 } catch(e){console.log("Ignoring font errors: " + e);}
00072 try
00073 {
00074 Debug.FontComfortaaBold = new FontFace('Comfortaa-Bold', 'url(/WebPath/fonts/comfortaa/Comfortaa-Bold.ttf)');
00075 document.fonts.add(Debug.FontComfortaaBold);
00076 } catch(e){console.log("Ignoring font errors: " + e);}
00077 try
00078 {
00079 Debug.FontComfortaaLight = new FontFace('Comfortaa-Light', 'url(/WebPath/fonts/comfortaa/Comfortaa-Light.ttf)');
00080 document.fonts.add(Debug.FontComfortaaLight);
00081 } catch(e){console.log("Ignoring font errors: " + e);}
00082
00083
00084 if (Debug.simple)
00085 {
00086
00087 Debug.log = console.log.bind(window.console);
00088 }
00089 else
00090 {
00091
00092 Debug.log = function(str,num) {
00093
00094 if(num === undefined) num = Debug.LOW_PRIORITY;
00095
00096
00097 var returnStr;
00098
00099 if(num < 4)
00100 returnStr = localCallOutDebugLocales(str);
00101 if(returnStr)
00102 str = returnStr;
00103
00104
00105 if(Debug.level < 0) Debug.level = 0;
00106 if(Debug.mode && num <= Debug.level)
00107 {
00108 str = Debug.prependMessage + str;
00109
00110 var type = num < 4?
00111 (num==0?"High":(num==1?"Warn":(num==2?"Info":"Tip")))
00112 :(num<99?"Med":"Low");
00113
00114 if(Debug.BROWSER_TYPE == 1)
00115 {
00116 Debug.lastLogger = (new Error).stack.split("\n")[2];
00117 Debug.lastLog = Debug.lastLogger.slice(0,Debug.lastLogger.indexOf(' ('));
00118 Debug.lastLogger = Debug.lastLogger.slice(Debug.lastLog.length+2,
00119 Debug.lastLogger.length-1);
00120 }
00121 else if(Debug.BROWSER_TYPE == 2)
00122 {
00123 Debug.lastLogger = (new Error).stack.split("\n")[1];
00124 Debug.lastLog = Debug.lastLogger.slice(0,Debug.lastLogger.indexOf('@'));
00125 Debug.lastLogger = Debug.lastLogger.slice(Debug.lastLog.length+1,
00126 Debug.lastLogger.length);
00127 }
00128
00129 console.log("%c" + type + "-Priority" +
00130 ":\t " + Debug.lastLog + ":\n" +
00131 Debug.lastLogger + "::\t" + str,
00132 num == 0?"color:#F30;"
00133 :(num == 1?"color:#F70"
00134 :(num < 99?"color:#092":"color:#333")));
00135 Debug.lastLog = str;
00136
00137 if(num < 4)
00138 Debug.errorPop(str,num);
00139 }
00140
00142
00143
00144
00145 function localCallOutDebugLocales(str)
00146 {
00147 var i = 0;
00148 var j,k,l;
00149 var returnStr;
00150 try
00151 {
00152 while((j = str.indexOf('[',i)) > 0 && (k = str.indexOf(']',i)) > 0)
00153 {
00154 if(j < 4)
00155 {
00156 i = k+1;
00157 continue;
00158 }
00159
00160
00161
00162
00163 if(!returnStr)
00164 returnStr = "";
00165
00166
00167 if((str[j-3] == '.' && str[j-2] == 'h') ||
00168 (str[j-4] == '.' && str[j-3] == 'c' && str[j-2] == 'c'))
00169 {
00170
00171 for(l = j-3; l >= i; --l)
00172 if(!((str[l] >= 'a' && str[l] <= 'z') ||
00173 (str[l] >= 'A' && str[l] <= 'Z') ||
00174 (str[l] >= '0' && str[l] <= '9') ||
00175 (str[l] == '.') ||
00176 (str[l] == '_') ||
00177 (str[l] == '-') ||
00178 (str[l] == '/') ||
00179 (str[l] == ':')))
00180 break;
00181
00182 ++l;
00183
00184
00185
00186 returnStr += str.substr(i,l-i);
00187
00188
00189 returnStr += "<br><label class='" +
00190 Debug._errBoxId + "-localCallOut'>";
00191
00192
00193 returnStr += str.substr(l,k+1-l);
00194
00195
00196 returnStr += "</label><br>";
00197
00198
00199 while(k+1 < str.length &&
00200 (str[k+1] == '\n' || str[k+1] == '\t')) ++k;
00201
00202 }
00203 else
00204 returnStr += str.substr(i,k+1-i);
00205
00206 i = k+1;
00207 }
00208 }
00209 catch(e)
00210 {
00211 return undefined;
00212 }
00213
00214
00215 if(returnStr)
00216 returnStr += str.substr(i);
00217
00218
00219 return returnStr;
00220 }
00221 }
00222 }
00223
00224
00225
00226
00227 }
00228 else
00229 {
00230 console.log = function(){};
00231 Debug.log = function(){};
00232 Debug.logv = function(){};
00233 }
00234
00235
00236 Debug.log("Debug mode is on at level: " + Debug.level);
00237 Debug.log("This is an example for posterity that is not printed due to debug priority.",Debug.level+1);
00238
00239
00240
00241
00242
00243
00244
00245 Debug._errBox = 0;
00246 Debug._errBoxId = "Debug-error-box";
00247 Debug._errBoxOffX = 0;
00248 Debug._errBoxOffY = 0;
00249 Debug._errBoxOffW = 0;
00250 Debug._errBoxOffH = 0;
00251
00252
00253 Debug.errorPopConditionString = function(str) {
00254 return str.replace(/\n/g , "<br>").replace(/\t/g," ");
00255 }
00256
00257
00258
00259
00260 Debug.errorPop = function(err,severity) {
00261
00262 var errBoxAlpha = "1.0";
00263
00264
00265 if(!Debug._errBox)
00266 {
00267
00268 var el = document.getElementById(Debug._errBoxId);
00269 if(!el)
00270 {
00271 var body = document.getElementsByTagName("BODY")[0];
00272 if(!body)
00273 {
00274
00275 window.setTimeout(function() { Debug.errorPop(err,severity)}, 1000);
00276 return;
00277 }
00278
00279
00280 el = document.createElement("div");
00281 el.setAttribute("id", Debug._errBoxId);
00282 el.style.display = "none";
00283 var str = "<a class='" +
00284 Debug._errBoxId +
00285 "-header' onclick='javascript:Debug.closeErrorPop();event.stopPropagation();' onmouseup='event.stopPropagation();'>Close Errors</a>";
00286 str =
00287 "<div class='" +
00288 Debug._errBoxId +
00289 "-moveBar' style='" +
00290 "position:absolute;width:100%;height:15px;top:0;left:0;background-color:rgb(128, 128, 128);cursor:move;" +
00291 "outline: none; /* to stop firefox selection*/ -webkit-user-select: none; /* prevent selection*/ -moz-user-select: none; user-select: none;" +
00292 "' " +
00293 "onmousedown='javascript:Debug.handleErrorMoveStart(event);event.stopPropagation();' " +
00294 "title='Click and drag to reposition this popup window.' " +
00295 "></div>" +
00296 "<br>"+
00297 str + "<br>" +
00298 "<div style='color:white;font-size:16px;padding-bottom:5px;'>" +
00299 "Note: Newest messages are at the top." +
00300 "<label style='color:white;font-size:11px;'><br>(Press [ESC] to close and [SHIFT + ESC] to re-open)</font>" +
00301 "<div id='downloadIconDiv' onmouseup='Debug.downloadMessages()' title='Download messages to text file.' style='float: right; margin: -10px 30px -100px -100px; cursor: pointer'>" +
00302
00303 "<div style='display: block; margin-left: 3px; height:7px; width: 6px; background-color: white;'></div>" +
00304 "<div style='display: block; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid white;'></div>" +
00305 "<div style='position: relative; top: 5px; width: 12px; height: 2px; display: block; background-color: white;'></div>" +
00306 "</div>" +
00307 "</div>" +
00308 "<div id='" +
00309 Debug._errBoxId +
00310 "-err' class='" +
00311 Debug._errBoxId +
00312 "-err'></div>" +
00313 "<br>" + str;
00314
00315 str += "<div class='" + Debug._errBoxId + "-resizeBarLeft' " +
00316 "style='" +
00317 "background-color:rgb(128, 128, 128);position:absolute;width:15px;height:15px;top:-1000px;left:0;cursor:nesw-resize;" +
00318 "outline: none; /* to stop firefox selection*/ -webkit-user-select: none; /* prevent selection*/ -moz-user-select: none; user-select: none;" +
00319 "' " +
00320 "onmousedown='javascript:Debug.handleErrorResizeStart(event,1,1);event.stopPropagation();' " +
00321 "title='Click and drag to resize vertically this popup window.' " +
00322 "></div>";
00323 str += "<div class='" + Debug._errBoxId + "-resizeBar' " +
00324 "style='" +
00325 "background-color:transparent;position:absolute;width:100%;height:5px;top:-1000px;left:15px;cursor:ns-resize;" +
00326 "outline: none; /* to stop firefox selection*/ -webkit-user-select: none; /* prevent selection*/ -moz-user-select: none; user-select: none;" +
00327 "' " +
00328 "onmousedown='javascript:Debug.handleErrorResizeStart(event);event.stopPropagation();' " +
00329 "title='Click and drag to resize this popup window.' " +
00330 "></div>";
00331 str += "<div class='" + Debug._errBoxId + "-resizeBarRight' " +
00332 "style='" +
00333 "background-color:rgb(128, 128, 128);position:absolute;width:15px;height:15px;top:-1000px;left:0;cursor:nwse-resize;" +
00334 "outline: none; /* to stop firefox selection*/ -webkit-user-select: none; /* prevent selection*/ -moz-user-select: none; user-select: none;" +
00335 "' " +
00336 "onmousedown='javascript:Debug.handleErrorResizeStart(event,1);event.stopPropagation();' " +
00337 "title='Click and drag to resize this popup window.' " +
00338 "></div>";
00339 el.innerHTML = str;
00340 body.appendChild(el);
00341 el.focus();
00342
00344 function localDebugKeyDownListener(e)
00345 {
00346
00347
00348
00349
00350
00351
00352 if(!e.shiftKey && e.keyCode == 27)
00353 {
00354 e.preventDefault();
00355 e.stopPropagation();
00356 Debug.closeErrorPop();
00357 }
00358 else if(e.shiftKey && e.keyCode == 27)
00359 {
00360 e.preventDefault();
00361 e.stopPropagation();
00362 Debug.bringBackErrorPop();
00363 }
00364 }
00365
00366 document.body.removeEventListener("keydown",localDebugKeyDownListener);
00367 document.body.addEventListener("keydown",localDebugKeyDownListener);
00368
00369
00370
00371 var css = "";
00372
00373
00374 css += "#" + Debug._errBoxId + " *" +
00375 "{font-family: 'Comfortaa', arial;" +
00376 "font-weight: 200;" +
00377 "font-size: 18px;" +
00378 "color: rgb(255,200,100);" +
00379 "}\n\n";
00380
00381
00382
00383 css += "#" + Debug._errBoxId + " a" +
00384 ", #" + Debug._errBoxId + " center b" +
00385 "{color: white; text-decoration: none; font-weight: bold;" +
00386 "font-size: 18px; font-family: 'Comfortaa', arial;" +
00387 "}\n\n";
00388 css += "#" + Debug._errBoxId + " a:hover" +
00389 "{text-decoration: underline;" +
00390 "cursor:pointer;" +
00391 "}\n\n";
00392
00393
00394 css += "#" + Debug._errBoxId + " i" +
00395 ", #" + Debug._errBoxId + " u" +
00396 "{" +
00397 "font-size: 18px; font-family: 'Comfortaa', arial;" +
00398 "}\n\n";
00399 css += "#" + Debug._errBoxId + " b" +
00400 "{" +
00401 "font-weight: bold;" +
00402 "color: rgb(255, 231, 187);" +
00403 "}\n\n";
00404
00405
00406 css += "#" + Debug._errBoxId +
00407 "{" +
00408 "position: absolute; display: none; border: 2px solid gray;" +
00409 "background-color: rgba(153,0,51, " + errBoxAlpha + "); overflow-y: hidden;" +
00410 "overflow-x: hidden; padding: 5px; -moz-border-radius: 2px;" +
00411 "-webkit-border-radius: 2px; border-radius: 2px;" +
00412 "font-size: 18px; z-index: 2147483647;" +
00413 "font-family: 'Comfortaa', arial; text-align: center;" +
00414 "left: 8px; top: 8px; margin-right: 8px; " +
00415 "}\n\n";
00416
00417
00418 css += "#" + Debug._errBoxId + "-err" +
00419 "{" +
00420 "color: rgb(255,200,100); font-size: 18px;" +
00421 "font-family: 'Comfortaa', arial;" +
00422 "left: 8px; top: 8px; margin-right: 8px;" +
00423 "margin-bottom:-12px;" +
00424 "text-align: left;" +
00425 "overflow-y: scroll;" +
00426 "overflow-x: auto;" +
00427 "width: 100%;" +
00428 "}\n\n";
00429
00430 css += "#" + Debug._errBoxId + "-err i" +
00431
00432 ",#" + Debug._errBoxId + "-err u" +
00433
00434 "{" +
00435 "color: rgb(255,200,100); font-size: 18px;" +
00436 "font-family: 'Comfortaa', arial;" +
00437 "text-align: left;" +
00438 "}\n\n";
00439
00440 css +=
00441
00442
00443 "#" + Debug._errBoxId + "-err div" +
00444 "{" +
00445 "color: rgb(255,200,100); font-size: 18px;" +
00446 "font-family: 'Comfortaa', arial;" +
00447 "left: 8px, top: 8px; margin-right: 8px;" +
00448 "text-align: left;" +
00449 "}\n\n";
00450
00451 css += "#" + Debug._errBoxId + "-err b" +
00452 "{" +
00453 "color: rgb(255,225,200); font-size: 18px;" +
00454 "font-family: 'Comfortaa', arial;" +
00455 "text-align: left;" +
00456 "}\n\n";
00457
00458 css += "#" + Debug._errBoxId + " ." + Debug._errBoxId + "-localCallOut" +
00459 "{font-size: 10px;}\n\n";
00460
00461
00462 var style = document.createElement('style');
00463
00464 if (style.styleSheet) {
00465 style.styleSheet.cssText = css;
00466 } else {
00467 style.appendChild(document.createTextNode(css));
00468 }
00469
00470 document.getElementsByTagName('head')[0].appendChild(style);
00471
00472 window.addEventListener("resize",localResize);
00473 window.addEventListener("scroll",localScroll);
00474 window.addEventListener("mouseup",Debug.handleErrorMoveStop);
00475 window.addEventListener("mousemove",Debug.handleErrorMove);
00476 }
00477 Debug._errBox = el;
00478 }
00479
00480
00481
00482 var el = document.getElementById(Debug._errBoxId + "-err");
00483 var str = el.innerHTML;
00484 var d = new Date();
00485 var wasAlreadyContent = false;
00486
00487
00488 if(str.length)
00489 wasAlreadyContent = true;
00490
00491 var tstr = d.toLocaleTimeString();
00492 tstr = tstr.substring(0,tstr.lastIndexOf(' ')) +
00493 (tstr[tstr.length-2]=='A'?"am":"pm");
00494
00495 if(severity == Debug.TIP_PRIORITY)
00496 str = str +
00497 (wasAlreadyContent?"<br>...<br>":"") +
00498 "<label style='color:white;font-size:16px;'>" +
00499 d.toLocaleDateString() +
00500 " " + tstr + " (Tip) :</label><br>" +
00501 Debug.errorPopConditionString(err);
00502 else
00503 str = "<label style='color:white;font-size:16px;'>" +
00504 d.toLocaleDateString() +
00505 " " + tstr + " " +
00506 (severity == Debug.INFO_PRIORITY ? '(Info)':'')+
00507 (severity == Debug.WARN_PRIORITY ? '(Warning)':'') +
00508 ":</label><br>" +
00509 Debug.errorPopConditionString(err) +
00510 (wasAlreadyContent?"<br>...<br>":"") +
00511 str;
00512
00513 el.innerHTML = str;
00514
00515
00516 function localResize()
00517 {
00518 Debug._errBoxOffX = 0;
00519 Debug._errBoxOffY = 0;
00520 Debug._errBoxOffH = 0;
00521 Debug._errBoxOffW = 0;
00522 Debug.handleErrorResize();
00523 }
00524 function localScroll()
00525 {
00526 Debug.handleErrorResize();
00527 }
00528 Debug.handleErrorResize();
00529
00530
00531 Debug._errBox.style.display = "block";
00532
00533
00534
00535 var els = document.getElementsByClassName(Debug._errBoxId + "-header");
00536 el = els[0];
00537 switch(severity)
00538 {
00539 case Debug.TIP_PRIORITY:
00540
00541 if(wasAlreadyContent &&
00542 (el.innerHTML == "Close Errors" ||
00543 el.innerHTML == "Close Warnings" ||
00544 el.innerHTML == "Close Info"))
00545 return;
00546 el.innerHTML = "Close Tooltip";
00547 Debug._errBox.style.backgroundColor = "rgba(0, 49, 99, " + errBoxAlpha + ")";
00548 break;
00549 case Debug.INFO_PRIORITY:
00550
00551 if(wasAlreadyContent &&
00552 (el.innerHTML == "Close Errors" ||
00553 el.innerHTML == "Close Warnings"))
00554 return;
00555 el.innerHTML = "Close Info";
00556 Debug._errBox.style.backgroundColor = "rgba(0,153,51, " + errBoxAlpha + ")";
00557 break;
00558 case Debug.WARN_PRIORITY:
00559
00560 if(wasAlreadyContent &&
00561 el.innerHTML == "Close Errors")
00562 return;
00563 el.innerHTML = "Close Warnings";
00564 Debug._errBox.style.backgroundColor = "rgba(160, 79, 0, " + errBoxAlpha + ")";
00565 break;
00566 default:
00567 el.innerHTML = "Close Errors";
00568 Debug._errBox.style.backgroundColor = "rgba(153,0,51, " + errBoxAlpha + ")";
00569 }
00570 els[1].innerHTML = el.innerHTML;
00571 }
00572
00573 Debug._errBoxLastContent = "";
00574
00575
00576 Debug.closeErrorPop = function() {
00577 document.getElementById(Debug._errBoxId).style.display = "none";
00578 Debug._errBoxLastContent = document.getElementById(Debug._errBoxId + "-err").innerHTML;
00579 document.getElementById(Debug._errBoxId + "-err").innerHTML = "";
00580 }
00581
00582
00583 Debug.bringBackErrorPop = function() {
00584 document.getElementById(Debug._errBoxId + "-err").innerHTML = Debug._errBoxLastContent;
00585 document.getElementById(Debug._errBoxId).style.display = "block";
00586 }
00587
00588
00589 Debug._errBoxOffMoveStartX = -1;
00590 Debug._errBoxOffMoveStartY;
00591 Debug._errBoxOffResizeStartX = -1;
00592 Debug._errBoxOffResizeStartY = -1;
00593
00594 Debug.handleErrorMoveStart = function(e) {
00595 Debug.log("Move Start");
00596 Debug._errBoxOffMoveStartX = e.screenX - Debug._errBoxOffX;
00597 Debug._errBoxOffMoveStartY = e.screenY - Debug._errBoxOffY;
00598 }
00599
00600
00601 Debug.handleErrorResizeStart = function(e,resizeW,moveLeft) {
00602 Debug.log("Resize Start");
00603 Debug._errBoxOffResizeStartY = e.screenY - Debug._errBoxOffH;
00604 if(moveLeft)
00605 {
00606 Debug._errBoxOffMoveStartX = e.screenX - Debug._errBoxOffX;
00607 Debug._errBoxOffResizeStartX = e.screenX + Debug._errBoxOffW;
00608 }
00609 else if(resizeW)
00610 Debug._errBoxOffResizeStartX = e.screenX - Debug._errBoxOffW;
00611
00612 }
00613
00614
00615 Debug.handleErrorMoveStop = function(e) {
00616
00617
00618 if(Debug._errBoxOffResizeStartY != -1)
00619 {
00620 Debug.log("Resize Stop");
00621 Debug._errBoxOffH = e.screenY - Debug._errBoxOffResizeStartY;
00622 Debug._errBoxOffResizeStartY = -1;
00623
00624 if(Debug._errBoxOffMoveStartX != -1)
00625 {
00626 Debug._errBoxOffX = e.screenX - Debug._errBoxOffMoveStartX;
00627 Debug._errBoxOffW = Debug._errBoxOffResizeStartX - e.screenX;
00628 Debug._errBoxOffMoveStartX = -1;
00629 Debug._errBoxOffResizeStartX = -1;
00630 }
00631 else if(Debug._errBoxOffResizeStartX != -1)
00632 {
00633 Debug._errBoxOffW = e.screenX - Debug._errBoxOffResizeStartX;
00634 Debug._errBoxOffResizeStartX = -1;
00635 }
00636 Debug.handleErrorResize();
00637 }
00638 else if(Debug._errBoxOffMoveStartX != -1)
00639 {
00640 Debug.log("Move Stop");
00641 Debug._errBoxOffX = e.screenX - Debug._errBoxOffMoveStartX;
00642 Debug._errBoxOffY = e.screenY - Debug._errBoxOffMoveStartY;
00643 Debug._errBoxOffMoveStartX = -1;
00644 Debug.handleErrorResize();
00645 }
00646
00647
00648 }
00649
00650
00651 Debug.handleErrorMove = function(e) {
00652
00653 if(Debug._errBoxOffMoveStartX == -1 &&
00654 Debug._errBoxOffResizeStartY == -1) return;
00655
00656 if(e.buttons == 0)
00657 {
00658 Debug._errBoxOffMoveStartX = -1;
00659 Debug._errBoxOffResizeStartY = -1;
00660 Debug._errBoxOffResizeStartX = -1;
00661 return;
00662 }
00663
00664 if(Debug._errBoxOffResizeStartY != -1)
00665 {
00666 Debug.log("Resize " + e.buttons);
00667 Debug._errBoxOffH = e.screenY - Debug._errBoxOffResizeStartY;
00668
00669 if(Debug._errBoxOffMoveStartX != -1)
00670 {
00671 Debug._errBoxOffX = e.screenX - Debug._errBoxOffMoveStartX;
00672 Debug._errBoxOffW = Debug._errBoxOffResizeStartX - e.screenX;
00673 }
00674 else if(Debug._errBoxOffResizeStartX != -1)
00675 Debug._errBoxOffW = e.screenX - Debug._errBoxOffResizeStartX;
00676
00677 Debug.handleErrorResize();
00678 }
00679 else if(Debug._errBoxOffMoveStartX != -1)
00680 {
00681 Debug.log("Move " + e.buttons);
00682 Debug._errBoxOffX = e.screenX - Debug._errBoxOffMoveStartX;
00683 Debug._errBoxOffY = e.screenY - Debug._errBoxOffMoveStartY;
00684 Debug.handleErrorResize();
00685 }
00686
00687 }
00688
00689
00690 Debug.handleErrorResize = function() {
00691
00692
00693 var offX = document.documentElement.scrollLeft || document.body.scrollLeft || 0;
00694 var offY = document.documentElement.scrollTop || document.body.scrollTop || 0;
00695 var w;
00696 var screenh;
00697
00698
00699 if(typeof DesktopContent != 'undefined')
00700 {
00701 w = (DesktopContent.getWindowWidth()-16-14);
00702 screenh = (DesktopContent.getWindowHeight()-16-14);
00703 }
00704 else if(typeof Desktop != 'undefined' && Desktop.desktop)
00705 {
00706 w = (Desktop.desktop.getDesktopWidth()-16-14);
00707 screenh = (Desktop.desktop.getDesktopHeight()-16-14);
00708 }
00709
00710 var screenw = w;
00711 var minx = 0;
00712
00713 if(w > 900)
00714 {
00715 offX += (w-850)/2;
00716 minx = -(w-850)/2;
00717 w = 850;
00718 }
00719
00720 if(w + Debug._errBoxOffW < 200)
00721 {
00722 Debug._errBoxOffW = 200 - w;
00723 }
00724 w += Debug._errBoxOffW;
00725
00726 var h = (screenh - 20) + Debug._errBoxOffH;
00727 if(h < 200)
00728 {
00729 Debug._errBoxOffH = -200;
00730 h = 200;
00731 }
00732
00733
00734 if(Debug._errBoxOffX + w > screenw)
00735 Debug._errBoxOffX = screenw - w;
00736 if(Debug._errBoxOffX < minx)
00737 Debug._errBoxOffX = minx;
00738 if(Debug._errBoxOffY + h > screenh)
00739 Debug._errBoxOffY = screenh - h;
00740 if(Debug._errBoxOffY < 0)
00741 Debug._errBoxOffY = 0;
00742
00743 Debug._errBox.style.width = (w) + "px";
00744 Debug._errBox.style.height = (h) + "px";
00745 Debug._errBox.style.left = (Debug._errBoxOffX + offX + 8) + "px";
00746 Debug._errBox.style.top = (Debug._errBoxOffY + offY + 8) + "px";
00747 Debug._errBox.style.marginRight = -(w+10) + "px";
00748 Debug._errBox.style.marginBottom = -(h+80) + "px";
00749
00750
00751 var el = document.getElementsByClassName(Debug._errBoxId + "-resizeBar")[0];
00752 el.style.top = (h+6) + "px";
00753 el = document.getElementsByClassName(Debug._errBoxId + "-resizeBarLeft")[0];
00754 el.style.top = (h+6-10) + "px";
00755 el = document.getElementsByClassName(Debug._errBoxId + "-resizeBarRight")[0];
00756 el.style.left = (w-5) + "px";
00757 el.style.top = (h+6-10) + "px";
00758
00759 el = document.getElementsByClassName(Debug._errBoxId + "-err")[0];
00760 el.style.height = (h-115) + "px";
00761 }
00762
00763
00764
00765 Debug.downloadMessages = function() {
00766
00767 console.log("downloading messages...");
00768
00769
00770 var dataStr = "data:text/txt;charset=utf-8,";
00771
00772 var lines = Debug._errBox.innerText.split('\n');
00773 for(var i=2;i<lines.length-2;++i)
00774 {
00775 dataStr += encodeURIComponent(lines[i] + "\n");
00776 }
00777
00778 var link = document.createElement("a");
00779 link.setAttribute("href", dataStr);
00780 link.setAttribute("style", "display:none");
00781 link.setAttribute("download", "otsdaq_Messages_download.txt");
00782 document.body.appendChild(link);
00783
00784 link.click();
00785
00786 link.parentNode.removeChild(link);
00787
00788 }
00789