33936815abf8ead7089948eb3371d3311e6bedc4
larrym
  Sun Dec 5 21:47:08 2010 -0800
modify too many items logic to use limitedVis
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index a554dad..a2b4fd3 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2047,33 +2047,35 @@
 // e.g.: <IMG SRC = "../trash/hgtIdeo/hgtIdeo_hgwdev_larrym_61d1_8b4a80.gif" BORDER=1 WIDTH=1039 HEIGHT=21 USEMAP=#ideoMap id='chrom'>
     // Parse out new ideoGram url (if available)
     var a = /<IMG([^>]+SRC[^>]+id='chrom'[^>]*)>/.exec(response);
     if(a && a[1]) {
         b = /SRC\s*=\s*"([^")]+)"/.exec(a[1]);
         if(b[1]) {
             $('#chrom').attr('src', b[1]);
         }
     }
     var re = /<\!-- trackDbJson -->\n<script>var trackDbJson = ([\S\s]+)<\/script>\n<\!-- trackDbJson -->/m;
     a = re.exec(response);
     if(a && a[1]) {
         var json = eval("(" + a[1] + ")");
         if(json && json[this.id]) {
             var visibility = visibilityStrsOrder[json[this.id].visibility];
-            if(this.newVisibility && this.newVisibility != visibility) {
-                alert("Unable to change visibility to " + this.newVisibility + ".\n\nThis occurs when there are too many items to display the track in " + this.newVisibility + " mode.");
-            }
+            var limitedVis;
+            if(json[this.id].limitedVis)
+                limitedVis = visibilityStrsOrder[json[this.id].limitedVis];
+            if(this.newVisibility && limitedVis && this.newVisibility != limitedVis)
+                alert("There are too many items to display the track in " + this.newVisibility + " mode.");
             updateVisibility(this.id, visibility);
         } else {
             showWarning("Invalid trackDbJson received from the server");
         }
     } else {
         showWarning("trackDbJson is missing from the response");
     }
     if(imageV2 && this.id && this.cmd && this.cmd != 'wholeImage' && this.cmd != 'selectWholeGene') {
           // Extract <TR id='tr_ID'>...</TR> and update appropriate row in imgTbl;
           // this updates src in img_left_ID, img_center_ID and img_data_ID and map in map_data_ID
           var id = this.id;
           if(this.loadingId) {
 	          hideLoadingImage(this.loadingId);
           }
           var rec = trackDbJson[id];
@@ -2558,31 +2560,31 @@
                     str = "../ENCODE/otherTerms.html#" + val;
                 }
                 if(typeof(disabled[val]) == 'undefined')
                     span.html("<a target='_blank' title='detailed descriptions of terms' href='" + str + "'>" + text + "</a>");
                 else
                     span.empty();
             }
         } else {
             return;
         }
     }
 }
 
 function windowOpenFailedMsg()
 {
-    alert("Your web browser prevented us from opening a new window.\n\nYou need to change your browser settings to allow popups from " + document.domain);
+    alert("Your web browser prevented us from opening a new window.\n\nPlease change your browser settings to allow pop-up windows from " + document.domain + ".");
 }
 
 function updateVisibility(track, visibility)
 {
 // Updates visibility state in trackDbJson and any visible elements on the page.
 // returns true if we modify at least one select in the group list
     var rec = trackDbJson[track];
     var selectUpdated = false;
     $("select[name=" + track + "]").each(function(t) {
                                           $(this).val(visibility);
                                           selectUpdated = true;
                                       });
     if(rec) {
         rec.localVisibility = visibility;
     }