Skip to content

Commit

Permalink
move move stuff to utils from Bubble theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 29, 2024
1 parent 574775b commit 6aff2fb
Show file tree
Hide file tree
Showing 3 changed files with 740 additions and 717 deletions.
5 changes: 5 additions & 0 deletions src/chatviewcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ ChatViewCommon::updateReactions(const QString &senderNickname, const QString &me
auto sanitized = orig.remove(skinRemove);
ret << ReactionsItem { sanitized != orig ? sanitized : QString {}, orig, it.value() };
}
if (total.isEmpty()) {
_reactions.erase(msgIt);
} else if (userIt->isEmpty()) {
msgIt.value().perUser.erase(userIt);
}
return ret;
}

Expand Down
27 changes: 3 additions & 24 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
var themeStyle = document.getElementById("themeStyle").sheet;
var cssBody = util.findStyleSheet(themeStyle, "body").style;
const reactionsSelector = new shared.chat.ReactionsSelector(shared.session);
const likeButton = new shared.chat.LikeButton(reactionsSelector, document.documentElement);
const chatMenu = new shared.chat.ContextMenu();

var applyPsiSettings = function() {
Expand Down Expand Up @@ -78,26 +79,7 @@
}
},
postProcess: function(el) {
let shared_timer = {}
el.addEventListener("mouseleave", function () {
if (shared_timer.timer) { // if we were going to show it
clearTimeout(shared_timer.timer);
shared_timer.timer = null;
} else {
const rs = el.getElementsByClassName("like_button")[0];
rs.parentNode.removeChild(rs);
}
});
el.addEventListener("mouseenter", function () {
shared_timer.timer = setTimeout(function () {
let selector = el.appendChild(document.createElement("div"));
selector.classList.add("like_button");
selector.textContent = "❤️";
setTimeout(() => { selector.classList.add('noopacity'); }, 0);
shared_timer.timer = null;
selector.addEventListener("click", () => reactionsSelector.show(el.id, selector, document.documentElement));
}, 500);
});
likeButton.setupForMessageElement(el);
if (shared.cdata.reply) {
const bq = el.getElementsByTagName("blockquote")[0];
if (bq) {
Expand All @@ -107,8 +89,6 @@
}
});



function setup_context_menu() {
chatMenu.addItemProvider((event) => {
const isNick = event.target.className == "nick";
Expand Down Expand Up @@ -413,8 +393,7 @@
padding-top: 1rem;
/*background-color: green;*/
opacity: 0;
transition: opacity 0.5s linear, bottom .5s, font-size .5s;
;
transition: opacity 0.3s linear, bottom .3s, font-size .3s;
}

.noopacity {
Expand Down
Loading

0 comments on commit 6aff2fb

Please sign in to comment.