@@ -83,7 +83,6 @@ async function readGameAssetCatalog(assetCatalogPath) {
8383}
8484
8585const refs = {
86- toolSelect : document . querySelector ( "[data-tool-host-select]" ) ,
8786 stateInput : document . querySelector ( "[data-tool-host-state-input]" ) ,
8887 mountButton : null ,
8988 prevButton : document . querySelector ( "[data-tool-host-prev]" ) ,
@@ -107,12 +106,11 @@ const TOOL_LAUNCH_PARAM_PREFIXES = Object.freeze({
107106 workspaceHref : [ "/tools/Workspace%20Manager/" , "/tools/Workspace Manager/" ] ,
108107 returnTo : [ "/games/" , "/samples/" ]
109108} ) ;
110- let selectedToolId = refs . toolSelect instanceof HTMLSelectElement ? refs . toolSelect . value : "" ;
109+ let selectedToolId = "" ;
111110let pagerEventsBound = false ;
112111let pagerMessageBridgeBound = false ;
113112
114113function refreshPagerRefs ( ) {
115- refs . toolSelect = document . querySelector ( "[data-tool-host-select]" ) ;
116114 refs . prevButton = document . querySelector ( "[data-tool-host-prev]" ) ;
117115 refs . nextButton = document . querySelector ( "[data-tool-host-next]" ) ;
118116 refs . currentLabel = document . querySelector ( "[data-tool-host-current-label]" ) ;
@@ -194,20 +192,12 @@ function readForwardedToolLaunchParams() {
194192}
195193
196194function readSelectedToolId ( ) {
197- refreshPagerRefs ( ) ;
198- if ( refs . toolSelect instanceof HTMLSelectElement ) {
199- return refs . toolSelect . value ;
200- }
201195 return selectedToolId ;
202196}
203197
204198function writeSelectedToolId ( toolId ) {
205- refreshPagerRefs ( ) ;
206199 const normalizedToolId = typeof toolId === "string" ? toolId . trim ( ) : "" ;
207200 selectedToolId = normalizedToolId ;
208- if ( refs . toolSelect instanceof HTMLSelectElement ) {
209- refs . toolSelect . value = normalizedToolId ;
210- }
211201}
212202
213203function writeStatus ( text ) {
@@ -496,15 +486,7 @@ function syncControlState() {
496486 }
497487}
498488
499- function populateToolSelect ( initialToolId ) {
500- refreshPagerRefs ( ) ;
501- if ( refs . toolSelect instanceof HTMLSelectElement ) {
502- refs . toolSelect . innerHTML = toolIds
503- . map ( ( toolId ) => getToolHostEntryById ( manifest , toolId ) )
504- . filter ( Boolean )
505- . map ( ( tool ) => `<option value="${ tool . id } ">${ tool . displayName } </option>` )
506- . join ( "" ) ;
507- }
489+ function syncSelectedToolState ( initialToolId ) {
508490 const normalizedInitialToolId = toolIds . includes ( initialToolId ) ? initialToolId : "" ;
509491 writeSelectedToolId ( normalizedInitialToolId ) ;
510492 const selectedEntry = getToolHostEntryById ( manifest , readSelectedToolId ( ) ) ;
@@ -521,7 +503,7 @@ function applyToolsUsedFilterForGame(gameEntry, preferredToolId = "") {
521503 toolIds = [ ...allowed ] ;
522504 }
523505 const initialToolId = toolIds . includes ( preferredToolId ) ? preferredToolId : "" ;
524- populateToolSelect ( initialToolId ) ;
506+ syncSelectedToolState ( initialToolId ) ;
525507 updateStandaloneHref ( initialToolId ) ;
526508 syncControlState ( ) ;
527509}
@@ -555,18 +537,6 @@ function bindPagerDelegatedEvents() {
555537 mountSelectedTool ( "next" ) ;
556538 }
557539 } ) ;
558-
559- document . addEventListener ( "change" , ( event ) => {
560- const target = event . target instanceof HTMLSelectElement ? event . target : null ;
561- if ( ! target || ! target . matches ( "[data-tool-host-select]" ) ) {
562- return ;
563- }
564- refs . toolSelect = target ;
565- writeSelectedToolId ( target . value ) ;
566- updateSwitchMeta ( ) ;
567- updateStandaloneHref ( readSelectedToolId ( ) ) ;
568- mountSelectedTool ( "select" ) ;
569- } ) ;
570540}
571541
572542function bindPagerMessageBridge ( ) {
@@ -584,7 +554,7 @@ function bindPagerMessageBridge() {
584554 return ;
585555 }
586556
587- const action = payload . action === "prev" || payload . action === "next" || payload . action === "select"
557+ const action = payload . action === "prev" || payload . action === "next"
588558 ? payload . action
589559 : "" ;
590560 if ( ! action ) {
@@ -603,26 +573,6 @@ function bindPagerMessageBridge() {
603573 return ;
604574 }
605575
606- if ( action === "select" ) {
607- const selectedToolId = typeof payload . toolId === "string"
608- ? payload . toolId . trim ( )
609- : "" ;
610- if ( ! selectedToolId || ! toolIds . includes ( selectedToolId ) || ! getToolHostEntryById ( manifest , selectedToolId ) ) {
611- writeStatus ( `Tool "${ selectedToolId || "(missing)" } " is not available for Workspace Manager launch.` ) ;
612- renderMountDiagnostic (
613- `Tool "${ selectedToolId || "(missing)" } " is not available for delegated pager selection.` ,
614- "Select a valid tool id from the active registry."
615- ) ;
616- syncControlState ( ) ;
617- return ;
618- }
619- writeSelectedToolId ( selectedToolId ) ;
620- updateSwitchMeta ( ) ;
621- updateStandaloneHref ( selectedToolId ) ;
622- mountSelectedTool ( "select" ) ;
623- return ;
624- }
625-
626576 const offset = action === "prev" ? - 1 : 1 ;
627577 if ( ! selectToolByOffset ( offset ) ) {
628578 writeStatus ( `Unable to select ${ action === "prev" ? "previous" : "next" } tool.` ) ;
0 commit comments