-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
executable file
·102 lines (82 loc) · 2.82 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// -- Succinct -------------------------------------------------------------------
var Succinct;
Succinct = {
coalesceMessages: function (line)
{
var previousLine = Succinct.getPreviousLine(line);
var previousSender = Succinct.getSenderNickname(previousLine);
var sender = Succinct.getSenderNickname(line);
if (sender === null || previousSender === null)
{
return;
}
if (sender === previousSender &&
Succinct.getLineType(line) === 'privmsg' &&
Succinct.getLineType(previousLine) === 'privmsg')
{
line.classList.add('coalesced');
Succinct.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 = Succinct.getSenderElement(line);
return ((sender) ? sender.dataset.nickname : null);
},
setWhoisTags: function(line, fromBuffer)
{
if (line.getAttribute('data-command') === '311' ||
line.getAttribute('data-command') === '378' ||
line.getAttribute('data-command') === '307' ||
line.getAttribute('data-command') === '319' ||
line.getAttribute('data-command') === '312' ||
line.getAttribute('data-command') === '671' ||
line.getAttribute('data-command') === '317' ||
line.getAttribute('data-command') === '301' ||
line.getAttribute('data-command') === '330')
{
line.classList.add('whois');
}
}
};
// -- 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);
// Succinct.handleBufferPlayback(lineNum, fromBuffer);
Succinct.coalesceMessages(element);
Succinct.setWhoisTags(element);
ConversationTracking.updateNicknameWithNewMessage(element);
}
Textual.nicknameSingleClicked = function(e)
{
ConversationTracking.nicknameSingleClickEventCallback(e);
}