Skip to content

Commit

Permalink
Adium: scrolling hack for compatibility with webengine
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jul 7, 2024
1 parent b02b5ec commit 5be18ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions themes/chatview/adium/Template.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@

//Auto-scroll to bottom. Use nearBottom to determine if a scrollToBottom is desired.
function nearBottom() {
return ( (document.documentElement.scrollTop + document.body.scrollTop) >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
}
function scrollToBottom() {
document.body.scrollTop = document.body.offsetHeight;
document.documentElement.scrollTop = document.body.offsetHeight;
}

//Dynamically exchange the active stylesheet
Expand Down Expand Up @@ -321,7 +320,7 @@
.actionMessageBody:before { content:"*"; }
.actionMessageBody:after { content:"*"; }
* { word-wrap:break-word; text-rendering: optimizelegibility; }
img.scaledToFitImage { height: auto; max-width: 100%%; }
img.scaledToFitImage { height: auto; max-width: 100%; }
</style>

<!-- This style is shared by all variants. !-->
Expand Down
12 changes: 12 additions & 0 deletions themes/chatview/adium/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,18 @@ chat.util.updateObject(adapter, function(chat){

session.newMessage.connect(chat.receiveObject);
session.scrollRequested.connect((value) => { window.scrollBy(0, value); });
if (QWebChannel) {
// define compatibility hack for webengine
Object.defineProperty(document.body, "scrollTop", {
set: function(x) { document.documentElement.scrollTop = x; },
get: function() { return document.documentElement.scrollTop; }
});
Object.defineProperty(document.body, "scrollHeight", {
set: function(x) { document.documentElement.scrollHeight = x; },
get: function() { return document.documentElement.scrollHeight; }
});
}

chat.util.rereadOptions();
session.signalInited();
}
Expand Down

0 comments on commit 5be18ee

Please sign in to comment.