cd9d655961d6f2142350c1415c95fb8191e44b09 chmalee Tue Oct 1 12:16:19 2024 -0700 Save most recently clicked hgHubConnect tab to localStorage because jquery-ui upgrade removed cookie option, refs #34538 diff --git src/hg/js/hgHubConnect.js src/hg/js/hgHubConnect.js index 5a9bd34..074b8b6 100644 --- src/hg/js/hgHubConnect.js +++ src/hg/js/hgHubConnect.js @@ -54,34 +54,34 @@ $(function() { $(".hubList tr").hover( function() { $(this).addClass("hoverRow"); }, function() { $(this).removeClass("hoverRow"); }); }); // initializes the tabs - with cookie option // cookie option requires jquery.cookie.js $(function() { $("#tabs").tabs({ - cookie: { - name: 'hubTab_cookie', - expires: 30 - } + active: localStorage.getItem("hubTab") !== null ? localStorage.getItem("hubTab") : 0, + activate: function(event, ui) { + localStorage.setItem("hubTab", ui.newTab.index()); + }, }); }); // creates keyup event; listening for return key press $(document).ready(function() { $('#loadSampleHub').bind('click', function(e) { $('#validateHubUrl').val("https://genome.ucsc.edu/goldenPath/help/examples/hubDirectory/hub.txt"); }); $('#hubUrl').bind('keypress', function(e) { // binds listener to url field if (e.which === 13) { // listens for return key e.preventDefault(); // prevents return from also submitting whole form if (validateUrl($('#hubUrl').val())) $('input[name="hubAddButton"]').focus().click(); // clicks AddHub button }