forked from MarseyWorld/MarseyWorld
fsd
parent
b6e76a7a0b
commit
85cf7cc2a6
|
@ -25,14 +25,15 @@ if "load_chat" in sys.argv:
|
||||||
@auth_required
|
@auth_required
|
||||||
def speak(data, v):
|
def speak(data, v):
|
||||||
global messages
|
global messages
|
||||||
data = data[:1000].strip()
|
text = data[:1000].strip()
|
||||||
if not data: abort(403)
|
if not text: abort(403)
|
||||||
|
|
||||||
data={
|
data={
|
||||||
"avatar": v.profile_url,
|
"avatar": v.profile_url,
|
||||||
"username":v.username,
|
"username":v.username,
|
||||||
"namecolor":v.namecolor,
|
"namecolor":v.namecolor,
|
||||||
"text":sanitize(data),
|
"text":text,
|
||||||
|
"text_html":sanitize(text),
|
||||||
}
|
}
|
||||||
|
|
||||||
messages.append(data)
|
messages.append(data)
|
||||||
|
|
|
@ -47,7 +47,12 @@
|
||||||
<img src="{{m['avatar']}}" class="mobile-avatar profile-pic-30 mr-1 d-inline-block d-md-none" data-toggle="tooltip" data-placement="right">
|
<img src="{{m['avatar']}}" class="mobile-avatar profile-pic-30 mr-1 d-inline-block d-md-none" data-toggle="tooltip" data-placement="right">
|
||||||
<a class="font-weight-bold text-black userlink" style="color:#{{m['namecolor']}}" target="_blank" href="/@{{m['username']}}">{{m['username']}}</a>
|
<a class="font-weight-bold text-black userlink" style="color:#{{m['namecolor']}}" target="_blank" href="/@{{m['username']}}">{{m['username']}}</a>
|
||||||
<div style="overflow:hidden">
|
<div style="overflow:hidden">
|
||||||
<span class="chat-message text-black text-break">{{m['text'] | safe}}</span>
|
{% set text=m['text'] %}
|
||||||
|
<span class="chat-message text-black text-break">{{m['text_html'] | safe}}
|
||||||
|
<button onclick="quote('{{text}}')">
|
||||||
|
<i class="fas fa-reply" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -146,7 +151,7 @@
|
||||||
|
|
||||||
|
|
||||||
socket.on('speak', function(json) {
|
socket.on('speak', function(json) {
|
||||||
let text = json['text']
|
let text = json['text_html']
|
||||||
|
|
||||||
if (text.includes('<a href="/id/{{v.id}}">')){
|
if (text.includes('<a href="/id/{{v.id}}">')){
|
||||||
chatline.classList.add('chat-mention');
|
chatline.classList.add('chat-mention');
|
||||||
|
@ -184,6 +189,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function quote(text) {
|
||||||
|
textbox.value = text + '\n'
|
||||||
|
textbox.focus()
|
||||||
|
}
|
||||||
|
|
||||||
textbox.addEventListener("keyup", function(e) {
|
textbox.addEventListener("keyup", function(e) {
|
||||||
if (!e.shiftKey && e.key === 'Enter') {
|
if (!e.shiftKey && e.key === 'Enter') {
|
||||||
|
|
Loading…
Reference in New Issue