2013-02-13 22:04:35 +01:00
var tutorial = ( function ( ) {
var exports = { } ;
2013-06-20 18:06:31 +02:00
var is _running = false ;
2013-02-13 22:15:13 +01:00
2013-06-27 22:18:03 +02:00
// We'll temporarily set stream colors for the streams we use in the demo
// tutorial messages.
var real _stream _info ;
var tutorial _stream _info = { "design" : { "color" : "#76ce90" } ,
"social" : { "color" : "#fae589" } ,
"devel" : { "color" : "#a6c7e5" } } ;
// Each message object contains the minimal information necessary for it to be
// processed by our system for adding messages to your feed.
var fake _messages = [
{
id : 1 ,
content : "<p>We're working on some new screenshots for our landing page, and I'll show you what I have shortly.</p>" ,
is _stream : true ,
sender _full _name : "Waseem Daher" ,
avatar _url : "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a" ,
display _recipient : "design" ,
stream : "design" ,
subject : "screenshots" ,
timestr : "12:11" ,
type : "stream"
} ,
{
id : 2 ,
content : "<p>Hey, if I work on Windows, can you two make one for Mac and Linux?</p>" ,
is _stream : false ,
sender _full _name : "Waseem Daher" ,
avatar _url : "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a" ,
display _reply _to : "Jeff Arnold, Waseem Daher" ,
reply _to : true ,
timestr : "12:12" ,
type : "private"
} ,
{
id : 3 ,
content : "<p>Sure, no problem <img alt=':+1:' class='emoji' src='static/third/gemoji/images/emoji/+1.png' title=':+1:'></p>" ,
is _stream : false ,
sender _full _name : "Jessica McKellar" ,
avatar _url : "https://secure.gravatar.com/avatar/c89814a8ed5814421b617cf2242ff01a" ,
display _reply _to : "Jeff Arnold, Waseem Daher" ,
reply _to : true ,
timestr : "12:12" ,
type : "private"
} ,
{
id : 4 ,
content : "<p>Ok, here's my <a href='https://humbughq.com/static/images/app-screenshots/humbug-chrome-windows.png' target='_blank' title='https://humbughq.com/static/images/app-screenshots/humbug-chrome-windows.png'>latest version</a><div class='message_inline_image'><a href='https://humbughq.com/static/images/app-screenshots/humbug-chrome-windows.png' target='_blank' title='https://humbughq.com/static/images/app-screenshots/humbug-chrome-windows.png'><img src='https://humbughq.com/static/images/app-screenshots/humbug-chrome-windows.png'></a></div> for the Windows app -- thoughts? I'm particularly wondering whether people think the screenshot should be from Windows 7 or some other version.</p>" ,
is _stream : true ,
sender _full _name : "Waseem Daher" ,
avatar _url : "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a" ,
display _recipient : "design" ,
stream : "design" ,
subject : "screenshots" ,
timestr : "12:15" ,
type : "stream"
} ,
{
id : 5 ,
content : "<p>Looks good to me!</p>" ,
is _stream : true ,
sender _full _name : "Jeff Arnold" ,
avatar _url : "https://secure.gravatar.com/avatar/0e0080b53f71bb975c311a123acd8a48" ,
display _recipient : "design" ,
stream : "design" ,
subject : "screenshots" ,
timestr : "12:15" ,
type : "stream"
} ,
{
id : 6 ,
content : "<p>@<strong>all</strong> Any interest in lunch? I'd go for:</p>" +
"<ul>" +
"<li><img alt=':pizza:' class='emoji' src='static/third/gemoji/images/emoji/pizza.png' title=':pizza:'> (Hi-fi)</li>" +
"<li><img alt=':hamburger:' class='emoji' src='static/third/gemoji/images/emoji/hamburger.png' title=':hamburger:'> (Four Burgers)</li>" +
"<li><img alt=':sushi:' class='emoji' src='static/third/gemoji/images/emoji/sushi.png' title=':sushi:'> (Thelonious)</li>" +
"</ul></p>" ,
is _stream : true ,
sender _full _name : "Tim Abbott" ,
avatar _url : "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a" ,
display _recipient : "social" ,
stream : "social" ,
subject : "lunch" ,
timestr : "12:20" ,
type : "stream"
} ,
{
id : 7 ,
content : "<p>I'd go to Hi-fi</p>" ,
is _stream : true ,
sender _full _name : "Luke Faraone" ,
avatar _url : "https://secure.gravatar.com/avatar/948fcdfa93dd8986106032f1bad7f2c8" ,
display _recipient : "social" ,
stream : "social" ,
subject : "lunch" ,
timestr : "12:20" ,
type : "stream"
} ,
{
id : 8 ,
content : "<p>Reminder: engineering meeting in 1 hour.</p>" ,
is _stream : true ,
sender _full _name : "Jessica McKellar" ,
avatar _url : "https://secure.gravatar.com/avatar/c89814a8ed5814421b617cf2242ff01a" ,
display _recipient : "devel" ,
stream : "devel" ,
subject : "meeting" ,
timestr : "12:34" ,
type : "stream"
}
] ;
2013-04-12 21:33:00 +02:00
function set _tutorial _status ( status , callback ) {
2013-04-15 01:03:01 +02:00
return $ . ajax ( {
2013-06-20 18:06:31 +02:00
type : 'POST' ,
url : '/json/tutorial_status' ,
data : { status : status } ,
success : callback
2013-04-12 21:33:00 +02:00
} ) ;
}
2013-06-20 18:06:31 +02:00
exports . is _running = function ( ) {
return is _running ;
2013-02-13 22:15:13 +01:00
} ;
2013-06-20 18:06:31 +02:00
exports . start = function ( ) {
2013-06-27 22:18:03 +02:00
// If you somehow have messages, temporarily remove them from the visible
// feed.
current _msg _list . clear ( ) ;
// Set temporarly colors for the streams used in the tutorial.
real _stream _info = subs . stream _info ( ) ;
subs . stream _info ( tutorial _stream _info ) ;
// Add the fake messages to the feed and get started.
current _msg _list . add _and _rerender ( fake _messages ) ;
2013-06-20 18:06:31 +02:00
is _running = true ;
set _tutorial _status ( "started" ) ;
2013-02-13 22:15:13 +01:00
} ;
exports . initialize = function ( ) {
2013-03-25 23:26:14 +01:00
if ( page _params . needs _tutorial ) {
2013-03-07 21:14:44 +01:00
exports . start ( ) ;
2013-02-13 22:15:13 +01:00
}
} ;
2013-02-13 22:04:35 +01:00
return exports ;
} ( ) ) ;