1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-12-23 04:54:43 +01:00
bird-lg/templates/layout.html
2012-01-20 00:12:37 +01:00

133 lines
3.7 KiB
HTML

<!doctype html>
<title>Tetaneutral.net looking glass</title>
<meta charset="UTF-8">
<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>
<script type="text/javascript" src="{{url_for('static', filename='jquery-impromptu.3.2.min.js') }}"></script>
<script type="text/javascript">
$( 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' });
});
});
previous_req_type = "{{session.req_type}}".replace("_detail","")
function update_view(){
$("#request_args").hide()
$("#submit").hide()
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;
}
}
$("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;
}
});
if (document.location.pathname == "/"){
$("#submit").click()
}
});
</script>
<div id="page">
<div id="header">
<h1>Tetaneutral.net<br />Looking Glass</h1>
<form>
<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" />
</form>
</div>
<div id="content">
{% if errors %}
<div id="error">{{errors}}</div>
{% endif %}
{% block body %}{% endblock %}
</div>
</div>