1 <script type="text/javascript">
2 var djDebugLastObj = null;
3 function djDebugToggle(tag) {
5 djDebugLastObj.className = '';
6 document.getElementById(djDebugLastObj.getAttribute('rel')).style.display = 'none';
9 var obj = document.getElementById(tag.getAttribute('rel'));
11 if (djDebugLastObj == tag) {
12 djDebugLastObj = null;
15 if (obj.style.display != 'block') {
16 obj.style.display = 'block';
17 tag.className = 'active';
21 function djDebugClose() {
22 if (!djDebugLastObj) return;
23 djDebugLastObj.className = '';
24 document.getElementById(djDebugLastObj.getAttribute('rel')).style.display = 'none';
25 djDebugLastObj = null;
27 function djDebugWindowHtml(text) {
28 var obj = document.getElementById('djDebugWindow');
29 var frame = obj.getElementsByTagName('div')[1];
30 frame.innerHTML = text;
32 function djDebugWindow(url) {
33 var obj = document.getElementById('djDebugWindow');
34 djDebugWindowHtml('Loading request...');
35 djDebugHttp.open('get', url, true);
37 djDebugHttp.onreadystatechange = function() {
38 if (djDebugHttp.readyState == 4) {
39 // XXX: why does status return 0?
40 if (djDebugHttp.status == 200 || djDebugHttp.status == 0) {
41 djDebugWindowHtml(djDebugHttp.responseText);
44 djDebugWindowHtml('There was an error loading the document.');
48 djDebugHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
50 djDebugHttp.send(null);
53 djDebugWindowHtml('There was an error loading the document.');
55 obj.style.display = 'block';
57 function djDebugCreateXMLHttpRequest() {
59 if (window.XMLHttpRequest) { // Mozilla, Safari,...
60 http = new XMLHttpRequest();
61 if (http.overrideMimeType) {
62 // set type accordingly to anticipated content type
63 http.overrideMimeType('text/html');
66 else if (window.ActiveXObject) { // IE
68 http = new ActiveXObject("Msxml2.XMLHTTP");
71 http = new ActiveXObject("Microsoft.XMLHTTP");
76 alert('Cannot create XMLHTTP instance');
81 var djDebugHttp = djDebugCreateXMLHttpRequest();
82 function djDebugWindowClose() {
83 var obj = document.getElementById('djDebugWindow');
84 obj.style.display = 'none';
86 function djDebugCloseAll() {
90 function djDebugHide() {
91 var obj = document.getElementById('djDebug');
92 obj.style.display = 'none';
95 <style type="text/css">
96 #djDebug * { font: normal 12px Arial, sans-serif; margin: 0; padding: 0; float: none; position: static; border: 0; }
101 text-transform:lowercase;
104 border-top:1px solid #345447;
105 border-bottom:1px solid #10211a;
107 #djDebugToolbar ul { margin: 0; padding: 0 10px; }
108 #djDebugToolbar li { display: inline; height: 22px; float: left; }
109 #djDebugToolbar li span,
110 #djDebugToolbar li a { color: #FFE761; text-decoration: none; display: inline; width: auto; position: relative; float: none; margin: 0; height: 12px; line-height: 22px; padding: 4px 10px; border-left: 1px solid #345447; border-right: 1px solid #10211a; padding-right: 10px; }
111 #djDebugToolbar li a:hover, #djDebugToolbar li.active a { color: #fff; background-color: #2e4d41; }
112 #djDebugToolbar #djDebugButton span { border-left: 0; color: #fff; font-weight: bold; }
113 #djDebugToolbar #djDebugHide { float: right; }
114 #djDebugToolbar #djDebugHide a { border: 0; font-size: 93%; }
115 #djDebug .panelContent {
129 border:1px solid #345447;
131 #djDebug .panelContent * { color: #fff; }
132 #djDebug .panelContent a:hover { color: #FFE761; }
133 #djDebug .panelContent table { width: 100%; }
134 #djDebug .panelContent p { padding: 5px; }
135 #djDebug .panelContent p, #djDebug .panelContent table,
136 #djDebug .panelContent ul, #djDebug .panelContent dl,
137 #djDebug .panelContent .title { margin: 5px 0; }
138 #djDebug .panelContent dt, #djDebug .panelContent dd { display: block; }
139 #djDebug .panelContent dt { font-weight: bold; width: 100px; clear: left; float: left; }
140 #djDebug .panelContent dd { margin-left: 20px; margin-bottom: 5px; margin-left: 100px; }
141 #djDebug .panelContent th, #djDebug td { padding: 5px; }
142 #djDebug .panelContent td { background:#244035; }
143 #djDebug .panelContent th { font-weight: bold; text-align: left; background: transparent; color: #fff; }
144 #djDebug .panelContent thead th { border-bottom: 1px solid #2e4d41; color: #FFE761; }
145 #djDebug .panelContent .row2 td { background:#2e4d41; }
146 #djDebugWindow { z-index: 20000000; }
147 #djDebug .panelContent .title { font-weight: bold; font-size: 15px; color: #90EF45; }
148 #djDebug .panelContent .title a { float: right; font-weight: bold; font-size: 10px; }
149 #djDebug .panelContent .title .close { float: right; font-weight: bold; margin-left: 15px; }
153 <div id="djDebugToolbar">
154 <ul id="djDebugPanelList">
155 <li id="djDebugButton"><span>Django Debug</span></li>
156 {% for panel in panels %}
157 <li rel="{{ panel.dom_id }}">
158 {% if panel.content %}
159 <a href="{{ panel.url|default:"#" }}" onclick="djDebugToggle(this.parentNode)" title="{{ panel.title }}" class="{{ panel.dom_id }}">{{ panel.title }}</a>
161 <span>{{ panel.title }}</span>
165 <li id="djDebugHide"><a href="javascript:djDebugHide();">Hide Debug Toolbar</a></li>
168 {% for panel in panels %}
169 {% with panel.content as content %}
171 <div id="{{ panel.dom_id }}" class="panelContent">
173 <a href="javascript:djDebugCloseAll()" class="close">Close</a>
174 <!-- <h1>{{ panel.title }}</h1> -->
176 <div class="content">
183 <div id="djDebugWindow" class="panelContent">
185 <a href="javascript:djDebugCloseAll()" class="close">Close</a>
186 <a href="javascript:djDebugWindowClose();" class="close">Back</a>
188 <div class="content">