Sha256: f6e16bab9efe0ba303c7e89fb2d695c09f386e5c901c12352dae8e4504190459

Contents?: true

Size: 917 Bytes

Versions: 11

Compression:

Stored size: 917 Bytes

Contents

var SlackRubyBotServer = {};

$(document).ready(function() {

  SlackRubyBotServer.message = function(text) {
    $('#messages').fadeOut('slow', function() {
      $('#messages').fadeIn('slow').html(text)
    });
  };

  SlackRubyBotServer.error = function(xhr) {
    try {
      var message;
      if (xhr.responseText) {
        var rc = JSON.parse(xhr.responseText);
        if (rc && rc.message) {
          message = rc.message;
          if (message == 'invalid_code') {
            message = 'The code returned from the OAuth workflow was invalid.'
          } else if (message == 'code_already_used') {
            message = 'The code returned from the OAuth workflow has already been used.'
          }
        }
      }

      SlackRubyBotServer.message(message || xhr.statusText || xhr.responseText || 'Unexpected Error');

    } catch(err) {
      SlackRubyBotServer.message(err.message);
    }
  };

});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
slack-ruby-bot-server-2.1.1 public/scripts/messages.js
slack-ruby-bot-server-2.1.0 public/scripts/messages.js
slack-ruby-bot-server-2.0.1 public/scripts/messages.js
slack-ruby-bot-server-1.2.1 public/scripts/messages.js
slack-ruby-bot-server-1.2.0 public/scripts/messages.js
slack-ruby-bot-server-1.1.0 public/scripts/messages.js
slack-ruby-bot-server-1.0.0 public/scripts/messages.js
slack-ruby-bot-server-0.12.3 public/scripts/messages.js
slack-ruby-bot-server-0.12.2 public/scripts/messages.js
slack-ruby-bot-server-0.12.1 public/scripts/messages.js
slack-ruby-bot-server-0.12.0 public/scripts/messages.js