0b9a4a802e90edc25f19f5ec28bd03aede83c2ae
tdreszer
  Mon Oct 7 10:52:10 2013 -0700
Fix for regex which scrapes out json objects as per redmine 11873.  Some IPSs are stripping newlines so regex must tolerate that.  This problem was found by Rachel working from England.
diff --git src/hg/js/ajax.js src/hg/js/ajax.js
index a2a2d7c..2a5cb9a 100644
--- src/hg/js/ajax.js
+++ src/hg/js/ajax.js
@@ -441,31 +441,34 @@
 
     var myWidth =  $(window).width() - 300;
     if(myWidth > 900)
         myWidth = 900;
     $(popUp).dialog("option", "maxWidth", myWidth);
     $(popUp).dialog("option", "width", myWidth);
     $(popUp).dialog('open');
     var buttOk = $('button.ui-state-default');
     if($(buttOk).length == 1)
         $(buttOk).focus();
 }
 
 function scrapeVariable(html, name)
 {
 // scrape a variable defintion out of html (see jsHelper.c::jsPrintHash)
-    var re = new RegExp("^// START " + name + "\\nvar " + name + " = ([\\S\\s]+);\\n// END " + name + "$", "m");
+    // NOTE: newlines are being removed by some ISPs, so regex must tolerate that:
+    var re = new RegExp("// START " + name + 
+                        "\\n?var " + name + " = ([\\S\\s]+);" + 
+                        "\\n?// END " + name, "m");
     var a = re.exec(html);
     var json;
     if(a && a[1]) {
         json = eval("(" + a[1] + ")");
     }
     return json;
 }
 
 // The loadingImage module helps you manage a loading image (for a slow upload; e.g. in hgCustom).
 
 var loadingImage = function ()
 {
     // private vars
     var imgEle, msgEle, statusMsg;