From 2d9f2ebf81c0de164948c372e26e8bba286c7bb9 Mon Sep 17 00:00:00 2001
From: Stephen Birarda <commit@birarda.com>
Date: Wed, 14 Feb 2018 13:50:46 -0800
Subject: [PATCH] fix active with anchor and settings dropdowns on non-settings
 pages

---
 domain-server/resources/web/base-settings-scripts.html | 1 -
 domain-server/resources/web/footer.html                | 1 +
 domain-server/resources/web/js/domain-server.js        | 6 +++---
 domain-server/resources/web/settings/js/settings.js    | 1 -
 domain-server/resources/web/wizard/index.shtml         | 1 -
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/domain-server/resources/web/base-settings-scripts.html b/domain-server/resources/web/base-settings-scripts.html
index fe370c4675..877b0a6125 100644
--- a/domain-server/resources/web/base-settings-scripts.html
+++ b/domain-server/resources/web/base-settings-scripts.html
@@ -3,5 +3,4 @@
 <script src='/js/bootbox.min.js'></script>
 <script src='/js/form2js.min.js'></script>
 <script src='/js/bootstrap-switch.min.js'></script>
-<script src='/js/shared.js'></script>
 <script src='/js/base-settings.js'></script>
diff --git a/domain-server/resources/web/footer.html b/domain-server/resources/web/footer.html
index e8ea392b49..49e883509e 100644
--- a/domain-server/resources/web/footer.html
+++ b/domain-server/resources/web/footer.html
@@ -1,4 +1,5 @@
 </div>
 <script src='/js/jquery-2.1.4.min.js'></script>
 <script src='/js/bootstrap.min.js'></script>
+<script src='/js/shared.js'></script>
 <script src='/js/domain-server.js'></script>
diff --git a/domain-server/resources/web/js/domain-server.js b/domain-server/resources/web/js/domain-server.js
index 184b2b954f..6b2d4e1316 100644
--- a/domain-server/resources/web/js/domain-server.js
+++ b/domain-server/resources/web/js/domain-server.js
@@ -28,7 +28,7 @@ function settingsGroupAnchor(base, html_id) {
 }
 
 $(document).ready(function(){
-  var url = window.location;
+  var url = location.protocol + '//' + location.host+location.pathname;
 
   // Will only work if string in href matches with location
   $('ul.nav a[href="'+ url +'"]').parent().addClass('active');
@@ -55,7 +55,7 @@ $(document).ready(function(){
   var $contentDropdown = $('#content-settings-nav-dropdown');
   var $settingsDropdown = $('#domain-settings-nav-dropdown');
 
-   // define extra groups to add to setting panels, with their splice index
+  // define extra groups to add to setting panels, with their splice index
   Settings.extraContentGroupsAtIndex = {
     0: {
       html_id: Settings.CONTENT_ARCHIVES_PANEL_ID,
@@ -99,7 +99,7 @@ $(document).ready(function(){
       }
 
       for (var endIndex in Settings.extraContentGroupsAtEnd) {
-        data.content_settings.push(Settings.extraContentGroupsAtIndex[spliceIndex]);
+        data.content_settings.push(Settings.extraContentGroupsAtEnd[endIndex]);
       }
 
       $.each(data.content_settings, function(index, group){
diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js
index d4de0d5f4c..1c6510298f 100644
--- a/domain-server/resources/web/settings/js/settings.js
+++ b/domain-server/resources/web/settings/js/settings.js
@@ -17,7 +17,6 @@ $(document).ready(function(){
   Settings.extraGroupsAtEnd = Settings.extraDomainGroupsAtEnd;
   Settings.extraGroupsAtIndex = Settings.extraDomainGroupsAtIndex;
 
-
   Settings.afterReloadActions = function() {
     // append the domain selection modal
     appendDomainIDButtons();
diff --git a/domain-server/resources/web/wizard/index.shtml b/domain-server/resources/web/wizard/index.shtml
index b526a5719b..5a3286296d 100644
--- a/domain-server/resources/web/wizard/index.shtml
+++ b/domain-server/resources/web/wizard/index.shtml
@@ -261,6 +261,5 @@
 <script src='/js/underscore-min.js'></script>
 <script src='/js/bootbox.min.js'></script>
 <script src='/js/sha256.js'></script>
-<script src='/js/shared.js'></script>
 <script src='js/wizard.js'></script>
 <!--#include virtual="page-end.html"-->