2 version:[1.23,20090309],
7 "css":"http://getfirebug.com/releases/lite/1.2/firebug-lite.css",
12 "hideDOMFunctions":false,
15 "liteFilename":"firebug-lite.js",
21 "showIconWhenHidden":true,
22 "targetWindow":undefined,
25 "popupWidth":undefined,
26 "popupHeight":undefined
28 initConsole:function(){
30 * initialize the console - user defined values are not available within this method because FBLite is not yet initialized
34 if((!window.console || (window.console && !window.console.firebug)) || (firebug.env.override && !(/Firefox\/3/i.test(navigator.userAgent)))){
35 window.console = { "provider":"Firebug Lite" };
37 for(command in firebug.d.console.cmd){
38 window.console[command] = firebug.lib.util.Curry(firebug.d.console.run,window,command);
41 /*window.onerror = function(_message,_file,_line){
42 firebug.d.console.run('error',firebug.lib.util.String.format('{0} ({1},{2})',_message,firebug.getFileName(_file),_line));
46 overrideConsole:function(){
50 env.extConsole=window.console;
55 restoreConsole:function(){
60 window.console=env.extConsole;
67 var iconTitle = "Click here or press F12, (CTRL|CMD)+SHIFT+L or SHIFT+ENTER to show Firebug Lite. CTRL|CMD click this icon to hide it.";
70 if(document.getElementsByTagName('html')[0].attributes.getNamedItem('debug')){
71 env.debug = document.getElementsByTagName('html')[0].attributes.getNamedItem('debug').nodeValue !== "false";
75 env.openInPopup = false;
76 env.targetWindow = window.opener;
77 env.popupWidth = window.opener.firebug.env.popupWidth || window.opener.firebug.lib.util.GetViewport().width;
78 env.popupHeight = window.opener.firebug.env.popupHeight || window.opener.firebug.lib.util.GetViewport().height;
80 env.targetWindow = window;
81 env.popupWidth = env.popupWidth || lib.util.GetViewport().width;
82 env.popupHeight = env.popupHeight || lib.util.GetViewport().height;
85 settings.readCookie();
87 if(env.init || (env.detectFirebug && window.console && window.console.firebug)) {
91 document.getElementsByTagName("head")[0].appendChild(
92 new lib.element("link").attribute.set("rel","stylesheet").attribute.set("type","text/css").attribute.set("href",env.css).element
102 el.firebugIcon = new lib.element("div").attribute.set("id","firebugIconDiv").attribute.set("title",iconTitle).attribute.set("alt",iconTitle).event.addListener("mousedown",win.iconClicked).insert(document.body);
108 el.mainiframe = new lib.element("IFRAME").attribute.set("id","FirebugIFrame").environment.addStyle({ "display":"none", "width":lib.util.GetViewport().width+"px" }).insert(document.body);
109 el.main = new lib.element("DIV").attribute.set("id","Firebug").environment.addStyle({ "display":"none", "width":lib.util.GetViewport().width+"px" }).insert(document.body);
111 el.resizer = new lib.element("DIV").attribute.addClass("Resizer").event.addListener("mousedown",win.resizer.start).insert(el.main);
113 el.header = new lib.element("DIV").attribute.addClass("Header").insert(el.main);
115 el.left.container = new lib.element("DIV").attribute.addClass("Left").insert(el.main);
117 el.right.container = new lib.element("DIV").attribute.addClass("Right").insert(el.main);
118 el.main.child.add(new lib.element("DIV").attribute.addClass('Clear'));
124 el.button.container = new lib.element("DIV").attribute.addClass("ButtonContainer").insert(el.header);
125 el.button.logo = new lib.element("A").attribute.set("title","Firebug Lite").attribute.set("target","_blank").attribute.set("href","http://getfirebug.com/lite.html").update(" ").attribute.addClass("Button Logo").insert(el.button.container);
126 el.button.inspect = new lib.element("A").attribute.addClass("Button").event.addListener("click",env.targetWindow.firebug.d.inspector.toggle).update("Inspect").insert(el.button.container);
127 el.button.dock = new lib.element("A").attribute.addClass("Button Dock").event.addListener("click", win.dock).insert(el.button.container);
128 el.button.newWindow = new lib.element("A").attribute.addClass("Button NewWindow").event.addListener("click", win.newWindow).insert(el.button.container);
131 el.button.maximize = new lib.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container);
132 el.button.minimize = new lib.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container);
133 el.button.close = new lib.element("A").attribute.addClass("Button Close").event.addListener("click",win.hide).insert(el.button.container);
136 if(lib.env.ie||lib.env.webkit){
137 el.button.container.environment.addStyle({ "paddingTop":"12px" });
144 el.nav.container = new lib.element("DIV").attribute.addClass("Nav").insert(el.left.container);
145 el.nav.console = new lib.element("A").attribute.addClass("Tab Selected").event.addListener("click",lib.util.Curry(d.navigate,window,"console")).update("Console").insert(el.nav.container);
146 el.nav.html = new lib.element("A").attribute.addClass("Tab").update("HTML").event.addListener("click",lib.util.Curry(d.navigate,window,"html")).insert(el.nav.container);
147 el.nav.css = new lib.element("A").attribute.addClass("Tab").update("CSS").event.addListener("click",lib.util.Curry(d.navigate,window,"css")).insert(el.nav.container);
149 el.nav.scripts = new lib.element("A").attribute.addClass("Tab").update("Script").event.addListener("click",lib.util.Curry(d.navigate,window,"scripts")).insert(el.nav.container);
151 el.nav.dom = new lib.element("A").attribute.addClass("Tab").update("DOM").event.addListener("click",lib.util.Curry(d.navigate,env.targetWindow,"dom")).insert(el.nav.container);
152 el.nav.xhr = new lib.element("A").attribute.addClass("Tab").update("XHR").event.addListener("click",lib.util.Curry(d.navigate,window,"xhr")).insert(el.nav.container);
153 el.nav.optionsdiv = new lib.element("DIV").attribute.addClass("Settings").insert(el.nav.container);
154 el.nav.options = new lib.element("A").attribute.addClass("Tab").update("Options ∨").event.addListener("click", settings.toggle).insert(el.nav.optionsdiv);
159 el.borderInspector = new lib.element("DIV").attribute.set("id","FirebugBorderInspector").event.addListener("click",listen.inspector).insert(document.body);
160 el.bgInspector = new lib.element("DIV").attribute.set("id","FirebugBGInspector").insert(document.body);
165 el.left.console = {};
166 el.left.console.container = new lib.element("DIV").attribute.addClass("Console").insert(el.left.container);
167 el.left.console.mlButton = new lib.element("A").attribute.addClass("MLButton").event.addListener("click",d.console.toggleML).insert(el.left.console.container);
168 el.left.console.monitor = new lib.element("DIV").insert(
169 new lib.element("DIV").attribute.addClass("Monitor").insert(el.left.console.container)
171 el.left.console.container.child.add(
172 new lib.element("DIV").attribute.addClass("InputArrow").update(">>>")
174 el.left.console.input = new lib.element("INPUT").attribute.set("type","text").attribute.addClass("Input").event.addListener("keydown",listen.consoleTextbox).insert(
175 new lib.element("DIV").attribute.addClass("InputContainer").insert(el.left.console.container)
178 el.right.console = {};
179 el.right.console.container = new lib.element("DIV").attribute.addClass("Console Container").insert(el.right.container);
180 el.right.console.mlButton = new lib.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.console.container);
181 el.right.console.input = new lib.element("TEXTAREA").attribute.addClass("Input").insert(el.right.console.container);
182 el.right.console.input.event.addListener("keydown",lib.util.Curry(tab,window,el.right.console.input.element));
183 el.right.console.run = new lib.element("A").attribute.addClass("Button").event.addListener("click",listen.runMultiline).update("Run").insert(el.right.console.container);
184 el.right.console.clear = new lib.element("A").attribute.addClass("Button").event.addListener("click",lib.util.Curry(d.clean,window,el.right.console.input)).update("Clear").insert(el.right.console.container);
186 el.button.console = {};
187 el.button.console.container = new lib.element("DIV").attribute.addClass("ButtonSet").insert(el.button.container);
188 el.button.console.clear = new lib.element("A").attribute.addClass("Button").event.addListener("click",d.console.clear).update("Clear").insert(el.button.console.container);
195 el.left.html.container = new lib.element("DIV").attribute.addClass("HTML").insert(el.left.container);
198 el.right.html.container = new lib.element("DIV").attribute.addClass("HTML Container").insert(el.right.container);
200 el.right.html.nav = {};
201 el.right.html.nav.container = new lib.element("DIV").attribute.addClass("Nav").insert(el.right.html.container);
202 el.right.html.nav.computedStyle = new lib.element("A").attribute.addClass("Tab Selected").event.addListener("click",lib.util.Curry(d.html.navigate,firebug,"computedStyle")).update("Computed Style").insert(el.right.html.nav.container);
203 el.right.html.nav.dom = new lib.element("A").attribute.addClass("Tab").event.addListener("click",lib.util.Curry(d.html.navigate,firebug,"dom")).update("DOM").insert(el.right.html.nav.container);
205 el.right.html.content = new lib.element("DIV").attribute.addClass("Content").insert(el.right.html.container);
208 el.button.html.container = new lib.element("DIV").attribute.addClass("ButtonSet HTML").insert(el.button.container);
215 el.left.css.container = new lib.element("DIV").attribute.addClass("CSS").insert(el.left.container);
218 el.right.css.container = new lib.element("DIV").attribute.addClass("CSS Container").insert(el.right.container);
220 el.right.css.nav = {};
221 el.right.css.nav.container = new lib.element("DIV").attribute.addClass("Nav").insert(el.right.css.container);
222 el.right.css.nav.runCSS = new lib.element("A").attribute.addClass("Tab Selected").update("Run CSS").insert(el.right.css.nav.container);
224 el.right.css.mlButton = new lib.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.css.container);
225 el.right.css.input = new lib.element("TEXTAREA").attribute.addClass("Input").insert(el.right.css.container);
226 el.right.css.input.event.addListener("keydown",lib.util.Curry(firebug.tab,window,el.right.css.input.element));
227 el.right.css.run = new lib.element("A").attribute.addClass("Button").event.addListener("click",listen.runCSS).update("Run").insert(el.right.css.container);
228 el.right.css.clear = new lib.element("A").attribute.addClass("Button").event.addListener("click",lib.util.Curry(d.clean,window,el.right.css.input)).update("Clear").insert(el.right.css.container);
231 el.button.css.container = new lib.element("DIV").attribute.addClass("ButtonSet CSS").insert(el.button.container);
232 el.button.css.selectbox = new lib.element("SELECT").event.addListener("change",listen.cssSelectbox).insert(el.button.css.container);
238 el.left.scripts = {};
239 el.left.scripts.container = new lib.element("DIV").attribute.addClass("Scripts").insert(el.left.container);
241 el.right.scripts = {};
242 el.right.scripts.container = new lib.element("DIV").attribute.addClass("Scripts Container").insert(el.right.container);
244 el.button.scripts = {};
245 el.button.scripts.container = new lib.element("DIV").attribute.addClass("ButtonSet Scripts").insert(el.button.container);
246 el.button.scripts.selectbox = new lib.element("SELECT").event.addListener("change",listen.scriptsSelectbox).insert(el.button.scripts.container);
247 el.button.scripts.lineNumbers = new lib.element("A").attribute.addClass("Button").event.addListener("click",d.scripts.toggleLineNumbers).update("Show Line Numbers").insert(el.button.scripts.container);
254 el.left.dom.container = new lib.element("DIV").attribute.addClass("DOM").insert(el.left.container);
257 el.right.dom.container = new lib.element("DIV").attribute.addClass("DOM Container").insert(el.right.container);
260 el.button.dom.container = new lib.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container);
261 el.button.dom.label = new lib.element("LABEL").update("Object Path:").insert(el.button.dom.container);
262 el.button.dom.textbox = new lib.element("INPUT").event.addListener("keydown",listen.domTextbox).update(env.isPopup?"window.opener":"window").insert(el.button.dom.container);
268 el.left.str.container = new lib.element("DIV").attribute.addClass("STR").insert(el.left.container);
271 el.right.str.container = new lib.element("DIV").attribute.addClass("STR").insert(el.left.container);
274 el.button.str.container = new lib.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);
275 el.button.str.watch = new lib.element("A").attribute.addClass("Button").event.addListener("click",lib.util.Curry(d.navigate,window,"xhr")).update("Back").insert(el.button.str.container);
281 el.left.xhr.container = new lib.element("DIV").attribute.addClass("XHR").insert(el.left.container);
284 el.right.xhr.container = new lib.element("DIV").attribute.addClass("XHR").insert(el.left.container);
288 el.button.xhr.container = new lib.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);
289 el.button.xhr.label = new lib.element("LABEL").update("XHR Path:").insert(el.button.xhr.container);
290 el.button.xhr.textbox = new lib.element("INPUT").event.addListener("keydown",listen.xhrTextbox).insert(el.button.xhr.container);
291 el.button.xhr.watch = new lib.element("A").attribute.addClass("Button").event.addListener("click",listen.addXhrObject).update("Watch").insert(el.button.xhr.container);
297 el.settings.container = new lib.element("DIV").child.add(
298 new lib.element("DIV").attribute.addClass("Header").child.add(
299 new lib.element().attribute.addClass("Title").update('Firebug Lite Settings')
301 ).attribute.addClass("SettingsDiv").insert(el.main);
302 el.settings.content = new lib.element("DIV").attribute.addClass("Content").insert(el.settings.container);
303 el.settings.progressDiv = new lib.element("DIV").attribute.addClass("ProgressDiv").insert(el.settings.content);
304 el.settings.progress = new lib.element("DIV").attribute.addClass("Progress").insert(el.settings.progressDiv);
305 el.settings.cbxDebug = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content);
306 el.settings.content.child.add(document.createTextNode("Start visible"));
307 new lib.element("BR").insert(el.settings.content);
308 el.settings.cbxDetectFirebug = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content);
309 el.settings.content.child.add(document.createTextNode("Hide when Firebug active"));
310 new lib.element("BR").insert(el.settings.content);
311 el.settings.cbxHideDOMFunctions = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content);
312 el.settings.content.child.add(document.createTextNode("Hide DOM functions"));
313 new lib.element("BR").insert(el.settings.content);
314 el.settings.cbxOverride = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content);
315 el.settings.content.child.add(document.createTextNode("Override window.console"));
316 new lib.element("BR").insert(el.settings.content);
317 el.settings.cbxShowIcon = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content);
318 el.settings.content.child.add(document.createTextNode("Show icon when hidden"));
319 new lib.element("BR").insert(el.settings.content);
320 el.settings.cbxOpenInPopup = new lib.element("INPUT").attribute.set("type","checkbox").attribute.addClass("SettingsCBX").insert(el.settings.content);
321 el.settings.content.child.add(document.createTextNode("Open in popup"));
322 el.settings.buttonDiv = new lib.element("DIV").insert(el.settings.content);
323 el.settings.buttonLeftDiv = new lib.element("DIV").attribute.addClass("ButtonsLeft").insert(el.settings.buttonDiv);
324 el.settings.resetButton = new lib.element("INPUT").attribute.set("type","button").update("Reset").event.addListener("click",settings.reset).insert(el.settings.buttonLeftDiv);
325 el.settings.buttonRightDiv = new lib.element("DIV").attribute.addClass("ButtonsRight").insert(el.settings.buttonDiv);
326 el.settings.cancelButton = new lib.element("INPUT").attribute.set("type","button").update("Cancel").event.addListener("click",settings.hide).insert(el.settings.buttonRightDiv);
327 el.settings.buttonRightDiv.child.add(document.createTextNode(" "));
328 el.settings.saveButton = new lib.element("INPUT").attribute.set("type","button").update("Save").event.addListener("click",settings.saveClicked).insert(el.settings.buttonRightDiv);
330 lib.util.AddEvent(document,"mousemove",listen.mouse)("mousemove",win.resizer.resize)("mouseup",win.resizer.stop)("keydown",listen.keyboard);
334 for(var i=0, len=d.console.cache.length; i<len; i++){
335 var item = d.console.cache[i];
336 d.console.cmd[item.command].apply(window,item.arg);
340 window.onscroll = lib.util.Curry(win.setVerticalPosition,window,null);
345 el.button.console.clear,
346 el.right.console.run,
347 el.right.console.clear,
351 for(var i=0, len=buttons.length; i<len; i++)
352 buttons[i].attribute.set("href","#");
356 if(env.showIconWhenHidden) {
358 el.firebugIcon.environment.addStyle({ "display": env.debug&&'none'||'block' });
362 lib.util.AddEvent(window, "unload", win.unload);
365 env.height=lib.util.GetViewport().height;
366 lib.util.AddEvent(window, "resize", win.fitToPopup);
369 lib.util.AddEvent(window, "resize", win.refreshSize);
372 win.setHeight(env.height);
374 if(env.openInPopup&&!env.isPopup) {
377 el.main.environment.addStyle({ "display":env.debug&&'block'||'none' });
378 el.mainiframe.environment.addStyle({ "display":env.debug&&'block'||'none' });
383 return firebug.d.html.inspect.apply(window,arguments);
387 d.xhr.addObject.apply(window,arguments);
388 if(env.dIndex!="xhr"){
397 var posXY=lib.util.Element.getPosition(firebug.el.nav.options.element);
398 settings.refreshForm();
400 el.settings.container.environment.addStyle({
402 "left": (posXY.offsetLeft-125)+"px"
404 el.settings.progressDiv.environment.addStyle({
407 firebug.settings.isVisible = true;
412 firebug.el.settings.container.environment.addStyle({
415 firebug.settings.isVisible = false;
420 settings[!settings.isVisible && 'show' || 'hide']();
423 saveClicked: function() {
424 firebug.el.settings.progressDiv.environment.addStyle({
427 setTimeout(firebug.settings.formToSettings,0);
429 formToSettings: function() {
432 elSet=firebug.el.settings,
435 fe.debug=elSet.cbxDebug.element.checked;
436 fe.detectFirebug=elSet.cbxDetectFirebug.element.checked;
437 fe.hideDOMFunctions=elSet.cbxHideDOMFunctions.element.checked;
438 fe.override=elSet.cbxOverride.element.checked;
439 fe.showIconWhenHidden=elSet.cbxShowIcon.element.checked;
440 fe.openInPopup=elSet.cbxOpenInPopup.element.checked;
443 ofe=window.opener.firebug.env;
445 ofe.detectFirebug=fe.detectFirebug;
446 ofe.hideDOMFunctions=fe.hideDOMFunctions;
447 ofe.override=fe.override;
448 ofe.showIconWhenHidden=fe.showIconWhenHidden;
449 ofe.openInPopup=fe.openInPopup;
450 ofe.popupTop=fe.popupTop;
451 ofe.popupLeft=fe.popupLeft;
452 ofe.popupWidth=fe.popupWidth;
453 ofe.popupHeight=fe.popupHeight;
457 settings.writeCookie();
463 var exdate=new Date();
465 exdate.setTime(exdate.getTime()-1);
466 document.cookie='FBLiteSettings=;expires='+exdate.toGMTString();
467 location.reload(true);
469 readCookie: function() {
470 var i,cookieArr,valueArr,item,value;
473 if(targetWindow.document.cookie.length>0) {
474 cookieArr=targetWindow.document.cookie.split('; ');
476 for(i=0;i<cookieArr.length;i++) {
477 if(cookieArr[i].split('=')[0]=='FBLiteSettings') {
478 valueArr=cookieArr[i].split('=')[1].split(',');
483 for(i=0;i<valueArr.length;i++) {
484 item=valueArr[i].split(':')[0];
485 value=valueArr[i].split(':')[1];
491 case 'detectFirebug':
492 detectFirebug=value=="true";
494 case 'hideDOMFunctions':
495 hideDOMFunctions=value=="true";
498 override=value=="true";
500 case 'showIconWhenHidden':
501 showIconWhenHidden=value=="true";
504 openInPopup=value=="true";
507 popupTop=parseInt(value,10);
510 popupLeft=parseInt(value,10);
513 popupWidth=parseInt(value,10);
516 popupHeight=parseInt(value,10);
519 height=parseInt(value,10);
527 writeCookie: function() {
531 values='debug:'+debug+',';
532 values+='detectFirebug:'+detectFirebug+',';
533 values+='hideDOMFunctions:'+hideDOMFunctions+',';
534 values+='override:'+override+',';
535 values+='showIconWhenHidden:'+showIconWhenHidden+',';
536 values+='openInPopup:'+openInPopup+',';
539 if(window.outerWidth===undefined) {
540 values+='popupTop:'+(window.screenTop-56)+',';
541 values+='popupLeft:'+(window.screenLeft-8)+',';
542 values+='popupWidth:'+document.body.clientWidth+',';
543 values+='popupHeight:'+document.body.clientHeight+',';
545 values+='popupTop:'+window.screenY+',';
546 values+='popupLeft:'+window.screenX+',';
547 values+='popupWidth:'+window.outerWidth+',';
548 values+='popupHeight:'+window.outerHeight+',';
551 values+='popupTop:'+popupTop+',';
552 values+='popupLeft:'+popupLeft+',';
553 values+='popupWidth:'+popupWidth+',';
554 values+='popupHeight:'+popupHeight+',';
557 values+='height:'+(parseInt(targetWindow.firebug.el.main.element.style.height.replace(/px/,''),10)-38);
560 exdate.setDate(exdate.getDate()+365);
561 targetWindow.document.cookie='FBLiteSettings='+values+';expires='+exdate.toGMTString();
564 refreshForm: function() {
566 elSet=firebug.el.settings;
568 elSet.cbxDebug.element.checked=fe.debug;
569 elSet.cbxDetectFirebug.element.checked=fe.detectFirebug;
570 elSet.cbxHideDOMFunctions.element.checked=fe.hideDOMFunctions;
571 elSet.cbxOverride.element.checked=fe.override;
572 elSet.cbxShowIcon.element.checked=fe.showIconWhenHidden;
573 elSet.cbxOpenInPopup.element.checked=fe.openInPopup;
579 el.main.environment.addStyle({
582 el.mainiframe.environment.addStyle({
585 if(env.showIconWhenHidden) {
586 el.firebugIcon.environment.addStyle({
594 el.main.environment.addStyle({
597 el.mainiframe.environment.addStyle({
600 if(env.showIconWhenHidden) {
601 el.firebugIcon.environment.addStyle({
607 iconClicked:function(_event) {
609 if(_event.ctrlKey==true||_event.metaKey==true) {
610 el.firebugIcon.environment.addStyle({ "display": "none" });
611 env.showIconWhenHidden=false;
620 el.main.environment.addStyle({ "height":"35px" });
621 el.mainiframe.environment.addStyle({ "height":"35px" });
622 el.button.maximize.environment.addStyle({ "display":"block" });
623 el.button.minimize.environment.addStyle({ "display":"none" });
630 el.button.minimize.environment.addStyle({ "display":"block" });
631 el.button.maximize.environment.addStyle({ "display":"none" });
632 win.setHeight(env.height);
635 newWindow: function() {
636 var interval,scripts,script,scriptPath,
640 scripts = document.getElementsByTagName('script');
642 fe.popupWin = window.open("", "_firebug",
643 "status=0,menubar=0,resizable=1,top="+fe.popupTop+",left="+fe.popupLeft+",width=" + fe.popupWidth +
644 ",height=" + fe.popupHeight + ",scrollbars=0,addressbar=0,outerWidth="+fe.popupWidth+",outerHeight="+fe.popupHeight+
645 "toolbar=0,location=0,directories=0,dialog=0");
648 alert("Firebug Lite could not open a pop-up window, most likely because of a popup blocker.\nPlease enable popups for this domain");
650 firebug.settings.hide();
652 for (i=0,len=scripts.length; i<len; i++) {
653 if (scripts[i].src.indexOf(fe.liteFilename) > -1) {
654 scriptPath = scripts[i].src;
660 script = fe.popupWin.document.createElement('script'), done = false;
661 script.type = 'text/javascript';
662 script.src = scriptPath;
664 script[firebug.lib.env.ie?"onreadystatechange":"onload"] = function(){
665 if(!done && (!firebug.lib.env.ie || this.readyState == "complete" || this.readyState=="loaded")){
667 if(fe.popupWin.firebug) {
668 with(fe.popupWin.firebug) {
672 el.button.dock.environment.addStyle({ "display": "block"});
673 el.button.newWindow.environment.addStyle({ "display": "none"});
679 if (!done && firebug.lib.env.webkit) {
680 fe.popupWin.document.write('<html><head></head><body></body></html>');
681 interval = setInterval(function() {
682 if (fe.popupWin.firebug) {
683 clearInterval(interval);
685 with(fe.popupWin.firebug) {
689 el.button.dock.environment.addStyle({ "display": "block"});
690 el.button.newWindow.environment.addStyle({ "display": "none"});
697 fe.popupWin.document.getElementsByTagName('head')[0].appendChild(script);
698 firebug.el.main.environment.addStyle({"display": "none"});
699 firebug.el.mainiframe.environment.addStyle({"display": "none"});
702 alert("Unable to detect the following script \"" + fe.liteFilename +
703 "\" ... if the script has been renamed then please set the value of firebug.env.liteFilename to reflect this change");
711 with(opener.firebug) {
713 el.main.environment.addStyle({
716 el.mainiframe.environment.addStyle({
719 settings.readCookie();
727 } else if(env.popupWin) {
728 env.popupWin.close();
732 fitToPopup: function() {
734 var viewport = lib.util.GetViewport(window);
735 win.setHeight((window.innerHeight||viewport.height) - 38);
736 el.main.environment.addStyle({
737 "width": (viewport.width) + "px"
739 el.mainiframe.environment.addStyle({
740 "width": (viewport.width) + "px"
746 start:function(_event){
748 if(env.minimized)return;
749 win.resizer.y=[el.main.element.offsetHeight,_event.clientY];
751 win.resizer.y[3]=parseInt(el.main.environment.getPosition().top);
753 win.resizer.enabled=true;
756 resize:function(_event){
758 if(!win.resizer.enabled)return;
759 win.resizer.y[2]=(win.resizer.y[0]+(win.resizer.y[1]-_event.clientY));
760 el.main.environment.addStyle({ "height":win.resizer.y[2]+"px" });
761 el.mainiframe.environment.addStyle({ "height":win.resizer.y[2]+"px" });
763 el.main.environment.addStyle({ "top":win.resizer.y[3]-(win.resizer.y[1]-_event.clientY)+"px" });
764 el.mainiframe.environment.addStyle({ "top":win.resizer.y[3]-(win.resizer.y[1]-_event.clientY)+"px" });
768 stop:function(_event){
770 if(win.resizer.enabled){
771 win.resizer.enabled=false;
772 win.setHeight(win.resizer.y[2]-35);
777 setHeight:function(_height){
781 el.left.container.environment.addStyle({ "height":_height+"px" });
782 el.right.container.environment.addStyle({ "height":_height+"px" });
783 el.main.environment.addStyle({ "height":_height+38+"px" });
784 el.mainiframe.environment.addStyle({ "height":_height+38+"px" });
789 el.left.console.monitor.element.parentNode.style.height=_height-47+"px";
790 el.left.console.mlButton.environment.addStyle({ "top":_height+19+"px" });
791 el.right.console.mlButton.environment.addStyle({ "top":_height+19+"px" });
792 el.right.console.input.environment.addStyle({ "height":_height-29+"px" });
795 el.left.html.container.environment.addStyle({"height":_height-23+"px"});
796 el.right.html.content.environment.addStyle({"height":_height-23+"px"});
799 el.left.css.container.environment.addStyle({"height":_height-33+"px"});
800 el.right.css.input.environment.addStyle({ "height":_height-55+"px" });
803 el.left.scripts.container.environment.addStyle({"height":_height-23+"px"});
806 el.left.dom.container.environment.addStyle({"height":_height-31+"px"});
809 el.left.xhr.container.environment.addStyle({"height":_height-32+"px"});
812 el.left.str.container.environment.addStyle({"height":_height-32+"px"});
815 refreshDOM:function(){
817 d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container);
818 if(d.html.nIndex=="dom"){
819 firebug.d.html.navigate("dom")
823 refreshSize:function(){
828 var dim = lib.util.GetViewport();
829 el.main.environment.addStyle({ "width":dim.width+"px"});
830 el.mainiframe.environment.addStyle({ "width":dim.width+"px"});
832 win.setVerticalPosition(dim);
835 setVerticalPosition:function(_dim,_event){
837 var dim = _dim||lib.util.GetViewport();
838 el.main.environment.addStyle({ "top":dim.height-el.main.environment.getSize().offsetHeight+Math.max(document.documentElement.scrollTop,document.body.scrollTop)+"px" });
839 el.mainiframe.environment.addStyle({ "top":dim.height-el.main.environment.getSize().offsetHeight+Math.max(document.documentElement.scrollTop,document.body.scrollTop)+"px" });
844 clean:function(_element){
852 return new lib.element("DIV").attribute.addClass("Row").insert(el.left.console.monitor);
858 d.clean(el.left.console.monitor);
859 d.console.cache = [];
862 formatArgs:function(){
865 for(var i=0, len=arguments.length; i<len; i++){
866 content.push( d.highlight(arguments[i],false,false,true) );
868 return content.join(" ");
871 history:[], historyIndex:0,
872 openObject:function(_index){
874 d.dom.open(d.console.cache[_index], el.left.dom.container, lib.env.ie);
878 print: function(_cmd,_text){
880 d.console.addLine().attribute.addClass("Arrow").update(">>> "+_cmd);
881 d.console.addLine().update(d.highlight(_text,false,false,true));
885 printException: function(_exception){
887 var message = _exception.description||_exception.message||_exception;
888 if(_exception.fileName){
889 message+=' ('+(_exception.name&&(_exception.name+', ')||'')+getFileName(_exception.fileName)+', '+_exception.lineNumber+')';
891 d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+message,true);
900 el.left.console.input.environment.getElement().value = "";
901 d.console.historyIndex = d.console.history.push(_cmd);
904 if(_cmd==='console.firebug') {
905 d.console.addLine().attribute.addClass("Arrow").update(firebug.version);
907 result = eval.call(window,_cmd);
908 d.console.print(_cmd,result);
911 d.console.addLine().attribute.addClass("Arrow").update(">>> "+_cmd);
912 d.console.printException(e);
919 el.left.console.monitor.environment.getElement().parentNode.scrollTop = Math.abs(el.left.console.monitor.environment.getSize().offsetHeight-(el.left.console.monitor.element.parentNode.offsetHeight-11));
922 run:function(_command){
925 d.console.cache.push({ "command":_command, "arg":Array.prototype.slice.call(arguments,1) });
927 d.console.cmd[_command].apply(window,Array.prototype.slice.call(arguments,1));
935 d.navigateRightColumn("console",open);
936 el[open?"left":"right"].console.mlButton.environment.addStyle({ display:"none" });
937 el[!open?"left":"right"].console.mlButton.environment.addStyle({ display:"block" });
938 el.left.console.mlButton.attribute[(open?"add":"remove")+"Class"]("CloseML");
941 countMap:{}, timeMap: {},
943 log: function(_value){
945 var args = d.console.formatArgs.apply(window,arguments);
946 d.console.addLine().attribute.addClass("Log").update(args);
950 warn: function(_value){
952 var args = d.console.formatArgs.apply(window,arguments);
953 d.console.addLine().attribute.addClass("Warn").update(args);
957 info: function(_value){
959 var args = d.console.formatArgs.apply(window,arguments);
960 d.console.addLine().attribute.addClass("Info").update(args);
964 debug: function(_value){
966 var args = d.console.formatArgs.apply(window,arguments);
967 d.console.addLine().attribute.addClass("Debug").update(args);
971 error: function(_value){
973 var args = d.console.formatArgs.apply(window,arguments);
974 d.console.addLine().attribute.addClass("Error").update(args);
978 trace: function(_value){
980 var stackAmt = 3, f = arguments.caller, isArray = lib.util.IsArray(f); //function that called trace
982 if((!isArray&&f)||(isArray&&f.length>0)){
983 d.console.addLine().attribute.addClass("Arrow").update(">>> console.trace(stack)");
984 for(var i=0;i<stackAmt;i++){
985 var func = f.toString(), args = f.arguments;
986 d.dom.open({"function":func, "arguments":args},d.console.addLine());
992 dir:function(_value){
994 d.console.addLine().attribute.addClass("Arrow").update(">>> console.dir("+_value+")");
995 d.dom.open(_value,d.console.addLine());
1000 d.console.cmd.log.apply(this, arguments);
1003 time: function(_name){
1005 d.console.timeMap[_name] = new Date().getTime();
1008 timeEnd: function(_name){
1010 if(_name in d.console.timeMap){
1011 var delta = new Date().getTime() - d.console.timeMap[_name],
1012 args = d.console.formatArgs.apply(window,[_name+":", delta+"ms"]);
1013 d.console.addLine().attribute.addClass("log").update(args);
1014 delete d.console.timeMap[_name];
1018 count: function(_name){
1020 if(!d.console.countMap[_name])
1021 d.console.countMap[_name] = 0;
1022 d.console.countMap[_name]++;
1023 d.console.cmd.log.apply(window, [_name, d.console.countMap[_name]]);
1028 d.console.cmd.log.apply(this, ["console.group is not supported"]);
1031 groupEnd:function(){
1033 d.console.cmd.log.apply(this, ["console.groupEnd is not supported"]);
1038 d.console.cmd.log.apply(this, ["console.profile is not supported"]);
1041 profileEnd:function(){
1043 d.console.cmd.log.apply(this, ["console.profileEnd is not supported"]);
1050 open:function(_index){
1052 var item = env.targetWindow.document.styleSheets[_index],
1055 var rules = item[lib.env.ie ? "rules" : "cssRules"], str = "";
1056 for (var i=0; i<rules.length; i++) {
1057 var item = rules[i];
1058 var selector = item.selectorText;
1059 var cssText = lib.env.ie?item.style.cssText:item.cssText.match(/\{(.*)\}/)[1];
1060 str+=d.css.printRule(selector, cssText.split(";"), el.left.css.container);
1063 str="<em>Access to restricted URI denied</em>";
1065 el.left.css.container.update(str);
1068 printRule:function(_selector,_css,_layer){
1070 var str = "<div class='Selector'>"+_selector+" {</div>";
1071 for(var i=0,len=_css.length; i<len; i++){
1073 str += "<div class='CSSText'>"+item.replace(/(.+\:)(.+)/,"<span class='CSSProperty'>$1</span><span class='CSSValue'>$2;</span>")+"</div>";
1075 str+="<div class='Selector'>}</div>";
1081 el.button.css.selectbox.update("");
1082 var collection = env.targetWindow.document.styleSheets;
1083 for(var i=0,len=collection.length; i<len; i++){
1084 var uri = getFileName(collection[i].href);
1085 d.css.index=d.css.index<0?i:d.css.index;
1086 el.button.css.selectbox.child.add(
1087 new lib.element("OPTION").attribute.set("value",i).update(uri)
1090 d.css.open(d.css.index);
1095 open: function(_object,_layer){
1098 var container = new lib.element("DIV").attribute.addClass("DOMContent").insert(_layer);
1099 d.dom.print(_object, container);
1102 print:function(_object,_parent, _inTree){
1104 var obj = _object || window, parentElement = _parent;
1105 parentElement.update("");
1107 if(parentElement.opened&&parentElement!=el.left.dom.container){
1108 parentElement.environment.getParent().lib.child.get()[0].lib.child.get()[0].lib.attribute.removeClass("Opened");
1109 parentElement.opened = false;
1110 parentElement.environment.addStyle({ "display":"none" });
1114 parentElement.environment.getParent().lib.child.get()[0].lib.child.get()[0].lib.attribute.addClass("Opened");
1115 parentElement.opened = true;
1117 for (var key in obj) {
1119 if (env.hideDOMFunctions && typeof(obj[key]) == "function") continue;
1120 var value = obj[key], property = key, container = new lib.element("DIV").attribute.addClass("DOMRow").insert(parentElement),
1121 left = new lib.element("DIV").attribute.addClass("DOMRowLeft").insert(container), right = new lib.element("DIV").attribute.addClass("DOMRowRight").insert(container);
1123 container.child.add(
1124 new lib.element("DIV").attribute.addClass('Clear')
1127 var link = new lib.element("A").attribute.addClass(
1128 typeof value=="object"&&Boolean(value)?"Property Object":"Property"
1129 ).update(property).insert(left);
1131 right.update(d.highlight(value,false,true));
1133 var subContainer = new lib.element("DIV").attribute.addClass("DOMRowSubContainer").insert(container);
1135 if(typeof value!="object"||Boolean(value)==false)
1138 link.event.addListener("click",lib.util.Curry(d.dom.print,window,value, subContainer, true));
1142 parentElement.environment.addStyle({ "display":"block" });
1146 highlight:function(_value,_inObject,_inArray,_link){
1148 var isArray = false, isHash, isElement = false, vtype=typeof _value, result=[];
1150 if(vtype=="object"){
1151 if(Object.prototype.toString.call(_value) === "[object Date]"){
1153 } else if(Object.prototype.toString.call(_value) === "[object String]"){
1155 } else if(Object.prototype.toString.call(_value) === "[object Boolean]"){
1157 } else if(Object.prototype.toString.call(_value) === "[object RegExp]"){
1163 isArray = lib.util.IsArray(_value);
1164 isHash = lib.util.IsHash(_value);
1165 isElement = _value!=undefined&&Boolean(_value.nodeName)&&Boolean(_value.nodeType);
1167 // number, string, boolean, null, function
1168 if(_value==null||vtype=="number"||vtype=="string"||vtype=="boolean"||vtype=="function"||vtype=="regexp"||vtype=="date"){
1170 result.push("<span class='Null'>null</span>");
1171 }else if (vtype=="regexp") {
1172 result.push("<span class='Maroon'>" + _value + "</span>");
1173 }else if (vtype=="date") {
1174 result.push("<span class='DarkBlue'>'" + _value + "'</span>");
1175 } else if (vtype=="boolean"||vtype=="number") {
1176 result.push("<span class='DarkBlue'>" + _value + "</span>");
1177 } else if(vtype=="function"){
1178 result.push("<span class='"+(_inObject?"Italic Gray":"Green")+"'>function()</span>");
1180 result.push("<span class='Red'>\""+( !_inObject&&!_inArray?_value : _value.substring(0,35)+(_value.length>35?" ...":"") ).replace(/\n/g,"\\n").replace(/\s/g," ").replace(/>/g,">").replace(/</g,"<")+"\"</span>");
1186 if(_value.nodeType==3)
1187 result.push(d.highlight(_value.nodeValue));
1189 result.push("<span class='Gray Italic'>"+_value.nodeName.toLowerCase()+"</span>");
1191 result.push("<span class='Blue"+ ( !_link?"'":" ObjectLink' onmouseover='this.className=this.className.replace(\"ObjectLink\",\"ObjectLinkHover\")' onmouseout='this.className=this.className.replace(\"ObjectLinkHover\",\"ObjectLink\")' onclick='firebug.d.html.inspect(firebug.d.console.cache[" +( d.console.cache.push( _value ) -1 )+"])'" ) + "'>");
1194 result.push(_value.nodeName.toLowerCase());
1195 if(_value.getAttribute){
1196 if(_value.getAttribute&&_value.getAttribute("id"))
1197 result.push("<span class='DarkBlue'>#"+_value.getAttribute("id")+"</span>");
1198 var elClass = _value.getAttribute(lib.env.ie&&!lib.env.ie8?"className":"class")||"";
1199 result.push(!elClass?"":"<span class='Red'>."+elClass.split(" ")[0]+"</span>");
1201 result.push("</span>");
1203 result.push("<span class='DarkBlue'><<span class='Blue TagName'>"+ _value.nodeName.toLowerCase());
1205 if(_value.attributes){
1206 for(var i=0,len=_value.attributes.length; i<len; i++){
1207 var item = _value.attributes[i];
1209 if(!lib.env.ie||item.nodeValue)
1210 result.push(" <span class='DarkBlue'>"+item.nodeName+"=\"<span class='Red'>"+item.nodeValue+"</span>\"</span>");
1214 result.push("</span>></span>");
1219 else if(isArray||isHash){
1222 result.push("<span class='Gray Italic'>["+_value.length+"]</span>");
1224 result.push("<span class='Strong'>[ ");
1226 for(var i=0,len=_value.length; i<len; i++){
1227 if((_inObject||_inArray)&&i>3){
1228 result.push(", <span class='Strong Gray'>"+(len-4)+" More...</span>");
1231 result.push( (i > 0 ? ", " : "") + d.highlight(_value[i], false, true, true) );
1234 result.push(" ]</span>");
1236 } else if(_inObject){
1237 result.push("<span class='Gray Italic'>Object</span>");
1239 result.push("<span class='Strong Green"+ ( !_link?"'":" ObjectLink' onmouseover='this.className=this.className.replace(\"ObjectLink\",\"ObjectLinkHover\")' onmouseout='this.className=this.className.replace(\"ObjectLinkHover\",\"ObjectLink\")' onclick='firebug.d.console.openObject(" +( d.console.cache.push( _value ) -1 )+")'" ) + ">Object");
1241 for(var key in _value){
1242 var value = _value[key];
1243 if((_inObject||_inArray)&&i>3){
1244 result.push(" <span class='Strong Gray'>More...</span>");
1247 result.push(" "+key+"="+d.highlight(value,true));
1250 result.push("</span>");
1253 result.push(["<span class'Gray Italic'>"+_value+"</span>"]);
1258 return result.join("");
1262 nIndex:"computedStyle",
1264 highlight:function(_element,_clear,_event){
1266 if(_element.firebugElement){
1270 env.targetWindow.firebug.el.bgInspector.environment.addStyle({ "display":"none" });
1273 d.inspector.inspect(_element,true);
1276 inspect:function(_element){
1284 if (parent == firebug.env.targetWindow.document.body) break;
1285 parent = parent.parentNode;
1287 map = map.reverse();
1289 if (env.dIndex != "html") {
1290 env.targetWindow.firebug.d.navigate("html");
1293 env.targetWindow.firebug.d.inspector.toggle(false);
1295 for (t = 0; t < el.left.html.container.child.get().length; t++) {
1296 if (el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0]) {
1297 if (el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0].innerText) {
1298 tagName = el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0].innerText;
1300 tagName = el.left.html.container.child.get()[t].childNodes[0].childNodes[1].childNodes[0].childNodes[0].textContent;
1303 if (/<body/i.test(tagName)) {
1304 parentLayer = el.left.html.container.child.get()[t].childNodes[1].lib;
1311 parentLayer = el.left.html.container.child.get()[3].childNodes[1].lib;
1314 for (t = 0, len = map.length; map[t]; t++) {
1316 var link = parentLayer.environment.getElement().previousSibling.lib;
1317 link.attribute.addClass("Selected");
1319 if (d.html.current) {
1320 d.html.current[1].attribute.removeClass("Selected");
1322 d.html.current = [_element, link];
1325 parentLayer = d.html.openHtmlTree(map[t], parentLayer, map[t + 1]);
1329 navigate:function(_index,_element){
1331 el.right.html.nav[d.html.nIndex].attribute.removeClass("Selected");
1332 el.right.html.nav[_index].attribute.addClass("Selected");
1333 d.html.nIndex = _index;
1334 d.html.openProperties();
1337 openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){
1339 var element = _element || env.targetWindow.document.documentElement,
1340 parent = _parent || el.left.html.container,
1341 returnParentEl = _returnParentElementByElement || null,
1342 returnParentVal = null,
1343 len = element.childNodes.length,
1346 if(parent!=el.left.html.container){
1347 nodeLink = parent.environment.getParent().lib.child.get()[0].lib;
1348 if (d.html.current) {
1349 d.html.current[1].attribute.removeClass("Selected");
1351 nodeLink.attribute.addClass("Selected");
1353 d.html.current = [_element,nodeLink];
1354 d.html.openProperties();
1357 if(element.childNodes&&(len==0||(len==1&&element.childNodes[0].nodeType==3)))return;
1360 if(parent.opened&&Boolean(_returnParentElementByElement)==false){
1361 parent.opened = false;
1362 parent.element.previousSibling.lib.attribute.removeClass("Open");
1363 parent.element.lib.attribute.removeClass("OpenSubContainer");
1367 if (parent != el.left.html.container) {
1368 parent.element.previousSibling.lib.attribute.addClass("Open");
1369 parent.element.lib.attribute.addClass("OpenSubContainer");
1370 parent.opened = true;
1373 if(element==document.documentElement){
1374 new lib.element("A").attribute.addClass("Block").update("<span class='DarkBlue'><<span class='Blue'>html</span>>").insert(parent);
1377 for(var i=0; i<=len; i++){
1379 new lib.element("A").attribute.addClass("Block").update("<span class='DarkBlue'></<span class='Blue'>"+element.nodeName.toLowerCase()+"</span>>").insert(container);
1382 var item = element.childNodes[i];
1384 if (item.nodeType != 3){
1385 var container = new lib.element().attribute.addClass("Block").insert(parent),
1386 link = new lib.element("A").attribute.addClass("Link").insert(container),
1387 spacer = new lib.element("SPAN").attribute.addClass("Spacer").update(" ").insert(link),
1388 html = new lib.element("SPAN").attribute.addClass("Content").update(d.highlight(item)).insert(link),
1389 subContainer = new lib.element("DIV").attribute.addClass("SubContainer").insert(container),
1390 view = lib.util.Element.getView(item);
1392 link.event.addListener("click", lib.util.Curry(d.html.openHtmlTree, window, item, subContainer, false));
1393 link.event.addListener("mouseover", lib.util.Curry(d.html.highlight, window, item, false));
1394 link.event.addListener("mouseout", lib.util.Curry(d.html.highlight, window, item, true));
1396 returnParentVal = returnParentEl == item ? subContainer : returnParentVal;
1398 if(d.html.current==null&&item==document.body){
1399 link.attribute.addClass("Selected");
1400 d.html.current = [item,link];
1401 d.html.openHtmlTree(item,subContainer);
1404 if(element.nodeName!="HEAD"&&element!=document.documentElement&&(view.visibility=="hidden"||view.display=="none")){
1405 container.attribute.addClass("Unvisible");
1408 if (item.childNodes){
1409 var childLen = item.childNodes.length;
1410 if (childLen == 1 && item.childNodes[0].nodeType == 3) {
1411 html.child.add(document.createTextNode(item.childNodes[0].nodeValue.substring(0, 50)));
1412 html.child.add(document.createTextNode("</"));
1413 html.child.add(new lib.element("span").attribute.addClass("Blue").update(item.nodeName.toLowerCase()).environment.getElement());
1414 html.child.add(document.createTextNode(">"));
1419 link.attribute.addClass("Parent");
1424 return returnParentVal;
1427 openProperties:function(){
1429 var index = d.html.nIndex;
1430 var node = d.html.current[0];
1431 d.clean(el.right.html.content);
1434 case "computedStyle":
1435 var property = ["opacity","filter","azimuth","background","backgroundAttachment","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","border","borderCollapse","borderColor","borderSpacing","borderStyle","borderTop","borderRight","borderBottom","borderLeft","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderWidth","bottom","captionSide","clear","clip","color","content","counterIncrement","counterReset","cue","cueAfter","cueBefore","cursor","direction","display","elevation","emptyCells","cssFloat","font","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","height","left","letterSpacing","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginTop","marginRight","marginBottom","marginLeft","markerOffset","marks","maxHeight","maxWidth","minHeight","minWidth","orphans","outline","outlineColor","outlineStyle","outlineWidth","overflow","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","page","pageBreakAfter","pageBreakBefore","pageBreakInside","pause","pauseAfter","pauseBefore","pitch","pitchRange","playDuring","position","quotes","richness","right","size","speak","speakHeader","speakNumeral","speakPunctuation","speechRate","stress","tableLayout","textAlign","textDecoration","textIndent","textShadow","textTransform","top","unicodeBidi","verticalAlign","visibility","voiceFamily","volume","whiteSpace","widows","width","wordSpacing","zIndex"].sort();
1436 var view = document.defaultView?document.defaultView.getComputedStyle(node,null):node.currentStyle;
1437 for(var i=0,len=property.length; i<len; i++){
1438 var item = property[i];
1439 if(!view[item])continue;
1440 str+="<div class='CSSItem'><div class='CSSProperty'>"+item+"</div><div class='CSSValue'>"+d.highlight(view[item])+"</div></div>";
1442 el.right.html.content.update(str);
1445 d.dom.open(node,el.right.html.content,lib.env.ie);
1454 inspect:function(_element,_bgInspector){
1456 var pos = env.targetWindow.firebug.lib.util.Element.getPosition(_element);
1458 env.targetWindow.firebug.el[_bgInspector&&"bgInspector"||"borderInspector"].environment.addStyle({
1459 "width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px",
1460 "top":pos.offsetTop-(_bgInspector?0:2)+"px", "left":pos.offsetLeft-(_bgInspector?0:2)+"px",
1465 d.inspector.el = _element;
1469 toggle:function(_absoluteValue,_event){
1471 if(_absoluteValue==d.inspector.enabled)
1473 d.inspector.enabled = _absoluteValue!=undefined&&!_absoluteValue.clientX?_absoluteValue:!d.inspector.enabled;
1474 el.button.inspect.attribute[(d.inspector.enabled ? "add" : "remove") + "Class"]("Enabled");
1475 if(d.inspector.enabled==false){
1476 el.borderInspector.environment.addStyle({ "display":"none" });
1477 d.inspector.el = null;
1478 } else if(lib.env.dIndex!="html") {
1480 env.popupWin.firebug.d.navigate("html");
1491 open:function(_index){
1493 d.scripts.index = _index;
1494 el.left.scripts.container.update("");
1495 var script = document.getElementsByTagName("script")[_index],uri = script.src||document.location.href,source;
1497 if(uri!=document.location.href){
1498 source = env.cache[uri]||lib.xhr.get(uri).responseText;
1499 env.cache[uri] = source;
1501 source = script.innerHTML;
1503 source = source.replace(/<|>/g,function(_ch){
1504 return ({"<":"<",">":">"})[_ch];
1507 if(!d.scripts.lineNumbers)
1508 el.left.scripts.container.child.add(
1509 new lib.element("DIV").attribute.addClass("CodeContainer").update(source)
1512 source = source.split("<br />");
1513 for (var i = 0; i < source.length; i++) {
1514 el.left.scripts.container.child.add(new lib.element("DIV").child.add(new lib.element("DIV").attribute.addClass("LineNumber").update(i + 1), new lib.element("DIV").attribute.addClass("Code").update(" " + source[i]), new lib.element("DIV").attribute.addClass('Clear')));
1518 el.left.scripts.container.child.add(
1519 new lib.element("DIV").attribute.addClass("CodeContainer").update("<em>Access to restricted URI denied</em>")
1524 toggleLineNumbers:function(){
1526 d.scripts.lineNumbers = !d.scripts.lineNumbers;
1527 el.button.scripts.lineNumbers.attribute[(d.scripts.lineNumbers ? "add" : "remove") + "Class"]("Enabled");
1528 d.scripts.open( d.scripts.index );
1533 el.button.scripts.selectbox.clean();
1534 var collection = env.targetWindow.document.getElementsByTagName("script");
1535 for(var i=0,len=collection.length; i<len; i++){
1536 var item = collection[i],
1537 fileName = getFileName(item.src||item.baseURI||"..");
1538 d.scripts.index=d.scripts.index<0?i:d.scripts.index;
1539 el.button.scripts.selectbox.child.add(
1540 new lib.element("OPTION").attribute.set("value",i).update(fileName)
1543 d.scripts.open( d.scripts.index );
1548 open:function(_str){
1551 el.left.str.container.update(_str.replace(/\n/g,"<br />"))
1557 addObject:function(){
1559 for(var i=0,len=arguments.length; i<len; i++){
1561 var item = arguments[i],
1562 val = env.targetWindow.eval(item);
1563 d.xhr.objects.push([item, val]);
1572 el.left.xhr.container.update("");
1573 el.left.xhr.name = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").attribute.addClass("Block").environment.addStyle({ "width":"20%" }).insert(el.left.xhr.container));
1574 el.left.xhr.nameTitle = new lib.element("STRONG").update("Object Name:").insert(el.left.xhr.name);
1575 el.left.xhr.nameContent = new lib.element("DIV").insert(el.left.xhr.name);
1576 el.left.xhr.status = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").attribute.addClass("Block").environment.addStyle({ "width":"10%" }).insert(el.left.xhr.container));
1577 el.left.xhr.statusTitle = new lib.element("STRONG").update("Status:").insert(el.left.xhr.status);
1578 el.left.xhr.statusContent = new lib.element("DIV").insert(el.left.xhr.status);
1579 el.left.xhr.readystate = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").environment.addStyle({ "width":"15%" }).attribute.addClass("Block").insert(el.left.xhr.container));
1580 el.left.xhr.readystateTitle =el.left.xhr.nameTitle = new lib.element("STRONG").update("Ready State:").insert(el.left.xhr.readystate);
1581 el.left.xhr.readystateContent = new lib.element("DIV").insert(el.left.xhr.readystate);
1582 el.left.xhr.response = new lib.element("DIV").attribute.addClass("BlockContent").insert(new lib.element("DIV").environment.addStyle({ "width":(lib.env.ie?"50":"55")+"%" }).attribute.addClass("Block").insert(el.left.xhr.container));
1583 el.left.xhr.responseTitle = new lib.element("STRONG").update("Response:").insert(el.left.xhr.response);
1584 el.left.xhr.responseContent = new lib.element("DIV").insert(el.left.xhr.response);
1585 setTimeout(d.xhr.refresh,500);
1590 el.left.xhr.nameContent.update("");
1591 el.left.xhr.statusContent.update("");
1592 el.left.xhr.readystateContent.update("");
1593 el.left.xhr.responseContent.update("");
1594 for(var i=0,len=d.xhr.objects.length; i<len; i++){
1595 var item = d.xhr.objects[i],
1596 response = item[1].responseText;
1597 if(Boolean(item[1])==false)continue;
1598 el.left.xhr.nameContent.child.add(new lib.element("span").update(item[0]));
1600 el.left.xhr.statusContent.child.add(new lib.element("span").update(item[1].status));
1601 } catch(e){ el.left.xhr.statusContent.child.add(new lib.element("span").update(" ")); }
1602 el.left.xhr.readystateContent.child.add(new lib.element("span").update(item[1].readyState));
1604 el.left.xhr.responseContent.child.add(new lib.element("span").child.add(
1605 new lib.element("A").event.addListener("click",lib.util.Curry(d.str.open,window,response)).update(" "+response.substring(0,50))
1608 if(env.dIndex=="xhr")
1609 setTimeout(d.xhr.refresh,500);
1613 navigateRightColumn:function(_index,_open){
1615 el.left.container.environment.addStyle({ "width":_open?"70%":"100%" });
1616 el.right.container.environment.addStyle({ "display":_open?"block":"none" });
1619 navigate:function(_index){
1621 var open = _index, close = env.dIndex;
1626 el.button[close].container.environment.addStyle({ "display":"none" });
1627 el.left[close].container.environment.addStyle({ "display":"none" });
1628 el.right[close].container.environment.addStyle({ "display":"none" });
1630 el.button[open].container.environment.addStyle({ "display":"inline" });
1631 el.left[open].container.environment.addStyle({ "display":"block" });
1632 el.right[open].container.environment.addStyle({ "display":"block" });
1635 el.nav[close].attribute.removeClass("Selected");
1637 el.nav[open].attribute.addClass("Selected");
1641 d.navigateRightColumn(_index);
1644 d.navigateRightColumn(_index,true);
1645 if(!d.html.current){
1646 var t=Number(new Date);
1647 d.html.openHtmlTree();
1651 d.navigateRightColumn(_index,true);
1655 d.navigateRightColumn(_index);
1656 d.scripts.refresh();
1659 d.navigateRightColumn(_index);
1660 if(el.left.dom.container.environment.getElement().innerHTML==""){
1661 var t=Number(new Date);
1662 d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container);
1666 d.navigateRightColumn(_index);
1673 getFileName:function(_path){
1674 var match = _path&&_path.match(/[\w\-\.\?\=\&]+$/);
1675 return match&&match[0]||_path;
1677 cancelEvent:function(_event){
1678 if(_event.stopPropagation)
1679 _event.stopPropagation();
1680 if(_event.preventDefault)
1681 _event.preventDefault();
1683 getSelection:function(_el){
1686 var range = document.selection.createRange(),stored = range.duplicate();
1687 stored.moveToElementText(_el);
1688 stored.setEndPoint('EndToEnd', range);
1689 _el.selectionStart = stored.text.length - range.text.length;
1690 _el.selectionEnd = _el.selectionStart + range.text.length;
1693 start:_el.selectionStart,
1694 length:_el.selectionEnd-_el.selectionStart
1698 tab:function(_el,_event){
1700 if(_event.keyCode==9){
1701 if(_el.setSelectionRange){
1702 var position = firebug.getSelection(_el);
1703 _el.value = _el.value.substring(0,position.start) + String.fromCharCode(9) + _el.value.substring(position.start+position.length,_el.value.length);
1704 _el.setSelectionRange(position.start+1,position.start+1);
1705 } else if(document.selection) {
1706 var range = document.selection.createRange(), isCollapsed = range.text == '';
1707 range.text = String.fromCharCode(9);
1708 range.moveStart('character', -1);
1710 firebug.cancelEvent(_event);
1712 setTimeout(_el.focus,100);
1717 addXhrObject:function(){
1719 d.xhr.addObject.apply(env.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(","));
1722 consoleTextbox:function(_event){
1724 if(_event.keyCode==13&&(env.multilinemode==false||_event.shiftKey==false)){
1725 d.console.historyIndex = d.console.history.length;
1726 d.console.eval(el.left.console.input.environment.getElement().value);
1730 switch(_event.keyCode){
1732 if(d.console.history[d.console.historyIndex+1]){
1733 d.console.historyIndex+=1;
1734 el.left.console.input.update( d.console.history[d.console.historyIndex] );
1738 if(d.console.history[d.console.historyIndex-1]){
1739 d.console.historyIndex-=1;
1740 el.left.console.input.update( d.console.history[d.console.historyIndex] );
1746 cssSelectbox:function(){
1748 d.css.open(el.button.css.selectbox.environment.getElement().selectedIndex);
1751 domTextbox:function(_event){
1753 if(_event.keyCode==13){
1754 d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container);
1758 inspector:function(){
1761 env.popupWin.firebug.d.html.inspect(firebug.d.inspector.el);
1763 firebug.d.html.inspect(firebug.d.inspector.el);
1767 keyboard:function(_event){
1769 if(_event.keyCode==27 && d.inspector.enabled){
1770 d.inspector.toggle();
1771 } else if(_event.keyCode === 123 && _event.ctrlKey || _event.metaKey) {
1778 (_event.keyCode === 123 && !_event.ctrlKey && !_event.metaKey) ||
1779 (_event.keyCode === 76 && (_event.ctrlKey || _event.metaKey) && _event.shiftKey) ||
1780 (_event.keyCode === 13 && _event.shiftKey)) {
1784 } else if (el.main.environment.getStyle("display") === 'none') {
1792 mouse:function(_event){
1796 if(document.elementFromPoint) {
1797 target = document.elementFromPoint(_event.clientX, _event.clientY);
1800 target = _event.srcElement;
1802 target = _event.explicitOriginalTarget || _event.target;
1806 if( d.inspector.enabled&&
1807 target!=document.body&&
1808 target!=document.firstChild&&
1809 target!=document.childNodes[1]&&
1810 target!=el.borderInspector.environment.getElement()&&
1811 target!=el.main.environment.getElement()&&
1812 target.offsetParent!=el.main.environment.getElement() ) {
1813 d.inspector.inspect(target);
1817 runMultiline:function(){
1819 d.console.eval.call(window,el.right.console.input.environment.getElement().value);
1824 var source = el.right.css.input.environment.getElement().value.replace(/\n|\t/g,"").split("}");
1825 for(var i=0, len=source.length; i<len; i++){
1826 var item = source[i]+"}", rule = !lib.env.ie?item:item.split(/{|}/),
1827 styleSheet = document.styleSheets[0];
1829 if(item.match(/.+\{.+\}/)){
1831 styleSheet.addRule(rule[0],rule[1]);
1833 styleSheet.insertRule( rule, styleSheet.cssRules.length );
1838 scriptsSelectbox:function(){
1840 d.scripts.open(parseInt(el.button.scripts.selectbox.environment.getElement().value));
1843 xhrTextbox:function(_event){
1845 if(_event.keyCode==13){
1846 d.xhr.addObject.apply(env.targetWindow, el.button.xhr.textbox.environment.getElement().value.split(","));
1855 var pi = _scope.lib; pi.version = [1.1,2008091000];
1858 ie: /MSIE/i.test(navigator.userAgent),
1859 ie6: /MSIE 6/i.test(navigator.userAgent),
1860 ie7: /MSIE 7/i.test(navigator.userAgent),
1861 ie8: /MSIE 8/i.test(navigator.userAgent),
1862 firefox: /Firefox/i.test(navigator.userAgent),
1863 opera: /Opera/i.test(navigator.userAgent),
1864 webkit: /Webkit/i.test(navigator.userAgent),
1865 camino: /Camino/i.test(navigator.userAgent)
1868 pi.get = function(){
1869 return document.getElementById(arguments[0]);
1871 pi.get.byTag = function(){
1872 return document.getElementsByTagName(arguments[0]);
1874 pi.get.byClass = function(){ return document.getElementsByClassName.apply(document,arguments); };
1878 clone:function(_array,_undeep){
1880 Array.prototype.push.apply(tmp,_array);
1881 pi.util.Array.forEach(tmp,function(_item,_index,_source){
1882 if(_item instanceof Array&&!_undeep)
1883 _source[_index] = pi.util.Array.clone(_source[_index]);
1887 count:function(_array,_value){
1889 pi.util.Array.forEach(_array,function(){
1890 count+=Number(arguments[0]==_value);
1894 forEach:function(_array,_function){
1896 return _array.forEach(_function);
1897 for(var i=0,len=_array.length; i<len; i++)
1898 _function.apply(_array,[_array[i],i,_array]);
1900 getLatest:function(_array){
1901 return _array[_array.length-1];
1903 indexOf:function(_array,_value){
1905 return _array.indexOf(_value);
1909 for(var i=0, len=_array.length; i<len; i++){
1910 if(_array[i]==_value){
1917 remove:function(_array,_index){
1918 var result = _array.slice(0,_index);
1919 _array = Array.prototype.push.apply(result,_array.slice(_index+1));
1923 Curry:function(_fn,_scope){
1924 var fn = _fn, scope = _scope||window, args = Array.prototype.slice.call(arguments,2);
1926 return fn.apply(scope,args.concat( Array.prototype.slice.call(arguments,0) ));
1929 Extend:function(_superClass,_prototype,_skipClonning){
1930 var object = new pi.base;
1931 if(_prototype["$Init"]){
1932 object.init = _prototype["$Init"];
1933 delete _prototype["$Init"];
1936 object.body = _superClass==pi.base?_prototype:pi.util.Hash.merge(_prototype,_superClass.prototype);
1937 object.init=object.init||function(){
1938 if(_superClass!=pi.base)
1939 _superClass.apply(this,arguments);
1942 return object.build(_skipClonning);
1944 IsArray:function(_object){
1948 if(window.NodeList&&window.NamedNodeMap&&!pi.env.ie8){
1949 if(_object instanceof Array||_object instanceof NodeList||_object instanceof NamedNodeMap||(window.HTMLCollection&&_object instanceof HTMLCollection))
1952 if(!_object||_object==window||typeof _object=="function"||typeof _object=="string"||typeof _object.length!="number"){
1955 var len = _object.length;
1956 if(len>0&&_object[0]!=undefined&&_object[len-1]!=undefined){
1959 for(var key in _object){
1960 if(key!="item"&&key!="length"&&key!="setNamedItemNS"&&key!="setNamedItem"&&key!="getNamedItem"&&key!="removeNamedItem"&&key!="getNamedItemNS"&&key!="removeNamedItemNS"&&key!="tags"){
1967 IsHash:function(_object){
1968 return _object && typeof _object=="object"&&(_object==window||_object instanceof Object)&&!_object.nodeName&&!pi.util.IsArray(_object)
1971 AddEvent: function(_element,_eventName,_fn,_useCapture){
1972 _element[pi.env.ie?"attachEvent":"addEventListener"]((pi.env.ie?"on":"")+_eventName,_fn,_useCapture||false);
1973 return pi.util.Curry(pi.util.AddEvent,this,_element);
1975 RemoveEvent: function(_element,_eventName,_fn,_useCapture){
1976 _element[pi.env.ie?"detachEvent":"removeEventListener"]((pi.env.ie?"on":"")+_eventName,_fn,_useCapture||false);
1977 return pi.util.Curry(pi.util.RemoveEvent,this,_element);
1980 addClass:function(_element,_class){
1981 if( !pi.util.Element.hasClass(_element,_class) )
1982 pi.util.Element.setClass(_element, pi.util.Element.getClass(_element) + " " + _class );
1984 getClass:function(_element){
1985 return _element.getAttribute(pi.env.ie&&!pi.env.ie8?"className":"class")||"";
1987 hasClass:function(_element,_class){
1988 return pi.util.Array.indexOf(pi.util.Element.getClass(_element).split(" "),_class)>-1;
1990 removeClass:function(_element,_class){
1991 if( pi.util.Element.hasClass(_element,_class) ){
1992 var names = pi.util.Element.getClass(_element,_class).split(" ");
1993 pi.util.Element.setClass(
1995 pi.util.Array.remove(names,pi.util.Array.indexOf(names,_class)).join(" ")
1999 setClass:function(_element,_value){
2001 _element.setAttribute("className", _value );
2002 _element.setAttribute("class", _value );
2004 _element.setAttribute(pi.env.ie?"className":"class", _value );
2007 toggleClass:function(){
2008 if(pi.util.Element.hasClass.apply(this,arguments))
2009 pi.util.Element.removeClass.apply(this,arguments);
2011 pi.util.Element.addClass.apply(this,arguments);
2013 getOpacity:function(_styleObject){
2014 var styleObject = _styleObject;
2016 return styleObject["opacity"];
2018 var alpha = styleObject["filter"].match(/opacity\=(\d+)/i);
2019 return alpha?alpha[1]/100:1;
2021 setOpacity:function(_element,_value){
2023 return pi.util.Element.addStyle(_element,{ "opacity":_value });
2025 pi.util.Element.addStyle(_element,{ "filter":"alpha(opacity="+_value+")" });
2026 return this._parent_;
2028 getPosition:function(_element){
2029 var parent = _element,offsetLeft = document.body.offsetLeft, offsetTop = document.body.offsetTop, view = pi.util.Element.getView(_element);
2030 while(parent&&parent!=document.body&&parent!=document.firstChild){
2031 offsetLeft +=parseInt(parent.offsetLeft);
2032 offsetTop += parseInt(parent.offsetTop);
2033 parent = parent.offsetParent;
2036 "bottom":view["bottom"],
2037 "clientLeft":_element.clientLeft,
2038 "clientTop":_element.clientTop,
2039 "left":view["left"],
2040 "marginTop":view["marginTop"],
2041 "marginLeft":view["marginLeft"],
2042 "offsetLeft":offsetLeft,
2043 "offsetTop":offsetTop,
2044 "position":view["position"],
2045 "right":view["right"],
2047 "zIndex":view["zIndex"]
2050 getSize:function(_element){
2051 var view = pi.util.Element.getView(_element);
2053 "height":view["height"],
2054 "clientHeight":_element.clientHeight,
2055 "clientWidth":_element.clientWidth,
2056 "offsetHeight":_element.offsetHeight,
2057 "offsetWidth":_element.offsetWidth,
2058 "width":view["width"]
2061 addStyle:function(_element,_style){
2062 for(var key in _style){
2063 key = key=="float"?pi.env.ie?"styleFloat":"cssFloat":key;
2064 if (key == "opacity" && pi.env.ie) {
2065 pi.util.Element.setOpacity(_element,_style[key]);
2069 _element.style[key] = _style[key];
2073 getStyle:function(_element,_property){
2074 _property = _property=="float"?pi.env.ie?"styleFloat":"cssFloat":_property;
2075 if(_property=="opacity"&&pi.env.ie)
2076 return pi.util.Element.getOpacity(_element.style);
2077 return typeof _property=="string"?_element.style[_property]:_element.style;
2079 getValue:function(_element){
2080 switch(_element.nodeName.toLowerCase()){
2083 return _element.value;
2085 return _element.options[_element.selectedIndex].value;
2087 return _element.innerHTML;
2091 getView:function(_element,_property){
2092 var view = document.defaultView?document.defaultView.getComputedStyle(_element,null):_element.currentStyle;
2093 _property = _property=="float"?pi.env.ie?"styleFloat":"cssFloat":_property;
2094 if(_property=="opacity"&&pi.env.ie)
2095 return pi.util.Element.getOpacity(_element,view);
2096 return typeof _property=="string"?view[_property]:view;
2100 clone:function(_hash,_undeep){
2102 for(var key in _hash){
2103 if( !_undeep&&pi.util.IsArray( _hash[key] ) ){
2104 tmp[key] = pi.util.Array.clone( _hash[key] );
2105 } else if( !_undeep&&pi.util.IsHash( _hash[key] ) ){
2106 tmp[ key ] = pi.util.Hash.clone(_hash[key]);
2108 tmp[key] = _hash[key];
2113 merge:function(_hash,_source,_undeep){
2114 for(var key in _source){
2115 var value = _source[key];
2116 if (!_undeep&&pi.util.IsArray(_source[key])) {
2117 if(pi.util.IsArray( _hash[key] )){
2118 Array.prototype.push.apply( _source[key], _hash[key] )
2121 value = pi.util.Array.clone(_source[key]);
2123 else if (!_undeep&&pi.util.IsHash(_source[key])) {
2124 if (pi.util.IsHash(_hash[key])) {
2125 value = pi.util.Hash.merge(_hash[key], _source[key]);
2127 value = pi.util.Hash.clone( _source[key] );
2129 } else if( _hash[key] )
2130 value = _hash[ key ];
2137 format:function(_str){
2138 var values = Array.prototype.slice.call(arguments,1);
2139 return _str.replace(/\{(\d)\}/g,function(){
2140 return values[arguments[1]];
2144 GetViewport:function(){
2146 height:document.documentElement.clientHeight||document.body.clientHeight,
2147 width:document.documentElement.clientWidth||document.body.clientWidth
2152 pi.base = function(){
2156 this.build = function(_skipClonning){
2157 var base = this, skipClonning = _skipClonning||false, _private = {},
2159 var _p = pi.util.Hash.clone(_private);
2161 for(var key in this){
2162 if(pi.util.IsArray( this[ key ] ) ){
2163 this[key] = pi.util.Array.clone( this[key] );
2165 if( pi.util.IsHash(this[key]) ){
2166 this[key] = pi.util.Hash.clone(
2168 function(_key,_object){
2169 this[ _key ]._parent_ = this;
2172 //this[key]._parent_ = this;
2176 base.createAccessors( _p, this );
2178 return base.init.apply(this,arguments);
2181 this.movePrivateMembers(this.body,_private);
2183 fn["$Init"] = this.init;
2185 fn.prototype = this.body;
2189 this.createAccessors = function(_p, _branch){
2190 var getter = function(_property){ return this[_property]; },
2191 setter = function(_property,_value){ this[_property] = _value; return _branch._parent_||_branch; };
2193 for (var name in _p) {
2194 var isPrivate = name.substring(0, 1) == "_", title = name.substring(1, 2).toUpperCase() + name.substring(2);
2197 _branch[(_branch["get" + title]?"_":"")+"get" + title] = pi.util.Curry(getter,_p,name);
2198 _branch[(_branch["set" + title]?"_":"")+"set" + title] = pi.util.Curry(setter,_p,name);
2201 if (pi.util.IsHash(_p[name])){
2202 _branch[name]._parent_ = _branch;
2205 this.createAccessors(_p[name], _branch[name]);
2210 this.movePrivateMembers = function(_object, _branch){
2211 for (var name in _object) {
2212 var isPrivate = name.substring(0, 1) == "_";
2215 _branch[name] = _object[name];
2216 delete _object[name];
2219 if (pi.util.IsHash(_object[name])){
2221 this.movePrivateMembers(_object[name], _branch[name]);
2227 pi.element = new pi.base;
2228 pi.element.init = function(_val){
2229 this.environment.setElement(
2230 typeof _val=="string"||!_val?
2231 document.createElement(_val||"DIV"):
2238 "addStyle":function(){
2239 return this.environment.addStyle.apply(this.environment,arguments);
2242 var childs = this.child.get();
2243 while(childs.length){
2244 childs[0].parentNode.removeChild(childs[0]);
2247 "clone":function(_deep){
2248 return this.environment.getElement().cloneNode(_deep);
2250 "insert":function(_element){
2251 _element = _element.environment?_element.environment.getElement():_element;
2252 _element.appendChild(this.environment.getElement());
2255 "insertAfter":function(_referenceElement){
2256 _referenceElement = _referenceElement.environment?_referenceElement.environment.getElement():_referenceElement;
2257 _referenceElement.nextSibling?this.insertBefore(_referenceElement.nextSibling):this.insert(_referenceElement.parentNode);
2260 "insertBefore":function(_referenceElement){
2261 _referenceElement = _referenceElement.environment?_referenceElement.environment.getElement():_referenceElement;
2262 _referenceElement.parentNode.insertBefore(this.environment.getElement(),_referenceElement);
2265 "query":function(_expression,_resultType,namespaceResolver,_result){
2266 return pi.xpath(_expression,_resultType||"ORDERED_NODE_SNAPSHOT_TYPE",this.environment.getElement(),_namespaceResolver,_result);
2268 "remove":function(){
2269 if (this.environment.getParent()) {
2270 this.environment.getParent().removeChild(this.environment.getElement());
2273 "update":function(_value){
2274 this.element[this.element.nodeName.toLowerCase()=="textarea"||this.element.nodeName.toLowerCase()=="input"?"value":"innerHTML"]=_value;
2278 "getAll":function(){
2279 return this._parent_.environment.getElement().attributes;
2281 "clear":function(_name){
2283 return this._parent_;
2285 "get":function(_name){
2286 return this._parent_.environment.getElement().getAttribute(_name);
2288 "has":function(_name){
2289 return pi.env.ie?(this.get(_name)!=null):this._parent_.environment.getElement().hasAttribute(_name);
2291 "remove":function(_name){
2292 this._parent_.environment.getElement().removeAttribute(_name);
2293 return this._parent_;
2295 "set":function(_name,_value){
2296 this._parent_.environment.getElement().setAttribute(_name,_value);
2297 return this._parent_;
2299 "addClass":function(_classes){
2300 for(var i=0,len=arguments.length; i<len; i++){
2301 pi.util.Element.addClass(this._parent_.environment.getElement(),arguments[i]);
2303 return this._parent_;
2305 "clearClass":function(){
2309 "getClass":function(){
2310 return pi.util.Element.getClass( this._parent_.environment.getElement() );
2312 "hasClass":function(_class){
2313 return pi.util.Element.hasClass( this._parent_.environment.getElement(), _class );
2315 "setClass":function(_value){
2316 return pi.util.Element.setClass( this._parent_.environment.getElement(), _value );
2318 "removeClass":function(_class){
2319 pi.util.Element.removeClass( this._parent_.environment.getElement(), _class );
2320 return this._parent_;
2322 "toggleClass":function(_class){
2323 pi.util.Element.toggleClass( this._parent_.environment.getElement(), _class );
2328 return this._parent_.environment.getElement().childNodes;
2330 "add":function(_elements){
2331 for (var i = 0; i < arguments.length; i++) {
2332 var el = arguments[i];
2333 this._parent_.environment.getElement().appendChild(
2334 el.environment ? el.environment.getElement() : el
2337 return this._parent_;
2339 "addAfter":function(_element,_referenceElement){
2341 _element.environment?_element.environment.getElement():_element,
2342 (_referenceElement.environment?_referenceElement.environment.getElement():_referenceElement).nextSibling
2344 return this._parent_;
2346 "addBefore":function(_element,_referenceElement){
2347 this._parent_.environment.getElement().insertBefore(
2348 _element.environment?_element.environment.getElement():_element,
2349 _referenceElement.environment?_referenceElement.environment.getElement():_referenceElement
2351 return this._parent_;
2353 "remove":function(_element){
2354 this._parent_.environment.getElement().removeChild(_element.environment?_element.environment.getElement():_element);
2359 "setElement":function(_value){
2360 this._parent_.element = _value;
2361 this._parent_.element.lib = this._parent_;
2362 this._parent_.element.firebugElement = true;
2363 this._setElement(_value);
2365 "getParent":function(){
2366 return this.getElement().parentNode;
2368 "getPosition":function(){
2369 return pi.util.Element.getPosition(this.getElement());
2371 "getSize":function(){
2372 return pi.util.Element.getSize( this.getElement() );
2374 "addStyle":function(_styleObject){
2375 pi.util.Element.addStyle(this.getElement(),_styleObject);
2376 return this._parent_;
2378 "getStyle":function(_property){
2379 return pi.util.Element.getStyle(this.getElement(),_property);
2381 "getName":function(){
2382 return this.getElement().nodeName;
2384 "getType":function(){
2385 return this.getElement().nodeType;
2387 "getValue":function(){
2388 return pi.util.Element.getValue(this.getElement());
2390 "getView":function(_property){
2391 return pi.util.Element.getView(this.getElement(),_property);
2395 "addListener":function(_event,_fn,_useCapture){
2396 pi.util.AddEvent(this._parent_.environment.getElement(),_event,_fn,_useCapture);
2397 return this._parent_;
2399 "removeListener":function(_event,_fn,_useCapture){
2400 pi.util.RemoveEvent(this._parent_.environment.getElement(),_event,_fn,_useCapture);
2401 return this._parent_;
2405 pi.element = pi.element.build();
2407 pi.xhr = new pi.base;
2408 pi.xhr.init = function(_url){
2409 if(!window.XMLHttpRequest){
2410 var names = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];
2411 for (var i = 0; i < names.length; i++) {
2413 this.environment.setApi(new ActiveXObject(names[i]));
2415 } catch (e) { continue; }
2419 this.environment.setApi(new XMLHttpRequest());
2421 this.environment.getApi().onreadystatechange=pi.util.Curry(this.event.readystatechange,this);
2422 this.environment.setUrl(_url);
2423 this.environment.setCallback([]);
2428 "addCallback": function(){
2429 return this.environment.addCallback.apply(this.environment,arguments);
2431 "addData": function(){
2432 return this.environment.addData.apply(this.environment,arguments);
2435 this.environment.getApi().abort();
2439 var url = this.environment.getUrl(), data = this.environment.getData(),dataUrl = "";
2441 if(!this.environment.getCache())
2442 data["forceCache"] = Number(new Date);
2444 for (var key in data)
2445 dataUrl += pi.util.String.format("{0}={1}&",key, data[key]);
2447 if (this.environment.getType()=="GET")
2448 url += (url.search("\\?")==-1?"?":"&")+pi.util.String.format("{0}",dataUrl);
2450 this.api.open(this.environment.getType(),url,this.environment.getAsync());
2451 if(this.environment.getType()=="POST"){
2452 this.api.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
2454 this.api.send(this.environment.getType()=="GET"?"":dataUrl);
2458 pi.xhr.body.environment = {
2459 "_async":true, "_api":null, "_cache":true, "_callback":null, "_data":{}, "_type":"GET", "_url":"",
2460 "setApi":function(_value){
2461 this._parent_.api = _value;
2462 this._setApi(_value);
2464 "addCallback": function(_readyState,_fn){
2465 this.getCallback().push({ "fn":_fn, "readyState":_readyState });
2466 return this._parent_;
2468 "addData": function(_key,_value){
2469 this.getData()[_key] = _value;
2470 return this._parent_;
2472 "setType": function(_value){
2473 this._setType(_value);
2474 return this._parent_;
2477 pi.xhr.body.event = {
2478 "readystatechange":function(){
2479 var readyState = this.environment.getApi().readyState, callback=this.environment.getCallback();
2480 for (var i = 0, len=callback.length; i < len; i++) {
2481 if(pi.util.Array.indexOf(callback[i].readyState,readyState)>-1){
2482 callback[i].fn.apply(this);
2487 pi.xhr = pi.xhr.build();
2493 pi.xhr.get = function(_url,_returnPiObject){
2494 var request = new pi.xhr();
2495 request.environment.setAsync(false);
2496 request.environment.setUrl(_url);
2498 return _returnPiObject?request:request.environment.getApi();
2502 * registering onload event for init functions
2505 pi.env.ie?window:document,
2506 pi.env.ie?"load":"DOMContentLoaded",
2508 for(var i=0,len=pi.util.Init.length; i<len; i++){
2509 pi.util.Init[ i ]();
2517 lib.util.Init.push(firebug.init);