Add client-side debugging tools

(imported from commit faa87e85f366e91fe33e0f24e00ae1197403605d)
This commit is contained in:
Keegan McAllister 2012-09-19 16:25:13 -04:00
parent 72b98d1d01
commit af5282abd4
3 changed files with 32 additions and 0 deletions

View File

@ -7,6 +7,9 @@ deployed = (platform.node() == 'humbug-dev')
DEBUG = not deployed
TEMPLATE_DEBUG = DEBUG
if DEBUG:
INTERNAL_IPS = ('127.0.0.1',)
ADMINS = (
('Jessica McKellar', 'jessica.mckellar@gmail.com'),
)

View File

@ -29,6 +29,11 @@
<script type="text/javascript" src="/static/third/jquery/jquery.form.js"></script>
<script type="text/javascript" src="/static/third/ich/ICanHaz.min.js"></script>
<script type="text/javascript" src="/static/js/zephyr.js"></script>
{% if debug %}
<script type="text/javascript" src="/static/js/debug.js"></script>
{% endif %}
<script type="text/javascript">
var initial_zephyr_array = {{ zephyr_array }};
var initial_pointer = {{ user_profile.pointer }};

24
zephyr/static/js/debug.js Normal file
View File

@ -0,0 +1,24 @@
/* WARNING:
This file is only included when Django's DEBUG = True and your
host is in INTERNAL_IPS.
Do not commit any code to zephyr.js which uses these functions.
They are for debugging use only.
The file may still be accessible under other circumstances, so do
not put sensitive information here. */
/*
print_elapsed_time("foo", foo)
evaluates to foo() and prints the elapsed time
to the console along with the name "foo". */
function print_elapsed_time(name, fun) {
var t0 = new Date().getTime();
var out = fun();
var t1 = new Date().getTime();
console.log(name + ': ' + (t1 - t0) + ' ms');
return out;
}