Sha256: 4909d793f61e0551257937b8c2fd1b5dc9e943de0d1285bf4873fadcb73bc7b3

Contents?: true

Size: 944 Bytes

Versions: 2

Compression:

Stored size: 944 Bytes

Contents

var PageHelper = {
  currentRoom: function() {
    return window.location.hash;
  },

  setCurrentRoomName: function(roomName) {
    window.location.hash = roomName;
    $('room-name').innerHTML = TextHelper.truncateRoomName(PageHelper.currentRoom());
    $('room-name').title = PageHelper.currentRoom();
    document.title = PageHelper.title();    
  },

  allRoomNames: function() {
    return $$('#rooms li a').collect(function(link) {
      return link.innerHTML;
    });
  },

  nickname: function() {
    return JsChat.user.name;
  },

  title: function() {
    if (PageHelper.currentRoom()) {
      return 'JsChat: ' + PageHelper.currentRoom();
    } else {
      return 'JsChat';
    }
  },

  device: function() {
    if ($$('body.iphone').length > 0) {
      return 'iphone';
    } else if ($$('body.ipad').length > 0) {
      return 'ipad';
    }
  },

  isDevice: function(device) {
    return PageHelper.device() == device;
  }
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jschat-0.3.7 lib/jschat/http/public/javascripts/app/helpers/page_helper.js
jschat-0.3.6 lib/jschat/http/public/javascripts/app/helpers/page_helper.js