Merged in trolan/adium/fix-autoscroll (pull request #12) adium-1.5.10.5
authorRobbie <robertvehse@fastmail.fm>
Mon, 04 Nov 2019 10:23:55 +0000
branchadium-1.5.10.5
changeset 5996 1894c44cfd13
parent 5994 004dd9e7a1e7 (current diff)
parent 5995 2bfcb17b7076 (diff)
child 5997 d88e6711d0e0
Merged in trolan/adium/fix-autoscroll (pull request #12)

Adjust auto-scroll code to use more compatible APIs, adding support for macOS Catalina
--- a/Plugins/WebKit Message View/Template.html	Wed Oct 30 10:55:34 2019 +0000
+++ b/Plugins/WebKit Message View/Template.html	Mon Nov 04 10:23:55 2019 +0000
@@ -214,10 +214,10 @@
 
 		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
 		function nearBottom() {
-			return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
+			return ( window.scrollY >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
 		}
 		function scrollToBottom() {
-			document.body.scrollTop = document.body.offsetHeight;
+			window.scrollTo(0, document.body.scrollHeight);
 		}
 
 		//Dynamically exchange the active stylesheet
--- a/Resources/Message Styles/Renkoo.AdiumMessageStyle/Contents/Resources/Footer.html	Wed Oct 30 10:55:34 2019 +0000
+++ b/Resources/Message Styles/Renkoo.AdiumMessageStyle/Contents/Resources/Footer.html	Mon Nov 04 10:23:55 2019 +0000
@@ -184,10 +184,10 @@
 		if ( intervall_scroll ) clearInterval( intervall_scroll );
 		intervall_scroll = setInterval( function() {
 			var target_scroll = (document.body.scrollHeight-window.innerHeight);
-			var scrolldiff = target_scroll - document.body.scrollTop;
-			if ( document.body.scrollTop != target_scroll ) {
-				var saved_scroll = document.body.scrollTop;
-				document.body.scrollTop += scrolldiff / 5 + ( scrolldiff >= 0 ? (scrolldiff != 0 ) : -1 );
+			var scrolldiff = target_scroll - window.scrollY;
+			if ( window.scrollY != target_scroll ) {
+				var saved_scroll = window.scrollY;
+				window.scrollTo(0, window.scrollY + scrolldiff / 5 + ( scrolldiff >= 0 ? (scrolldiff != 0 ) : -1 ));
 			} else {
 				saved_scroll = -1;
 				clearInterval( intervall_scroll );