Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 22nd, 2012  |  syntax: Diff  |  size: 1.97 KB  |  hits: 62  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/public/js/script.js b/public/js/script.js
  2. index b9d81b6..4121e4e 100644
  3. --- a/public/js/script.js
  4. +++ b/public/js/script.js
  5. @@ -170,10 +170,7 @@ $(document).ready(function() {
  6.         nameStyle = 'style="display: none"';
  7.      }
  8.      $.each(clients, function(index, client) {
  9. -      var picture = client.picture ? client.picture : DEFAULT_PICTURE;
  10. -      var idle = client.idle ? 'idle' : '';
  11. -      var idleSince = client.idle ? '<span class="idleSince" idleSince="' + (new Date().getTime() - client.idleFor) + '"></span>' : '';
  12. -      $(buddylist).append('<li><img class="profilepic ' + idle + ' middle" title="' +client.name + '" src="' + picture + '"/><span class="profilename ' + idle + '" ' + nameStyle + '>' + client.name + '</span>' + idleSince + '</li>');
  13. +      addClient(client, buddylist, nameStyle);
  14.      });
  15.  
  16.      $('#clients-count').html(clients.length);
  17. diff --git a/views/index.jade b/views/index.jade
  18. index 3174218..f118ff3 100644
  19. --- a/views/index.jade
  20. +++ b/views/index.jade
  21. @@ -14,6 +14,7 @@ block append scripts
  22.    script(src='/public/js/script.js')
  23.    script(src='http://www.google.com/jsapi')
  24.    script(src='/public/js/google_calendar.js')
  25. +  script(src='/public/js/helpers.js')
  26.  
  27.  block header
  28.    #header.row-fluid
  29.  
  30.  
  31.  
  32. addPorfilePic = function(client) {
  33.   var picture = client.picture ? client.picture : DEFAULT_PICTURE;
  34.   var idle = client.idle ? 'idle' : '';
  35.   return '<img class="profilepic ' + idle + ' middle" title="' +client.name + '" src="' + picture + '"/>'
  36. }
  37.  
  38. addProfileName = function(client, nameStyle) {
  39.   var idleSince = client.idle ? '<span class="idleSince" idleSince="' + (new Date().getTime() - client.idleFor) + '"></span>' : '';
  40.   return '<span class="profilename ' + idle + '" ' + nameStyle + '>' + client.name + '</span>' + idleSince
  41. }
  42.  
  43. addClient = function(client, buddylist, nameStyle) {
  44.   clientLi = $("<li>").html(addPorfilePic(client) + addProfileName(client, nameStyle));
  45.   $(buddylist).html(clientLi);
  46. }