-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathircify.js
More file actions
35 lines (34 loc) · 931 Bytes
/
ircify.js
File metadata and controls
35 lines (34 loc) · 931 Bytes
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
/*global jQuery, $ */
function reverse(list) {
"use strict";
var x = [], i;
for (i = list.length - 1; i >= 0; i -= 1) {
x.push(list[i]);
}
return x;
}
reverse(jQuery(".chatmsg fieldset").map(function () {
"use strict";
var timestamp = jQuery("span.timestamp", this)[0],
base = "[" + timestamp.innerHTML + "] <" + $("legend a", this)[0].innerHTML + "> ",
flag = false,
j;
for (j = 0; j < this.childNodes.length; j += 1) {
if (this.childNodes[j] === timestamp) {
flag = j;
}
}
var kid;
for (j = flag + 1; j < this.childNodes.length; j += 1) {
kid = this.childNodes[j];
switch(kid.nodeName) {
case "#text":
base += kid.nodeValue;
break;
default:
base += kid.innerHTML;
break;
}
}
return base;
})).join("~~~~")