"share"
];
var currentStep = null;
startup.start = function () {
if (! session) {
require(["session"], function (sessionModule) {
session = sessionModule;
startup.start();
});
return;
}
var index = -1;
if (currentStep) {
index = STEPS.indexOf(currentStep);
}
index++;
if (index >= STEPS.length) {
session.emit("startup-ready");
return;
}
currentStep = STEPS[index];
handlers[currentStep](startup.start);
};
var handlers = {
browserBroken: function (next) {
if (window.WebSocket) {
next();
return;
}
windowing.show("#togetherjs-browser-broken", {
onClose: function () {
session.close();
}
});
if ($.browser.msie) {
$("#togetherjs-browser-broken-is-ie").show();
}
},
browserUnsupported: function (next) {
if (! $.browser.msie) {
next();
return;
}
var cancel = true;
windowing.show("#togetherjs-browser-unsupported", {
onClose: function () {
if (cancel) {
session.close();
} else {
next();
}
}
});
$("#togetherjs-browser-unsupported-anyway").click(function () {
cancel = false;
});
},
sessionIntro: function (next) {
if ((! session.isClient) || ! session.firstRun) {
next();
return;
}
TogetherJS.config.close("suppressJoinConfirmation");
if (TogetherJS.config.get("suppressJoinConfirmation")) {
next();
return;
}
var cancelled = false;
windowing.show("#togetherjs-intro", {
onClose: function () {
if (! cancelled) {
next();
}
}
});
$("#togetherjs-intro .togetherjs-modal-dont-join").click(function () {
cancelled = true;
windowing.hide();
session.close("declined-join");
});
},
walkthrough: function (next) {
storage.settings.get("seenIntroDialog").then(function (seenIntroDialog) {
if (seenIntroDialog) {
next();
return;
}
require(["walkthrough"], function (walkthrough) {
walkthrough.start(true, function () {
storage.settings.set("seenIntroDialog", true);
next();
});
});
});
},
share: function (next) {
TogetherJS.config.close("suppressInvite");
if (session.isClient || (! session.firstRun) ||
TogetherJS.config.get("suppressInvite")) {
next();
return;
}
require(["windowing"], function (windowing) {
windowing.show("#togetherjs-share");