Add chat enter to send + chat ctrl or shift enter to keep writing

This commit is contained in:
Bofh 2020-12-30 15:35:48 +01:00
parent cc04ede6f2
commit 7649f30323
4 changed files with 62 additions and 2 deletions

View File

@ -20,6 +20,14 @@
<!-- inline CSS --> <!-- inline CSS -->
<style id="fedilove" media="all">
@media (max-width: 500px) {
div.timeline > div.the-list div.list-item article.status-article {
max-width: 18em !important;
}
}
</style>
<style id="theGrayscaleStyle" media="only x"> <style id="theGrayscaleStyle" media="only x">
/* Firefox doesn't seem to like applying filter: grayscale() to /* Firefox doesn't seem to like applying filter: grayscale() to
* the entire body, so we apply individually. * the entire body, so we apply individually.

View File

@ -35,7 +35,6 @@
<StatusToolbar {...params} {replyShown} on:recalculateHeight /> <StatusToolbar {...params} {replyShown} on:recalculateHeight />
<div class="like-div"><a class="status-favs-reblogs status-favs" <div class="like-div"><a class="status-favs-reblogs status-favs"
rel="prefetch" rel="prefetch"
href="/statuses/{originalStatusId}"
onclick="return api_status_fav(this,'{originalStatusId}');" onclick="return api_status_fav(this,'{originalStatusId}');"
aria-label={favoritesLabel}> aria-label={favoritesLabel}>
<svg class="status-favs-reblogs-svg"><path d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"></path></svg> <svg class="status-favs-reblogs-svg"><path d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"></path></svg>

View File

@ -84,6 +84,7 @@ div#chat-party-global {
width: 100%; width: 100%;
padding-left: 1em; padding-left: 1em;
a { a {
display: flex;
font-weight: bold; font-weight: bold;
margin: auto 0; margin: auto 0;
color: #000; color: #000;
@ -96,7 +97,12 @@ div#chat-party-global {
} }
div#back { div#back {
background: #fff;
display: flex; display: flex;
padding-left: 1em;
position: fixed;
right: 0;
top: .6em;
a { a {
display: flex; display: flex;
@ -211,9 +217,18 @@ div.main-content.direct {
} }
div.timeline div.virtual-list-item { div.timeline div.virtual-list-item {
article.status-article {
cursor: pointer;
}
article.status-article:focus {
background: #f7f7f7;
}
a.status-favs-reblogs.status-favs { a.status-favs-reblogs.status-favs {
display: none; display: none;
} }
} }
div.timeline > div.the-list { div.timeline > div.the-list {
@ -221,6 +236,7 @@ div.timeline > div.the-list {
div.list-item { div.list-item {
article.status-article.mymsg { article.status-article.mymsg {
background: #fbfbfb; background: #fbfbfb;
float: right; float: right;
@ -235,9 +251,17 @@ div.timeline > div.the-list {
} }
article.status-article.partymsg { article.status-article.partymsg {
a.status-favs-reblogs.status-favs.liked-msg > svg { a.status-favs-reblogs.status-favs.liked-msg > svg {
fill: red !important; fill: red !important;
} }
div.like-div {
a.status-favs-reblogs.status-favs {
cursor: pointer;
}
}
} }
article.status-article { article.status-article {
@ -273,6 +297,11 @@ div.timeline > div.the-list {
display: none; display: none;
} }
a.status-relative-date {
position: relative;
left: 1.5em;
}
a.external-link.status-absolute-date { a.external-link.status-absolute-date {
text-decoration: none; text-decoration: none;
cursor: initial; cursor: initial;

View File

@ -87,6 +87,10 @@ var fediloveUI = {
id: accid, acct: acct, id: accid, acct: acct,
avatar: avatar, name: name avatar: avatar, name: name
}; };
// add domain part on acct on painting it to be clear
if (acct.split('@').length-1 === 1) {
acct += `@${fediloveApi.getCurrentInstance()}`;
}
} }
// to-do: check is it XSS safe to add it like this :) ?? // to-do: check is it XSS safe to add it like this :) ??
@ -123,7 +127,8 @@ var fediloveApi = {
var fediloveFunctions = {}; var fediloveFunctions = {};
var fediloveData = { var fediloveData = {
chatAvatarCache: undefined, chatAvatarCache: undefined,
gotEmojifyTextFunction: false gotEmojifyTextFunction: false,
composeTxtKeypressEvent: false
}; };
var fediloveEvents = { var fediloveEvents = {
onGotEmojifyTextFunction: function() { onGotEmojifyTextFunction: function() {
@ -205,6 +210,25 @@ function fedilove_customization() {
document.querySelector('#chat-party-hide').style = ''; document.querySelector('#chat-party-hide').style = '';
document.querySelector('nav#main-nav > ul.main-nav-ul').style = 'display: none !important'; document.querySelector('nav#main-nav > ul.main-nav-ul').style = 'display: none !important';
if (!fediloveData.composeTxtKeypressEvent) {
$('div#chat-compose-global textarea').keypress(function(e) {
const keycode = (e.keyCode ? e.keyCode : e.which);
if (keycode == '13') {
if (!e.ctrlKey && !e.shiftKey) {
e.stopPropagation();
e.preventDefault();
setTimeout(function() { api_send_message() }, 100);
return true;
} else {
if (!e.shiftKey && e.ctrlKey) {
$(this).val($(this).val()+'\n');
}
}
}
});
fediloveData.composeTxtKeypressEvent = true;
}
// ******* // *******
// load cached avatars or paint it empty (automated process after this will fill it) // load cached avatars or paint it empty (automated process after this will fill it)
if (fediloveData.chatAvatarCache !== undefined) { if (fediloveData.chatAvatarCache !== undefined) {