Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.2020
Browse files Browse the repository at this point in the history
It is based on:
* psi: c6d401b5
* plugins: 7a65467
* psimedia: 478567e
* resources: e32ef4b
  • Loading branch information
tehnick committed Jul 3, 2024
1 parent 19c5c95 commit 038a206
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 45 deletions.
7 changes: 0 additions & 7 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,6 @@
margin-top: auto;
}

.mymsg .time {
margin-top: inherit;
display: flex;
align-items: flex-end;
order: 2;
}

.avatar {
margin-left: -2.8rem;
font-size: 2.3rem;
Expand Down
80 changes: 43 additions & 37 deletions themes/chatview/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,35 @@ function initPsiTheme() {
this.items = [];
this.providers = [];

this.addItem = function(text, action) {
var menu = this;
document.addEventListener("contextmenu", function (event) {
var all_items = menu.items.slice();
try {
for (let i = 0; i < menu.providers.length; i++) {
all_items = all_items.concat(menu.providers[i](event));
}
} catch(e) {
chat.console(e+"");
}
if (!all_items.length) {
return true;
}

event.stopPropagation();
event.preventDefault();

menu.show(event.pageX, event.pageY, all_items).catch(()=>{});
});
}

ContextMenu.prototype = {
addItem : function(text, action) {
this.items.push({text: text, action: action});
};
this.addItemProvider = function(itemProvider) {
},
addItemProvider : function(itemProvider) {
this.providers.push(itemProvider);
};
this.show = function(x, y, items) {
},
show : function(x, y, items) {
if (window.activeMenu) {
window.activeMenu.destroyMenu();
}
Expand All @@ -462,46 +484,30 @@ function initPsiTheme() {
}, { "once": true });
}
menu.destroyMenu = () => {
document.body.removeEventListener("click", menu.destroyMenu);
document.removeEventListener("click", menu.destroyMenu);
menu.parentNode.removeChild(menu);
window.activeMenu = undefined;
reject();
};
document.body.addEventListener("click", menu.destroyMenu, { "once": true });
document.addEventListener("click", menu.destroyMenu, { "once": true });

menu.style.top = y + "px";
if (x + menu.clientWidth > document.body.clientWidth) {
x = document.body.clientWidth - menu.clientWidth - 5;
if (x < 0) x = 0;
}
menu.style.left = x + "px";

const docEl = document.documentElement;
const bottom = docEl.clientHeight + docEl.scrollTop + document.body.scrollTop;
if (y + menu.clientHeight > bottom) {
y = bottom - menu.clientHeight;
if (y < docEl.scrollTop) y = docEl.scrollTop;
}
menu.style.top = y + "px";

window.activeMenu = menu;
});
};

var menu = this;
document.addEventListener("contextmenu", function (event) {
var all_items = menu.items.slice();
try {
for (let i = 0; i < menu.providers.length; i++) {
all_items = all_items.concat(menu.providers[i](event));
}
} catch(e) {
chat.console(e+"");
}
if (!all_items.length) {
return true;
}

event.stopPropagation();
event.preventDefault();

var totalScrollY = 0;
var el = event.target;
while (el) {
if (el.scrollTop !== undefined) {
totalScrollY += el.scrollTop;
}
el = el.parentNode;
}
menu.show(event.x, event.y + totalScrollY, all_items).catch(()=>{});
});
}
}

var util = {
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2019 (2024-07-03, 0fa8d5d2)
1.5.2020 (2024-07-03, c6d401b5)

0 comments on commit 038a206

Please sign in to comment.