Fixed scrolling issue

This commit is contained in:
Jiiks 2015-10-14 09:50:34 +03:00
parent a498bdf231
commit 40a77179f5
3 changed files with 19 additions and 8 deletions

View File

@ -1,8 +1,8 @@
/* BetterDiscordApp EmoteModule JavaScript /* BetterDiscordApp EmoteModule JavaScript
* Version: 1.3 * Version: 1.4
* Author: Jiiks | http://jiiks.net * Author: Jiiks | http://jiiks.net
* Date: 26/08/2015 - 15:29 * Date: 26/08/2015 - 15:29
* Last Update: 29/08/2015 - 11:46 * Last Update: 14/10/2015 - 09:48
* https://github.com/Jiiks/BetterDiscordApp * https://github.com/Jiiks/BetterDiscordApp
* Note: Due to conflicts autocapitalize only supports global emotes * Note: Due to conflicts autocapitalize only supports global emotes
*/ */
@ -78,7 +78,12 @@ EmoteModule.prototype.injectEmote = function(node) {
} }
}); });
var oldHeight = parent.parentElement.offsetHeight;
parent.innerHTML = parentInnerHTML; parent.innerHTML = parentInnerHTML;
var newHeight = parent.parentElement.offsetHeight;
var scrollPane = $($(".scroller.messages")[0])
scrollPane.scrollTop(scrollPane.scrollTop() + (newHeight - oldHeight));
} }
EmoteModule.prototype.autoCapitalize = function() { EmoteModule.prototype.autoCapitalize = function() {

View File

@ -131,10 +131,10 @@ Core.prototype.initObserver = function() {
} }
/* BetterDiscordApp EmoteModule JavaScript /* BetterDiscordApp EmoteModule JavaScript
* Version: 1.3 * Version: 1.4
* Author: Jiiks | http://jiiks.net * Author: Jiiks | http://jiiks.net
* Date: 26/08/2015 - 15:29 * Date: 26/08/2015 - 15:29
* Last Update: 29/08/2015 - 11:46 * Last Update: 14/10/2015 - 09:48
* https://github.com/Jiiks/BetterDiscordApp * https://github.com/Jiiks/BetterDiscordApp
* Note: Due to conflicts autocapitalize only supports global emotes * Note: Due to conflicts autocapitalize only supports global emotes
*/ */
@ -198,19 +198,24 @@ EmoteModule.prototype.injectEmote = function(node) {
words.some(function(word) { words.some(function(word) {
if (emotesTwitch.hasOwnProperty(word)) { if (emotesTwitch.hasOwnProperty(word)) {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + emotesTwitch[word] + twitchEmoteUrlEnd + "><\/img>"); parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + emotesTwitch[word] + twitchEmoteUrlEnd + " title="+word+"><\/img>");
} else if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) { } else if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
if(emotesFfz.hasOwnProperty(word)) { if(emotesFfz.hasOwnProperty(word)) {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + "><\/img>"); parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + ffzEmoteUrlStart + emotesFfz[word] + ffzEmoteUrlEnd + " title="+word+"><\/img>");
} else if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) { } else if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
if(emotesBTTV.hasOwnProperty(word)) { if(emotesBTTV.hasOwnProperty(word)) {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + bttvEmoteUrlStart + emotesBTTV[word] + bttvEmoteUrlEnd + "><\/img>"); parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + bttvEmoteUrlStart + emotesBTTV[word] + bttvEmoteUrlEnd + " title="+word+"><\/img>");
} }
} }
} }
}); });
var oldHeight = parent.parentElement.offsetHeight;
parent.innerHTML = parentInnerHTML; parent.innerHTML = parentInnerHTML;
var newHeight = parent.parentElement.offsetHeight;
var scrollPane = $($(".scroller.messages")[0])
scrollPane.scrollTop(scrollPane.scrollTop() + (newHeight - oldHeight));
} }
EmoteModule.prototype.autoCapitalize = function() { EmoteModule.prototype.autoCapitalize = function() {
@ -242,6 +247,7 @@ EmoteModule.prototype.capitalize = function(value) {
return null; return null;
} }
/* BetterDiscordApp PublicSevers JavaSctript /* BetterDiscordApp PublicSevers JavaSctript
* Version: 1.0 * Version: 1.0
* Author: Jiiks | http://jiiks.net * Author: Jiiks | http://jiiks.net

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long