<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <script type="text/javascript" src="{{ url_for('static', file='json_formatter.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', file='jquery-1.8.2.min.js') }}"></script>
    <title>Object Viewer</title>
</head>

<body>
<pre id="json"></pre>

<form style="text-align: center">
    <input type="button" value="Close Window" onclick="window.close()"/>
</form>

<script type="text/javascript">
    function getUrlParameter(sParam) {
        var sPageURL = window.location.search.substring(1);
        var sURLVariables = sPageURL.split('&');
        for (var i = 0; i < sURLVariables.length; i++) {
            var sParameterName = sURLVariables[i].split('=');
            if (sParameterName[0] == sParam) {
                return sParameterName[1];
            }
        }
        return null;
    }

    $(document).ready(function () {
        var action = getUrlParameter('action');
        var url = '/' + action + '/?' + window.location.search.substring(1);

        $.get(url, function (data) {
            $("#json").text(FormatJSON(data));
        });
    });
</script>

</body>
</html>
