Skip to content

Commit

Permalink
Merge pull request #390 from PureKrome/DynamicTips
Browse files Browse the repository at this point in the history
- Added rotating tips. 5 tips that cycle every 60 seconds with fadeout/fadein
  • Loading branch information
davidfowl committed Feb 27, 2012
2 parents 2904ea0 + 9a5fd51 commit f90bc2f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions JabbR/Chat.ui.js
Expand Up @@ -654,6 +654,32 @@
room.roomTopic.html(topicHtml);
}

// Rotating Tips.
var messages = [
'Type @ then press TAB to auto-complete nicknames',
'Type /help to see the list of commands',
'Type /rooms to list all available rooms',
'Type : then press TAB to auto-complete emoji icons',
'You can create your own private rooms. Type /help for more info'
];

var cycleTimeInMilliseconds = 60 * 1000; // 1 minute.
var messageIndex = 0;

function cycleMessages() {
setTimeout(function () {
messageIndex++;
if (messageIndex >= messages.length) {
messageIndex = 0;
}
$('#message-instruction').fadeOut(2000, function () {
$('#message-instruction').html(messages[messageIndex]);
});

$('#message-instruction').fadeIn(2000, cycleMessages);
}, cycleTimeInMilliseconds);
};

var ui = {

//lets store any events to be triggered as constants here to aid intellisense and avoid
Expand Down Expand Up @@ -937,6 +963,9 @@

// Initilize liveUpdate plugin for room search
ui.$roomFilter = $roomFilterInput.liveUpdate('#userlist-lobby', true);

// Start cycling the messages once the document has finished loading.
cycleMessages();
},
run: function () {
$.history.init(function (hash) {
Expand Down

0 comments on commit f90bc2f

Please sign in to comment.