MarseyWorld/files/templates/hats.html

160 lines
6.1 KiB
HTML
Raw Normal View History

{% extends "default.html" %}
{% block title %}
<title>Hats</title>
{% endblock %}
{% block pagetype %}message{% endblock %}
2022-09-03 01:11:10 +00:00
{% block Banner %}
2022-09-08 16:02:53 +00:00
<style>
2022-09-19 18:30:54 +00:00
.shop-tabs {
padding-top: 50px;
}
2022-09-08 16:02:53 +00:00
@media (max-width: 768px) {
#hats-banner {
width: 80%;
}
2022-09-19 18:30:54 +00:00
.shop-tabs {
padding-top: 30px;
}
2022-09-08 16:02:53 +00:00
}
2022-09-18 17:12:28 +00:00
.shop-tab {
display: inline-flex;
max-width: 46.6%;
letter-spacing: 3px;
2022-09-19 18:30:54 +00:00
border-radius: 0;
2022-09-18 17:12:28 +00:00
}
.shop-tab.active {
background-color: var(--primary) !important;
pointer-events: none !important;
cursor: default !important;
}
2022-09-08 16:02:53 +00:00
</style>
2022-09-19 18:30:54 +00:00
<div class="container-fluid bg-white sticky shop-tabs" style="padding-bottom: 0 !important;">
2022-09-18 17:12:28 +00:00
<div class="row box-shadow-bottom">
2022-09-19 18:30:54 +00:00
<div class="col p-0">
2022-09-18 17:12:28 +00:00
<div class="container" style="padding-bottom: 0;">
<div class="row box-shadow-bottom bg-white" style="justify-content: center;">
2022-09-19 18:30:54 +00:00
<a class="btn btn-primary btn-block m-0 shop-tab" href="/shop">
2022-09-18 17:12:28 +00:00
<span class="mr-auto ml-auto"><i class="fas fa-gift mr-2"></i>AWARDS</span>
</a>
2022-09-19 18:30:54 +00:00
<a class="btn btn-primary btn-block m-0 shop-tab active" href="/hats">
2022-09-18 17:12:28 +00:00
<span class="mr-auto ml-auto"><i class="fas fa-hat-cowboy mr-2"></i>HATS</span>
</a>
</div>
</div>
</div>
</div>
</div>
2022-09-03 01:11:10 +00:00
<header class="container pb-1 text-center">
2022-09-08 16:02:53 +00:00
<img id="hats-banner" class="mt-5" alt="hats banner" src="/i/hats.webp?v=1" width="50%">
2022-09-03 18:50:20 +00:00
<h5 class="mt-4">Number of hats you bought: {{v.num_of_owned_hats}}</h5>
<h5 class="mt-4">Number of hats you designed: {{v.num_of_designed_hats}}</h5>
2022-09-10 06:43:38 +00:00
<h5 class="mt-4">Coins you spent on hats: {{"{:,}".format(v.coins_spent_on_hats)}}</h5>
<h5 class="mt-4">Total hat sales: {{"{:,}".format(sales)}}</h5>
2022-09-08 18:36:43 +00:00
<h5 class="mt-4">Number of hats: {{num_of_hats}}</h5>
2022-09-03 01:11:10 +00:00
</header>
{% endblock %}
{% block content %}
<script>
function equip_hat(t, hat_id, hat_name) {
const profile_pic_hat = document.getElementById("profile-pic-35-hat");
function extra_actions(xhr) {
if(xhr.status == 200) {
2022-09-10 09:34:48 +00:00
profile_pic_hat.src = `/i/hats/${hat_name}.webp?h=5`
profile_pic_hat.classList.remove('d-none')
}
}
post_toast(t, `/equip_hat/${hat_id}`, `equip-${hat_id}`, `unequip-${hat_id}`, `d-none`, extra_actions)
}
</script>
<pre>
</pre>
<div class="overflow-x-auto"><table class="table table-striped shop">
<thead class="bg-primary text-white">
<tr>
<th scope="col">Hat</th>
<th scope="col">Name</th>
<th scope="col">Description</th>
{% if SITE == 'rdrama.net' %}
{% if request.values.get("sort") == 'author_asc' %}
<th scope="col"><a href="?sort=author_desc">Author</a></th>
{% else %}
2022-09-05 08:32:52 +00:00
<th scope="col"><a href="?sort=author_asc">Author</a></th>
{% endif %}
2022-09-03 19:36:50 +00:00
<th scope="col" onclick="sort_table(4)">Owners</th>
2022-09-03 03:04:51 +00:00
<th scope="col" onclick="sort_table(5)">Price</th>
2022-09-18 17:18:44 +00:00
<th scope="col">Actions</th>
<th scope="col" onclick="sort_table(7)">Added on</th>
2022-09-03 03:04:51 +00:00
{% else %}
2022-09-03 19:36:50 +00:00
<th scope="col" onclick="sort_table(3)">Owners</th>
2022-09-03 03:04:51 +00:00
<th scope="col" onclick="sort_table(4)">Price</th>
2022-09-18 17:18:44 +00:00
<th scope="col">Actions</th>
<th scope="col" onclick="sort_table(6)">Added on</th>
{% endif %}
</tr>
</thead>
2022-09-03 22:07:59 +00:00
<tbody>
2022-09-03 19:11:02 +00:00
{% for hat, user in hats %}
<tr>
2022-09-06 01:47:14 +00:00
<td>
2022-09-06 07:03:14 +00:00
<div class="profile-pic-75-wrapper mt-4">
<img loading="lazy" alt="avatar" src="{{v.profile_url}}" class="profile-pic-75">
2022-09-10 09:34:48 +00:00
<img loading="lazy" alt="{{hat.name}}" class="profile-pic-75-hat" src="/i/hats/{{hat.name}}.webp?h=5">
2022-09-06 01:47:14 +00:00
</div>
</td>
<td>{{hat.name}}</td>
2022-09-03 22:07:59 +00:00
<td style="word-break:break-word">{{hat.censored_description(v)}}</td>
{% if SITE == 'rdrama.net' %}
2022-09-05 03:01:06 +00:00
<td>{% include "user_in_table.html" %}</td>
{% endif %}
2022-09-03 19:36:50 +00:00
<td><a href="/hat_owners/{{hat.id}}">{{hat.number_sold}}</a></td>
<td>{{hat.price}}</td>
2022-09-03 22:07:59 +00:00
<td class="shop-table-actions" style="width:unset">
2022-09-03 19:11:02 +00:00
{% if hat.id not in owned_hat_ids %}
<div id="if-not-owned-{{hat.id}}">
<a id="buy1-{{hat.id}}" class="btn btn-success {% if v.coins < hat.price %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy1-go-{{hat.id}}').classList.remove('d-none')"><span class="m-auto">Buy</span></a>
<a id="buy1-go-{{hat.id}}" class="d-none btn btn-success {% if v.coins < hat.price %}disabled{% endif %}" role="button" onclick="post_toast(this, '/buy_hat/{{hat.id}}', 'if-not-owned-{{hat.id}}', 'if-owned-{{hat.id}}', 'd-none', (xhr)=>{if(xhr.status == 200)document.getElementById('user-coins-amount').innerHTML-={{hat.price}}})"><span class="m-auto">Are you sure?</span></a>
2022-09-03 19:11:02 +00:00
{% if FEATURES['PROCOINS'] %}
2022-09-03 22:07:59 +00:00
<a id="buy2-{{hat.id}}" class="marseybux btn btn-success {% if v.procoins < hat.price %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy2-go-{{hat.id}}').classList.remove('d-none')"><span class="m-auto">MBux</span></a>
<a id="buy2-go-{{hat.id}}" class="d-none marseybux btn btn-success {% if v.procoins < hat.price %}disabled{% endif %}" role="button" onclick="post_toast(this, '/buy_hat/{{hat.id}}?mb=true', 'if-not-owned-{{hat.id}}', 'if-owned-{{hat.id}}', 'd-none', (xhr)=>{if(xhr.status == 200)document.getElementById('user-bux-amount').innerHTML-={{hat.price}}})"><span class="m-auto">Are you sure?</span></a>
2022-09-03 19:11:02 +00:00
{% endif %}
</div>
{% endif %}
2022-09-03 19:11:02 +00:00
<div id="if-owned-{{hat.id}}" {% if hat.id not in owned_hat_ids %}class="d-none"{% endif %}>
<a id="unequip-{{hat.id}}" class="unequip {% if hat.id not in v.equipped_hat_ids %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this, '/unequip_hat/{{hat.id}}', 'equip-{{hat.id}}', 'unequip-{{hat.id}}', 'd-none')"><span class="m-auto">Unequip</span></a>
<a id="equip-{{hat.id}}" class="equip {% if hat.id in v.equipped_hat_ids %}d-none{% endif %} btn btn-success" role="button" onclick="equip_hat(this, '{{hat.id}}', '{{hat.name}}')"><span class="m-auto">Equip</span></a>
2022-09-03 19:11:02 +00:00
</div>
</td>
2022-09-18 17:18:44 +00:00
<td data-time="{{hat.created_utc}}"></td>
</tr>
{% endfor %}
</tbody>
</table>
<pre>
</pre>
2022-09-08 17:12:46 +00:00
<script defer src="{{asset('js/sort_table.js')}}"></script>
2022-09-03 22:07:59 +00:00
{% endblock %}