1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 13:28:35 +01:00

refactoring, fixed coding conventions

This commit is contained in:
maximebf 2014-02-14 11:49:37 -03:00
parent cff4a0fce6
commit 9efc22aca1
2 changed files with 14 additions and 14 deletions

View File

@ -177,6 +177,7 @@ div.phpdebugbar-panel.phpdebugbar-active {
} }
/* -------------------------------------- */ /* -------------------------------------- */
div.phpdebugbar-mini-design a.phpdebugbar-tab { div.phpdebugbar-mini-design a.phpdebugbar-tab {
position: relative; position: relative;
border-right: 1px solid #ddd; border-right: 1px solid #ddd;

View File

@ -419,26 +419,23 @@ if (typeof(PhpDebugBar) == 'undefined') {
* Resizes the debugbar to fit the current browser window * Resizes the debugbar to fit the current browser window
*/ */
resize: function() { resize: function() {
var $ = PhpDebugBar.$;
var header = $(".phpdebugbar-header");
var contentSize = this.respCSSSize; var contentSize = this.respCSSSize;
if (this.respCSSSize == 0) { if (this.respCSSSize == 0) {
$(header).find("> *:visible").each(function () { this.$header.find("> *:visible").each(function () {
contentSize += $(this).outerWidth(); contentSize += $(this).outerWidth();
}); });
} }
var currentSize = $(header).width(); var currentSize = this.$header.width();
var cssClass = "phpdebugbar-mini-design";
var bool = this.$header.hasClass(cssClass);
var cssClass = "phpdebugbar-mini-design", bool = $(header).hasClass(cssClass);
if (currentSize <= contentSize && !bool) { if (currentSize <= contentSize && !bool) {
this.respCSSSize = contentSize; this.respCSSSize = contentSize;
this.$header.addClass(cssClass);
$(header).addClass(cssClass);
} else if (contentSize < currentSize && bool) { } else if (contentSize < currentSize && bool) {
this.respCSSSize = 0; this.respCSSSize = 0;
$(".phpdebugbar-header").removeClass(cssClass); this.$header.removeClass(cssClass);
} }
}, },
@ -522,9 +519,9 @@ if (typeof(PhpDebugBar) == 'undefined') {
// bar visibility // bar visibility
var open = localStorage.getItem('phpdebugbar-open'); var open = localStorage.getItem('phpdebugbar-open');
if(open && open == '0'){ if (open && open == '0') {
this.close(); this.close();
}else{ } else {
var visible = localStorage.getItem('phpdebugbar-visible'); var visible = localStorage.getItem('phpdebugbar-visible');
if (visible && visible == '1') { if (visible && visible == '1') {
var tab = localStorage.getItem('phpdebugbar-tab'); var tab = localStorage.getItem('phpdebugbar-tab');
@ -719,6 +716,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
this.$el.removeClass(csscls('minimized')); this.$el.removeClass(csscls('minimized'));
localStorage.setItem('phpdebugbar-visible', '1'); localStorage.setItem('phpdebugbar-visible', '1');
localStorage.setItem('phpdebugbar-tab', name); localStorage.setItem('phpdebugbar-tab', name);
this.resize();
}, },
/** /**
@ -733,6 +731,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
this.recomputeBottomOffset(); this.recomputeBottomOffset();
localStorage.setItem('phpdebugbar-visible', '0'); localStorage.setItem('phpdebugbar-visible', '0');
this.$el.addClass(csscls('minimized')); this.$el.addClass(csscls('minimized'));
this.resize();
}, },
/** /**
@ -1009,9 +1008,9 @@ if (typeof(PhpDebugBar) == 'undefined') {
} }
var data = this.parseHeaders(raw); var data = this.parseHeaders(raw);
if(data.error){ if (data.error) {
throw new Error('Error loading debugbar data: '+data.error); throw new Error('Error loading debugbar data: ' + data.error);
}else if(data.data){ } else if(data.data) {
this.debugbar.addDataSet(data.data, data.id, "(ajax)"); this.debugbar.addDataSet(data.data, data.id, "(ajax)");
} }
return true; return true;