8c46d490346a7046a0a80c1b78b4ce78e7cd4688 tdreszer Tue Jun 21 23:22:58 2011 -0700 Worked on popup styling diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index f362d27..84bbf71 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2280,31 +2280,31 @@ // TODO: Shlurp up any javascript files from the response and load them with $.getScript() // example <script type='text/javascript' SRC='../js/tdreszer/jquery.contextmenu-1296177766.js'></script> var cleanHtml = response; var shlurpPattern=/\<script type=\'text\/javascript\' SRC\=\'.*\'\>\<\/script\>/gi; var jsFiles = cleanHtml.match(shlurpPattern); cleanHtml = cleanHtml.replace(shlurpPattern,""); shlurpPattern=/\<script type=\'text\/javascript\'>.*\<\/script\>/gi; var jsEmbeded = cleanHtml.match(shlurpPattern); cleanHtml = cleanHtml.replace(shlurpPattern,""); //<LINK rel='STYLESHEET' href='../style/ui.dropdownchecklist-1276528376.css' TYPE='text/css' /> shlurpPattern=/\<LINK rel=\'STYLESHEET\' href\=\'.*\' TYPE=\'text\/css\' \/\>/gi; var cssFiles = cleanHtml.match(shlurpPattern); cleanHtml = cleanHtml.replace(shlurpPattern,""); - $('#hgTrackUiDialog').html("<div id='pop'>" + cleanHtml + "</div>"); + $('#hgTrackUiDialog').html("<div id='pop' style='font-size:.9em;'>" + cleanHtml + "</div>"); // Strategy for poups with js: // - jsFiles and CSS should not be included in html. Here they are shluped out. // - The resulting files ought to be loadable dynamically (with getScript()), but this was not working nicely with the modal dialog // Therefore include files must be included with hgTracks CGI ! // - embedded js should not be in the popup box. // - Somethings should be in a popup.ready() function, and this is emulated below, as soon as the cleanHtml is added // Since there are many possible popup cfg dialogs, the ready should be all inclusive. /* //in open ? Will load of css work this way? $(cssFiles).each(function (i) { bix = "<LINK rel='STYLESHEET' href='".length; eix = this.lastIndexOf("' TYPE='text/css' />"); file = this.substring(bix,eix); $.getScript(file); // Should protect against already loaded files. @@ -2320,40 +2320,50 @@ if( ! popUpTrackDescriptionOnly ) { var subtrack = tdbIsSubtrack(trackDbJson[popUpTrackName]) ? popUpTrackName :""; // If subtrack then vis rules differ popSaveAllVars = getAllVars( $('#hgTrackUiDialog'), subtrack ); // Saves the vars that may get changed by the popup cfg. // -- popup.ready() -- Here is the place to do things that might otherwise go into a $('#pop').ready() routine! if (!newJQuery) { $('#hgTrackUiDialog').find('.filterComp').each( function(i) { // Do this by 'each' to set noneIsAll individually $(this).dropdownchecklist({ firstItemChecksAll: true, noneIsAll: $(this).hasClass('filterBy'), maxDropHeight: filterByMaxHeight(this), emptyText: "Please select ...", textFormatFunction: ddclTextFormatter }); }); } } + + // Searching for some selblance of size suitability + var popMaxHeight = ($(window).height() - 40); + var popMaxWidth = ($(window).width() - 40); + var popWidth = 740; + if (popWidth > popMaxWidth) + popWidth > popMaxWidth; + $('#hgTrackUiDialog').dialog({ ajaxOptions: { // This doesn't work cache: true }, - resizable: popUpTrackDescriptionOnly, - height: 'auto', - width: 'auto', + resizable: true, + height: (popUpTrackDescriptionOnly ? popMaxHeight : 'auto'), // Let description scroll vertically + width: popWidth, minHeight: 200, minWidth: 700, + maxHeight: popMaxHeight, + maxWidth: popMaxWidth, modal: true, closeOnEscape: true, autoOpen: false, buttons: { "OK": function() { if( ! popUpTrackDescriptionOnly ) hgTrackUiPopCfgOk($('#pop'), popUpTrackName); $(this).dialog("close"); }}, // popup.ready() doesn't seem to work in open. So there is no need for open at this time. //open: function() { // var subtrack = tdbIsSubtrack(trackDbJson[popUpTrackName]) ? popUpTrackName :""; // If subtrack then vis rules differ // popSaveAllVars = getAllVars( $('#pop'), subtrack ); //}, open: function () { if (newJQuery) {