Cleanup templates
This commit is contained in:
parent
b4a8ae73eb
commit
c50e11d0d5
6 changed files with 194 additions and 310 deletions
|
@ -14,43 +14,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="Home">
|
<div class="Home">
|
||||||
<div class="contentBox_">
|
<div class="contentBox_">
|
||||||
<div style="margin-bottom: 1rem;" class='searchBar'>
|
<span style="margin-bottom: 1em;">{% include "searchBar.html" %}</span>
|
||||||
<form action="/search" method="get">
|
|
||||||
<div class="search_entry">
|
|
||||||
<input style="width: 19rem;" type='text' id="q" name="q" value='' placeholder="Enter a level name or code"/>
|
|
||||||
<button class="searchButton" id='searchButton' type='submit'>🔍</button>
|
|
||||||
</div>
|
|
||||||
<details>
|
|
||||||
<summary>More options</summary>
|
|
||||||
{% macro option(name, value, key) -%}
|
|
||||||
<option value={{ value }} {{ isSelected(value, key) }}>{{ name }}</option>
|
|
||||||
{%- endmacro %}
|
|
||||||
<div class="sortType">
|
|
||||||
<label for="sort">Sort type</label>
|
|
||||||
<select id="sort" name="sort">
|
|
||||||
{{ option("Rating", "average_rating", "sort") }}
|
|
||||||
{{ option("Upload date", "created_at", "sort") }}
|
|
||||||
{{ option("Difficulty", "average_difficulty", "sort") }}
|
|
||||||
{{ option("Plays", "play_count", "sort") }}
|
|
||||||
</select>
|
|
||||||
<select id="dir" name="dir">
|
|
||||||
{{ option("Descending", "desc", "dir") }}
|
|
||||||
{{ option("Ascending", "asc", "dir") }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="upload_date">
|
|
||||||
<label for="date">Upload date</label>
|
|
||||||
<select id="date" name="date">
|
|
||||||
{{ option("All time", -1, "date") }}
|
|
||||||
{{ option("Past 30 days", 720, "date") }}
|
|
||||||
{{ option("Past 7 days", 168, "date") }}
|
|
||||||
{{ option("Past day", 24, "date") }}
|
|
||||||
{{ option("Past hour", 1, "date") }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="contentBox">
|
<div class="contentBox">
|
||||||
<div class="header">IWM Browser</div>
|
<div class="header">IWM Browser</div>
|
||||||
<div class="splitter"></div>
|
<div class="splitter"></div>
|
||||||
|
|
38
iwm_browser/templates/levelCard.html
Normal file
38
iwm_browser/templates/levelCard.html
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<div class="searchResultCard">
|
||||||
|
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
||||||
|
<div class="details">
|
||||||
|
<div class="basic">
|
||||||
|
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
||||||
|
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
||||||
|
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
||||||
|
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
||||||
|
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
||||||
|
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
||||||
|
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
||||||
|
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
||||||
|
<div class="fullResponse">
|
||||||
|
<details>
|
||||||
|
<summary>Full server response</summary>
|
||||||
|
<table>
|
||||||
|
<thead><td>Key</td><td>Value</td></thead>
|
||||||
|
<tbody>
|
||||||
|
{% for value in map %}
|
||||||
|
<tr>
|
||||||
|
<td>{{value}}</td><td>{{map[value]}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="times">
|
||||||
|
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
||||||
|
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
||||||
|
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
||||||
|
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
||||||
|
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,78 +1,36 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title></title>
|
<title></title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="{{ combineCSS(
|
<link rel="stylesheet" href="{{ combineCSS(
|
||||||
'/static/index.css',
|
'/static/index.css',
|
||||||
'/static/main.css',
|
'/static/main.css',
|
||||||
'/static/search/search.css',
|
'/static/search/search.css',
|
||||||
'/static/search/searchResults.css'
|
'/static/search/searchResults.css'
|
||||||
) }}">
|
) }}">
|
||||||
<!-- Optional features -->
|
<!-- Optional features -->
|
||||||
<script>
|
<script>
|
||||||
function copy(obj) {
|
function copy(obj) {
|
||||||
// copies the contents of the
|
// copies the contents of the
|
||||||
// input field to clipboard, and
|
// input field to clipboard, and
|
||||||
// adds the "copied" css class
|
// adds the "copied" css class
|
||||||
navigator.clipboard.writeText(obj.value);
|
navigator.clipboard.writeText(obj.value);
|
||||||
alert("Level code copied")
|
alert("Level code copied")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="Search">
|
<div class="Search">
|
||||||
<div class="contentBox_">
|
<div class="contentBox_">
|
||||||
<div class="header">Level</div>
|
<div class="header">Level</div>
|
||||||
<div class="splitter"></div>
|
<div class="splitter"></div>
|
||||||
<div class="searchResults">
|
<div class="searchResults">
|
||||||
<div class="searchResultCard full">
|
{% include 'levelCard.html' %}
|
||||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
|
||||||
<div class="details">
|
|
||||||
<div class="basic">
|
|
||||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
|
||||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
|
||||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
|
||||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
|
||||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
|
||||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
|
||||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
|
||||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
|
||||||
<div class="fullResponse">
|
|
||||||
<details>
|
|
||||||
<summary>Full server response</summary>
|
|
||||||
<table>
|
|
||||||
<thead><td>Key</td><td>Value</td></thead>
|
|
||||||
<tbody>
|
|
||||||
{% for value in map %}
|
|
||||||
<tr>
|
|
||||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
|
||||||
</details>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="times">
|
|
||||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
|
||||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
|
||||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
|
||||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
|
||||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</body>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,86 +1,45 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<!-- {{ QueryValues }} -->
|
<!-- {{ QueryValues }} -->
|
||||||
<title>IWM Browser</title>
|
<title>IWM Browser</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="{{ combineCSS(
|
<link rel="stylesheet" href="{{ combineCSS(
|
||||||
'/static/index.css',
|
'/static/index.css',
|
||||||
'/static/main.css',
|
'/static/main.css',
|
||||||
'/static/search/search.css',
|
'/static/search/search.css',
|
||||||
'/static/search/searchResults.css'
|
'/static/search/searchResults.css'
|
||||||
) }}">
|
) }}">
|
||||||
<!-- Optional features -->
|
<!-- Optional features -->
|
||||||
<script>
|
<script>
|
||||||
function copy(obj) {
|
function copy(obj) {
|
||||||
// copies the contents of the
|
// copies the contents of the
|
||||||
// input field to clipboard, and
|
// input field to clipboard, and
|
||||||
// adds the "copied" css class
|
// adds the "copied" css class
|
||||||
navigator.clipboard.writeText(obj.value);
|
navigator.clipboard.writeText(obj.value);
|
||||||
//alert("Level code copied")
|
//alert("Level code copied")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="Search">
|
<div class="Search">
|
||||||
<div class="contentBox_">
|
<div class="contentBox_">
|
||||||
<div class="playlist-details">
|
<div class="playlist-details">
|
||||||
<h1>{{ response.Name }} </h1>
|
<h1>{{ response.Name }} </h1>
|
||||||
<h2>by <a href="/user/{{ response.CreatorID }}">{{ response.CreatorName }}</a></h2>
|
<h2>by <a href="/user/{{ response.CreatorID }}">{{ response.CreatorName }}</a></h2>
|
||||||
<p>ID: {{ response.ID }}</p>
|
<p>ID: {{ response.ID }}</p>
|
||||||
<p>Maps: {{ response.MapCount }}</p>
|
<p>Maps: {{ response.MapCount }}</p>
|
||||||
</div>
|
|
||||||
{% if response.Maps %}
|
|
||||||
<div class="searchResults">
|
|
||||||
{% for map in response.Maps %}
|
|
||||||
<div class="searchResultCard">
|
|
||||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
|
||||||
<div class="details">
|
|
||||||
<div class="basic">
|
|
||||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
|
||||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
|
||||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
|
||||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
|
||||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
|
||||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
|
||||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
|
||||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
|
||||||
<div class="fullResponse">
|
|
||||||
<details>
|
|
||||||
<summary>Full server response</summary>
|
|
||||||
<table>
|
|
||||||
<thead><td>Key</td><td>Value</td></thead>
|
|
||||||
<tbody>
|
|
||||||
{% for value in map %}
|
|
||||||
<tr>
|
|
||||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
|
||||||
</details>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="times">
|
|
||||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
|
||||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
|
||||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
|
||||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
|
||||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% if response.Maps %}
|
||||||
{% endfor %}
|
<div class="searchResults">
|
||||||
|
{% for map in response.Maps %}
|
||||||
|
{% include 'levelCard.html' %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</body>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,127 +1,53 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<!-- {{ QueryValues }} -->
|
<!-- {{ QueryValues }} -->
|
||||||
<title>IWM Browser - {{ QueryValues["q"] if QueryValues["q"] is not none }}{{ QueryValues["type"] }}</title>
|
<title>IWM Browser - {{ QueryValues["q"] if QueryValues["q"] is not none }}{{ QueryValues["type"] }}</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="{{ combineCSS(
|
<link rel="stylesheet" href="{{ combineCSS(
|
||||||
'/static/index.css',
|
'/static/index.css',
|
||||||
'/static/main.css',
|
'/static/main.css',
|
||||||
'/static/search/search.css',
|
'/static/search/search.css',
|
||||||
'/static/search/searchResults.css'
|
'/static/search/searchResults.css'
|
||||||
) }}">
|
) }}">
|
||||||
<!-- Optional features -->
|
<!-- Optional features -->
|
||||||
<script>
|
<script>
|
||||||
function copy(obj) {
|
function copy(obj) {
|
||||||
// copies the contents of the
|
// copies the contents of the
|
||||||
// input field to clipboard, and
|
// input field to clipboard, and
|
||||||
// adds the "copied" css class
|
// adds the "copied" css class
|
||||||
navigator.clipboard.writeText(obj.value);
|
navigator.clipboard.writeText(obj.value);
|
||||||
//alert("Level code copied")
|
//alert("Level code copied")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="Search">
|
<div class="Search">
|
||||||
<div class="contentBox_">
|
<div class="contentBox_">
|
||||||
<div class="header">Search</div>
|
<div class="header">Search</div>
|
||||||
<div class="splitter"></div>
|
<div class="splitter"></div>
|
||||||
<div class='searchBar'>
|
{% include "searchBar.html" %}
|
||||||
<form action="/search" method="get">
|
{% if searchResults %}
|
||||||
<div class="search_entry">
|
<div class="searchResults">
|
||||||
<input type='text' id="q" name="q" value='{{ QueryValues["q"] if QueryValues["q"] is not none }}' placeholder="Enter a level name or code"/>
|
{% for map in searchResults %}
|
||||||
<button class="searchButton" id='searchButton' type='submit'>🔍</button>
|
{% include "levelCard.html" %}
|
||||||
</div>
|
{% endfor %}
|
||||||
<details>
|
|
||||||
<summary>More options</summary>
|
|
||||||
{% macro option(name, value, key) -%}
|
|
||||||
<option value={{ value }} {{ isSelected(value, QueryValues[key]) }}>{{ name }}</option>
|
|
||||||
{%- endmacro %}
|
|
||||||
<div class="sortType">
|
|
||||||
<label for="sort">Sort type</label>
|
|
||||||
<select id="sort" name="sort">
|
|
||||||
{{ option("Rating", "average_rating", "sort") }}
|
|
||||||
{{ option("Upload date", "created_at", "sort") }}
|
|
||||||
{{ option("Difficulty", "average_difficulty", "sort") }}
|
|
||||||
{{ option("Plays", "play_count", "sort") }}
|
|
||||||
</select>
|
|
||||||
<select id="dir" name="dir">
|
|
||||||
{{ option("Descending", "desc", "dir") }}
|
|
||||||
{{ option("Ascending", "asc", "dir") }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="upload_date">
|
|
||||||
<label for="date">Upload date</label>
|
|
||||||
<select id="date" name="date">
|
|
||||||
{{ option("All time", -1, "date") }}
|
|
||||||
{{ option("Past 30 days", 720, "date") }}
|
|
||||||
{{ option("Past 7 days", 168, "date") }}
|
|
||||||
{{ option("Past day", 24, "date") }}
|
|
||||||
{{ option("Past hour", 1, "date") }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{% if searchResults %}
|
|
||||||
<div class="searchResults">
|
|
||||||
{% for map in searchResults %}
|
|
||||||
<div class="searchResultCard">
|
|
||||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
|
||||||
<div class="details">
|
|
||||||
<div class="basic">
|
|
||||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
|
||||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
|
||||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
|
||||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
|
||||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
|
||||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
|
||||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
|
||||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
|
||||||
<div class="fullResponse">
|
|
||||||
<details>
|
|
||||||
<summary>Full server response</summary>
|
|
||||||
<table>
|
|
||||||
<thead><td>Key</td><td>Value</td></thead>
|
|
||||||
<tbody>
|
|
||||||
{% for value in map %}
|
|
||||||
<tr>
|
|
||||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
|
||||||
</details>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="times">
|
|
||||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
|
||||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
|
||||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
|
||||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
|
||||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="searchResultsFooter">
|
||||||
{% endfor %}
|
{% set searchPage = builtins.int(QueryValues['p']) %}
|
||||||
|
<p>Page {{ searchPage+1 }}</p>
|
||||||
</div>
|
{#<!-- {% if not searchPage <= 0 %}<a href="/search?q={{ QueryValues['q'] }}&sort={{ QueryValues['sort'] }}&dir={{ QueryValues['dir'] }}&date={{ QueryValues['date'] }}&p={{ QueryValues['p']-1 }}">Prev</a>{% endif %} -->#}
|
||||||
<div class="searchResultsFooter">
|
{% if not searchPage <= 0 %}<a href="/search?{{ urlencode(builtins.dict(QueryValues, **{'p': searchPage-1})) }}">Prev</a>{% endif %}
|
||||||
{% set searchPage = builtins.int(QueryValues['p']) %}
|
{% if not entryNumber < entryLimit %}<a href="/search?{{ urlencode(builtins.dict(QueryValues, **{'p': searchPage+1})) }}">Next</a>{% endif %}
|
||||||
<p>Page {{ searchPage+1 }}</p>
|
{#{% if not entryNumber < entryLimit %}<a href="/search?q={{ QueryValues['q'] }}&sort={{ QueryValues['sort'] }}&dir={{ QueryValues['dir'] }}&date={{ QueryValues['date'] }}&p={{ QueryValues['p']+1 }}">Next</a>{% endif %}#}
|
||||||
{#<!-- {% if not searchPage <= 0 %}<a href="/search?q={{ QueryValues['q'] }}&sort={{ QueryValues['sort'] }}&dir={{ QueryValues['dir'] }}&date={{ QueryValues['date'] }}&p={{ QueryValues['p']-1 }}">Prev</a>{% endif %} -->#}
|
</div>
|
||||||
{% if not searchPage <= 0 %}<a href="/search?{{ urlencode(builtins.dict(QueryValues, **{'p': searchPage-1})) }}">Prev</a>{% endif %}
|
</div>
|
||||||
{% if not entryNumber < entryLimit %}<a href="/search?{{ urlencode(builtins.dict(QueryValues, **{'p': searchPage+1})) }}">Next</a>{% endif %}
|
{% endif %}
|
||||||
{#{% if not entryNumber < entryLimit %}<a href="/search?q={{ QueryValues['q'] }}&sort={{ QueryValues['sort'] }}&dir={{ QueryValues['dir'] }}&date={{ QueryValues['date'] }}&p={{ QueryValues['p']+1 }}">Next</a>{% endif %}#}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
39
iwm_browser/templates/searchBar.html
Normal file
39
iwm_browser/templates/searchBar.html
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<div class='searchBar'>
|
||||||
|
<form action="/search" method="get">
|
||||||
|
<div class="search_entry">
|
||||||
|
{% set QueryValues = "" if not QueryValues %}
|
||||||
|
<input type='text' id="q" name="q" value='{{ QueryValues["q"] if QueryValues["q"] is not none }}' placeholder="Enter a level name or code"/>
|
||||||
|
<button class="searchButton" id='searchButton' type='submit'>🔍</button>
|
||||||
|
</div>
|
||||||
|
<details>
|
||||||
|
<summary>More options</summary>
|
||||||
|
{% macro option(name, value, key) -%}
|
||||||
|
<option value={{ value }} {{ isSelected(value, QueryValues[key]) }}>{{ name }}</option>
|
||||||
|
{%- endmacro %}
|
||||||
|
<div class="sortType">
|
||||||
|
<label for="sort">Sort type</label>
|
||||||
|
<select id="sort" name="sort">
|
||||||
|
{{ option("Rating", "average_rating", "sort") }}
|
||||||
|
{{ option("Upload date", "created_at", "sort") }}
|
||||||
|
{{ option("Difficulty", "average_difficulty", "sort") }}
|
||||||
|
{{ option("Plays", "play_count", "sort") }}
|
||||||
|
</select>
|
||||||
|
<select id="dir" name="dir">
|
||||||
|
{{ option("Descending", "desc", "dir") }}
|
||||||
|
{{ option("Ascending", "asc", "dir") }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="upload_date">
|
||||||
|
<label for="date">Upload date</label>
|
||||||
|
<select id="date" name="date">
|
||||||
|
{{ option("All time", -1, "date") }}
|
||||||
|
{{ option("Past 30 days", 720, "date") }}
|
||||||
|
{{ option("Past 7 days", 168, "date") }}
|
||||||
|
{{ option("Past day", 24, "date") }}
|
||||||
|
{{ option("Past hour", 1, "date") }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue