7c141bf86bd1599d8996cebe8de1289db03ff6d1 larrym Thu Nov 3 08:59:48 2011 -0700 add optional absolute parameter to showLoadingImage diff --git src/hg/js/utils.js src/hg/js/utils.js index facc1fb..70e8127 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -1042,53 +1042,55 @@ // return < 0 ends iteration with no call to continuingFunc // Both interatingFunc and continuingFunc will receive the single "args" param. // Hint. for multiple args, create a single struct object var ro = new _yieldingIteratorObject(function() { var msecs = interatingFunc(args); if (msecs > 0) ro.step(msecs,args); // recursion else if (msecs == 0) continuingFunc(args); // completion // else (msec < 0) // abandon }); ro.step(1,args); // kick-off } -function showLoadingImage(id) +function showLoadingImage(id, absolute) { // Show a loading image above the given id; return's id of div added (so it can be removed when loading is finished). // This code was mostly directly copied from hgHeatmap.js, except I also added the "overlay.appendTo("body");" +// If absolute is TRUE, then we use and absolute reference for the src tag. var loadingId = id + "LoadingOverlay"; // make an opaque overlay to partially hide the image var overlay = $("<div></div>").attr("id", loadingId).css("position", "absolute"); var ele = $(document.getElementById(id)); overlay.appendTo("body"); overlay.css("top", ele.position().top); var divLeft = ele.position().left + 2; overlay.css("left",divLeft); var width = ele.width() - 5; var height = ele.height(); overlay.width(width); overlay.height(height); overlay.css("background", "white"); overlay.css("opacity", 0.75); // now add the overlay image itself in the center of the overlay. var imgWidth = 220; // hardwired based on width of loading.gif var imgLeft = (width / 2) - (imgWidth / 2); var imgTop = (height / 2 ) - 10; - $("<img src='../images/loading.gif'/>").css("position", "relative").css('left', imgLeft).css('top', imgTop).appendTo(overlay); + var src = absolute ? "/images/loading.gif" : "../images/loading.gif"; + $("<img src='" + src + "'/>").css("position", "relative").css('left', imgLeft).css('top', imgTop).appendTo(overlay); return loadingId; } function hideLoadingImage(id) { $(document.getElementById(id)).remove(); } function codonColoringChanged(name) { // Updated disabled state of codonNumbering checkbox based on current value of track coloring select. var val = $("select[name='" + name + ".baseColorDrawOpt'] option:selected").text(); $("input[name='" + name + ".codonNumbering']").attr('disabled', val == "OFF"); }