This commit is contained in:
Aevann1 2021-09-10 06:35:43 +02:00
parent d28d2cc318
commit 4960d5d8e6
3 changed files with 9 additions and 5 deletions

View file

@ -311,7 +311,7 @@ function post(url, callback, errortext) {
xhr.send(form); xhr.send(form);
}; };
function post_toast(url, reload, data) { function post_toast(url, reload, callback, data) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("POST", url, true); xhr.open("POST", url, true);
var form = new FormData() var form = new FormData()
@ -337,6 +337,10 @@ function post_toast(url, reload, data) {
} }
if (reload == 1) {window.location.reload(true)} if (reload == 1) {window.location.reload(true)}
else {
try {callback(xhr)}
catch(e) {}
}
return true return true
} else if (xhr.status >= 300 && xhr.status < 400) { } else if (xhr.status >= 300 && xhr.status < 400) {

View file

@ -130,7 +130,7 @@
</div> </div>
<hr class="my-2"> <hr class="my-2">
<div class="px-2"> <div class="px-2">
<a class="dropdown-item" href="javascript:void(0)", onclick="post('/logout', callback=function(){window.location.reload(true)})"><i class="fas fa-sign-out fa-fw text-left mr-3"></i>Log out</a> <a class="dropdown-item" href="javascript:void(0)", onclick="post('/logout', '1'"><i class="fas fa-sign-out fa-fw text-left mr-3"></i>Log out</a>
</div> </div>
</div> </div>
</div> </div>
@ -190,7 +190,7 @@
<li class="nav-item"><a class="nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a></li> <li class="nav-item"><a class="nav-link" href="/contact"><i class="fas fa-file-signature fa-fw mr-3"></i>Contact us</a></li>
<li class="nav-item border-top border-bottom mt-2 pt-2"> <li class="nav-item border-top border-bottom mt-2 pt-2">
<a class="nav-link" href="javascript:void(0)", onclick="post('/logout', callback=function(){window.location.reload(true)})"><i class="fas fa-sign-out fa-fw mr-3 text-danger"></i>Log out</a> <a class="nav-link" href="javascript:void(0)", onclick="post('/logout', '1'"><i class="fas fa-sign-out fa-fw mr-3 text-danger"></i>Log out</a>
</li> </li>
{% else %} {% else %}
<li class="nav-item d-flex align-items-center justify-content-center pb-3"> <li class="nav-item d-flex align-items-center justify-content-center pb-3">

View file

@ -13,11 +13,11 @@
<p class="text-muted">This user has enabled private mode to cloak their posting history.</p> <p class="text-muted">This user has enabled private mode to cloak their posting history.</p>
{% if u.id == 253 and 'rdrama' in request.host %} {% if u.id == 253 and 'rdrama' in request.host %}
{% if v and v.coins > 500 and not v.is_suspended %} {% if v and v.coins > 500 and not v.is_suspended %}
<a class="btn btn-primary" href="javascript:void(0)", onclick="post('/pay_rent', callback=function(){window.location.reload(true)})">Pay rent to view profile (500 coins)</a> <a class="btn btn-primary" href="javascript:void(0)", onclick="post('/pay_rent', '1'">Pay rent to view profile (500 coins)</a>
{% endif %} {% endif %}
<pre></pre> <pre></pre>
{% if v and v.coins > 5000 and time - v.created_utc > 604800 and not v.is_suspended %} {% if v and v.coins > 5000 and time - v.created_utc > 604800 and not v.is_suspended %}
<a class="btn btn-primary" href="javascript:void(0)", onclick="post('/steal', callback=function(){window.location.reload(true)})">Attempt to steal coins</a> <a class="btn btn-primary" href="javascript:void(0)", onclick="post('/steal', '1'">Attempt to steal coins</a>
<div class="text-small-extra text-muted mt-1">Landlords, like all other men, love to reap where they never sowed.</div> <div class="text-small-extra text-muted mt-1">Landlords, like all other men, love to reap where they never sowed.</div>
{% endif %} {% endif %}
<pre> <pre>