mirror of
https://github.com/house-of-vanity/libopenanal.git
synced 2025-08-21 16:07:16 +00:00
2ch statistic page has been fixed and improved.
This commit is contained in:
48
index.py
48
index.py
@@ -1,7 +1,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
from flask import Flask, request, send_from_directory
|
from flask import Flask, request, send_from_directory
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
|
||||||
@@ -35,7 +37,7 @@ def serve_static(path):
|
|||||||
return send_from_directory('static', path)
|
return send_from_directory('static', path)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
order = request.args.get('order', default='id', type=str)
|
order = request.args.get('order', default='id', type=str)
|
||||||
sorting = request.args.get('sorting', default='ASC', type=str)
|
sorting = request.args.get('sorting', default='ASC', type=str)
|
||||||
@@ -136,6 +138,7 @@ def stat():
|
|||||||
sorting=sorting,
|
sorting=sorting,
|
||||||
posts=posts,
|
posts=posts,
|
||||||
threads=sorted_threads,
|
threads=sorted_threads,
|
||||||
|
now=datetime.datetime.now().strftime('%s'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -143,5 +146,46 @@ def main():
|
|||||||
app.run(host=flask_host, port=flask_port)
|
app.run(host=flask_host, port=flask_port)
|
||||||
|
|
||||||
|
|
||||||
|
@app.template_filter('datetimeformat')
|
||||||
|
def datetimeformat(value, format='%H:%M / %d-%m-%Y'):
|
||||||
|
return datetime.datetime.fromtimestamp(value).strftime(format)
|
||||||
|
|
||||||
|
|
||||||
|
@app.template_filter('readable_delta')
|
||||||
|
def readable_delta(from_seconds, until_seconds=None):
|
||||||
|
# Returns a nice readable delta.
|
||||||
|
def plur(it):
|
||||||
|
try:
|
||||||
|
size = len(it)
|
||||||
|
except TypeError:
|
||||||
|
size = int(it)
|
||||||
|
return '' if size == 1 else 's'
|
||||||
|
|
||||||
|
if not until_seconds:
|
||||||
|
until_seconds = time.time()
|
||||||
|
|
||||||
|
seconds = int(until_seconds) - int(from_seconds)
|
||||||
|
delta = datetime.timedelta(seconds=seconds)
|
||||||
|
delta_minutes = delta.seconds // 60
|
||||||
|
delta_hours = delta_minutes // 60
|
||||||
|
|
||||||
|
if delta.days:
|
||||||
|
return '%d day%s, %d hour%s' % (
|
||||||
|
delta.days,
|
||||||
|
plur(delta.days),
|
||||||
|
(delta_hours),
|
||||||
|
plur(delta_hours))
|
||||||
|
elif delta_hours:
|
||||||
|
return '%d hour%s, %d minute%s' % (
|
||||||
|
delta_hours,
|
||||||
|
plur(delta_hours),
|
||||||
|
(delta_minutes - delta_hours * 60),
|
||||||
|
plur(delta_minutes))
|
||||||
|
elif delta_minutes:
|
||||||
|
return '%d minute%s' % (delta_minutes, plur(delta_minutes))
|
||||||
|
else:
|
||||||
|
return '%d second%s' % (delta.seconds, plur(delta.seconds))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -1,31 +1,30 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
|
||||||
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
|
crossorigin="anonymous">
|
||||||
crossorigin="anonymous">
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="../static/css/style.css">
|
<link rel="stylesheet" type="text/css" href="../static/css/style.css">
|
||||||
<title>libOpenAnal appliance</title>
|
<title>libOpenAnal appliance</title>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container" id="content">{% block content %}
|
<div class="container" id="content">{% block content %}
|
||||||
<h1>Hexor's conf_bot data extractor tool</h1>{% endblock %}</div>
|
<h1>Hexor's conf_bot data extractor tool</h1>{% endblock %}</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
|
||||||
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
|
crossorigin="anonymous"></script>
|
||||||
crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
|
crossorigin="anonymous"></script>
|
||||||
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
|
{% endblock %}
|
||||||
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
{% endblock %}
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@@ -1,37 +1,36 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/">Users</a>
|
<a class="nav-link" href="/">Users</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" href="/conf">Conferences</a>
|
<a class="nav-link active" href="/conf">Conferences</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/stat">2ch.hk Stats</a>
|
<a class="nav-link" href="/stat">2ch.hk Stats</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link disabled" href="#">Disabled</a>
|
<a class="nav-link disabled" href="#">Disabled</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
<div class="row">
|
||||||
<div class="row">
|
<div class="col-sm-12">
|
||||||
<div class="col-sm-12">
|
<h4>Summary</h4>
|
||||||
<h4>Totals</h4>
|
<b>Users: </b> {{ totals.users[0] }}<br>
|
||||||
<b>Users: </b> {{ totals.users[0] }}<br>
|
<b>Unique words: </b> {{ totals.words[0] }}<br>
|
||||||
<b>Unique words: </b> {{ totals.words[0] }}<br>
|
<b>Words said: </b> {{ totals.relations[0] }}<br>
|
||||||
<b>Words said: </b> {{ totals.relations[0] }}<br>
|
<b>Chats fetched: </b> {{ totals.confs[0] }}<br>
|
||||||
<b>Chats fetched: </b> {{ totals.confs[0] }}<br>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table table-hover table-sm">
|
<table class="table table-hover table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">Title</th>
|
<th scope="col">Title</th>
|
||||||
@@ -40,21 +39,21 @@
|
|||||||
<th scope="col">Members</th>
|
<th scope="col">Members</th>
|
||||||
<th scope="col">Words said</th>
|
<th scope="col">Words said</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for conf in confs %}
|
{% for conf in confs %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ loop.index }}</th>
|
<th scope="row">{{ loop.index }}</th>
|
||||||
<td>{{ conf.0 }}</td>
|
<td>{{ conf.0 }}</td>
|
||||||
<td>{{ conf.1 }}</td>
|
<td>{{ conf.1 }}</td>
|
||||||
<td>{{ conf.2 }}</td>
|
<td>{{ conf.2 }}</td>
|
||||||
<td>{{ conf.4 }}</td>
|
<td>{{ conf.4 }}</td>
|
||||||
<td>{{ conf.3 }}</td>
|
<td>{{ conf.3 }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -1,78 +1,72 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" href="/">Users</a>
|
<a class="nav-link active" href="/">Users</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/conf">Conferences</a>
|
<a class="nav-link" href="/conf">Conferences</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/stat">2ch.hk Stats</a>
|
<a class="nav-link" href="/stat">2ch.hk Stats</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link disabled" href="#">Disabled</a>
|
<a class="nav-link disabled" href="#">Disabled</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h4>Totals</h4>
|
<h4>Summary</h4>
|
||||||
<b>Users: </b> {{ totals.users[0] }}<br>
|
<b>Users: </b> {{ totals.users[0] }}<br>
|
||||||
<b>Unique words: </b> {{ totals.words[0] }}<br>
|
<b>Unique words: </b> {{ totals.words[0] }}<br>
|
||||||
<b>Words said: </b> {{ totals.relations[0] }}<br>
|
<b>Words said: </b> {{ totals.relations[0] }}<br>
|
||||||
<b>Chats fetched: </b> {{ totals.confs[0] }}<br>
|
<b>Chats fetched: </b> {{ totals.confs[0] }}<br>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<br>
|
</div>
|
||||||
<table class="table table-hover table-sm">
|
<br>
|
||||||
<thead>
|
<table class="table table-hover table-sm">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col"><a
|
<th scope="col"><a href="./?order=first_name&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">First
|
||||||
href="./?order=first_name&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">First
|
name</a></th>
|
||||||
name</a></th>
|
<th scope="col"><a href="./?order=last_name&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Last
|
||||||
<th scope="col"><a
|
name</a></th>
|
||||||
href="./?order=last_name&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Last
|
<th scope="col"><a href="./?order=username&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Username</a>
|
||||||
name</a></th>
|
|
||||||
<th scope="col"><a
|
|
||||||
href="./?order=username&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Username</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a href="./?order=id&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">User
|
<th scope="col"><a href="./?order=id&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">User
|
||||||
ID</a></th>
|
ID</a></th>
|
||||||
<th scope="col"><a
|
<th scope="col"><a href="./?order=firstly_seen&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Firstly
|
||||||
href="./?order=firstly_seen&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Firstly
|
seen</a></th>
|
||||||
seen</a></th>
|
<th scope="col"><a href="./?order=last_activity&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Last
|
||||||
<th scope="col"><a
|
activity</a></th>
|
||||||
href="./?order=last_activity&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Last
|
<th scope="col"><a href="./?order=count&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Word
|
||||||
activity</a></th>
|
count</a></th>
|
||||||
<th scope="col"><a
|
|
||||||
href="./?order=count&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Word
|
|
||||||
count</a></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ loop.index }}</th>
|
<th scope="row">{{ loop.index }}</th>
|
||||||
<td><a href="/overview/user/{{ user.0 }}">{{ user.2 }}</a></td>
|
<td><a href="/overview/user/{{ user.0 }}">{{ user.2 }}</a></td>
|
||||||
<td>{% if user.3 != '_null' %}{{ user.3 }}{% else %}
|
<td>{% if user.3 != '_null' %}{{ user.3 }}{% else %}
|
||||||
<span class="badge badge-warning">N/D</span>{% endif %}</td>
|
<span class="badge badge-warning">N/D</span>{% endif %}</td>
|
||||||
<td>{% if user.1 != '_null' %}{{ user.1 }}{% else %}
|
<td>{% if user.1 != '_null' %}{{ user.1 }}{% else %}
|
||||||
<span class="badge badge-warning">N/D</span>{% endif %}</td>
|
<span class="badge badge-warning">N/D</span>{% endif %}</td>
|
||||||
<td><a class="badge badge-dark " href="/overview/user/{{ user.0 }}">{{ user.0 }}</a></td>
|
<td><a class="badge badge-dark " href="/overview/user/{{ user.0 }}">{{ user.0 }}</a></td>
|
||||||
<td>{{ user.4 }}</td>
|
<td>{{ user.4 }}</td>
|
||||||
<td>{{ user.5 }}</td>
|
<td>{{ user.5 }}</td>
|
||||||
<td>{{ user.6 }}</td>
|
<td>{{ user.6 }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -1,79 +1,84 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/">Users</a>
|
<a class="nav-link" href="/">Users</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/conf">Conferences</a>
|
<a class="nav-link" href="/conf">Conferences</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" href="/stat">2ch.hk Stats</a>
|
<a class="nav-link active" href="/stat">2ch.hk Stats</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link disabled" href="#">Disabled</a>
|
<a class="nav-link disabled" href="#">Disabled</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<form action="/" method="get">
|
<div class="row">
|
||||||
<div class="input-group mb-3">
|
<div class="col-sm-12">
|
||||||
<input type="text" class="form-control" placeholder="Board" aria-label="Board"
|
<h4>Summary</h4>
|
||||||
aria-describedby="button-stat" name="board">
|
<b>Board: </b> {{ board }}<br>
|
||||||
<div class="input-group-append">
|
<b>Threads: </b> {{ threads|length }}<br>
|
||||||
<button class="btn btn-primary" type="submit" id="button-stat">Get stat</button>
|
<b>Total posts: </b> {{ posts }}<br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<hr>
|
||||||
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-md-4"></div>
|
||||||
<h4>Info</h4>
|
<div class="col-md-4 offset-md-4">
|
||||||
<b>Board: </b> {{ board }}<br>
|
<form action="/stat" method="get">
|
||||||
<b>Threads: </b> {{ threads|length }}<br>
|
<div class="input-group mb-3">
|
||||||
<b>Total posts: </b> {{ posts }}<br>
|
<input type="text" class="form-control" placeholder="Board" aria-label="Board" aria-describedby="button-stat"
|
||||||
|
name="board">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button class="btn btn-primary" type="submit" id="button-stat">Get stat</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
</div>
|
||||||
<table class="table table-hover table-sm">
|
<br>
|
||||||
<thead>
|
<table class="table table-hover table-sm">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">Subject</th>
|
<th scope="col">Subject</th>
|
||||||
<th scope="col"><a
|
<th scope="col"><a href="./stat?board={{ board }}&order=posts&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Posts</a>
|
||||||
href="./stat?board={{ board }}&order=posts&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Posts</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a
|
<th scope="col"><a href="./stat?board={{ board }}&order=views&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Views</a>
|
||||||
href="./stat?board={{ board }}&order=views&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Views</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a
|
<th scope="col"><a href="./stat?board={{ board }}&order=score&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Score</a>
|
||||||
href="./stat?board={{ board }}&order=score&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Score</a>
|
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a
|
<th scope="col"><a href="./stat?board={{ board }}&order=lasthit&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Lasthit</a>
|
||||||
href="./stat?board={{ board }}&order=timestamp&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Created</a>
|
<th scope="col"><a href="./stat?board={{ board }}&order=timestamp&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Age</a>
|
||||||
</th>
|
|
||||||
<th scope="col"><a
|
|
||||||
href="./stat?board={{ board }}&order=lasthit&sorting={%- if sorting == 'ASC' -%}DESC{%- else -%}ASC{%- endif -%}">Lasthit</a>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for thread in threads %}
|
{% for thread in threads %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ loop.index }}</th>
|
<th scope="row">{{ loop.index }}</th>
|
||||||
<td><a href="https://2ch.hk/b/res/{{ thread['num'] }}.html">{{ thread['subject'] }}</a></td>
|
<td><a href="https://2ch.hk/{{board}}/res/{{ thread['num'] }}.html">{{ thread['subject'] }}</a></td>
|
||||||
<td>{{ thread['posts_count'] }}</td>
|
<td>{{ thread['posts_count'] }}</td>
|
||||||
<td>{{ thread['views'] }}</td>
|
<td>{{ thread['views'] }}</td>
|
||||||
<td>{{ "%.2f"|format(thread['score']|float) }}</td>
|
<td>{{ "%.2f"|format(thread['score']|float) }}</td>
|
||||||
<td>{{ thread['timestamp'] | time }}</td>
|
<td data-toggle="tooltip" data-placement="right" title="Last hit: {{ thread['lasthit']|time }}">{{thread['lasthit']|readable_delta(now)}}
|
||||||
<td>{{ thread['lasthit'] | time }}</td>
|
ago
|
||||||
</tr>
|
</td>
|
||||||
|
<td data-toggle="tooltip" data-placement="right" title="Created: {{ thread['timestamp']|time }}">{{thread['timestamp']|readable_delta(thread['lasthit'])}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
@@ -1,6 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
@@ -58,59 +58,59 @@
|
|||||||
<h5 class="card-title">Top</h5>
|
<h5 class="card-title">Top</h5>
|
||||||
<hr>
|
<hr>
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<table class="table table-hover table-sm">
|
<table class="table table-hover table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">Word</th>
|
<th scope="col">Word</th>
|
||||||
<th scope="col">Said</th>
|
<th scope="col">Said</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for word in user_info.top %}
|
{% for word in user_info.top %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ loop.index }}</th>
|
<th scope="row">{{ loop.index }}</th>
|
||||||
<td>{{ word[0] }}</td>
|
<td>{{ word[0] }}</td>
|
||||||
{% if not loop.last %}
|
{% if not loop.last %}
|
||||||
{% if (word[1]/loop.nextitem[1]) > 2 %}
|
{% if (word[1]/loop.nextitem[1]) > 2 %}
|
||||||
<td><span class="badge badge-danger" data-toggle="tooltip" data-placement="right"
|
<td><span class="badge badge-danger" data-toggle="tooltip" data-placement="right" title="Must have been abused">{{
|
||||||
title="Must have been abused">{{ word[1] }} </span></td>
|
word[1] }} </span></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><span class="badge badge-secondary">{{ word[1] }} </span></td>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
<td><span class="badge badge-secondary">{{ word[1] }} </span></td>
|
<td><span class="badge badge-secondary">{{ word[1] }} </span></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
{% else %}
|
||||||
{% endfor %}
|
<td><span class="badge badge-secondary">{{ word[1] }} </span></td>
|
||||||
</tbody>
|
{% endif %}
|
||||||
</table>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Chats</h5>
|
<h5 class="card-title">Chats</h5>
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<table class="table table-hover table-sm">
|
<table class="table table-hover table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">Chat</th>
|
<th scope="col">Chat</th>
|
||||||
<th scope="col">Words</th>
|
<th scope="col">Words</th>
|
||||||
<th scope="col">Messages</th>
|
<th scope="col">Messages</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for chat in user_info.chats %}
|
{% for chat in user_info.chats %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ loop.index }}</th>
|
<th scope="row">{{ loop.index }}</th>
|
||||||
<td>{{ chat[0] }}</td>
|
<td>{{ chat[0] }}</td>
|
||||||
<td><span class="badge badge-secondary">{{ chat[1] }} </span></td>
|
<td><span class="badge badge-secondary">{{ chat[1] }} </span></td>
|
||||||
<td><span class="badge badge-secondary">{{ chat[3] }} </span></td>
|
<td><span class="badge badge-secondary">{{ chat[3] }} </span></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user