93b4e6a3aeae8b052a7f2cbce148790b61274e86 jnavarr5 Wed Nov 13 17:21:23 2024 -0800 Check to see if you are on either hg38 or hg19 before starting the clinical tutorial. If not, go to hg38 and start the tutorial, refs #34208 diff --git src/hg/js/tutorials/hgTracksPopup.js src/hg/js/tutorials/hgTracksPopup.js index a8eabb0..d7c20c3 100644 --- src/hg/js/tutorials/hgTracksPopup.js +++ src/hg/js/tutorials/hgTracksPopup.js @@ -1,19 +1,20 @@ -// funtion to create the pop-up on hgTracks + +// funtion to create the pop-up on hgTracks window.openTutorialPopup = function() { // Create the pop-up container const tutorialDiv = document.createElement("div"); tutorialDiv.id = "tutorialContainer"; // Create the contents for the popup tutorialDiv.innerHTML = ` <p> These interactive tutorials will provide step-by-step guides to help navigate through various tools and pages on the UCSC Genome Browser.</p> <h4 id="hgTracksTutorials">Genome Browser tutorials</h4> <table style="width:600px; border-color:#666666; border-collapse:collapse; margin: auto;"> <tr><td style="padding: 8px;width: 200px; text-align: center; border: 1px solid #666666;"> <a href="#" id="basicTutorial">Basic tutorial</a></td> <td style="padding: 8px; width: 450px; word-wrap: break-word; border: 1px solid #666666; text-align:center"> @@ -43,29 +44,42 @@ modal: true, title: "All Interactive Tutorials Available", draggable: true, resizable: false, width: 650, /* buttons: [{ text: "Close", click: function() { $(this).dialog("close"); } }],*/ position: {my: "center top", at: "center top+100", of: window} }); + // Function to get which databse you are on + function getDb (){ + const currentUrl = window.location.href; + const dbValue = new URLSearchParams(window.location.search).get("db"); + return dbValue; + } + // Function to control the basic tutorial link document.getElementById('basicTutorial').addEventListener('click', function(event) { event.preventDefault(); $("#tutorialContainer").dialog("close"); basicTour.start(); }); // Function to control the clincial tutorial link document.getElementById('clinicalTutorial').addEventListener('click', function(event) { event.preventDefault(); $("#tutorialContainer").dialog("close"); - clinicalTour.start(); + const db = getDb(); // Get which database you are viewing + if (db == "hg38" || db =="hg19") { + clinicalTour.start(); // If you are on hg38 or hg19, then start the tutorial + } else { + // Otherwise go to hg38 and start the tutorial. + window.location.href = "/cgi-bin/hgTracks?db=hg38&startClinical=true"; + } }); };