summaryrefslogtreecommitdiff
path: root/templates/premates_html.jinja
diff options
context:
space:
mode:
Diffstat (limited to 'templates/premates_html.jinja')
-rw-r--r--templates/premates_html.jinja159
1 files changed, 159 insertions, 0 deletions
diff --git a/templates/premates_html.jinja b/templates/premates_html.jinja
new file mode 100644
index 0000000..b891bac
--- /dev/null
+++ b/templates/premates_html.jinja
@@ -0,0 +1,159 @@
+<html>
+ <head>
+ <title>Steam Prematefinder</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <link rel="stylesheet" type="text/css" href="static/style.css" />
+ <link rel="icon" type="image/png" href="static/favicon.png" />
+ <script src="static/vivagraph.min.js"></script>
+ </head>
+ <body onload="onLoad();">
+
+ <ul id="menu">
+ <li class="menu app"><a class="joinbutton" href="server">Serverinfo</a></li>
+ <li class="menu app"><a class="joinbutton" href="lobby">Lobbylinkfinder</a></li>
+ </ul>
+
+ <div class="form">
+ Copy&amp;Paste den Inhalt von 'status' aus der Konsole.<br />
+ <form action="prematefinder" method="post">
+ <textarea name="statustext" cols="75" rows="10"></textarea><br />
+ <input class="joinbutton" type="submit" value="Premates finden!" />
+ </form>
+ </div>
+
+ {% if steamids %}
+ <script type="text/javascript">
+ function onLoad() {
+ const graph = Viva.Graph.graph();
+
+ {% for steamid in steamids %}
+ graph.addNode('{{ steamid }}',
+ {
+ url: "{{ profiles[steamid]['avatarmedium'] }}",
+ name: "{{ profiles[steamid]['personaname']|e }}",
+ details1: "{{ profiles[steamid]['_ownedPlayedGames']|e }}",
+ details2: "{{ profiles[steamid]['_userstats']['total_time_played']|e }}",
+ friends: {% if profiles[steamid]['communityvisibilitystate'] == 3 %} "yes" {% else %} "no" {% endif %}
+ }
+ )
+ {% endfor %}
+
+ {% for connection in connections %}
+ graph.addLink("{{ connection[0] }}", "{{ connection[1] }}");
+ {% endfor %}
+
+ const graphics = Viva.Graph.View.svgGraphics()
+ graphics.node(
+ (node) => {
+ if (!node.data) return
+
+ const ui = Viva.Graph.svg('g')
+ ui.append(Viva.Graph.svg('text')
+ .attr('text-anchor', 'middle')
+ .attr('fill', 'rgb(150, 150, 0)')
+ .attr('x', '+16px')
+ .attr('y', '-8px')
+ .text(node.data.name)
+ )
+ ui.append(Viva.Graph.svg('image')
+ .attr('width', 32)
+ .attr('height', 32)
+ .link(node.data.url)
+ )
+ if (node.data.details1) {
+ const col = (node.data.details1 < 10 || node.data.details1 == 'n/a') ? 'rgb(150, 0, 0)' : 'rgb(150, 150, 0)'
+ ui.append(Viva.Graph.svg('text')
+ .attr('text-anchor', 'middle')
+ .attr('fill', col)
+ .attr('x', '+16px')
+ .attr('y', '+48px')
+ .text(`Steamspiele: ${node.data.details1}`)
+ )
+ }
+ if (node.data.details2) {
+ ui.append(Viva.Graph.svg('text')
+ .attr('text-anchor', 'middle')
+ .attr('fill', 'rgb(150, 150, 0)')
+ .attr('x', '+16px')
+ .attr('y', '+64px')
+ .text(`Spielzeit: ${Math.floor(node.data.details2 / 3600)}h`)
+ )
+ }
+ if (node.data.friends == 'no') {
+ ui.append(Viva.Graph.svg('rect')
+ .attr('width', 36)
+ .attr('height', 36)
+ .attr('x', '-2px')
+ .attr('y', '-2px')
+ .attr('fill', 'red')
+ )
+ }
+ return ui
+ }
+ )
+ .placeNode(
+ (nodeUI, pos) => {
+ nodeUI.attr('transform', `translate(${pos.x - 16}, ${pos.y - 16})`)
+ }
+ )
+
+ const layout = Viva.Graph.Layout.forceDirected(graph,
+ {
+ stableThreshold: 0.09,
+ springLength: 150,
+ springCoeff: 0.0008,
+ dragCoeff: 0.05,
+ gravity: -1.0
+ }
+ )
+
+ const renderer = Viva.Graph.View.renderer(graph,
+ {
+ container: document.getElementById('premates'),
+ graphics: graphics,
+ layout: layout
+ }
+ )
+
+ renderer.run()
+ }
+ </script>
+
+ <div id="premates">
+ </div>
+
+ <div id="info">
+ <strong>Steamspiele</strong>: Anzahl von Steamspielen mit Spielzeit. <br \>
+ <strong>Spielzeit</strong>: Die aktive Spielzeit in CSGO. <br \>
+ <strong>Private Profile</strong> sind durch einen roten Rahmen gekennzeichnet. <br \>
+ </div>
+ {% endif %}
+
+ <hr />
+
+ {% for profile in profiles.values() %}
+ <div class="player">
+ <div class="interna">
+ <a href="{{ profile['profileurl'] }}">
+ <span class="steamname {{ state }}">{{ profile['personaname']|e }}</span><br />
+ <img src="{{ profile['avatarmedium'] }}" class="avatar {{ state }}" /><br />
+ </a>
+ </div>
+ <div class="interna stats">
+ {% if profile['communityvisibilitystate'] == 3 %}
+ Account erstellt am: {{ profile['timecreated'] | display_time }}<br />
+ Spiele in Besitz: {{ profile['_ownedPlayedGames']|e }}<br />
+ {% if profile['_userstats'] %}
+ Spielzeit: {{ profile['_userstats']['total_time_played']|display_age }}<br />
+ {% else %}
+ Spielzeit: N/A
+ {% endif %}
+ {% else %}
+ <span class="error">Profile private</span>
+ {% endif %}
+ </div>
+ </div>
+ {% endfor %}
+
+ </body>
+</html>