diff --git a/flask_debugtoolbar/static/css/toolbar.css b/flask_debugtoolbar/static/css/toolbar.css index c963930..d5955d5 100644 --- a/flask_debugtoolbar/static/css/toolbar.css +++ b/flask_debugtoolbar/static/css/toolbar.css @@ -1,16 +1,16 @@ /* Debug Toolbar CSS Reset, adapted from Eric Meyer's CSS Reset */ #flDebug, #flDebug * { - margin:0; - padding:0; - border:0; - outline:0; - font-size:12px; - line-height:1.5em; - color:#000; - vertical-align:baseline; - background: none; - font-family: inherit; - text-align:left; + margin:0; + padding:0; + border:0; + outline:0; + font-size:12px; + line-height:1.5em; + color:#000; + vertical-align:baseline; + background: none; + font-family: inherit; + text-align:left; } #flDebug { font-family: sans-serif; color: #000; background: #fff; } @@ -20,376 +20,324 @@ } #flDebug #flDebugToolbar { - background:#111; - width:200px; - z-index:100000000; - position:fixed; - top:0; - bottom:0; - right:0; - opacity:0.9; + background:#111; + width:200px; + z-index:100000000; + position:fixed; + top:0; + bottom:0; + right:0; + opacity:0.9; } #flDebug #flDebugToolbar small { - color:#999; + color:#999; } #flDebug #flDebugToolbar ul { - margin:0; - padding:0; - list-style:none; + margin:0; + padding:0; + list-style:none; } #flDebug #flDebugToolbar li { - border-bottom:1px solid #222; - color:#fff; - display:block; - font-weight:bold; - float:none; - margin:0; - padding:0; - position:relative; - width:auto; + border-bottom:1px solid #222; + color:#fff; + display:block; + font-weight:bold; + float:none; + margin:0; + padding:0; + position:relative; + width:auto; } #flDebug #flDebugToolbar li>a, #flDebug #flDebugToolbar li>div.contentless { - font-weight:normal; - font-style:normal; - text-decoration:none; - display:block; - font-size:16px; - padding:10px 10px 5px 25px; - color:#fff; + font-weight:normal; + font-style:normal; + text-decoration:none; + display:block; + font-size:16px; + padding:10px 10px 5px 25px; + color:#fff; } #flDebug #flDebugToolbar li a:hover { - color:#111; - background-color:#ffc; + color:#111; + background-color:#ffc; } #flDebug #flDebugToolbar li.active { - background-image:url(../img/indicator.png); - background-repeat:no-repeat; - background-position:left center; - background-color:#333; - padding-left:10px; + background-image:url(../img/indicator.png); + background-repeat:no-repeat; + background-position:left center; + background-color:#333; + padding-left:10px; } #flDebug #flDebugToolbar li.active a:hover { - color:#b36a60; - background-color:transparent; + color:#b36a60; + background-color:transparent; } #flDebug #flDebugToolbar li small { - font-size:12px; - color:#999; - font-style:normal; - text-decoration:none; - font-variant:small-caps; + font-size:12px; + color:#999; + font-style:normal; + text-decoration:none; + font-variant:small-caps; } #flDebug #flDebugToolbar li .switch { - font-size: 10px; - position: absolute; - display: block; - color: white; - height: 16px; - width: 16px; - cursor: pointer; - top: 15px; - right: 2px; + font-size: 10px; + position: absolute; + display: block; + color: white; + height: 16px; + width: 16px; + cursor: pointer; + top: 15px; + right: 2px; } #flDebug #flDebugToolbar li .switch.active { - background-image: url(../img/tick.png); + background-image: url(../img/tick.png); } #flDebug #flDebugToolbar li .switch.inactive { - background-image: url(../img/tick-red.png); + background-image: url(../img/tick-red.png); } #flDebug #flDebugToolbarHandle { - position:fixed; - background:#fff; - border:1px solid #111; - top:30px; - right:0; - z-index:100000000; - opacity:0.75; + position:fixed; + background:#fff; + border:1px solid #111; + top:30px; + right:0; + z-index:100000000; + opacity:0.75; } #flDebug a#flShowToolBarButton { - display:block; - height:75px; - width:30px; - border-right:none; - border-bottom:4px solid #fff; - border-top:4px solid #fff; - border-left:4px solid #fff; - color:#fff; - font-size:10px; - font-weight:bold; - text-decoration:none; - text-align:center; - text-indent:-999999px; - background:#000 url(../img/djdt_vertical.png) no-repeat left center; - opacity:0.5; + display:block; + height:75px; + width:30px; + border-right:none; + border-bottom:4px solid #fff; + border-top:4px solid #fff; + border-left:4px solid #fff; + color:#fff; + font-size:10px; + font-weight:bold; + text-decoration:none; + text-align:center; + text-indent:-999999px; + background:#000 url(../img/djdt_vertical.png) no-repeat left center; + opacity:0.5; } #flDebug a#flShowToolBarButton:hover { - background-color:#111; - padding-right:6px; - border-top-color:#FFE761; - border-left-color:#FFE761; - border-bottom-color:#FFE761; - opacity:1.0; + background-color:#111; + padding-right:6px; + border-top-color:#FFE761; + border-left-color:#FFE761; + border-bottom-color:#FFE761; + opacity:1.0; } #flDebug code { - display:block; - white-space:pre; - overflow:auto; + display:block; + white-space:pre; + overflow:auto; } #flDebug tr.flDebugOdd { - background-color:#f5f5f5; + background-color:#f5f5f5; } #flDebug .panelContent { - display:none; - position:fixed; - margin:0; - top:0; - right:200px; - bottom:0; - left:0px; - background-color:#eee; - color:#666; - z-index:100000000; + display:none; + position:fixed; + margin:0; + top:0; + right:200px; + bottom:0; + left:0px; + background-color:#eee; + color:#666; + z-index:100000000; } #flDebug .panelContent > div { - border-bottom:1px solid #ddd; + border-bottom:1px solid #ddd; } #flDebug .flDebugPanelTitle { - position:absolute; - background-color:#ffc; - color:#666; - padding-left:20px; - top:0; - right:0; - left:0; - height:50px; + position:absolute; + background-color:#ffc; + color:#666; + padding-left:20px; + top:0; + right:0; + left:0; + height:50px; } #flDebug .flDebugPanelTitle code { - display:inline; - font-size:inherit; + display:inline; + font-size:inherit; } #flDebug .flDebugPanelContent { - position:absolute; - top:50px; - right:0; - bottom:0; - left:0; - height:auto; - padding:0 0 0 20px; + position:absolute; + top:50px; + right:0; + bottom:0; + left:0; + height:auto; + padding:0 0 0 20px; } #flDebug .flDebugPanelContent .scroll { - height:100%; - overflow:auto; - display:block; - padding:0 10px 0 0; + height:100%; + overflow:auto; + display:block; + padding:0 10px 0 0; } #flDebug h3 { - font-size:24px; - font-weight:normal; - line-height:50px; + font-size:24px; + font-weight:normal; + line-height:50px; } #flDebug h4 { - font-size:20px; - font-weight:bold; - margin-top:0.8em; + font-size:20px; + font-weight:bold; + margin-top:0.8em; } #flDebug .panelContent table { - border:1px solid #ccc; - border-collapse:collapse; - width:100%; - background-color:#fff; - display:block; - margin-top:0.8em; - overflow: auto; + border:1px solid #ccc; + border-collapse:collapse; + width:100%; + background-color:#fff; + display:block; + margin-top:0.8em; + overflow: auto; } #flDebug .panelContent tbody td, #flDebug .panelContent tbody th { - vertical-align:top; - padding:2px 3px; + vertical-align:top; + padding:2px 3px; } #flDebug .panelContent thead th { - padding:1px 6px 1px 3px; - text-align:left; - font-weight:bold; - font-size:14px; + padding:1px 6px 1px 3px; + text-align:left; + font-weight:bold; + font-size:14px; } #flDebug .panelContent tbody th { - width:12em; - text-align:right; - color:#666; - padding-right:.5em; + width:12em; + text-align:right; + color:#666; + padding-right:.5em; } #flDebug .flTemplateHideContextDiv { - background-color:#fff; + background-color:#fff; } -/* -#flDebug .panelContent p a:hover, #flDebug .panelContent dd a:hover { - color:#111; - background-color:#ffc; -} - -#flDebug .panelContent p { - padding:0 5px; -} - -#flDebug .panelContent p, #flDebug .panelContent table, #flDebug .panelContent ol, #flDebug .panelContent ul, #flDebug .panelContent dl { - margin:5px 0 15px; - background-color:#fff; -} -#flDebug .panelContent table { - clear:both; - border:0; - padding:0; - margin:0; - border-collapse:collapse; - border-spacing:0; -} - -#flDebug .panelContent table a { - color:#000; - padding:2px 4px; -} -#flDebug .panelContent table a:hover { - background-color:#ffc; -} - -#flDebug .panelContent table th { - background-color:#333; - font-weight:bold; - color:#fff; - padding:3px 7px 3px; - text-align:left; - cursor:pointer; -} -#flDebug .panelContent table td { - padding:5px 10px; - font-size:14px; - background:#fff; - color:#000; - vertical-align:top; - border:0; -} -#flDebug .panelContent table tr.flDebugOdd td { - background:#eee; -} -*/ - #flDebug .panelContent .flDebugClose { - text-indent:-9999999px; - display:block; - position:absolute; - top:4px; - right:15px; - height:40px; - width:40px; - background:url(../img/close.png) no-repeat center center; + text-indent:-9999999px; + display:block; + position:absolute; + top:4px; + right:15px; + height:40px; + width:40px; + background:url(../img/close.png) no-repeat center center; } #flDebug .panelContent .flDebugClose:hover { - background-image:url(../img/close_hover.png); + background-image:url(../img/close_hover.png); } #flDebug .panelContent .flDebugClose.flDebugBack { - background-image:url(../img/back.png); + background-image:url(../img/back.png); } #flDebug .panelContent .flDebugClose.flDebugBack:hover { - background-image:url(../img/back_hover.png); + background-image:url(../img/back_hover.png); } #flDebug .panelContent dt, #flDebug .panelContent dd { - display:block; + display:block; } #flDebug .panelContent dt { - margin-top:0.75em; + margin-top:0.75em; } #flDebug .panelContent dd { - margin-left:10px; + margin-left:10px; } #flDebug a.toggleTemplate { - padding:4px; - background-color:#bbb; - -moz-border-radius:3px; - -webkit-border-radius:3px; + padding:4px; + background-color:#bbb; + -moz-border-radius:3px; + -webkit-border-radius:3px; } #flDebug a.toggleTemplate:hover { - padding:4px; - background-color:#444; - color:#ffe761; - -moz-border-radius:3px; - -webkit-border-radius:3px; + padding:4px; + background-color:#444; + color:#ffe761; + -moz-border-radius:3px; + -webkit-border-radius:3px; } #flDebug a.flTemplateShowContext, #flDebug a.flTemplateShowContext span.toggleArrow { - color:#999; + color:#999; } #flDebug a.flTemplateShowContext:hover, #flDebug a.flTemplateShowContext:hover span.toggleArrow { - color:#000; - cursor:pointer; + color:#000; + cursor:pointer; } #flDebug .flDebugSqlWrap { - position:relative; + position:relative; } #flDebug .flDebugSql { - z-index:100000002; + z-index:100000002; } #flDebug .flSQLHideStacktraceDiv tbody th { - text-align: left; + text-align: left; } #flDebug .flSqlExplain td { - white-space: pre; + white-space: pre; } #flDebug span.flDebugLineChart { - background-color:#777; - height:3px; - position:absolute; - bottom:0; - top:0; - left:0; - display:block; - z-index:1000000001; + background-color:#777; + height:3px; + position:absolute; + bottom:0; + top:0; + left:0; + display:block; + z-index:1000000001; } #flDebug span.flDebugLineChartWarning { - background-color:#900; + background-color:#900; } #flDebug .highlight { color:#000; } @@ -414,24 +362,24 @@ /* tablesorted */ #flDebug table.tablesorter { - width: 100%; + width: 100%; } #flDebug table.tablesorter thead th, table.tablesorter tfoot th { - padding-right: 20px; + padding-right: 20px; } #flDebug table.tablesorter thead th { - background: url(../img/bg.gif) center right no-repeat; - cursor: pointer; + background: url(../img/bg.gif) center right no-repeat; + cursor: pointer; } #flDebug table.tablesorter tbody tr.odd td { - background-color: #F0F0F6; + background-color: #F0F0F6; } #flDebug table.tablesorter thead .headerSortUp { - background-image: url(../img/asc.gif); + background-image: url(../img/asc.gif); } #flDebug table.tablesorter thead .headerSortDown { - background-image: url(../img/desc.gif); + background-image: url(../img/desc.gif); } #flDebug table.tablesorter thead .headerSortDown, #flDebug table.tablesorter thead .headerSortUp { - background-color: #8dbdd8; + background-color: #8dbdd8; } diff --git a/flask_debugtoolbar/static/js/toolbar.js b/flask_debugtoolbar/static/js/toolbar.js index 673c525..deb7eb5 100644 --- a/flask_debugtoolbar/static/js/toolbar.js +++ b/flask_debugtoolbar/static/js/toolbar.js @@ -1,194 +1,192 @@ (function($) { - $.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; - $('head').append(''); - var COOKIE_NAME = 'fldt'; - var COOKIE_NAME_ACTIVE = COOKIE_NAME +'_active'; - var fldt = { - init: function() { - $('#flDebug').show(); - var current = null; - $('#flDebugPanelList li a').click(function() { - if (!this.className) { - return false; - } - current = $('#flDebug #' + this.className + '-content'); - if (current.is(':visible')) { - $(document).trigger('close.flDebug'); - $(this).parent().removeClass('active'); - } else { - $('.panelContent').hide(); // Hide any that are already open - current.show(); - $('#flDebugToolbar li').removeClass('active'); - $(this).parent().addClass('active'); - } - return false; - }); - $('#flDebugPanelList li .switch').click(function() { - var $panel = $(this).parent(); - var $this = $(this); - var dom_id = $panel.attr('id'); - - // Turn cookie content into an array of active panels - var active_str = $.cookie(COOKIE_NAME_ACTIVE); - var active = (active_str) ? active_str.split(';') : []; - active = $.grep(active, function(n,i) { return n != dom_id; }); - - if ($this.hasClass('active')) { - $this.removeClass('active'); - $this.addClass('inactive'); - } - else { - active.push(dom_id); - $this.removeClass('inactive'); - $this.addClass('active'); - } - - if (active.length > 0) { - $.cookie(COOKIE_NAME_ACTIVE, active.join(';'), { - path: '/', expires: 10 - }); - } - else { - $.cookie(COOKIE_NAME_ACTIVE, null, { - path: '/', expires: -1 - }); - } - }); - $('#flDebug a.flDebugClose').click(function() { - $(document).trigger('close.flDebug'); - $('#flDebugToolbar li').removeClass('active'); - return false; - }); - $('#flDebug a.remoteCall').click(function() { - $('#flDebugWindow').load(this.href, {}, function() { - $('#flDebugWindow a.flDebugBack').click(function() { - $(this).parent().parent().hide(); - return false; - }); - }); - $('#flDebugWindow').show(); - return false; - }); - $('#flDebugTemplatePanel a.flTemplateShowContext').click(function() { - fldt.toggle_arrow($(this).children('.toggleArrow')) - fldt.toggle_content($(this).parent().next()); - return false; - }); - $('#flDebugSQLPanel a.flSQLShowStacktrace').click(function() { - fldt.toggle_content($('.flSQLHideStacktraceDiv', $(this).parents('tr'))); - return false; - }); - $('#flHideToolBarButton').click(function() { - fldt.hide_toolbar(true); - return false; - }); - $('#flShowToolBarButton').click(function() { - fldt.show_toolbar(); - return false; - }); - $(document).bind('close.flDebug', function() { - // If a sub-panel is open, close that - if ($('#flDebugWindow').is(':visible')) { - $('#flDebugWindow').hide(); - return; - } - // If a panel is open, close that - if ($('.panelContent').is(':visible')) { - $('.panelContent').hide(); - return; - } - // Otherwise, just minimize the toolbar - if ($('#flDebugToolbar').is(':visible')) { - fldt.hide_toolbar(true); - return; - } - }); - if ($.cookie(COOKIE_NAME)) { - fldt.hide_toolbar(false); - } else { - fldt.show_toolbar(false); - } - $('#flDebug table.tablesorter') - .tablesorter() - .bind('sortStart', function() { - $(this).find('tbody tr') - .removeClass('flDebugEven') - .removeClass('flDebugOdd'); - }) - .bind('sortEnd', function() { - $(this).find('tbody tr').each(function(idx, elem) { - var even = idx % 2 == 0; - $(elem) - .toggleClass('flDebugEven', even) - .toggleClass('flDebugOdd', !even); - }); - }); - }, - toggle_content: function(elem) { - if (elem.is(':visible')) { - elem.hide(); - } else { - elem.show(); - } - }, - close: function() { - $(document).trigger('close.flDebug'); - return false; - }, - hide_toolbar: function(setCookie) { - // close any sub panels - $('#flDebugWindow').hide(); - // close all panels - $('.panelContent').hide(); - $('#flDebugToolbar li').removeClass('active'); - // finally close toolbar - $('#flDebugToolbar').hide('fast'); - $('#flDebugToolbarHandle').show(); - // Unbind keydown - $(document).unbind('keydown.flDebug'); - if (setCookie) { - $.cookie(COOKIE_NAME, 'hide', { - path: '/', - expires: 10 - }); - } - }, - show_toolbar: function(animate) { - // Set up keybindings - $(document).bind('keydown.flDebug', function(e) { - if (e.keyCode == 27) { - fldt.close(); - } - }); - $('#flDebugToolbarHandle').hide(); - if (animate) { - $('#flDebugToolbar').show('fast'); - } else { - $('#flDebugToolbar').show(); - } - $.cookie(COOKIE_NAME, null, { - path: '/', - expires: -1 - }); - }, - toggle_arrow: function(elem) { - var uarr = String.fromCharCode(0x25b6); - var darr = String.fromCharCode(0x25bc); - elem.html(elem.html() == uarr ? darr : uarr); - }, - load_href: function(href) { - $.get(href, function(data, status, xhr) { - document.open(); - document.write(xhr.responseText); - document.close(); - }); + $.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; + $('head').append(''); + var COOKIE_NAME = 'fldt'; + var COOKIE_NAME_ACTIVE = COOKIE_NAME +'_active'; + var fldt = { + init: function() { + $('#flDebug').show(); + var current = null; + $('#flDebugPanelList li a').click(function() { + if (!this.className) { return false; - }, - $: $ - }; - $(document).ready(function() { - fldt.init(); - }); - window.fldt = fldt; + } + current = $('#flDebug #' + this.className + '-content'); + if (current.is(':visible')) { + $(document).trigger('close.flDebug'); + $(this).parent().removeClass('active'); + } else { + $('.panelContent').hide(); // Hide any that are already open + current.show(); + $('#flDebugToolbar li').removeClass('active'); + $(this).parent().addClass('active'); + } + return false; + }); + $('#flDebugPanelList li .switch').click(function() { + var $panel = $(this).parent(); + var $this = $(this); + var dom_id = $panel.attr('id'); + + // Turn cookie content into an array of active panels + var active_str = $.cookie(COOKIE_NAME_ACTIVE); + var active = (active_str) ? active_str.split(';') : []; + active = $.grep(active, function(n,i) { return n != dom_id; }); + + if ($this.hasClass('active')) { + $this.removeClass('active'); + $this.addClass('inactive'); + } else { + active.push(dom_id); + $this.removeClass('inactive'); + $this.addClass('active'); + } + + if (active.length > 0) { + $.cookie(COOKIE_NAME_ACTIVE, active.join(';'), { + path: '/', expires: 10 + }); + } else { + $.cookie(COOKIE_NAME_ACTIVE, null, { + path: '/', expires: -1 + }); + } + }); + $('#flDebug a.flDebugClose').click(function() { + $(document).trigger('close.flDebug'); + $('#flDebugToolbar li').removeClass('active'); + return false; + }); + $('#flDebug a.remoteCall').click(function() { + $('#flDebugWindow').load(this.href, {}, function() { + $('#flDebugWindow a.flDebugBack').click(function() { + $(this).parent().parent().hide(); + return false; + }); + }); + $('#flDebugWindow').show(); + return false; + }); + $('#flDebugTemplatePanel a.flTemplateShowContext').click(function() { + fldt.toggle_arrow($(this).children('.toggleArrow')) + fldt.toggle_content($(this).parent().next()); + return false; + }); + $('#flDebugSQLPanel a.flSQLShowStacktrace').click(function() { + fldt.toggle_content($('.flSQLHideStacktraceDiv', $(this).parents('tr'))); + return false; + }); + $('#flHideToolBarButton').click(function() { + fldt.hide_toolbar(true); + return false; + }); + $('#flShowToolBarButton').click(function() { + fldt.show_toolbar(); + return false; + }); + $(document).bind('close.flDebug', function() { + // If a sub-panel is open, close that + if ($('#flDebugWindow').is(':visible')) { + $('#flDebugWindow').hide(); + return; + } + // If a panel is open, close that + if ($('.panelContent').is(':visible')) { + $('.panelContent').hide(); + return; + } + // Otherwise, just minimize the toolbar + if ($('#flDebugToolbar').is(':visible')) { + fldt.hide_toolbar(true); + return; + } + }); + if ($.cookie(COOKIE_NAME)) { + fldt.hide_toolbar(false); + } else { + fldt.show_toolbar(false); + } + $('#flDebug table.tablesorter') + .tablesorter() + .bind('sortStart', function() { + $(this).find('tbody tr') + .removeClass('flDebugEven') + .removeClass('flDebugOdd'); + }) + .bind('sortEnd', function() { + $(this).find('tbody tr').each(function(idx, elem) { + var even = idx % 2 == 0; + $(elem) + .toggleClass('flDebugEven', even) + .toggleClass('flDebugOdd', !even); + }); + }); + }, + toggle_content: function(elem) { + if (elem.is(':visible')) { + elem.hide(); + } else { + elem.show(); + } + }, + close: function() { + $(document).trigger('close.flDebug'); + return false; + }, + hide_toolbar: function(setCookie) { + // close any sub panels + $('#flDebugWindow').hide(); + // close all panels + $('.panelContent').hide(); + $('#flDebugToolbar li').removeClass('active'); + // finally close toolbar + $('#flDebugToolbar').hide('fast'); + $('#flDebugToolbarHandle').show(); + // Unbind keydown + $(document).unbind('keydown.flDebug'); + if (setCookie) { + $.cookie(COOKIE_NAME, 'hide', { + path: '/', + expires: 10 + }); + } + }, + show_toolbar: function(animate) { + // Set up keybindings + $(document).bind('keydown.flDebug', function(e) { + if (e.keyCode == 27) { + fldt.close(); + } + }); + $('#flDebugToolbarHandle').hide(); + if (animate) { + $('#flDebugToolbar').show('fast'); + } else { + $('#flDebugToolbar').show(); + } + $.cookie(COOKIE_NAME, null, { + path: '/', + expires: -1 + }); + }, + toggle_arrow: function(elem) { + var uarr = String.fromCharCode(0x25b6); + var darr = String.fromCharCode(0x25bc); + elem.html(elem.html() == uarr ? darr : uarr); + }, + load_href: function(href) { + $.get(href, function(data, status, xhr) { + document.open(); + document.write(xhr.responseText); + document.close(); + }); + return false; + }, + $: $ + }; + $(document).ready(function() { + fldt.init(); + }); + window.fldt = fldt; })(jQuery.noConflict(true)); diff --git a/flask_debugtoolbar/templates/base.html b/flask_debugtoolbar/templates/base.html index 0f15c74..59769c9 100644 --- a/flask_debugtoolbar/templates/base.html +++ b/flask_debugtoolbar/templates/base.html @@ -1,56 +1,57 @@ diff --git a/flask_debugtoolbar/templates/panels/headers.html b/flask_debugtoolbar/templates/panels/headers.html index d373add..2a1486c 100644 --- a/flask_debugtoolbar/templates/panels/headers.html +++ b/flask_debugtoolbar/templates/panels/headers.html @@ -1,16 +1,16 @@ - - - - - - - - {% for key, value in headers.iteritems() %} - - - - - {% endfor %} - + + + + + + + + {% for key, value in headers.iteritems() %} + + + + + {% endfor %} +
KeyValue
{{ key|escape }}{{ value|escape }}
KeyValue
{{ key|escape }}{{ value|escape }}
diff --git a/flask_debugtoolbar/templates/panels/logger.html b/flask_debugtoolbar/templates/panels/logger.html index e4e7673..b7f5632 100644 --- a/flask_debugtoolbar/templates/panels/logger.html +++ b/flask_debugtoolbar/templates/panels/logger.html @@ -1,26 +1,26 @@ {% if records %} - - - - - - - - - - - {% for record in records %} - - - - - - - {% endfor %} - -
LevelTimeMessageLocation
{{ record.level }}{{ record.time }}{{ record.message }}{{ record.file }}:{{ record.line }}
+ + + + + + + + + + + {% for record in records %} + + + + + + + {% endfor %} + +
LevelTimeMessageLocation
{{ record.level }}{{ record.time }}{{ record.message }}{{ record.file }}:{{ record.line }}
{% else %} -

No messages logged.

+

No messages logged.

{% endif %} diff --git a/flask_debugtoolbar/templates/panels/profiler.html b/flask_debugtoolbar/templates/panels/profiler.html index 59ba34a..205cee8 100644 --- a/flask_debugtoolbar/templates/panels/profiler.html +++ b/flask_debugtoolbar/templates/panels/profiler.html @@ -1,25 +1,25 @@ - - - - - - - - - - - - {% for row in function_calls %} - - - - - - - - - {% endfor %} - + + + + + + + + + + + + {% for row in function_calls %} + + + + + + + + + {% endfor %} +
CallsTotal Time (ms)Per Call (ms)Cumulative Time (ms)Per Call (ms)Function
{{ row.ncalls }}{{ row.tottime }}{{ '%.4f'|format(row.percall) }}{{ row.cumtime }}{{ '%.4f'|format(row.percall_cum) }}{{ row.filename|escape }}
CallsTotal Time (ms)Per Call (ms)Cumulative Time (ms)Per Call (ms)Function
{{ row.ncalls }}{{ row.tottime }}{{ '%.4f'|format(row.percall) }}{{ row.cumtime }}{{ '%.4f'|format(row.percall_cum) }}{{ row.filename|escape }}
diff --git a/flask_debugtoolbar/templates/panels/request_vars.html b/flask_debugtoolbar/templates/panels/request_vars.html index dad3719..a018224 100644 --- a/flask_debugtoolbar/templates/panels/request_vars.html +++ b/flask_debugtoolbar/templates/panels/request_vars.html @@ -1,104 +1,104 @@

View information

- - - - - - - - - - - - - - + + + + + + + + + + + + + +
View Functionargskwargs
{{ view_func }}{{ view_args|default("None") }} - {% if view_kwargs.items() %} - {% for k, v in view_kwargs.items() %} - {{ k }}={{ v }}{% if not loop.last %}, {% endif %} - {% endfor %} - {% else %} - None - {% endif %} -
View Functionargskwargs
{{ view_func }}{{ view_args|default("None") }} + {% if view_kwargs.items() %} + {% for k, v in view_kwargs.items() %} + {{ k }}={{ v }}{% if not loop.last %}, {% endif %} + {% endfor %} + {% else %} + None + {% endif %} +
{% macro show_map(map) %} - - - - - - - - - - - - - {% for key, value in map %} - - - - - {% endfor %} - -
VariableValue
{{ key|printable }}{{ value|printable }}
+ + + + + + + + + + + + + {% for key, value in map %} + + + + + {% endfor %} + +
VariableValue
{{ key|printable }}{{ value|printable }}
{% endmacro %}

COOKIES Variables

{% if cookies %} - {{ show_map(cookies) }} + {{ show_map(cookies) }} {% else %} -

No COOKIE data

+

No COOKIE data

{% endif %}

SESSION Variables

{% if session %} - {{ show_map(session) }} + {{ show_map(session) }} {% else %} -

No SESSION data

+

No SESSION data

{% endif %} {% macro show_multi_map(map) %} - - - - - - - - - {% for key, value in map %} - - - - - {% endfor %} - -
VariableValue
{{ key|printable }} - {%- set sep = joiner() -%} - {%- for v in value -%} - {{ sep() }}{{ v|printable }} - {%- endfor -%} -
+ + + + + + + + + {% for key, value in map %} + + + + + {% endfor %} + +
VariableValue
{{ key|printable }} + {%- set sep = joiner() -%} + {%- for v in value -%} + {{ sep() }}{{ v|printable }} + {%- endfor -%} +
{% endmacro %}

GET Variables

{% if get %} - {{ show_multi_map(get) }} + {{ show_multi_map(get) }} {% else %} -

No GET data

+

No GET data

{% endif %}

POST Variables

{% if post %} - {{ show_multi_map(post) }} + {{ show_multi_map(post) }} {% else %} -

No POST data

+

No POST data

{% endif %} diff --git a/flask_debugtoolbar/templates/panels/sqlalchemy.html b/flask_debugtoolbar/templates/panels/sqlalchemy.html index 1af9535..ddc1ce3 100644 --- a/flask_debugtoolbar/templates/panels/sqlalchemy.html +++ b/flask_debugtoolbar/templates/panels/sqlalchemy.html @@ -1,63 +1,63 @@ - - - - - - - - - - {% for query in queries %} - - - - + + + + + + + + + {% for query in queries %} + + + + - + - - {% endfor %} - + #} + + + + {% endfor %} +
 (ms)ActionContextQuery
{{ '%.4f'|format(query.duration * 1000) }} - {% if query.signed_query %} - SELECT
- EXPLAIN
- {% endif %} -
+
 (ms)ActionContextQuery
{{ '%.4f'|format(query.duration * 1000) }} + {% if query.signed_query %} + SELECT
+ EXPLAIN
+ {% endif %} +
{{ query.context }} - -
-
{{ query.sql|safe }}
- {# - {% if query.stacktrace %} - - {% endif %} +
+
+
{{ query.sql|safe }}
+ {# + {% if query.stacktrace %} + + {% endif %} - #} -
-
diff --git a/flask_debugtoolbar/templates/panels/sqlalchemy_explain.html b/flask_debugtoolbar/templates/panels/sqlalchemy_explain.html index 05df296..13625e6 100644 --- a/flask_debugtoolbar/templates/panels/sqlalchemy_explain.html +++ b/flask_debugtoolbar/templates/panels/sqlalchemy_explain.html @@ -1,33 +1,33 @@
- Back -

SQL Explained

+ Back +

SQL Explained

-
-
-
Executed SQL
-
{{ sql|safe }}
-
Time
-
{{ '%.4f'|format(duration) }} ms
-
- - - - {% for h in headers %} - - {% endfor %} - - - - {% for row in result %} - - {% for column in row %} - - {% endfor %} - - {% endfor %} - -
{{ h|upper }}
{{ column }}
-
+
+
+
Executed SQL
+
{{ sql|safe }}
+
Time
+
{{ '%.4f'|format(duration) }} ms
+
+ + + + {% for h in headers %} + + {% endfor %} + + + + {% for row in result %} + + {% for column in row %} + + {% endfor %} + + {% endfor %} + +
{{ h|upper }}
{{ column }}
+
diff --git a/flask_debugtoolbar/templates/panels/sqlalchemy_select.html b/flask_debugtoolbar/templates/panels/sqlalchemy_select.html index e7ec035..ed77080 100644 --- a/flask_debugtoolbar/templates/panels/sqlalchemy_select.html +++ b/flask_debugtoolbar/templates/panels/sqlalchemy_select.html @@ -1,37 +1,36 @@
- Back -

SQL Explained

+ Back +

SQL Explained

-
-
-
Executed SQL
-
{{ sql|safe }}
-
Time
-
{{ '%.4f'|format(duration) }} ms
-
- {% if result %} - - - - {% for h in headers %} - - {% endfor %} - - - - {% for row in result %} - - {% for column in row %} - - {% endfor %} - - {% endfor %} - -
{{ h|upper }}
{{ column }}
- {% else %} -

Empty set

- {% endif %} -
+
+
+
Executed SQL
+
{{ sql|safe }}
+
Time
+
{{ '%.4f'|format(duration) }} ms
+
+ {% if result %} + + + + {% for h in headers %} + + {% endfor %} + + + + {% for row in result %} + + {% for column in row %} + + {% endfor %} + + {% endfor %} + +
{{ h|upper }}
{{ column }}
+ {% else %} +

Empty set

+ {% endif %} +
- diff --git a/flask_debugtoolbar/templates/panels/template.html b/flask_debugtoolbar/templates/panels/template.html index 3505e89..a36c5a7 100644 --- a/flask_debugtoolbar/templates/panels/template.html +++ b/flask_debugtoolbar/templates/panels/template.html @@ -1,26 +1,26 @@ {% if templates %} - {% if editable %} + {% if editable %} Edit templates - {% endif %} - {% for template in templates %} -

{{ template.template.name }}

- - - - - - - - - {% for k, v in template.context|dictsort %} - - - - - {% endfor %} - -
VariableValue
{{ k }}{{ v|printable }}
- {% endfor %} + {% endif %} + {% for template in templates %} +

{{ template.template.name }}

+ + + + + + + + + {% for k, v in template.context|dictsort %} + + + + + {% endfor %} + +
VariableValue
{{ k }}{{ v|printable }}
+ {% endfor %} {% else %} -

No template rendered

+

No template rendered

{% endif %} diff --git a/flask_debugtoolbar/templates/panels/timer.html b/flask_debugtoolbar/templates/panels/timer.html index 8b69e67..5238e47 100644 --- a/flask_debugtoolbar/templates/panels/timer.html +++ b/flask_debugtoolbar/templates/panels/timer.html @@ -1,21 +1,21 @@ - - - - - - - - - - - - {% for key, value in rows %} - - - - - {% endfor %} - + + + + + + + + + + + + {% for key, value in rows %} + + + + + {% endfor %} +
ResourceValue
{{ key|escape }}{{ value|escape }}
ResourceValue
{{ key|escape }}{{ value|escape }}
diff --git a/flask_debugtoolbar/templates/redirect.html b/flask_debugtoolbar/templates/redirect.html index 6f49fe5..28818bc 100644 --- a/flask_debugtoolbar/templates/redirect.html +++ b/flask_debugtoolbar/templates/redirect.html @@ -1,15 +1,15 @@ - - Redirect intercepted - - -

Redirect ({{ redirect_code }})

-

Location: {{ redirect_to }}

-

- The Flask Debug Toolbar has intercepted a redirect to the above URL for - debug viewing purposes. You can click the above link to continue with the - redirect as normal. If you'd like to disable this feature, you can set the - config variable DEBUG_TB_INTERCEPT_REDIRECTS to False. -

- + + Redirect intercepted + + +

Redirect ({{ redirect_code }})

+

Location: {{ redirect_to }}

+

+ The Flask Debug Toolbar has intercepted a redirect to the above URL for + debug viewing purposes. You can click the above link to continue with the + redirect as normal. If you'd like to disable this feature, you can set the + config variable DEBUG_TB_INTERCEPT_REDIRECTS to False. +

+