From 07ef16f1bbeb4dec50ac1e92aeb413258b40450e Mon Sep 17 00:00:00 2001 From: "alexanders@b2ef00c0-3703-41da-baef-cfe82387ac0c" Date: Wed, 3 Feb 2010 11:24:30 +0000 Subject: fixed superdomain handling --HG-- extra : convert_revision : svn%3Ab2ef00c0-3703-41da-baef-cfe82387ac0c/trunk%4021 --- etherpad/src/etherpad/pro/pro_utils.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/etherpad/src/etherpad/pro/pro_utils.js b/etherpad/src/etherpad/pro/pro_utils.js index c539223..1dc2468 100644 --- a/etherpad/src/etherpad/pro/pro_utils.js +++ b/etherpad/src/etherpad/pro/pro_utils.js @@ -44,18 +44,16 @@ function getProRequestSubdomain() { return d.split('.')[0]; } -function getRequestSuperdomain() { - var parts = request.domain.split('.').reverse(); - parts.pop(); // Remove one level - while (parts.length > 0) { - var domain = parts.reverse().join('.'); - if (SUPERDOMAINS[domain]) { - return domain; - } - parts = parts.pop(); // Remove next level +function getRequestSuperdomain() { + var parts = request.domain.split('.'); + while (parts.length > 0) { + var domain = parts.join('.'); + if (SUPERDOMAINS[domain]) { + return domain; + } + parts.shift(); // Remove next level } - return "foo"; -} +} function isProDomainRequest() { // the result of this function never changes within the same request. -- cgit v1.2.3