first commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
( function() {
|
||||
var count, list, dbjsError,
|
||||
rawCount = 0,
|
||||
errors = [];
|
||||
|
||||
window.onerror = function ( errorMsg, url, lineNumber ) {
|
||||
if ( ! document.getElementById( 'debug-bar-js-error-count' ) ) {
|
||||
errors[ errors.length ] = [ errorMsg, url, lineNumber ];
|
||||
} else {
|
||||
dbjsError( errorMsg, url, lineNumber );
|
||||
}
|
||||
};
|
||||
|
||||
jQuery( function () {
|
||||
for ( err in errors ) {
|
||||
dbjsError( errors[ err ][0], errors[ err ][1], errors[ err ][2] );
|
||||
}
|
||||
} );
|
||||
|
||||
dbjsError = function dbjsError( errorMsg, url, lineNumber ) {
|
||||
var errorLine, place, button, tab;
|
||||
|
||||
rawCount++;
|
||||
|
||||
if ( ! count ) {
|
||||
count = document.getElementById( 'debug-bar-js-error-count' );
|
||||
}
|
||||
if ( ! list ) {
|
||||
list = document.getElementById( 'debug-bar-js-errors' );
|
||||
}
|
||||
|
||||
if ( ! count || ! list ) {
|
||||
return; // threw way too early... @todo cache these?
|
||||
}
|
||||
|
||||
if ( 1 == rawCount ) {
|
||||
button = document.getElementById( 'wp-admin-bar-debug-bar' );
|
||||
|
||||
if ( ! button ) {
|
||||
return; // how did this happen?
|
||||
}
|
||||
|
||||
if ( -1 === button.className.indexOf( 'debug-bar-php-warning-summary' ) ) {
|
||||
button.className = button.className + ' debug-bar-php-warning-summary';
|
||||
}
|
||||
|
||||
[ 'debug-menu-link-Debug_Bar_JS', 'wp-admin-bar-debug-bar-Debug_Bar_JS' ].map( function( id ) {
|
||||
tab = document.getElementById( id );
|
||||
if ( tab ) {
|
||||
tab.style.display = 'block';
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
count.textContent = rawCount;
|
||||
|
||||
errorLine = document.createElement( 'li' );
|
||||
errorLine.className = 'debug-bar-js-error';
|
||||
errorLine.textContent = errorMsg;
|
||||
|
||||
place = document.createElement( 'span' );
|
||||
place.textContent = url + ' line ' + lineNumber;
|
||||
|
||||
errorLine.appendChild( place );
|
||||
list.appendChild( errorLine );
|
||||
};
|
||||
} )();
|
||||
@@ -0,0 +1 @@
|
||||
!function(){var e,i,t,r=0,n=[];window.onerror=function(e,i,r){document.getElementById("debug-bar-js-error-count")?t(e,i,r):n[n.length]=[e,i,r]},jQuery(function(){for(err in n)t(n[err][0],n[err][1],n[err][2])}),t=function(t,n,a){var s,o,u,d;if(r++,e||(e=document.getElementById("debug-bar-js-error-count")),i||(i=document.getElementById("debug-bar-js-errors")),e&&i){if(1==r){if(u=document.getElementById("wp-admin-bar-debug-bar"),!u)return;-1===u.className.indexOf("debug-bar-php-warning-summary")&&(u.className=u.className+" debug-bar-php-warning-summary"),["debug-menu-link-Debug_Bar_JS","wp-admin-bar-debug-bar-Debug_Bar_JS"].map(function(e){d=document.getElementById(e),d&&(d.style.display="block")})}e.textContent=r,s=document.createElement("li"),s.className="debug-bar-js-error",s.textContent=t,o=document.createElement("span"),o.textContent=n+" line "+a,s.appendChild(o),i.appendChild(s)}}}();
|
||||
@@ -0,0 +1,123 @@
|
||||
var wpDebugBar;
|
||||
|
||||
( function( $ ) {
|
||||
var api;
|
||||
|
||||
wpDebugBar = api = {
|
||||
// The element that we will pad to prevent the debug bar
|
||||
// from overlapping the bottom of the page.
|
||||
body: undefined,
|
||||
|
||||
init: function init() {
|
||||
// If we're not in the admin, pad the body.
|
||||
api.body = $( document.body );
|
||||
|
||||
api.toggle.init();
|
||||
api.tabs();
|
||||
api.actions.init();
|
||||
},
|
||||
|
||||
isVisible: function isVisible() {
|
||||
return api.body.hasClass( 'debug-bar-visible' );
|
||||
},
|
||||
|
||||
toggle: {
|
||||
init: function init() {
|
||||
$( '#wp-admin-bar-debug-bar' ).click( function onClickAdminBarMenu( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
// Click on submenu item.
|
||||
if ( event.target.hash ) {
|
||||
var $menuLink = $( event.target.rel );
|
||||
|
||||
// Open/close debug bar.
|
||||
if ( ! api.isVisible() ) {
|
||||
api.toggle.visibility();
|
||||
} else if ( $menuLink.hasClass( 'current' ) ) {
|
||||
$menuLink.removeClass( 'current' );
|
||||
api.toggle.visibility();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Deselect other tabs and hide other panels.
|
||||
$( '.debug-menu-target' ).hide().trigger( 'debug-bar-hide' );
|
||||
$( '.debug-menu-link' ).removeClass( 'current' );
|
||||
|
||||
$menuLink.addClass( 'current' );
|
||||
$( event.target.hash ).show().trigger( 'debug-bar-show' );
|
||||
} else {
|
||||
api.toggle.visibility();
|
||||
}
|
||||
} );
|
||||
},
|
||||
visibility: function visibility( show ) {
|
||||
show = typeof show == 'undefined' ? ! api.isVisible() : show;
|
||||
|
||||
// Show/hide the debug bar.
|
||||
api.body.toggleClass( 'debug-bar-visible', show );
|
||||
|
||||
// Press/unpress the button.
|
||||
$( this ).toggleClass( 'active', show );
|
||||
}
|
||||
},
|
||||
|
||||
tabs: function tabs() {
|
||||
var debugMenuLinks = $( '.debug-menu-link' ),
|
||||
debugMenuTargets = $( '.debug-menu-target' );
|
||||
|
||||
debugMenuLinks.click( function onClickLink( event ) {
|
||||
var $this = $( this );
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( $this.hasClass( 'current' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Deselect other tabs and hide other panels.
|
||||
debugMenuTargets.hide().trigger( 'debug-bar-hide' );
|
||||
debugMenuLinks.removeClass( 'current' );
|
||||
|
||||
// Select the current tab and show the current panel.
|
||||
$this.addClass( 'current' );
|
||||
// The hashed component of the href is the id that we want to display.
|
||||
$( '#' + this.href.substr( this.href.indexOf( '#' ) + 1 ) ).show().trigger( 'debug-bar-show' );
|
||||
} );
|
||||
},
|
||||
|
||||
actions: {
|
||||
init: function init() {
|
||||
var actions = $( '#debug-bar-actions' );
|
||||
|
||||
// Close the panel with the esc key if it's open.
|
||||
$( document ).keydown( function maybeClosePanel( event ) {
|
||||
var key = event.key || event.which || event.keyCode;
|
||||
|
||||
if ( 27 /* esc */ === key && api.isVisible() ) {
|
||||
event.preventDefault();
|
||||
api.actions.close();
|
||||
}
|
||||
} );
|
||||
|
||||
$( '.maximize', actions ).click( api.actions.maximize );
|
||||
$( '.restore', actions ).click( api.actions.restore );
|
||||
$( '.close', actions ).click( api.actions.close );
|
||||
},
|
||||
maximize: function maximize() {
|
||||
api.body.removeClass( 'debug-bar-partial' );
|
||||
api.body.addClass( 'debug-bar-maximized' );
|
||||
},
|
||||
restore: function restore() {
|
||||
api.body.removeClass( 'debug-bar-maximized' );
|
||||
api.body.addClass( 'debug-bar-partial' );
|
||||
},
|
||||
close: function close() {
|
||||
api.toggle.visibility( false );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$( wpDebugBar.init );
|
||||
|
||||
} )( jQuery );
|
||||
@@ -0,0 +1 @@
|
||||
var wpDebugBar;!function(e){var i;wpDebugBar=i={body:void 0,init:function(){i.body=e(document.body),i.toggle.init(),i.tabs(),i.actions.init()},isVisible:function(){return i.body.hasClass("debug-bar-visible")},toggle:{init:function(){e("#wp-admin-bar-debug-bar").click(function(t){if(t.preventDefault(),t.target.hash){var s=e(t.target.rel);if(i.isVisible()){if(s.hasClass("current"))return s.removeClass("current"),void i.toggle.visibility()}else i.toggle.visibility();e(".debug-menu-target").hide().trigger("debug-bar-hide"),e(".debug-menu-link").removeClass("current"),s.addClass("current"),e(t.target.hash).show().trigger("debug-bar-show")}else i.toggle.visibility()})},visibility:function(t){t=void 0===t?!i.isVisible():t,i.body.toggleClass("debug-bar-visible",t),e(this).toggleClass("active",t)}},tabs:function(){var i=e(".debug-menu-link"),t=e(".debug-menu-target");i.click(function(s){var r=e(this);s.preventDefault(),r.hasClass("current")||(t.hide().trigger("debug-bar-hide"),i.removeClass("current"),r.addClass("current"),e("#"+this.href.substr(this.href.indexOf("#")+1)).show().trigger("debug-bar-show"))})},actions:{init:function(){var t=e("#debug-bar-actions");e(document).keydown(function(e){var t=e.key||e.which||e.keyCode;27===t&&i.isVisible()&&(e.preventDefault(),i.actions.close())}),e(".maximize",t).click(i.actions.maximize),e(".restore",t).click(i.actions.restore),e(".close",t).click(i.actions.close)},maximize:function(){i.body.removeClass("debug-bar-partial"),i.body.addClass("debug-bar-maximized")},restore:function(){i.body.removeClass("debug-bar-maximized"),i.body.addClass("debug-bar-partial")},close:function(){i.toggle.visibility(!1)}}},e(wpDebugBar.init)}(jQuery);
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Dockable.
|
||||
**/
|
||||
(function($){
|
||||
$.widget("db.dockable", $.ui.mouse, {
|
||||
options: {
|
||||
handle: false,
|
||||
axis: 'y',
|
||||
resize: function() {},
|
||||
resized: function() {}
|
||||
},
|
||||
_create: function() {
|
||||
if ( this.options.axis == 'x' ) {
|
||||
this.page = 'pageX';
|
||||
this.dimension = 'width';
|
||||
} else {
|
||||
this.page = 'pageY';
|
||||
this.dimension = 'height';
|
||||
}
|
||||
|
||||
if ( ! this.options.handle )
|
||||
return;
|
||||
|
||||
this.handle = $( this.options.handle );
|
||||
|
||||
this._mouseInit();
|
||||
},
|
||||
_handoff: function() {
|
||||
return {
|
||||
element: this.element,
|
||||
handle: this.handle,
|
||||
axis: this.options.axis
|
||||
};
|
||||
},
|
||||
_mouseStart: function(event) {
|
||||
this._trigger( "start", event, this._handoff() );
|
||||
this.d0 = this.element[this.dimension]() + event[this.page];
|
||||
},
|
||||
_mouseDrag: function(event) {
|
||||
var resize = this._trigger( "resize", event, this._handoff() );
|
||||
|
||||
// If the resize event returns false, we don't resize.
|
||||
if ( resize === false )
|
||||
return;
|
||||
|
||||
this.element[this.dimension]( this.d0 - event[this.page] );
|
||||
this._trigger( "resized", event, this._handoff() );
|
||||
},
|
||||
_mouseCapture: function(event) {
|
||||
return !this.options.disabled && event.target == this.handle[0];
|
||||
},
|
||||
_mouseStop: function(event) {
|
||||
this._trigger( "stop", event, this._handoff() );
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
(function(a){a.widget("db.dockable",a.ui.mouse,{options:{handle:false,axis:"y",resize:function(){},resized:function(){}},_create:function(){if(this.options.axis=="x"){this.page="pageX";this.dimension="width"}else{this.page="pageY";this.dimension="height"}if(!this.options.handle){return}this.handle=a(this.options.handle);this._mouseInit()},_handoff:function(){return{element:this.element,handle:this.handle,axis:this.options.axis}},_mouseStart:function(b){this._trigger("start",b,this._handoff());this.d0=this.element[this.dimension]()+b[this.page]},_mouseDrag:function(c){var b=this._trigger("resize",c,this._handoff());if(b===false){return}this.element[this.dimension](this.d0-c[this.page]);this._trigger("resized",c,this._handoff())},_mouseCapture:function(b){return !this.options.disabled&&b.target==this.handle[0]},_mouseStop:function(b){this._trigger("stop",b,this._handoff())}})})(jQuery);
|
||||
Reference in New Issue
Block a user