adium 3822:67a59959597d: As requested by mathuaerknedam, also ad...
commits at adium.im
commits at adium.im
Fri Apr 1 12:26:34 UTC 2011
details: http://hg.adium.im/adium/rev/67a59959597d
revision: 3822:67a59959597d
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Fri Apr 01 14:26:19 2011 +0200
As requested by mathuaerknedam, also add a regainedFocus CSS class to the first message received after regaining focus.
diffs (92 lines):
diff -r 1022bf3c27e6 -r 67a59959597d ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt Fri Apr 01 03:01:24 2011 -0400
+++ b/ChangeLogs/Changes.txt Fri Apr 01 14:26:19 2011 +0200
@@ -44,7 +44,7 @@
* Rounded user icon in the chat window toolbar. (#3757)
Message View
- * Added the "lastFocus" class for message styles to the latest message received while the chat didn't have focus.
+ * Added the "lastFocus" class for message styles to the latest message received while the chat didn't have focus, and "regainedFocus" for the first message received while the chat has regained focus after having previously lost it.
Transcript Viewer
* Added next/previous buttons for highlighted search terms within a transcript (similar to Safari).
diff -r 1022bf3c27e6 -r 67a59959597d Plugins/WebKit Message View/AIWebKitMessageViewController.h
--- a/Plugins/WebKit Message View/AIWebKitMessageViewController.h Fri Apr 01 03:01:24 2011 -0400
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.h Fri Apr 01 14:26:19 2011 +0200
@@ -50,6 +50,7 @@
//Focus tracking
BOOL nextMessageFocus;
+ BOOL nextMessageRegainedFocus;
}
/*!
diff -r 1022bf3c27e6 -r 67a59959597d Plugins/WebKit Message View/AIWebKitMessageViewController.m
--- a/Plugins/WebKit Message View/AIWebKitMessageViewController.m Fri Apr 01 03:01:24 2011 -0400
+++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.m Fri Apr 01 14:26:19 2011 +0200
@@ -132,6 +132,7 @@
* classed as such.
*/
nextMessageFocus = YES;
+ nextMessageRegainedFocus = YES;
//Observe preference changes.
[adium.preferenceController registerPreferenceObserver:self forGroup:PREF_GROUP_WEBKIT_REGULAR_MESSAGE_DISPLAY];
@@ -487,6 +488,7 @@
[previousContent release];
previousContent = nil;
nextMessageFocus = NO;
+ nextMessageRegainedFocus = NO;
[chat clearUnviewedContentCount];
}
@@ -708,6 +710,7 @@
[content addDisplayClass:@"firstFocus"];
nextMessageFocus = NO;
+ nextMessageRegainedFocus = YES;
}
// Add a class for "this content received while out of focus"
@@ -731,6 +734,11 @@
}
}
+ if (content.postProcessContent && adium.interfaceController.activeChat == content.chat && !nextMessageFocus && nextMessageRegainedFocus) {
+ nextMessageRegainedFocus = NO;
+ [content addDisplayClass:@"regainedFocus"];
+ }
+
//Add the content object
[self _appendContent:content
similar:similar
@@ -1514,6 +1522,7 @@
// The next message being inserted needs to add a mark.
nextMessageFocus = YES;
+ nextMessageRegainedFocus = NO;
DOMNodeList *nodeList = [webView.mainFrameDocument querySelectorAll:@".focus"];
DOMHTMLElement *node = nil; NSMutableArray *classes = nil;
@@ -1530,6 +1539,21 @@
[classes release];
}
+ // Also remove .regainedFocus. By definition this should _not_ have class .focus too, so make a new list
+ DOMNodeList *nodeListRegained = [webView.mainFrameDocument querySelectorAll:@".regainedFocus"];
+
+ for (unsigned i = 0; i < nodeListRegained.length; i++)
+ {
+ node = (DOMHTMLElement *)[nodeListRegained item:i];
+ classes = [[node.className componentsSeparatedByString:@" "] mutableCopy];
+
+ [classes removeObject:@"regainedFocus"];
+
+ node.className = [classes componentsJoinedByString:@" "];
+
+ [classes release];
+ }
+
}
- (void)addMark
More information about the commits
mailing list