-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
executable file
·86 lines (64 loc) · 1.83 KB
/
scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -- Sulaco -------------------------------------------------------------------
var Sulaco;
Sulaco = {
coalesceMessages: function (line)
{
var previousLine = Sulaco.getPreviousLine(line);
var previousSender = Sulaco.getSenderNickname(previousLine);
var sender = Sulaco.getSenderNickname(line);
if (sender === null || previousSender === null) {
return;
}
if (sender === previousSender &&
Sulaco.getLineType(line) === 'privmsg' &&
Sulaco.getLineType(previousLine) === 'privmsg')
{
line.classList.add('coalesced');
Sulaco.getSenderElement(line).innerHTML = '';
}
},
getPreviousLine: function (line)
{
var previousLine = line.previousElementSibling;
if (previousLine &&
previousLine.classList &&
previousLine.classList.contains('line'))
{
return previousLine;
}
return null;
},
getLineType: function (line)
{
return ((line) ? line.dataset.lineType : null);
},
getMessage: function (line)
{
return ((line) ? line.querySelector('.message').textContent.trim() : null);
},
getSenderElement: function (line)
{
return ((line) ? line.querySelector('.sender') : null);
},
getSenderNickname: function (line)
{
var sender = Sulaco.getSenderElement(line);
return ((sender) ? sender.dataset.nickname : null);
}
};
// -- Textual ------------------------------------------------------------------
/* Defined in: "Textual.app -> Contents -> Resources -> JavaScript -> API -> core.js" */
Textual.viewBodyDidLoad = function()
{
Textual.fadeOutLoadingScreen(1.00, 0.90);
}
Textual.messageAddedToView = function(line, fromBuffer)
{
var element = document.getElementById("line-" + line);
Sulaco.coalesceMessages(element);
ConversationTracking.updateNicknameWithNewMessage(element);
}
Textual.nicknameSingleClicked = function(e)
{
ConversationTracking.nicknameSingleClickEventCallback(e);
}