1 /*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
2 latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
3 trailing:true, white:true*/
4 /*global XT:true, enyo:true, window:true, location: true */
6 XT = typeof XT !== 'undefined' ? XT : {};
10 XT.getBaseUrl = function () {
11 return location.protocol + "//" + location.hostname + (location.port && ":" + location.port);
14 XT.getOrganizationPath = function () {
15 return "/" + window.location.pathname.split("/")[1];
18 XT.logout = function () {
19 if (window.onbeforeunload) {
20 // if we've set up a "are you sure you want to leave?" warning, disable that
21 // here. Presumably we've already asked if they want to leave.
22 // delete window.onbeforeunload; // doesn't work
23 window.onbeforeunload = undefined;
25 window.location = XT.getOrganizationPath() + "/logout";
28 XT.setVersion = function (version, qualifier) {
29 // default to the core version
30 version = version || XT.session.config.version;
32 var aboutVersionLabel = XT.app.$.postbooks.$.navigator.$.aboutVersion,
33 versionText = "_version".loc() + " " + version;
36 versionText = ("_" + qualifier).loc() + " " + versionText;
38 if (aboutVersionLabel.getContent()) {
39 versionText = aboutVersionLabel.getContent() + "<br>" + versionText;
42 aboutVersionLabel.setContent(versionText);