Merge pull request #1 from shackbarth/keith1
[xtuple] / enyo-client / application / source / preliminaries.js
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 */
5
6 XT = typeof XT !== 'undefined' ? XT : {};
7
8 (function () {
9
10   XT.getBaseUrl = function () {
11     return location.protocol + "//" + location.hostname + (location.port && ":" + location.port);
12   };
13
14   XT.getOrganizationPath = function () {
15     return "/" + window.location.pathname.split("/")[1];
16   };
17
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;
24     }
25     window.location = XT.getOrganizationPath() + "/logout";
26   };
27
28   XT.setVersion = function (version, qualifier) {
29     XT.log("XT.setVersion is now deprecated. The app now reads extension versions from " +
30       "package.json or manifest.js (" + qualifier + ")");
31   };
32
33 }());