From 94aeca6c92b2e0f47faaf7dae744f2936569712f Mon Sep 17 00:00:00 2001 From: Frank Harris Date: Tue, 27 Jan 2026 17:18:17 -0600 Subject: [PATCH] workshop --- modules/steam_workshop/lang/en_US.php | 3 ++ modules/steam_workshop/steam_workshop.css | 41 +++++++++++++++++++ modules/steam_workshop/steam_workshop.js | 22 ++++++++++ .../views/partials/mod_picker.php | 10 +++++ 4 files changed, 76 insertions(+) diff --git a/modules/steam_workshop/lang/en_US.php b/modules/steam_workshop/lang/en_US.php index 5e07d6b1..451acaaa 100644 --- a/modules/steam_workshop/lang/en_US.php +++ b/modules/steam_workshop/lang/en_US.php @@ -84,6 +84,9 @@ return [ 'mod_picker_results_empty' => 'No workshop items matched that search.', 'mod_picker_status_need_query' => 'Enter a Workshop ID or keyword before searching.', 'mod_picker_toggle_label' => 'Sync', + 'mod_picker_request_label' => 'Submitting request', + 'mod_picker_request_hint' => 'Exact URL preview. The input shows the text that will be submitted.', + 'mod_picker_request_input_label' => 'Workshop query preview', 'error_game_key_required' => 'Select a valid game key before editing the adapter.', 'error_adapter_delete_failed' => 'Adapter could not be deleted.', 'button_edit_adapter' => 'Edit', diff --git a/modules/steam_workshop/steam_workshop.css b/modules/steam_workshop/steam_workshop.css index 5aa88e03..2bc0ee6a 100644 --- a/modules/steam_workshop/steam_workshop.css +++ b/modules/steam_workshop/steam_workshop.css @@ -392,6 +392,47 @@ overflow-x: auto; } +.sw-picker__request-row { + margin-top: 0.75rem; +} + +.sw-picker__request-label { + display: block; + font-weight: 600; + margin-bottom: 0.15rem; +} + +.sw-picker__request-hint { + display: block; + margin-bottom: 0.35rem; + color: #6b6b6b; +} + +.sw-picker__request-line { + display: flex; + flex-wrap: wrap; + gap: 0.4rem; + align-items: center; + font-family: Consolas, 'Courier New', monospace; +} + +.sw-picker__request-summary { + padding: 0.2rem 0.4rem; + background: #f6f6f6; + border-radius: 4px; + border: 1px solid #e0e0e0; +} + +.sw-picker__request-input { + flex: 1; + min-width: 160px; + padding: 0.25rem 0.4rem; + border: 1px solid #ced4da; + border-radius: 4px; + font-family: inherit; + background: #fff; +} + .sw-picker__action { padding: 0.25rem 0.5rem; border-radius: 4px; diff --git a/modules/steam_workshop/steam_workshop.js b/modules/steam_workshop/steam_workshop.js index 19c5cf52..f816275f 100644 --- a/modules/steam_workshop/steam_workshop.js +++ b/modules/steam_workshop/steam_workshop.js @@ -21,12 +21,16 @@ this.searchForm = root.querySelector('.js-sw-search-form'); this.searchInput = root.querySelector('.js-sw-search-input'); this.searchButton = root.querySelector('.js-sw-search-button'); + this.requestInput = root.querySelector('.js-sw-request-input'); + this.requestSummary = root.querySelector('.js-sw-request-summary'); + this.requestSummaryBase = this.requestSummary ? (this.requestSummary.getAttribute('data-base') || '') : ''; this.state = { selected: this.readInitialSelection(), }; this.lastResults = []; this.bindEvents(); this.renderSelected(); + this.updateRequestPreview(); } Picker.prototype.readInitialSelection = function () { if (!this.selectedInput) { @@ -73,6 +77,11 @@ } }); } + if (this.searchInput) { + this.searchInput.addEventListener('input', function () { + _this.updateRequestPreview(); + }); + } if (this.selectedList) { this.selectedList.addEventListener('click', function (event) { var target = event.target; @@ -126,6 +135,7 @@ return; } var term = this.searchInput.value.trim(); + this.updateRequestPreview(); if (!term) { this.setStatus(this.lang.query, 'error'); return; @@ -222,6 +232,18 @@ _loop_1(item); } }; + Picker.prototype.updateRequestPreview = function () { + if (this.requestInput && this.searchInput) { + this.requestInput.value = this.searchInput.value; + } + if (this.requestSummary) { + var encoded = ''; + if (this.searchInput && this.searchInput.value.trim() !== '') { + encoded = encodeURIComponent(this.searchInput.value.trim()); + } + this.requestSummary.textContent = (this.requestSummaryBase || '') + encoded; + } + }; Picker.prototype.isSelected = function (id) { return this.state.selected.some(function (item) { return item.id === id; }); }; diff --git a/modules/steam_workshop/views/partials/mod_picker.php b/modules/steam_workshop/views/partials/mod_picker.php index f5c223ba..d7d734b5 100644 --- a/modules/steam_workshop/views/partials/mod_picker.php +++ b/modules/steam_workshop/views/partials/mod_picker.php @@ -58,6 +58,16 @@ $langAttrs = [ +
+ + +
+ + + +
+
+