<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Analysis Information Leak framework Dashboard</title>

  <!-- Core CSS -->
  <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
  <link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
  <link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
  <link href="{{ url_for('static', filename='css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
  <script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
  <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
  <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
  <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>

  <style>
      .tooltip-inner {
         text-align: left;
         height: 200%;
         width: 200%;
         max-width: 500px;
         max-height: 500px;
         font-size: 13px;
      }
      xmp {
         white-space:pre-wrap;
         word-wrap:break-word;
      }
  </style>

</head>
<body>

   {% include 'navbar.html' %}

<!-- Modal -->
<div id="mymodal" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">

    <!-- Modal content-->
    <div id="mymodalcontent" class="modal-content">
      <div id="mymodalbody" class="modal-body" max-width="850px">
        <p>Loading paste information...</p>
        <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" height="26" width="26" style="margin: 4px;">
      </div>
      <div class="modal-footer">
        <a id="button_show_path" target="_blank" href=""><button type="button" class="btn btn-info">Show saved paste</button></a>
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>


<div id="page-wrapper">
  <div class="row">
      <div class="col-lg-12">
          <h1 class="page-header" data-page="page-browse" >Browse important pastes</h1>
      </div>
      <!-- /.col-lg-12 -->
  </div>

  <div class="row">
  <div class="col-md-12" style="margin-bottom: 0.2cm;">
      <strong style="">Year: </strong> 
      <select class="form-control" id="index_year" style="display: inline-block; margin-bottom: 5px; width: 5%">
          {% for yearElem in year_list %}
          <option {% if yearElem[2] %} selected="selected" {% endif %}  value="{{ yearElem[0] }}" >{{ yearElem[1] }}</option>
          {% endfor %}
      </select>
  </div>
  </br>
  </div>


    <!-- /.row -->
    <div class="row">

    <!-- /.nav-tabs -->
    <ul class="nav nav-tabs">
        <li name='nav-pan' class="active"><a data-toggle="tab" href="#credential-tab" data-attribute-name="credential" data-panel="credential-panel">Credentials</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#creditcard-tab" data-attribute-name="creditcard" data-panel="creditcard-panel">Credit cards</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#sqlinjection-tab" data-attribute-name="sqlinjection" data-panel="sqlinjection-panel">SQL injections</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#cve-tab" data-attribute-name="cve" data-panel="cve-panel">CVEs</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#keys-tab" data-attribute-name="keys" data-panel="keys-panel">Keys</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#mail-tab" data-attribute-name="mail" data-panel="mail-panel">Mails</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#phone-tab" data-attribute-name="phone" data-panel="phone-panel">Phones</a></li>
        <li name='nav-pan'><a data-toggle="tab" href="#onion-tab" data-attribute-name="onion" data-panel="onion-panel">Onions</a></li>
    </ul>
    </br>


    <div class="tab-content">
        <div class="col-lg-12 tab-pane fade in active" id="credential-tab" >
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="creditcard-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="sqlinjection-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="cve-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="keys-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="mail-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="phone-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
        <div class="col-lg-12 tab-pane fade" id="onion-tab">
            <img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" style="margin: 4px;">
        </div>
    </div> <!-- tab-content -->
    <!-- /.row -->
</div>
<!-- /#page-wrapper -->

<!-- import graph function -->
<script>
    $(document).ready(function(){
        activePage = $('h1.page-header').attr('data-page');
        $("#"+activePage).addClass("active");

        var dataPath = 'credential';
        $.get("{{ url_for('browsepastes.importantPasteByModule') }}"+"?moduleName="+dataPath+"&year="+currentSelectYear, function(data, status){
            $('#'+dataPath+'-tab').html(data);
        });

    });
</script>


<script>
// When a pannel is shown, create the data-table.
var previous_tab = $('[data-attribute-name="credential');
var currentTabName = previous_tab.attr('data-attribute-name');
var loading_gif = "<img id='loading-gif-modal' class='img-center' src=\"{{url_for('static', filename='image/loading.gif') }}\" height='26' width='26' style='margin: 4px;'>";
var currentSelectYear = {{ selected_year }};

$('#index_year').on('change', function() {
    currentSelectYear = this.value;

    $.get("{{ url_for('browsepastes.importantPasteByModule') }}"+"?moduleName="+currentTabName+"&year="+currentSelectYear, function(data, status){
        $('#'+currentTabName+'-tab').html(data);
    });
})

$('.nav-tabs a').on('shown.bs.tab', function(event){
    var dataPath = $(event.target).attr('data-attribute-name');
    currentTabName = dataPath;
    $.get("{{ url_for('browsepastes.importantPasteByModule') }}"+"?moduleName="+currentTabName+"&year="+currentSelectYear, function(data, status){
        currentTab = $('[name].active').children();
        $('#'+previous_tab.attr('data-attribute-name')+'-tab').html(loading_gif);
        currentTab.removeClass( "active" );

        $('#'+dataPath+'-tab').html(data);

        $(event.target).parent().addClass( "active" );
        previous_tab = currentTab;
    });
});
</script>


    </div>
</body>

</html>
