components-chat-box.js 2.4 KB
Newer Older
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
"use strict";

var chats = [
  {
    text: 'Hi, dude!',
    position: 'left'
  },
  {
    text: 'Wat?',
    position: 'right'
  },
  {
    text: 'You wanna know?',
    position: 'left'
  },
  {
    text: 'Wat?!',
    position: 'right'
  },
  {
    typing: true,
    position: 'left'
  }
];
for(var i = 0; i < chats.length; i++) {
  var type = 'text';
  if(chats[i].typing != undefined) type = 'typing';
  $.chatCtrl('#mychatbox', {
    text: (chats[i].text != undefined ? chats[i].text : ''),
    picture: (chats[i].position == 'left' ? '../assets/img/avatar/avatar-1.png' : '../assets/img/avatar/avatar-2.png'),
    position: 'chat-'+chats[i].position,
    type: type
  });
}

$("#chat-form").submit(function() {
  var me = $(this);

  if(me.find('input').val().trim().length > 0) {
    $.chatCtrl('#mychatbox', {
      text: me.find('input').val(),
      picture: '../assets/img/avatar/avatar-2.png',
    });
    me.find('input').val('');
  }
  return false;
});

var chats = [
  {
    text: 'Wake up!',
    position: 'left'
  },
  {
    text: 'Yes, already',
    position: 'right'
  },
  {
    text: 'Grab a brush and put a little make-up',
    position: 'left'
  },
  {
    text: 'What do you mean?',
    position: 'right'
  },
  {
    text: 'Hide the scars to fade away the shake-up',
    position: 'left'
  },
  {
    text: 'WTF?!',
    position: 'right'
  },
  {
    text: 'Why\'d you leave the keys upon the table?',
    position: 'left'
  },
  {
    text: '-__________________-',
    position: 'right'
  },
  {
    text: 'Here you go create another fable',
    position: 'left'
  },
  {
    text: 'You wanted do!',
    position: 'right'
  },
  {
    text: 'FXCK!',
    position: 'right'
  },
  {
    text: '<i>You have blocked Ryan</i>',
    position: 'right'
  },
];
for(var i = 0; i < chats.length; i++) {
  var type = 'text';
  if(chats[i].typing != undefined) type = 'typing';
  $.chatCtrl('#mychatbox2', {
    text: (chats[i].text != undefined ? chats[i].text : ''),
    picture: (chats[i].position == 'left' ? '../assets/img/avatar/avatar-5.png' : '../assets/img/avatar/avatar-2.png'),
    position: 'chat-'+chats[i].position,
    type: type
  });
}
$("#chat-form2").submit(function() {
  var me = $(this);

  if(me.find('input').val().trim().length > 0) {
    $.chatCtrl('#mychatbox2', {
      text: me.find('input').val(),
      picture: '../assets/img/avatar/avatar-2.png',
    });
    me.find('input').val('');
  }
  return false;
});