forked from MarseyWorld/MarseyWorld
105 lines
4.8 KiB
HTML
105 lines
4.8 KiB
HTML
{% extends "default.html" %}
|
|
|
|
{% block title %}
|
|
<title>Hats</title>
|
|
{% endblock %}
|
|
|
|
{% block pagetype %}message{% endblock %}
|
|
|
|
{% block Banner %}
|
|
<header class="container pb-1 text-center">
|
|
<img class="mt-5" alt="hats banner" src="/i/hats.webp?v=1" width="50%">
|
|
<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>
|
|
<h5 class="mt-4">Coins you spent on hats: {{v.coins_spent_on_hats}}</h5>
|
|
<h5 class="mt-4">Total hat sales: {{sales}}</h5>
|
|
</header>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<script>
|
|
function equip_hat(t, hat_id, hat_name) {
|
|
const old_unequip_btn = document.querySelector(".unequip:not(.d-none)");
|
|
const profile_img = document.getElementById("profile-pic-35-hat");
|
|
function extra_actions(xhr) {
|
|
if(xhr.status != 200) return
|
|
|
|
if (old_unequip_btn) {
|
|
old_unequip_btn.classList.add('d-none');
|
|
old_unequip_btn.nextElementSibling.classList.remove('d-none');
|
|
}
|
|
profile_img.src = `/i/hats/${hat_name}.webp?v=1`
|
|
profile_img.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' %}
|
|
<th scope="col">Author</th>
|
|
<th scope="col" onclick="sort_table(4)">Owners</th>
|
|
<th scope="col" onclick="sort_table(5)">Price</th>
|
|
{% else %}
|
|
<th scope="col" onclick="sort_table(3)">Owners</th>
|
|
<th scope="col" onclick="sort_table(4)">Price</th>
|
|
{% endif %}
|
|
<th scope="col">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{% for hat, user in hats %}
|
|
<tr>
|
|
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1" style="max-width:100%;height:auto"></td>
|
|
<td>{{hat.name}}</td>
|
|
<td style="word-break:break-word">{{hat.censored_description(v)}}</td>
|
|
{% if SITE == 'rdrama.net' %}
|
|
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
|
|
{% endif %}
|
|
<td><a href="/hat_owners/{{hat.id}}">{{hat.number_sold}}</a></td>
|
|
<td>{{hat.price}}</td>
|
|
<td class="shop-table-actions" style="width:unset">
|
|
{% 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>
|
|
|
|
{% if FEATURES['PROCOINS'] %}
|
|
<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>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<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 != v.equipped_hat.id %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast(this, '/unequip_hat', 'equip-{{hat.id}}', 'unequip-{{hat.id}}', 'd-none');document.getElementById('profile-pic-35-hat').classList.add('d-none')"><span class="m-auto">Unequip</span></a>
|
|
|
|
<a id="equip-{{hat.id}}" class="equip {% if hat.id == v.equipped_hat.id %}d-none{% endif %} btn btn-success" role="button" onclick="equip_hat(this, '{{hat.id}}', '{{hat.name}}')"><span class="m-auto">Equip</span></a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<pre>
|
|
|
|
|
|
|
|
|
|
|
|
</pre>
|
|
<script src="{{asset('js/sort_table.js')}}"></script>
|
|
{% endblock %}
|