mirror of
https://github.com/Codeux-Software/Textual.git
synced 2026-06-16 13:24:32 +00:00
Core JavaScript improvements
Almost the entire core.js file has been rewritten to provide greater documentation. app.channelIsJoined() has been deprecated in favor of app.channelIsActive(). app.channelIsActive() will return a value for a regular channel or private message, so it makes more sense to use "active" over "joined" Why don't I add app.privateMessageIsActive() instead? Because app.channelIsActive() can kill two birds with one stone. app.channelMemberCount() now throws a JavaScript exception when used outside a channel.
This commit is contained in:
@@ -83,23 +83,25 @@ ConversationTracking.updateNicknameWithNewMessage = function(lineElement)
|
||||
var elementType = lineElement.dataset.lineType;
|
||||
|
||||
/* We only want to target plain text messages */
|
||||
if (elementType === "privmsg" ||
|
||||
elementType === "action" ||
|
||||
elementType === "notice")
|
||||
if (elementType !== "privmsg" &&
|
||||
elementType !== "action" &&
|
||||
elementType !== "notice")
|
||||
{
|
||||
var senderElement = lineElement.querySelector(".sender");
|
||||
return;
|
||||
}
|
||||
|
||||
if (senderElement) {
|
||||
/* Is this a tracked nickname? */
|
||||
var nickname = senderElement.dataset.nickname;
|
||||
var senderElement = lineElement.querySelector(".sender");
|
||||
|
||||
if (ConversationTracking.isNicknameTracked(nickname) === false) {
|
||||
return;
|
||||
}
|
||||
if (senderElement) {
|
||||
/* Is this a tracked nickname? */
|
||||
var nickname = senderElement.dataset.nickname;
|
||||
|
||||
/* Toggle status on for new message */
|
||||
ConversationTracking.toggleSelectionStatusForSenderElement(senderElement);
|
||||
if (ConversationTracking.isNicknameTracked(nickname) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Toggle status on for new message */
|
||||
ConversationTracking.toggleSelectionStatusForSenderElement(senderElement);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ _Textual.viewBodyDidLoad = function() /* PRIVATE */
|
||||
small delay between the view being created and the background process laying out
|
||||
its contents. To work around this, Textual presents an overlay view that matches
|
||||
the background color of the style. We then request an animation frame that calls
|
||||
app.finishedLayingOutView), instructing Textual that it can destroy the overlay view. */
|
||||
app.finishedLayingOutView, instructing Textual that it can destroy the overlay view. */
|
||||
|
||||
if (app.isWebKit2()) {
|
||||
_Textual._viewBodyDidLoadAnimationFrame =
|
||||
@@ -132,11 +132,7 @@ _Textual.viewFinishedLoading = function(configuration) /* PRIVATE */
|
||||
if (isVisible) {
|
||||
_Textual.notifyDidBecomeVisible();
|
||||
|
||||
if (isSelected) {
|
||||
_Textual.notifySelectionChanged(true);
|
||||
} else {
|
||||
_Textual.notifySelectionChanged(false);
|
||||
}
|
||||
_Textual.notifySelectionChanged(isSelected);
|
||||
} else {
|
||||
_Textual.notifyDidBecomeHidden();
|
||||
}
|
||||
|
||||
@@ -370,19 +370,26 @@ app.serverIsConnected = function(callbackFunction)
|
||||
}
|
||||
};
|
||||
|
||||
app.channelIsJoined = function(callbackFunction)
|
||||
app.channelIsActive = function(callbackFunction)
|
||||
{
|
||||
var promiseIndex = appInternal.makePromise(callbackFunction);
|
||||
|
||||
var dataValue = {"promiseIndex" : promiseIndex};
|
||||
|
||||
if (app.isWebKit2()) {
|
||||
window.webkit.messageHandlers.channelIsJoined.postMessage(dataValue);
|
||||
window.webkit.messageHandlers.channelIsActive.postMessage(dataValue);
|
||||
} else {
|
||||
TextualScriptSink.channelIsJoined(dataValue);
|
||||
TextualScriptSink.channelIsActive(dataValue);
|
||||
}
|
||||
};
|
||||
|
||||
app.channelIsJoined = function(callbackFunction)
|
||||
{
|
||||
console.warn("app.channelIsJoined() is deprecated. Use app.channelIsActive() instead.");
|
||||
|
||||
app.channelIsActive(callbackFunction);
|
||||
};
|
||||
|
||||
app.channelName = function(callbackFunction)
|
||||
{
|
||||
var promiseIndex = appInternal.makePromise(callbackFunction);
|
||||
|
||||
Reference in New Issue
Block a user