bird-lg/templates/layout.html

133 lines
3.7 KiB
HTML
Raw Normal View History

2011-12-16 11:02:24 +01:00
<!doctype html>
<title>Tetaneutral.net looking glass</title>
2012-01-20 00:12:19 +01:00
<meta charset="UTF-8">
2011-12-16 11:02:24 +01:00
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
<script type="text/javascript" src="{{url_for('static', filename='jquery.js') }}"></script>
2012-01-20 00:12:19 +01:00
<script type="text/javascript" src="{{url_for('static', filename='jquery-impromptu.3.2.min.js') }}"></script>
2011-12-16 11:02:24 +01:00
<script type="text/javascript">
2012-01-20 00:12:19 +01:00
$( function() {
$("a.whois").click(function (event){
event.preventDefault();
link = $(this).attr('href')
$.getJSON(link, function(data) {
$.prompt("<h3>" + data.title + "</h3>" + data.output,{ show:'slideDown' });
});
});
2011-12-16 19:05:36 +01:00
2012-01-20 00:12:19 +01:00
previous_req_type = "{{session.req_type}}".replace("_detail","")
function update_view(){
$("#request_args").hide()
$("#submit").hide()
2011-12-16 19:05:36 +01:00
2012-01-20 00:12:19 +01:00
next_req_type = $("#req_type").val().replace("_detail","")
if (previous_req_type != next_req_type) {
$("#request_args").val("")
}
previous_req_type = next_req_type
switch(next_req_type)
{
case "summary":
$("#submit").click()
break;
default:
$("#submit").show()
$("#request_args").show()
if ($("#request_args").val()) {
$("#submit").click()
} else {
$("#request_args").focus()
}
break;
}
2011-12-16 11:02:24 +01:00
2012-01-20 00:12:19 +01:00
}
2011-12-16 12:59:00 +01:00
2012-01-20 00:12:19 +01:00
$("ul li").click(function(){
// set hiddent field with class value
p = $(this).parent() // lu
c = p.attr("class")
$("#"+c).val($(this).attr("id"))
$("ul."+p.attr("class") + " li").removeClass('selected')
$(this).addClass('selected')
update_view()
});
update_view()
$("ul.proto li#{{session.proto}}").addClass('selected')
$("ul.hosts li[id='{{session.hosts}}']").addClass('selected')
$("ul.req_type li#{{session.req_type}}").addClass('selected')
$("ul.proto li#{{session.proto}}").addClass('current')
$("ul.hosts li[id='{{session.hosts}}']").addClass('current')
$("ul.req_type li#{{session.req_type}}").addClass('current')
$("#request_args").keyup(function(event) {
if (event.which == 13) {
event.preventDefault();
$("#submit").click()
}
});
$("#submit").click( function(){
switch ($("#req_type").val())
{
case "summary":
document.location = "/summary/" + $("#hosts").val() + "/" + $("#proto").val();
break;
default:
document.location = "/" + $("#req_type").val() + "/" + $("#hosts").val() + "/" + $("#proto").val() + "?q=" + $("#request_args").val() ;
break;
2012-01-03 10:11:24 +01:00
}
2012-01-20 00:12:19 +01:00
});
2011-12-16 19:05:36 +01:00
2012-01-20 00:12:19 +01:00
if (document.location.pathname == "/"){
$("#submit").click()
}
});
2011-12-16 11:02:24 +01:00
</script>
<div id="page">
2012-01-20 00:12:19 +01:00
<div id="header">
<h1>Tetaneutral.net<br />Looking Glass</h1>
2011-12-16 11:02:24 +01:00
<form>
2012-01-20 00:12:19 +01:00
<input id="hosts" type="hidden" value="{{session.hosts}}" />
<input id="proto" type="hidden" value="{{session.proto}}" />
<input id="req_type" type="hidden" value="{{session.req_type}}" />
<ul class="proto">
<li id="ipv4">ipv4</li>
<li id="ipv6">ipv6</li>
</ul>
<ul class="hosts">
<li id="{{all_hosts}}">all</li>
{% for host in config.HOST_MAPPING %}
<li id="{{host}}">{{host}}</li>
{% endfor %}
</ul>
<ul class="req_type">
<li id="summary">summary</li>
<li id="detail">detail</li>
<li id="prefix">prefix</li>
<li id="prefix_detail">prefix (detail)</li>
<li id="where">where net ~ [ ... ]</li>
<li id="where_detail">where net ~ [ ... ] (detail)</li>
</ul>
<br />
<!--textarea type="text" id="request_args" style="display:none">{{session.request_args}}</textarea-->
<input type="text" id="request_args" style="display:none" value="{{session.request_args}}" />
<br />
<input type="button" id="submit" value="submit" />
2011-12-16 11:02:24 +01:00
</form>
2012-01-20 00:12:19 +01:00
</div>
<div id="content">
{% if errors %}
<div id="error">{{errors}}</div>
{% endif %}
2011-12-16 11:02:24 +01:00
{% block body %}{% endblock %}
2012-01-20 00:12:19 +01:00
</div>
2011-12-16 11:02:24 +01:00
</div>