Sha256: 9e20bfc07935512c5dd0260e32d616839e27ac9f030bb28f8e80c6bd6aa32968
Contents?: true
Size: 1.33 KB
Versions: 7
Compression:
Stored size: 1.33 KB
Contents
Campfire.NagiosExpander = Class.create({ initialize: function(chat) { this.chat = chat; var messages = this.chat.transcript.messages; for (var i = 0; i < messages.length; i++) { this.detectNagios(messages[i]); } }, detectNagios: function(message) { if (!message.pending() && message.kind === 'text') { var body = message.bodyElement() var author = message.author(); var email = message.authorElement().getAttribute('data-email'); if (body.innerText.match(/^Nagios : /) || (email && email.match(/nagios/i))) { if (body.innerText.match(/PROBLEM/)) { message.bodyCell.setStyle({ color: "#ef2929" }) } else if (body.innerText.match(/WARNING/)) { message.bodyCell.setStyle({ color: "#fce94f" }) } else if (body.innerText.match(/RECOVERY/)) { message.bodyCell.setStyle({ color: "#4e9a06" }) } } } }, onMessagesInsertedBeforeDisplay: function(messages) { for (var i = 0; i < messages.length; i++) { this.detectNagios(messages[i]); } }, onMessageAccepted: function(message, messageID) { this.detectNagios(message); } }); Campfire.Responders.push("NagiosExpander"); window.chat.installPropaneResponder("NagiosExpander", "nagiosexpander");
Version data entries
7 entries across 7 versions & 1 rubygems