106895cbff17848866e9b5cfeefb0ce1985203a1
tdreszer
  Wed Oct 5 16:52:11 2011 -0700
More tightening of screws.  Several special cases solved. Altererd which right-click menu items for cfg appear and regularized this with subCfg availability.
diff --git src/hg/js/subCfg.js src/hg/js/subCfg.js
index 02a62e6..9c2241c 100644
--- src/hg/js/subCfg.js
+++ src/hg/js/subCfg.js
@@ -513,53 +513,35 @@
                 });
             }
             if (count > 1) // if hasChanged() is working, there should never be more than one
                 warn('DEBUG: Both composite and view are seen as updated!  Named update is not working.');
         }
     },
 
     currentCfg: undefined, // keep track of cfg while ajaxing, man
     currentSub: undefined, // keep track of subtrack while ajaxing, dude
 
     cfgFill: function (content, status)
     { // Finishes the population of a subtrack cfg.  Called by ajax return.
         var cfg = subCfg.currentCfg;
         subCfg.currentCfg = undefined;
         var cleanHtml = content;
-        var shlurpPattern=/\<script type=\'text\/javascript\' SRC\=\'.*\'\>\<\/script\>/gi;
-        // DEBUG -------------
-            var jsFiles = cleanHtml.match(shlurpPattern);
-            if (jsFiles && jsFiles.length > 0)
-                alert("jsFiles:'"+jsFiles+"'\n---------------\n"+cleanHtml); // warn() interprets html, etc.
-        // DEBUG -------------
-        cleanHtml = cleanHtml.replace(shlurpPattern,"");
-        shlurpPattern=/\<script type=\'text\/javascript\'>.*\<\/script\>/gi;
-        // DEBUG -------------
-            var jsEmbeded = cleanHtml.match(shlurpPattern);
-            if (jsEmbeded && jsEmbeded.length > 0)
-                alert("jsEmbeded:'"+jsEmbeded+"'\n---------------\n"+cleanHtml);
-        // DEBUG -------------
-        cleanHtml = cleanHtml.replace(shlurpPattern,"");
-        shlurpPattern=/\<LINK rel=\'STYLESHEET\' href\=\'.*\' TYPE=\'text\/css\' \/\>/gi;
-        // DEBUG -------------
-            var cssFiles = cleanHtml.match(shlurpPattern);
-            if (cssFiles && cssFiles.length > 0)
-                alert("cssFiles:'"+cssFiles+"'\n---------------\n"+cleanHtml);
-        // DEBUG -------------
-        cleanHtml = cleanHtml.replace(shlurpPattern,"");
+        cleanHtml = stripJsFiles(cleanHtml,true);   // DEBUG msg with true
+        cleanHtml = stripCssFiles(cleanHtml,true);  // DEBUG msg with true
+        cleanHtml = stripJsEmbedded(cleanHtml,true);// DEBUG msg with true
         if (subCfg.visIndependent) {
-            ix = cleanHtml.indexOf('</SELECT>');
+            var ix = cleanHtml.indexOf('</SELECT>');
             if (ix > 0)
                 cleanHtml = cleanHtml.substring(ix+'</SELECT>'.length);
             while(cleanHtml.length > 0) {
                 ix = cleanHtml.search("<");
                 cleanHtml = cleanHtml.substring(ix);
                 ix = cleanHtml.search(/\<BR\>/i);
                 if (ix != 0)
                     break; // Not found or not at start.
                 else
                     cleanHtml = cleanHtml.substring(4); // skip past <BR> and continue
             }
         } else {
             var ix = cleanHtml.indexOf('<B>Display&nbsp;mode:&nbsp;</B>');
             if (ix > 0)
                 cleanHtml = cleanHtml.substring(ix+'<B>Display&nbsp;mode:&nbsp;</B>'.length); // Excludes vis!