e17ab1abdfd35d012ce831f46c24e972d52517db chmalee Thu Feb 16 16:20:49 2023 -0800 Strip hub_id when making api requests for hub tracks/genomes, refs #30024 diff --git src/hg/js/utils.js src/hg/js/utils.js index 64ffdf5..ff669b0 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -1153,51 +1153,71 @@ hgsid = getURLParam(window.location.href, "hgsid"); if (hgsid.length > 0) return hgsid; // This may be moved to 1st position as the most likely source if (typeof(common) !== 'undefined' && common.hgsid !== undefined && common.hgsid !== null) return common.hgsid; hgsid = normed($("input#hgsid").first()); if (hgsid) return hgsid.value; return ""; } +function undecoratedDb(db) +// return the db name with any hub_id_ stripped +{ +var retDb = db; +if (db.startsWith("hub_")) { + retDb = db.split('_', 3)[2]; +} +return retDb; +} + function getDb() { var db = normed($("input[name='db']").first()); if (db) return db.value; db = getURLParam(window.location.href, "db"); if (db.length > 0) return db; // This may be moved to 1st position as the most likely source if (typeof(common) !== 'undefined' && common.db) return common.db; db = normed($("input#db").first()); if (db) return db.value; return ""; } +function undecoratedTrack(track) +// return the track name with any hub_id_ stripped +{ +var retTrack = track; +if (track.startsWith("hub_")) { + retTrack = track.split('_', 3)[2]; +} +return retTrack; +} + function getTrack() { var track = normed($("input#g").first()); if (track) return track.value; track = normed($("input[name='g']").first()); if (track) return track.value; track = getURLParam(window.location.href, "g"); if (track.length > 0) return track; // This may be moved to 1st position as the most likely source