-function setupIconBar() {
- if (!document.getElementById("switch")) {
- return;
- }
- _switchToRoomList = getTextContent(document.getElementById("rmlist_template"));
- _switchToMenu = getTextContent(document.getElementById("mnlist_template"));
- var switchSpan = document.getElementById("switch").firstChild;
- if (switchSpan != null) {
- setTextContent(switchSpan, _switchToRoomList);
- $(switchSpan).observe('click', changeIconBarEvent);
- var currentView = ctdlLocalPrefs.readPref("iconbar_view");
- if (currentView != null) {
- switchSpan.ctdlSwitchIconBarTo = currentView;
- changeIconBar(switchSpan);
- } else {
- switchSpan.ctdlSwitchIconBarTo = "rooms";
- }
- }
- var online_users = document.getElementById("online_users");
- if (online_users.offsetParent != null && online_users.offsetTop > 0) {
- new Ajax.PeriodicalUpdater('online_users', 'do_template?template=who_iconbar', {method: 'get', frequency: 30});
- }
-}
-function changeIconBarEvent(event) {
- changeIconBar(event.target);
-}
-function changeIconBar(target) {
- var switchTo = target.ctdlSwitchIconBarTo;
- WCLog("Changing to: " + switchTo);
- ctdlLocalPrefs.setPref("iconbar_view", target.ctdlSwitchIconBarTo);
- if (switchTo == "rooms") {
- switch_to_room_list();
- setTextContent(target, _switchToMenu);
- target.ctdlSwitchIconBarTo = "menu";
- } else {
- switch_to_menu_buttons();
- setTextContent(target, _switchToRoomList);
- target.ctdlSwitchIconBarTo = "rooms";
- }
-}
-function switch_to_room_list() {
- var roomlist = document.getElementById("roomlist");
- var summary = document.getElementById("iconbar_menu");
- if (!rooms || !floors || !roomlist) {
- FillRooms(IconBarRoomList);
- }
- roomlist.className = roomlist.className.replace("hidden","");
- summary.className += " hidden";