workshop
This commit is contained in:
parent
4c24d14bf5
commit
94aeca6c92
4 changed files with 76 additions and 0 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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; });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,6 +58,16 @@ $langAttrs = [
|
|||
<button type="button" class="btn secondary js-sw-search-button"><?php echo htmlspecialchars($lang['mod_picker_search_button'] ?? 'Search'); ?></button>
|
||||
</div>
|
||||
|
||||
<div class="sw-picker__request-row">
|
||||
<span class="sw-picker__request-label"><?php echo htmlspecialchars($lang['mod_picker_request_label'] ?? 'Submitting request'); ?></span>
|
||||
<small class="sw-picker__request-hint"><?php echo htmlspecialchars($lang['mod_picker_request_hint'] ?? 'Exact URL preview. The field below mirrors your search text.'); ?></small>
|
||||
<div class="sw-picker__request-line">
|
||||
<?php $baseRequest = $endpoint . '&q='; ?>
|
||||
<code class="sw-picker__request-summary js-sw-request-summary" data-base="<?php echo htmlspecialchars($baseRequest, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($baseRequest, ENT_QUOTES, 'UTF-8'); ?></code>
|
||||
<input type="text" class="sw-picker__request-input js-sw-request-input" value="" readonly aria-label="<?php echo htmlspecialchars($lang['mod_picker_request_input_label'] ?? 'Workshop search text preview'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sw-picker__status js-sw-picker-status" role="status" aria-live="polite"></div>
|
||||
|
||||
<div class="sw-picker__selected">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue