getModifier: function() {
let self = this;
return (function (aNode) {
let result = 0;
let exp = self._getRegExp();
let match;
// loop to handle channels
while ((match = exp.exec(aNode.data.toLowerCase()))) {
let channelNode = aNode.splitText(match.index);
aNode = channelNode.splitText(exp.lastIndex - match.index);
// at this point, channelNode is a text node with only the text
// of the nick and aNode is a text node with the text after
// the nick. The text in aNode hasn't been processed yet.
let channel = channelNode.data;
let elt = aNode.ownerDocument.createElement("div");
elt.setAttribute("style", "color: green; text-decoration: underline; cursor: pointer;");
elt.setAttribute("class", "channelNode");
channelNode.parentNode.replaceChild(elt, channelNode);
elt.textContent = channel;
result += 2;
exp.lastIndex = 0;
}
return result;
});
}
Mibbit.com Pasted on 2012-05-17 08:27:25