fdsfds
This commit is contained in:
parent
6d9727d0b8
commit
1f32f3a35d
12 changed files with 51 additions and 32 deletions
|
@ -104,9 +104,10 @@ function post_toast2(url, button1, button2) {
|
||||||
xhr.withCredentials=true;
|
xhr.withCredentials=true;
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
data=JSON.parse(xhr.response);
|
||||||
|
if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
|
||||||
try {
|
try {
|
||||||
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
|
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
document.getElementById('toast-post-success-text').innerText = "Action successful!";
|
document.getElementById('toast-post-success-text').innerText = "Action successful!";
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,10 @@ function post_toast2(url, button1, button2) {
|
||||||
xhr.withCredentials=true;
|
xhr.withCredentials=true;
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
data=JSON.parse(xhr.response);
|
||||||
|
if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
|
||||||
try {
|
try {
|
||||||
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
|
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
document.getElementById('toast-post-success-text').innerText = "Action successful!";
|
document.getElementById('toast-post-success-text').innerText = "Action successful!";
|
||||||
}
|
}
|
||||||
|
@ -29,8 +30,6 @@ function post_toast2(url, button1, button2) {
|
||||||
window.location.href = JSON.parse(xhr.response)["redirect"]
|
window.location.href = JSON.parse(xhr.response)["redirect"]
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
data=JSON.parse(xhr.response);
|
|
||||||
|
|
||||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
||||||
myToast.show();
|
myToast.show();
|
||||||
document.getElementById('toast-post-error-text').innerText = data["error"];
|
document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||||
|
|
|
@ -16,7 +16,7 @@ function post_toast2(url, button1, button2) {
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
data = JSON.parse(xhr.response)
|
data = JSON.parse(xhr.response)
|
||||||
if (xhr.status >= 200 && xhr.status < 300 && !data["error"] ) {
|
if (xhr.status >= 200 && xhr.status < 300 && !data["error"]) {
|
||||||
try {
|
try {
|
||||||
document.getElementById('toast-post-success-text').innerText = data["message"];
|
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
|
@ -967,15 +967,15 @@ def api_distinguish_post(post_id, v):
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def api_sticky_post(post_id, v):
|
def api_sticky_post(post_id, v):
|
||||||
|
|
||||||
pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
|
||||||
if pins > 2: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
|
|
||||||
|
|
||||||
post = g.db.query(Submission).filter_by(id=post_id).first()
|
post = g.db.query(Submission).filter_by(id=post_id).first()
|
||||||
if post:
|
if post:
|
||||||
if post.stickied:
|
if post.stickied:
|
||||||
if post.stickied.startswith("t:"): abort(403)
|
if post.stickied.startswith("t:"): abort(403)
|
||||||
else: post.stickied = None
|
else: post.stickied = None
|
||||||
else: post.stickied = v.username
|
else:
|
||||||
|
pins = g.db.query(Submission.id).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
||||||
|
if pins > 2: return {"error": "Can't exceed 3 pinned posts limit!"}, 403
|
||||||
|
post.stickied = v.username
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
|
||||||
ma=ModAction(
|
ma=ModAction(
|
||||||
|
|
|
@ -104,6 +104,6 @@
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="/assets/CHRISTMAS/js/post_toast2.js?v=200"></script>
|
<script src="/assets/CHRISTMAS/js/post_toast2.js?v=201"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -346,7 +346,7 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<script>function formkey() {return '{{v.formkey}}';}</script>
|
<script>function formkey() {return '{{v.formkey}}';}</script>
|
||||||
<script src="/assets/CHRISTMAS/js/default.js?v=200"></script>
|
<script src="/assets/CHRISTMAS/js/default.js?v=201"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
<script>function formkey() {return '{{v.formkey}}';}</script>
|
<script>function formkey() {return '{{v.formkey}}';}</script>
|
||||||
<script src="/assets/CHRISTMAS/js/default.js?v=200"></script>
|
<script src="/assets/CHRISTMAS/js/default.js?v=201"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -53,7 +53,4 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block SongsTax %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -80,7 +80,4 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block SongsTax %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -683,6 +683,18 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if u.song %}
|
||||||
|
<div id="uid" class="d-none">{{u.id}}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if v %}
|
||||||
|
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
|
||||||
|
<script src="/assets/js/userpage_v.js?v=190"></script>
|
||||||
|
<div id="username" class="d-none">{{u.username}}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<script src="/assets/js/userpage.js?v=190"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block pagenav %}
|
{% block pagenav %}
|
||||||
|
@ -720,16 +732,5 @@
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block SongsTax %}
|
{% block GIFpicker %}
|
||||||
{% if u.song %}
|
|
||||||
<div id="uid" class="d-none">{{u.id}}</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if v %}
|
|
||||||
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
|
|
||||||
<script src="/assets/js/userpage_v.js?v=190"></script>
|
|
||||||
<div id="username" class="d-none">{{u.username}}</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<script src="/assets/js/userpage.js?v=190"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -103,4 +103,16 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if u.song %}
|
||||||
|
<div id="uid" class="d-none">{{u.id}}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if v %}
|
||||||
|
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
|
||||||
|
<script src="/assets/js/userpage_v.js?v=190"></script>
|
||||||
|
<div id="username" class="d-none">{{u.username}}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<script src="/assets/js/userpage.js?v=190"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -30,6 +30,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if u.song %}
|
||||||
|
<div id="uid" class="d-none">{{u.id}}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if v %}
|
||||||
|
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
|
||||||
|
<script src="/assets/js/userpage_v.js?v=190"></script>
|
||||||
|
<div id="username" class="d-none">{{u.username}}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<script src="/assets/js/userpage.js?v=190"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block pagenav %}
|
{% block pagenav %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue