forked from rDrama/rDrama
pause,unpausable
parent
4a905496da
commit
5ed72c3e47
|
@ -76,6 +76,8 @@ class User(Base):
|
||||||
newtabexternal = Column(Boolean, default=True)
|
newtabexternal = Column(Boolean, default=True)
|
||||||
oldreddit = Column(Boolean, default=True)
|
oldreddit = Column(Boolean, default=True)
|
||||||
nitter = Column(Boolean)
|
nitter = Column(Boolean)
|
||||||
|
mute = Column(Boolean)
|
||||||
|
unmutable = Column(Boolean)
|
||||||
frontsize = Column(Integer, default=25)
|
frontsize = Column(Integer, default=25)
|
||||||
controversial = Column(Boolean, default=False)
|
controversial = Column(Boolean, default=False)
|
||||||
bio = Column(String)
|
bio = Column(String)
|
||||||
|
|
|
@ -213,6 +213,22 @@ if SITE_NAME == "Drama":
|
||||||
"color": "text-success",
|
"color": "text-success",
|
||||||
"price": 10000
|
"price": 10000
|
||||||
},
|
},
|
||||||
|
"pause": {
|
||||||
|
"kind": "pause",
|
||||||
|
"title": "Pause",
|
||||||
|
"description": "Gives the recipient the ability to pause profile anthems.",
|
||||||
|
"icon": "fas fa-volume-mute",
|
||||||
|
"color": "text-danger",
|
||||||
|
"price": 20000
|
||||||
|
},
|
||||||
|
"unpausable": {
|
||||||
|
"kind": "unpausable",
|
||||||
|
"title": "Unpausable",
|
||||||
|
"description": "Makes the profile anthem of the recipient unpausable.",
|
||||||
|
"icon": "fas fa-volume",
|
||||||
|
"color": "text-success",
|
||||||
|
"price": 40000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -256,4 +272,20 @@ else:
|
||||||
"color": "text-black",
|
"color": "text-black",
|
||||||
"price": 1000
|
"price": 1000
|
||||||
},
|
},
|
||||||
|
"pause": {
|
||||||
|
"kind": "pause",
|
||||||
|
"title": "Pause",
|
||||||
|
"description": "Gives the recipient the ability to pause profile anthems.",
|
||||||
|
"icon": "fas fa-volume-mute",
|
||||||
|
"color": "text-danger",
|
||||||
|
"price": 20000
|
||||||
|
},
|
||||||
|
"unpausable": {
|
||||||
|
"kind": "unpausable",
|
||||||
|
"title": "Unpausable",
|
||||||
|
"description": "Makes the profile anthem of the recipient unpausable.",
|
||||||
|
"icon": "fas fa-volume",
|
||||||
|
"color": "text-success",
|
||||||
|
"price": 40000
|
||||||
|
},
|
||||||
}
|
}
|
|
@ -131,6 +131,24 @@ def shop(v):
|
||||||
"owned": 0,
|
"owned": 0,
|
||||||
"price": 10000
|
"price": 10000
|
||||||
},
|
},
|
||||||
|
"pause": {
|
||||||
|
"kind": "pause",
|
||||||
|
"title": "Pause",
|
||||||
|
"description": "Gives the recipient the ability to pause profile anthems.",
|
||||||
|
"icon": "fas fa-volume-mute",
|
||||||
|
"color": "text-danger",
|
||||||
|
"owned": 0,
|
||||||
|
"price": 20000
|
||||||
|
},
|
||||||
|
"unpausable": {
|
||||||
|
"kind": "unpausable",
|
||||||
|
"title": "Unpausable",
|
||||||
|
"description": "Makes the profile anthem of the recipient unpausable.",
|
||||||
|
"icon": "fas fa-volume",
|
||||||
|
"color": "text-success",
|
||||||
|
"owned": 0,
|
||||||
|
"price": 40000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -179,6 +197,24 @@ def shop(v):
|
||||||
"owned": 0,
|
"owned": 0,
|
||||||
"price": 1000
|
"price": 1000
|
||||||
},
|
},
|
||||||
|
"pause": {
|
||||||
|
"kind": "pause",
|
||||||
|
"title": "Pause",
|
||||||
|
"description": "Gives the recipient the ability to pause profile anthems.",
|
||||||
|
"icon": "fas fa-volume-mute",
|
||||||
|
"color": "text-danger",
|
||||||
|
"owned": 0,
|
||||||
|
"price": 20000
|
||||||
|
},
|
||||||
|
"unpausable": {
|
||||||
|
"kind": "unpausable",
|
||||||
|
"title": "Unpausable",
|
||||||
|
"description": "Makes the profile anthem of the recipient unpausable.",
|
||||||
|
"icon": "fas fa-volume",
|
||||||
|
"color": "text-success",
|
||||||
|
"owned": 0,
|
||||||
|
"price": 40000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): AWARDS[useraward.kind]["owned"] += 1
|
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): AWARDS[useraward.kind]["owned"] += 1
|
||||||
|
@ -280,7 +316,22 @@ def buy(v, award):
|
||||||
"color": "text-success",
|
"color": "text-success",
|
||||||
"price": 10000
|
"price": 10000
|
||||||
},
|
},
|
||||||
|
"pause": {
|
||||||
|
"kind": "pause",
|
||||||
|
"title": "Pause",
|
||||||
|
"description": "Gives the recipient the ability to pause profile anthems.",
|
||||||
|
"icon": "fas fa-volume-mute",
|
||||||
|
"color": "text-danger",
|
||||||
|
"price": 20000
|
||||||
|
},
|
||||||
|
"unpausable": {
|
||||||
|
"kind": "unpausable",
|
||||||
|
"title": "Unpausable",
|
||||||
|
"description": "Makes the profile anthem of the recipient unpausable.",
|
||||||
|
"icon": "fas fa-volume",
|
||||||
|
"color": "text-success",
|
||||||
|
"price": 40000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
|
@ -324,6 +375,22 @@ def buy(v, award):
|
||||||
"color": "text-black",
|
"color": "text-black",
|
||||||
"price": 1000
|
"price": 1000
|
||||||
},
|
},
|
||||||
|
"pause": {
|
||||||
|
"kind": "pause",
|
||||||
|
"title": "Pause",
|
||||||
|
"description": "Gives the recipient the ability to pause profile anthems.",
|
||||||
|
"icon": "fas fa-volume-mute",
|
||||||
|
"color": "text-danger",
|
||||||
|
"price": 20000
|
||||||
|
},
|
||||||
|
"unpausable": {
|
||||||
|
"kind": "unpausable",
|
||||||
|
"title": "Unpausable",
|
||||||
|
"description": "Makes the profile anthem of the recipient unpausable.",
|
||||||
|
"icon": "fas fa-volume",
|
||||||
|
"color": "text-success",
|
||||||
|
"price": 40000
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if award not in AWARDS: abort(400)
|
if award not in AWARDS: abort(400)
|
||||||
|
@ -458,6 +525,10 @@ def award_post(pid, v):
|
||||||
author.customtitle = filter_title(new_name)
|
author.customtitle = filter_title(new_name)
|
||||||
if len(author.customtitle) > 1000: abort(403)
|
if len(author.customtitle) > 1000: abort(403)
|
||||||
author.flairchanged = time.time() + 86400
|
author.flairchanged = time.time() + 86400
|
||||||
|
elif kind == "pause":
|
||||||
|
author.mute = True
|
||||||
|
elif kind == "unpausable":
|
||||||
|
author.unmutable = True
|
||||||
|
|
||||||
post.author.received_award_count += 1
|
post.author.received_award_count += 1
|
||||||
g.db.add(post.author)
|
g.db.add(post.author)
|
||||||
|
@ -565,6 +636,8 @@ def award_comment(cid, v):
|
||||||
author.customtitle = filter_title(new_name)
|
author.customtitle = filter_title(new_name)
|
||||||
if len(author.customtitle) > 1000: abort(403)
|
if len(author.customtitle) > 1000: abort(403)
|
||||||
author.flairchanged = time.time() + 86400
|
author.flairchanged = time.time() + 86400
|
||||||
|
elif kind == "pause": author.mute = True
|
||||||
|
elif kind == "unpausable": author.unmutable = True
|
||||||
|
|
||||||
c.author.received_award_count += 1
|
c.author.received_award_count += 1
|
||||||
g.db.add(c.author)
|
g.db.add(c.author)
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
|
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
|
||||||
<td style="font-weight: bold">{{a['title']}}</td>
|
<td style="font-weight: bold">{{a['title']}}</td>
|
||||||
<td><input type="number" class="form-control" name="{{a['kind']}}" value="0" placeholder="enter amount" /></td>
|
<td><input type="number" class="form-control" name="{{a['kind']}}" value="0" placeholder="Enter amount..." /></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
|
|
||||||
@media (min-width: 767.98px) {
|
@media (min-width: 767.98px) {
|
||||||
.award-columns {
|
.award-columns {
|
||||||
column-count: 5 !important;
|
column-count: 6 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -63,7 +63,7 @@
|
||||||
{% set kind = a['kind'] %}
|
{% set kind = a['kind'] %}
|
||||||
<td style="font-weight: bold">
|
<td style="font-weight: bold">
|
||||||
<a class="d-flex btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}')"><span class="m-auto">Buy</span></a>
|
<a class="d-flex btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}')"><span class="m-auto">Buy</span></a>
|
||||||
{% if v.procoins and kind not in ["agendaposter","grass"] %}<a class="d-flex marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}?mb=true')"><span class="m-auto">Buy with Marseybux</span></a>{% endif %}
|
{% if v.procoins and kind not in ["agendaposter","grass","pause","unpausable"] %}<a class="d-flex marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}?mb=true')"><span class="m-auto">Buy with Marseybux</span></a>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -67,6 +67,24 @@
|
||||||
var audio = new Audio('/songs/{{u.id}}');
|
var audio = new Audio('/songs/{{u.id}}');
|
||||||
audio.loop=true;
|
audio.loop=true;
|
||||||
|
|
||||||
|
{% if not u.unmutable %}
|
||||||
|
function pause() {
|
||||||
|
audio.pause();
|
||||||
|
document.getElementById("pause1").classList.toggle("d-none");
|
||||||
|
document.getElementById("play1").classList.toggle("d-none");
|
||||||
|
document.getElementById("pause2").classList.toggle("d-none");
|
||||||
|
document.getElementById("play2").classList.toggle("d-none");
|
||||||
|
}
|
||||||
|
|
||||||
|
function play() {
|
||||||
|
audio.play();
|
||||||
|
document.getElementById("pause1").classList.toggle("d-none");
|
||||||
|
document.getElementById("play1").classList.toggle("d-none");
|
||||||
|
document.getElementById("pause2").classList.toggle("d-none");
|
||||||
|
document.getElementById("play2").classList.toggle("d-none");
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
window.addEventListener( 'load', function() {
|
window.addEventListener( 'load', function() {
|
||||||
audio.play();
|
audio.play();
|
||||||
document.getElementById('userpage').addEventListener('click', () => {
|
document.getElementById('userpage').addEventListener('click', () => {
|
||||||
|
@ -74,28 +92,9 @@
|
||||||
}, {once : true});
|
}, {once : true});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
{% if not u.unmutable %}
|
|
||||||
function pause() {
|
|
||||||
audio.pause();
|
|
||||||
document.getElementById("pause").classList.toggle("d-none");
|
|
||||||
document.getElementById("play").classList.toggle("d-none");
|
|
||||||
}
|
|
||||||
|
|
||||||
function play() {
|
|
||||||
audio.play();
|
|
||||||
document.getElementById("pause").classList.toggle("d-none");
|
|
||||||
document.getElementById("play").classList.toggle("d-none");
|
|
||||||
}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if not u.unmutable %}
|
|
||||||
<a id="pause" class="btn btn-secondary" href="javascript:void(0)" onclick="pause()">Pause</a>
|
|
||||||
<a id="play" class="btn btn-secondary d-none" href="javascript:void(0)" onclick="play()">Play</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="row d-none d-md-block">
|
<div class="row d-none d-md-block">
|
||||||
<div class="col px-0">
|
<div class="col px-0">
|
||||||
<div class="jumbotron jumbotron-fluid jumbotron-guild d-none d-md-block" style="background-image: url({{u.banner_url}})">
|
<div class="jumbotron jumbotron-fluid jumbotron-guild d-none d-md-block" style="background-image: url({{u.banner_url}})">
|
||||||
|
@ -256,6 +255,12 @@
|
||||||
<a href="/settings/profile" class="btn btn-secondary">Edit profile</a>
|
<a href="/settings/profile" class="btn btn-secondary">Edit profile</a>
|
||||||
<a href="/views" class="btn btn-secondary">Profile views</a>
|
<a href="/views" class="btn btn-secondary">Profile views</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if v and v.mute and not u.unmutable %}
|
||||||
|
<a id="pause1" class="btn btn-secondary" href="javascript:void(0)" onclick="pause()">Pause anthem</a>
|
||||||
|
<a id="play1" class="btn btn-secondary d-none" href="javascript:void(0)" onclick="play()">Play anthem</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if v and v.id != u.id and v.admin_level > 1 %}
|
{% if v and v.id != u.id and v.admin_level > 1 %}
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="body d-lg-flex border-bottom">
|
<div class="body d-lg-flex border-bottom">
|
||||||
|
@ -464,6 +469,12 @@
|
||||||
<a href="/settings/profile" class="btn btn-secondary ">Edit profile</a>
|
<a href="/settings/profile" class="btn btn-secondary ">Edit profile</a>
|
||||||
<a href="/views" class="btn btn-secondary">Profile views</a>
|
<a href="/views" class="btn btn-secondary">Profile views</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if v and v.mute and not u.unmutable %}
|
||||||
|
<a id="pause2" class="btn btn-secondary" href="javascript:void(0)" onclick="pause()">Pause anthem</a>
|
||||||
|
<a id="play2" class="btn btn-secondary d-none" href="javascript:void(0)" onclick="play()">Play anthem</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if v and v.id != u.id %}
|
{% if v and v.id != u.id %}
|
||||||
{% if u.id != 995 %}<a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast2('/unfollow/{{u.username}}','button-unsub2','button-sub2')">Unfollow</a>{% endif %}
|
{% if u.id != 995 %}<a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast2('/unfollow/{{u.username}}','button-unsub2','button-sub2')">Unfollow</a>{% endif %}
|
||||||
<a id="button-sub2" class="btn btn-primary {% if is_following or u.is_nofollow or u.is_blocked %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast2('/follow/{{u.username}}','button-unsub2','button-sub2')">Follow</a>
|
<a id="button-sub2" class="btn btn-primary {% if is_following or u.is_nofollow or u.is_blocked %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast2('/follow/{{u.username}}','button-unsub2','button-sub2')">Follow</a>
|
||||||
|
|
Loading…
Reference in New Issue