1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #6333 from viown/remove-jquery-part-1

Remove jQuery
This commit is contained in:
viown 2025-01-14 01:12:37 +03:00 committed by GitHub
parent f1c49163c2
commit 3600426058
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 177 additions and 152 deletions

View file

@ -8,7 +8,6 @@ import escapeHtml from 'escape-html';
import loading from '../loading/loading';
import dialogHelper from '../dialogHelper/dialogHelper';
import dom from '../../scripts/dom';
import 'jquery';
import libraryoptionseditor from '../libraryoptionseditor/libraryoptionseditor';
import globalize from '../../lib/globalize';
import '../../elements/emby-button/emby-button';
@ -43,8 +42,8 @@ function onAddLibrary(e) {
isCreating = true;
loading.show();
const dlg = dom.parentWithClass(this, 'dlg-librarycreator');
const name = $('#txtValue', dlg).val();
let type = $('#selectCollectionType', dlg).val();
const name = dlg.querySelector('#txtValue').value;
let type = dlg.querySelector('#selectCollectionType').value;
if (type == 'mixed') {
type = null;
@ -72,9 +71,12 @@ function getCollectionTypeOptionsHtml(collectionTypeOptions) {
}
function initEditor(page, collectionTypeOptions) {
$('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val('').on('change', function () {
const selectCollectionType = page.querySelector('#selectCollectionType');
selectCollectionType.innerHTML = getCollectionTypeOptionsHtml(collectionTypeOptions);
selectCollectionType.value = '';
selectCollectionType.addEventListener('change', function () {
const value = this.value;
const dlg = $(this).parents('.dialog')[0];
const dlg = dom.parentWithClass(this, 'dialog');
libraryoptionseditor.setContentType(dlg.querySelector('.libraryOptions'), value);
if (value) {
@ -90,12 +92,12 @@ function initEditor(page, collectionTypeOptions) {
const name = this.options[index].innerHTML
.replaceAll('*', '')
.replaceAll('&', '&');
$('#txtValue', dlg).val(name);
dlg.querySelector('#txtValue').value = name;
}
}
const folderOption = collectionTypeOptions.find(i => i.value === value);
$('.collectionTypeFieldDescription', dlg).html(folderOption?.message || '');
dlg.querySelector('.collectionTypeFieldDescription').innerHTML = folderOption?.message || '';
});
page.querySelector('.btnAddFolder').addEventListener('click', onAddButtonClick);
page.querySelector('.addLibraryForm').addEventListener('submit', onAddLibrary);
@ -184,7 +186,7 @@ function onDialogClosed() {
function initLibraryOptions(dlg) {
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions')).then(() => {
$('#selectCollectionType', dlg).trigger('change');
dlg.querySelector('#selectCollectionType').dispatchEvent(new Event('change'));
});
}