InstallationAssuming you have already installed devbarjs, you can configure the module and use the interface as you see fit. For more information on how to install devbarjs, visit the installation wiki. Namespacedevbarjs's namespace is simply DevBar. Sadly, Microsoft, and these guys also use this name but nobody seems to have captured the JavaScript namespace. DevBar is a static class. DevBar; // Yay! Attributesconfig
DevBar.config = {
width : "20px",
height : "30em",
newestOnTop : false,
footerEnabled : false
};
DevBar.load();active
DevBar.active = false; DevBar.load(); verbose
DevBar.verbose = false; DevBar.load(); invade
DevBar.invade = true;
DevBar.load();
/* Using jQuery syntax to create a paragraph that
* will attach to <body>, hiding it, attaching a
* "hello_world_css_class" CSS class and logging
* to the DevBar extended logger all the while.
* What a treat!
*/
$("<p>Hello World</p>")
.addClass( 'hello_world_css_class' )
.log( 'Paragraph added but we are to hide it.' )
.hide()
.appendTo( $( body ) );Methodsload
// Can be the window.onload event window.onload = DevBar.load(); <!--
Or could be randomly placed in the body, it doesn't matter. Everywhere is safe.
-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>DevBar Example</title>
<link rel="stylesheet" href="devbar-min.css" type="text/css" media="all" />
<script type="text/javascript" src="devbar-min.js"></script>
</head>
<body>
<script type="text/javascript>
DevBar.load():
</script>
</body>
</html> log
DevBar.verbose = true; // Default and optional DevBar.load(); DevBar.log( 'I logged', 'info' ); // Although 'info' is assumed register
DevBar.register( {
label : 'Logger',
links : [
$('<a>Clear</a>')
.attr( 'href', 'javascript:void(0);' )
.click( DevBar.clear ),
$('<span>| </span>'),
$('<a>Open</a>')
.attr( 'href', 'javascript:void(0);' )
.click( DevBar.open )
.attr( 'id', 'devbar_openlink' )
.hide(),
$('<a>Close</a>')
.attr( 'href', 'javascript:void(0);' )
.click( DevBar.close )
.attr( 'id', 'devbar_closelink' )
.show()
],
} );There are more that are available but are intentionally /undocumented/. Of course, by saying that, does that make them documented? hmmmm... |
► Sign in to add a comment