summaryrefslogtreecommitdiff
path: root/static/js/src/_main.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/src/_main.js')
-rwxr-xr-xstatic/js/src/_main.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/static/js/src/_main.js b/static/js/src/_main.js
index d97b0ac..18592d5 100755
--- a/static/js/src/_main.js
+++ b/static/js/src/_main.js
@@ -3,6 +3,9 @@
window.RootDomain = location.href.match(/http:\/\/(\w)+\./)
? '/' : '/';
+if (typeof window.Nick === 'undefined') { window.Nick = null; }
+if (typeof window.Domain === 'undefined') { window.Domain = ''; }
+
window.cache = {};
window.PendingMessages = {};
window.MessageContentCache = {};
@@ -29,9 +32,17 @@ window.Anim = {
"logThumbBig": {"width": "64px", "height": "64px", "marginRight": "-2px", "marginTop": "-2px"}
}
+function getCookieDomain() {
+ if (!location || !location.hostname) { return null; }
+ var hostname = location.hostname;
+ if (hostname == 'localhost' || hostname.match(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/)) { return null; }
+ var parts = hostname.split(".");
+ if (parts.length < 2) { return null; }
+ return "." + parts.slice(-2).join(".");
+}
window.Preferences = {
- "Domain": '.dump.fm',
+ "Domain": getCookieDomain(),
"getProperty": function(prop, defaultValue) {
var value = $.cookie(prop);
@@ -46,4 +57,3 @@ window.Preferences = {
$.cookie(prop, null, { domain: Preferences.Domain, path: '/' });
}
};
-