Sha256: 550913cc0ec0985edbdd0a04bd435d3c98a8779c31b4c5d31194a457881c76e1

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

Campfire.CommitExpander = Class.create({
  initialize: function(chat) {
    this.chat = chat;
    var messages = this.chat.transcript.messages;
    for (var i = 0; i < messages.length; i++) {
      this.detectCommit(messages[i]);
    }
  },

  detectCommit: function(message) {
    if (!message.pending() && message.kind === 'text') {
      var body = message.bodyElement()
      if (body.innerText.match(/^\[[\w-\.]+(\/|\])/) || body.innerText.match(/(is deploying|deployment of)/)) {
        message.bodyCell.setStyle({
          color: '#888888'
        })
      }
      else if (body.innerText.match(/^\w+'s deploy of (.*) failed$/)) {
        message.bodyCell.setStyle({
          color: '#ff0000',
          fontWeight: 'bold'
        })
      }
    }
  },

  onMessagesInsertedBeforeDisplay: function(messages) {
    for (var i = 0; i < messages.length; i++) {
      this.detectCommit(messages[i]);
    }
  }
});

Campfire.Responders.push("CommitExpander");
window.chat.installPropaneResponder("CommitExpander", "commitexpander");

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
caveat_patch_kids-0.0.8 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js
caveat_patch_kids-0.0.7 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js
caveat_patch_kids-0.0.5 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js
caveat_patch_kids-0.0.4 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js
caveat_patch_kids-0.0.3 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js
caveat_patch_kids-0.0.2 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js
caveat_patch_kids-0.0.1 scripts/caveat_patch_kids/unsupported/stylize_commits_and_deploys.js