Sha256: 5e8df8a514a9049de8456979c61044038334c049f1249bb891e42bf46fd434a1

Contents?: true

Size: 878 Bytes

Versions: 5

Compression:

Stored size: 878 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';
    }
  },

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jschat-0.3.5 lib/jschat/http/public/javascripts/app/helpers/page_helper.js
jschat-0.3.3 lib/jschat/http/public/javascripts/app/helpers/page_helper.js
jschat-0.3.2 lib/jschat/http/public/javascripts/app/helpers/page_helper.js
jschat-0.3.1 lib/jschat/http/public/javascripts/app/helpers/page_helper.js
jschat-0.3.0 lib/jschat/http/public/javascripts/app/helpers/page_helper.js