diff --git a/.gitignore b/.gitignore index ded606788..1b4aa885a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.py[cod] +data/* # C extensions *.so diff --git a/webui/debug.py b/webui/debug.py index 0fdc6cedf..ae872e9aa 100644 --- a/webui/debug.py +++ b/webui/debug.py @@ -130,3 +130,13 @@ def save(project): rpc.update_project() return 'OK', 200 + +@app.route('/helper/resizer.js') +def resizer_js(): + host = request.headers['Host'] + return render_template("resizer.js", host=host), 200, {'Content-Type': 'application/javascript'} + +@app.route('/helper/resizer.html') +def resizer_html(): + height = request.args['height'] + return render_template("resizer.html", height=height) diff --git a/webui/static/debug.js b/webui/static/debug.js index cc5170c8d..b3d24aae5 100644 --- a/webui/static/debug.js +++ b/webui/static/debug.js @@ -167,13 +167,28 @@ window.Debugger = (function() { }); }, + render_html: function(html, block_script, resizer, selector_helper) { + html = html.replace(/(\s)src=/g, "$1____src____="); + var dom = document.createElement('html'); + dom.innerHTML = html; + if (block_script) { + $(dom).find('script').attr('type', 'text/plain'); + } + if (resizer) { + $(dom).find('body').append(' + + + + diff --git a/webui/templates/resizer.js b/webui/templates/resizer.js new file mode 100644 index 000000000..6fff5f891 --- /dev/null +++ b/webui/templates/resizer.js @@ -0,0 +1,14 @@ +// vim: set et sw=2 ts=2 sts=2 ff=unix fenc=utf8: +// Author: Binux +// http://binux.me +// Created on 2014-03-16 11:05:05 + +window.addEventListener('load', function() { + var height = document.body.scrollHeight; + var iframe = document.createElement('iframe'); + iframe.height = 0; + iframe.width = 0; + iframe.frameborder = 0; + iframe.src = "http://{{ host }}/helper/resizer.html?height="+height+"&nocache="+(new Date()).getTime(); + document.body.appendChild(iframe); +});