adium 2762:9642be635e28: If we start a consecuative message outs...
commits at adium.im
commits at adium.im
Thu Oct 22 20:19:42 UTC 2009
details: http://hg.adium.im/adium/rev/9642be635e28
revision: 2762:9642be635e28
author: Stephen Holt <sholt at adium.im>
date: Thu Oct 22 16:19:21 2009 -0400
If we start a consecuative message outside an existing coalescing round, start a new one that's cancelled once we get a message from a new sender.
Speedy message view is speedy.
diffs (66 lines):
diff -r 687f12da3240 -r 9642be635e28 Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html Thu Oct 22 12:17:43 2009 -0400
+++ b/Plugins/WebKit Message View/Template.html Thu Oct 22 16:19:21 2009 -0400
@@ -25,6 +25,7 @@
this.timeoutID = 0;
this.coalesceRounds = 0;
this.isCoalescing = false;
+ this.isConsecutive = undefined;
this.shouldScroll = undefined;
function outputHTML() {
@@ -38,6 +39,7 @@
// reset state to empty/non-coalescing
self.shouldScroll = undefined;
+ self.isConsecutive = undefined;
self.isCoalescing = false;
self.coalesceRounds = 0;
}
@@ -91,6 +93,12 @@
// coalased analogs to the global functions
this.append = function(html, shouldScroll) {
+ // if we started this fragment with a consecuative message,
+ // cancel and output before we continue
+ if(undefined === self.isConsecutive || !self.isConsecutive) {
+ self.cancel();
+ }
+ self.isConsecutive = false;
rmInsertNode();
var node = createHTMLNode(html);
self.fragment.appendChild(node);
@@ -102,6 +110,7 @@
}
this.appendNext = function(html, shouldScroll) {
+ self.isConsecutive = self.isConsecutive||true;
var insert = self.fragment.querySelector("#insert");
if(insert) {
var node = createHTMLNode(html);
@@ -160,24 +169,7 @@
function appendNextMessageNoScroll(html, shouldScroll){
shouldScroll = shouldScroll || false;
// only group next messages if we're already coalescing input
- if(coalescedHTML.isCoalescing){
- coalescedHTML.appendNext(html, shouldScroll);
- } else {
- //Locate the insertion point
- var insert = document.getElementById("insert");
- if(insert){
- //make new node
- var range = document.createRange();
- range.selectNode(insert.parentNode);
- var newNode = range.createContextualFragment(html);
-
- //swap
- insert.parentNode.replaceChild(newNode,insert);
- alignChat(shouldScroll);
- } else {
- appendMessageNoScroll(html);
- }
- }
+ coalescedHTML.appendNext(html, shouldScroll);
}
function replaceLastMessage(html){
More information about the commits
mailing list