diff --git a/src/LSSM-Menu.vue b/src/LSSM-Menu.vue index d02d63ecbf..167a126a72 100644 --- a/src/LSSM-Menu.vue +++ b/src/LSSM-Menu.vue @@ -487,8 +487,7 @@ export default Vue.extend< this.iconBgAsNavBg = iconBgAsNavBg; if (iconBgAsNavBg) { - this.navbg.navbar = - document.querySelector('#main_navbar'); + this.navbg.navbar = document.getElementById('main_navbar'); const bgImg = this.navbg.navbar ? window.getComputedStyle(this.navbg.navbar) .backgroundImage @@ -541,9 +540,7 @@ export default Vue.extend< }) .then(v3MenuAsSubmenu => { if (!v3MenuAsSubmenu) return; - - const v3Dropdown = - document.querySelector('#lssm_dropdown'); + const v3Dropdown = document.getElementById('lssm_dropdown'); const versionWrapper = this.$el.querySelector( `#${this.versionWrapperId}` ); diff --git a/src/LSSMV4.vue b/src/LSSMV4.vue index 27cba32695..fb88ad44cb 100644 --- a/src/LSSMV4.vue +++ b/src/LSSMV4.vue @@ -76,8 +76,7 @@ onMounted(() => { }); // Workaround for when modals container appears behind V4 instance (dialogs are behind modals) - const modalsContainer = - document.querySelector('#modals-container'); + const modalsContainer = document.getElementById('modals-container'); if ( modalsContainer && getCurrentInstance()?.proxy.$el.compareDocumentPosition( diff --git a/src/components/anniversaryComponent.vue b/src/components/anniversaryComponent.vue index 06d7cecd6c..c4ca014bfe 100644 --- a/src/components/anniversaryComponent.vue +++ b/src/components/anniversaryComponent.vue @@ -190,7 +190,7 @@ onMounted(() => { navbar.classList.add('lssmv4-anniversary-navbar'); for (let i = 0; i < window.innerWidth / 100; i++) navbar.append(createBalloon(false, true, false).balloon); - document.querySelector('#main_navbar')?.prepend(navbar); + document.getElementById('main_navbar')?.prepend(navbar); }); diff --git a/src/modules/asyncButtons/assets/buildings.ts b/src/modules/asyncButtons/assets/buildings.ts index 4805066d60..dcb22a841a 100644 --- a/src/modules/asyncButtons/assets/buildings.ts +++ b/src/modules/asyncButtons/assets/buildings.ts @@ -6,7 +6,7 @@ export default ( $m: $m, MODULE_ID: string ): void => { - const BUILDING_MODE = document.querySelector('#ausbauten') + const BUILDING_MODE = document.getElementById('ausbauten') ? 'building' : 'dispatch'; diff --git a/src/modules/asyncButtons/assets/missions.ts b/src/modules/asyncButtons/assets/missions.ts index c4290452a7..de67fb17af 100644 --- a/src/modules/asyncButtons/assets/missions.ts +++ b/src/modules/asyncButtons/assets/missions.ts @@ -8,8 +8,7 @@ export default ( document.querySelector('.vehicle_prisoner_select') && missionSettings.includes('missionPrisoners') ) { - const prisonersLabel = - document.querySelector('#h2_prisoners'); + const prisonersLabel = document.getElementById('h2_prisoners'); let currentPrisoners = parseInt( prisonersLabel?.textContent?.trim().match(/^\d+/u)?.[0] || '0' ); @@ -100,9 +99,9 @@ export default ( const replyButton = document.querySelector( '#mission_reply_content ~ div button[type="submit"]' ); - const replyInputField = document.querySelector( - '#mission_reply_content' - ); + const replyInputField = document.getElementById( + 'mission_reply_content' + ) as HTMLInputElement; if ( missionSettings.includes('missionReply') && replyButton && diff --git a/src/modules/buildingListFilter/main.ts b/src/modules/buildingListFilter/main.ts index 5781f74e74..14ae1e1bd6 100644 --- a/src/modules/buildingListFilter/main.ts +++ b/src/modules/buildingListFilter/main.ts @@ -87,6 +87,7 @@ export default (async ({ buildings: number[]; state: 'disabled' | 'enabled'; } + const filters = [ { contentType: 'text', @@ -257,8 +258,7 @@ export default (async ({ } ); - const buildingList = - document.querySelector('#building_list'); + const buildingList = document.getElementById('building_list'); if (!buildingList) return; const buildings: [HTMLLIElement, string][] = []; @@ -401,8 +401,7 @@ export default (async ({ const observer = new MutationObserver(updateFilters); - const buildingsElement = - document.querySelector('#buildings'); + const buildingsElement = document.getElementById('buildings'); if (buildingsElement) observer.observe(buildingsElement, { childList: true }); diff --git a/src/modules/creditsextension/main.ts b/src/modules/creditsextension/main.ts index c7c592bdef..5c460ae290 100644 --- a/src/modules/creditsextension/main.ts +++ b/src/modules/creditsextension/main.ts @@ -3,7 +3,7 @@ import creditsextension from './creditsextension.vue'; import type { ModuleMainFunction } from 'typings/Module'; export default (async ({ LSSM, MODULE_ID, getSetting }) => { - const wrapper = document.querySelector('#navigation_top')?.parentElement; + const wrapper = document.getElementById('navigation_top')?.parentElement; if (wrapper) { const settings = { showSales: await getSetting('showSales'), @@ -17,6 +17,6 @@ export default (async ({ LSSM, MODULE_ID, getSetting }) => { props: { MODULE_ID, ...settings, getSetting }, }), }).$mount(wrapper); - document.querySelector('#coins_top')?.parentElement?.remove(); + document.getElementById('coins_top')?.parentElement?.remove(); } }); diff --git a/src/modules/enhancedPOI/main.ts b/src/modules/enhancedPOI/main.ts index cd011f4410..55e0ae7cd6 100644 --- a/src/modules/enhancedPOI/main.ts +++ b/src/modules/enhancedPOI/main.ts @@ -140,7 +140,7 @@ export default (async ({ LSSM, MODULE_ID, $m, getSetting, setSetting }) => { 'poi-hider-style', true ); - document.querySelector(`#${extraStyleId}`)?.remove(); + document.getElementById(extraStyleId)?.remove(); const style = document.createElement('style'); style.id = extraStyleId; style.textContent = `${selector} {display: block !important;}`; @@ -168,9 +168,7 @@ export default (async ({ LSSM, MODULE_ID, $m, getSetting, setSetting }) => { } if ( isPOIWindow && - document.querySelector( - `#${poiSettingsWrapperId}` - ) + document.getElementById(poiSettingsWrapperId) as HTMLDivElement ) return; isPOIWindow = true; @@ -277,8 +275,7 @@ export default (async ({ LSSM, MODULE_ID, $m, getSetting, setSetting }) => { }); }); - const buildingsElement = - document.querySelector('#buildings'); + const buildingsElement = document.getElementById('buildings'); if (buildingsElement) observer.observe(buildingsElement, { childList: true }); }) as ModuleMainFunction; diff --git a/src/modules/extendedBuilding/main.ts b/src/modules/extendedBuilding/main.ts index c5ad8462da..4f3b566d59 100644 --- a/src/modules/extendedBuilding/main.ts +++ b/src/modules/extendedBuilding/main.ts @@ -25,17 +25,15 @@ export default (async ({ window.location.pathname ) && !/^\/schoolings\/\d+\/?$/u.test(window.location.pathname)) || - (!document.querySelector('#bereitstellungsraumReset') && + (!document.getElementById('bereitstellungsraumReset') && document.querySelectorAll('[href*="profile"]').length) ) return; if (/^\/buildings\/\d+\/?$/u.test(window.location.pathname)) { - const BUILDING_MODE = document.querySelector( - '#tab_protocol' - ) + const BUILDING_MODE = document.getElementById('tab_protocol') ? 'dispatch' - : document.querySelector('#schooling_running') + : document.getElementById('schooling_running') ? 'schooling' : 'building'; @@ -64,7 +62,7 @@ export default (async ({ if (BUILDING_MODE === 'building') { if ( (await getSetting('personnelDemands')) && - document.querySelector('#vehicle_table') + document.getElementById('vehicle_table') ) { import( /* webpackChunkName: "modules/extendedBuilding/personnelDemands" */ './assets/personnelDemands' @@ -86,7 +84,7 @@ export default (async ({ if ( (await getSetting('expansions')) && - document.querySelector('#ausbauten') + document.getElementById('ausbauten') ) { import( /* webpackChunkName: "modules/extendedBuilding/expansions" */ './assets/expansions' diff --git a/src/modules/extendedCallList/assets/collapsableMissions/missionlist.ts b/src/modules/extendedCallList/assets/collapsableMissions/missionlist.ts index 8bc473df05..2c0ff2146c 100644 --- a/src/modules/extendedCallList/assets/collapsableMissions/missionlist.ts +++ b/src/modules/extendedCallList/assets/collapsableMissions/missionlist.ts @@ -163,7 +163,7 @@ export default ( if (allMissionsCollapsed) allBtn.click(); - const sortBtn = document.querySelector(`#${sortBtnId}`); + const sortBtn = document.getElementById(sortBtnId); if (sortBtn) { sortBtn.parentElement?.before(allBtn); } else { diff --git a/src/modules/extendedCallList/assets/fixedEventInfo.ts b/src/modules/extendedCallList/assets/fixedEventInfo.ts index aafcb29106..9c23b4fc94 100644 --- a/src/modules/extendedCallList/assets/fixedEventInfo.ts +++ b/src/modules/extendedCallList/assets/fixedEventInfo.ts @@ -1,5 +1,5 @@ export default (LSSM: Vue) => { - const eventInfo = document.querySelector('#eventInfo'); + const eventInfo = document.getElementById('eventInfo'); if (!eventInfo) return; const whitespace = document.createElement('div'); diff --git a/src/modules/extendedCallList/assets/sort/callList.ts b/src/modules/extendedCallList/assets/sort/callList.ts index 5934317f83..2829db5e90 100644 --- a/src/modules/extendedCallList/assets/sort/callList.ts +++ b/src/modules/extendedCallList/assets/sort/callList.ts @@ -120,7 +120,7 @@ export default async ( ); const panelBodyId = 'missions-panel-body'; - const panelBody = document.querySelector(`#${panelBodyId}`); + const panelBody = document.getElementById(panelBodyId); if (!panelBody) return; diff --git a/src/modules/extendedCallList/assets/sort/mission.ts b/src/modules/extendedCallList/assets/sort/mission.ts index f91c24cd53..3cb08cbc52 100644 --- a/src/modules/extendedCallList/assets/sort/mission.ts +++ b/src/modules/extendedCallList/assets/sort/mission.ts @@ -57,8 +57,7 @@ export default async ( if (found) { const alarm = (publish = false) => { - const form = - document.querySelector('#mission-form'); + const form = document.getElementById('mission-form'); if (!form) return; const nextMissionIdInput = form.querySelector('#next_mission_id'); @@ -72,9 +71,7 @@ export default async ( if (publishInput) publishInput.value = Number(publish).toString(); // we've set the next mission id and the publishing value, so we can easily submit the form with normal alarm button - document - .querySelector('#mission_alarm_btn') - ?.click(); + document.getElementById('mission_alarm_btn')?.click(); }; const toggleInput = document.createElement('input'); diff --git a/src/modules/extendedCallWindow/assets/alarmIcons.ts b/src/modules/extendedCallWindow/assets/alarmIcons.ts index ec8f51e64c..f657f244a4 100644 --- a/src/modules/extendedCallWindow/assets/alarmIcons.ts +++ b/src/modules/extendedCallWindow/assets/alarmIcons.ts @@ -7,11 +7,8 @@ export default ( vehicleTypes: (number | string)[]; }[] ): void => { - const alarmBtn = - document.querySelector('#mission_alarm_btn'); - const vehicleList = document.querySelector( - '#vehicle_show_table_all' - ); + const alarmBtn = document.getElementById('mission_alarm_btn'); + const vehicleList = document.getElementById('vehicle_show_table_all'); if (!alarmBtn || !vehicleList) return; const spacing = document.createElement('span'); diff --git a/src/modules/extendedCallWindow/assets/alarmTime.ts b/src/modules/extendedCallWindow/assets/alarmTime.ts index 16830541e5..6fdcff43c1 100644 --- a/src/modules/extendedCallWindow/assets/alarmTime.ts +++ b/src/modules/extendedCallWindow/assets/alarmTime.ts @@ -1,6 +1,5 @@ export default (LSSM: Vue): void => { - const alarmBtn = - document.querySelector('#mission_alarm_btn'); + const alarmBtn = document.getElementById('mission_alarm_btn'); if (!alarmBtn) return; LSSM.$stores.root.addStyle({ @@ -59,8 +58,7 @@ export default (LSSM: Vue): void => { const amountObserver = new MutationObserver(update); - const amountElement = - document.querySelector('#vehicle_amount'); + const amountElement = document.getElementById('vehicle_amount'); if (amountElement) { amountObserver.observe(amountElement, { diff --git a/src/modules/extendedCallWindow/assets/arrCounter.ts b/src/modules/extendedCallWindow/assets/arrCounter.ts index 408f69b79a..e29ff09e9f 100644 --- a/src/modules/extendedCallWindow/assets/arrCounter.ts +++ b/src/modules/extendedCallWindow/assets/arrCounter.ts @@ -5,8 +5,7 @@ export default async ( getSetting: (key: string) => Promise, $m: $m ): Promise => { - const ARRContainer = - document.querySelector('#mission-aao-group'); + const ARRContainer = document.getElementById('mission-aao-group'); if (!ARRContainer) return; diff --git a/src/modules/extendedCallWindow/assets/arrHover.ts b/src/modules/extendedCallWindow/assets/arrHover.ts index 9fe3e8be55..0fb5af3ab2 100644 --- a/src/modules/extendedCallWindow/assets/arrHover.ts +++ b/src/modules/extendedCallWindow/assets/arrHover.ts @@ -7,8 +7,7 @@ export default ( MODULE_ID: string, $m: $m ): void => { - const ARRContainer = - document.querySelector('#mission-aao-group'); + const ARRContainer = document.getElementById('mission-aao-group'); if (!ARRContainer) return; @@ -410,7 +409,7 @@ export default ( LSSM.$stores.root.hook({ event: 'aao_available', callback(id: number) { - const arr = document.querySelector(`#aao_${id}`); + const arr = document.getElementById(`aao_${id}`) as HTMLAnchorElement; if (!arr) return; const buildingIds: number[] = JSON.parse( arr.getAttribute('building_ids') || '[]' diff --git a/src/modules/extendedCallWindow/assets/arrMatchHighlight.ts b/src/modules/extendedCallWindow/assets/arrMatchHighlight.ts index 81e0a7dbec..8d70b86409 100644 --- a/src/modules/extendedCallWindow/assets/arrMatchHighlight.ts +++ b/src/modules/extendedCallWindow/assets/arrMatchHighlight.ts @@ -1,7 +1,7 @@ import type { $m } from 'typings/Module'; export default (LSSM: Vue, allWords: boolean, $m: $m): void => { - const title = document.querySelector('#mission_general_info'); + const title = document.getElementById('mission_general_info'); if (!title) return; const greyClass = LSSM.$stores.root.nodeAttribute('arr-grey'); diff --git a/src/modules/extendedCallWindow/assets/arrSearch.ts b/src/modules/extendedCallWindow/assets/arrSearch.ts index ed4768c6cb..62a5e38306 100644 --- a/src/modules/extendedCallWindow/assets/arrSearch.ts +++ b/src/modules/extendedCallWindow/assets/arrSearch.ts @@ -11,8 +11,7 @@ export default ( clearOnEnter: boolean, $sm: $m ) => { - const aaoGroupElement = - document.querySelector('#mission-aao-group'); + const aaoGroupElement = document.getElementById('mission-aao-group'); if (!aaoGroupElement) return; if (!dropdown) { diff --git a/src/modules/extendedCallWindow/assets/emv/getVehicleListObserveHandler.ts b/src/modules/extendedCallWindow/assets/emv/getVehicleListObserveHandler.ts index 02094949d2..ac31ffede1 100644 --- a/src/modules/extendedCallWindow/assets/emv/getVehicleListObserveHandler.ts +++ b/src/modules/extendedCallWindow/assets/emv/getVehicleListObserveHandler.ts @@ -32,10 +32,8 @@ export default ( group: Group ) => void ) => { - const vehicleList = document.querySelector( - '#vehicle_show_table_body_all' - ); - const occupiedList = document.querySelector('#occupied'); + const vehicleList = document.getElementById('vehicle_show_table_body_all'); + const occupiedList = document.getElementById('occupied'); if (!vehicleList || !occupiedList) return; diff --git a/src/modules/extendedCallWindow/assets/enhancedHeader.ts b/src/modules/extendedCallWindow/assets/enhancedHeader.ts index 21f81bb2b1..6f1776583c 100644 --- a/src/modules/extendedCallWindow/assets/enhancedHeader.ts +++ b/src/modules/extendedCallWindow/assets/enhancedHeader.ts @@ -30,8 +30,7 @@ export default (LSSM: Vue, sticky: boolean, load: boolean): void => { '.missing_vehicles_load' ) as HTMLAnchorElement | null; if (load && loadBtn) { - const people_amount = - document.querySelector('#amount_of_people'); + const people_amount = document.getElementById('amount_of_people'); if (people_amount && people_amount.parentElement) { people_amount.parentElement.classList.add( `col-md-${ diff --git a/src/modules/extendedCallWindow/assets/enhancedMissingVehicles.ts b/src/modules/extendedCallWindow/assets/enhancedMissingVehicles.ts index 9414212c08..49ddcc64e2 100644 --- a/src/modules/extendedCallWindow/assets/enhancedMissingVehicles.ts +++ b/src/modules/extendedCallWindow/assets/enhancedMissingVehicles.ts @@ -7,8 +7,9 @@ export default ( getSetting: Parameters[0]['getSetting'], $m: $m ): void => { - const missingDialog = - document.querySelector('#missing_text'); + const missingDialog = document.getElementById( + 'missing_text' + ) as HTMLDivElement; if (!missingDialog) return; import( diff --git a/src/modules/extendedCallWindow/assets/hideVehicleList.ts b/src/modules/extendedCallWindow/assets/hideVehicleList.ts index 2ccd24a0c2..dea0f161ee 100644 --- a/src/modules/extendedCallWindow/assets/hideVehicleList.ts +++ b/src/modules/extendedCallWindow/assets/hideVehicleList.ts @@ -9,13 +9,12 @@ export default (LSSM: Vue, MODULE_ID: string, $m: $m): void => { btn.setAttribute('id', toggleBtnId); btn.classList.add('btn', 'btn-success'); const toggleHidden = () => { - const free_vehicles = document.querySelector('#h2_free_vehicles'); + const free_vehicles = document.getElementById('h2_free_vehicles'); free_vehicles?.classList.toggle('hidden'); - const vehicle_list_step = document.querySelector('#vehicle_list_step'); + const vehicle_list_step = document.getElementById('vehicle_list_step'); vehicle_list_step?.classList.toggle('hidden'); - const group_max_distance = document.querySelector( - '#group_max_distance' - ); + const group_max_distance = + document.getElementById('group_max_distance'); group_max_distance?.classList.toggle('hidden'); btn.textContent = $m( `hideVehicleList.${ diff --git a/src/modules/extendedCallWindow/assets/missionKeywords.ts b/src/modules/extendedCallWindow/assets/missionKeywords.ts index eb330f1dc5..569159793a 100644 --- a/src/modules/extendedCallWindow/assets/missionKeywords.ts +++ b/src/modules/extendedCallWindow/assets/missionKeywords.ts @@ -9,8 +9,7 @@ export default async ( missions: (number | string)[]; }[] ): Promise => { - const missionTitle = - document.querySelector('#missionH1'); + const missionTitle = document.getElementById('missionH1'); if (!missionTitle) return; const missionType = LSSM.$utils.getMissionTypeInMissionWindow(); diff --git a/src/modules/extendedCallWindow/assets/selectedVehicleCounter.ts b/src/modules/extendedCallWindow/assets/selectedVehicleCounter.ts index 4f5de3e7a3..b5c7551baf 100644 --- a/src/modules/extendedCallWindow/assets/selectedVehicleCounter.ts +++ b/src/modules/extendedCallWindow/assets/selectedVehicleCounter.ts @@ -67,7 +67,7 @@ export default (LSSM: Vue, MODULE_ID: string, btnVehicles: string[]): void => { ); }); - document.querySelector('#navbar-alarm-spacer')?.before(holder); + document.getElementById('navbar-alarm-spacer')?.before(holder); LSSM.$stores.root.addStyle({ selectorText: `#${table.id} tr:nth-child(1) td`, diff --git a/src/modules/extendedCallWindow/assets/tailoredTabs.ts b/src/modules/extendedCallWindow/assets/tailoredTabs.ts index b10f5dbb2a..93cc71da69 100644 --- a/src/modules/extendedCallWindow/assets/tailoredTabs.ts +++ b/src/modules/extendedCallWindow/assets/tailoredTabs.ts @@ -40,8 +40,7 @@ export default ( // remove all existing tabs except all and occupied const tabList = - document.querySelector('#tabs') ?? - document.createElement('ul'); + document.getElementById('tabs') ?? document.createElement('ul'); tabList ?.querySelectorAll( 'li > a:not([tabload="all"]):not([tabload="occupied"])' @@ -155,7 +154,7 @@ export default ( allTab.append(allTabA); tabList.append(allTab); - document.querySelector('#vehicle_show_table_all')?.before(tabList); + document.getElementById('vehicle_show_table_all')?.before(tabList); } else { const originalAllTab = document.querySelector( '#tabs > li:first-child' diff --git a/src/modules/extendedCallWindow/assets/vehicleListPermanentSearch.ts b/src/modules/extendedCallWindow/assets/vehicleListPermanentSearch.ts index cd0d56bf16..3c7e6e401a 100644 --- a/src/modules/extendedCallWindow/assets/vehicleListPermanentSearch.ts +++ b/src/modules/extendedCallWindow/assets/vehicleListPermanentSearch.ts @@ -13,7 +13,7 @@ export default (): void => { if (vehicleSearch?.offsetParent === null) enableSearchBtn?.click(); } - const vehicleTabs = document.querySelector('#tabs'); + const vehicleTabs = document.getElementById('tabs'); if (vehicleTabs) vehicleTabs.addEventListener('click', vehicleListChange); //Initial expanding vehicleListChange(); diff --git a/src/modules/extendedCallWindow/assets/vehiclePlayerCounter.ts b/src/modules/extendedCallWindow/assets/vehiclePlayerCounter.ts index d973c6db0b..32e9d56d09 100644 --- a/src/modules/extendedCallWindow/assets/vehiclePlayerCounter.ts +++ b/src/modules/extendedCallWindow/assets/vehiclePlayerCounter.ts @@ -10,8 +10,7 @@ export default ( playerCounter: boolean, counterColors: Record ) => { - const amountOfPeopleSpan = - document.querySelector('#amount_of_people'); + const amountOfPeopleSpan = document.getElementById('amount_of_people'); if (!amountOfPeopleSpan) return; diff --git a/src/modules/extendedCallWindow/main.ts b/src/modules/extendedCallWindow/main.ts index 853024be84..d831354f61 100644 --- a/src/modules/extendedCallWindow/main.ts +++ b/src/modules/extendedCallWindow/main.ts @@ -73,7 +73,7 @@ export default (async ({ vehicleTypes: string[]; }[]; - if (isBuildingWindow && !document.querySelector('#education_schooling_-1')) + if (isBuildingWindow && !document.getElementById('education_schooling_-1')) return; // Tailored Tabs diff --git a/src/modules/extendedMap/assets/buildingComplexes.ts b/src/modules/extendedMap/assets/buildingComplexes.ts index 3214fca012..65af346cc1 100644 --- a/src/modules/extendedMap/assets/buildingComplexes.ts +++ b/src/modules/extendedMap/assets/buildingComplexes.ts @@ -139,7 +139,7 @@ export default async ( }); if ( window.buildingMarkerBulkContentCache.length && - document.querySelector('#building_list') + document.getElementById('building_list') ) window.buildingMarkerBulkContentCacheDraw(); }; diff --git a/src/modules/generalExtensions/assets/clickableLinks.ts b/src/modules/generalExtensions/assets/clickableLinks.ts index f3b409d8cb..bd7a68fad5 100644 --- a/src/modules/generalExtensions/assets/clickableLinks.ts +++ b/src/modules/generalExtensions/assets/clickableLinks.ts @@ -14,11 +14,12 @@ export default async (LSSM: Vue, showImg: boolean): Promise => { if (window.location.pathname === '/') { await scopedClickableLinks( - document.querySelector('#chat_panel_body') ?? document + document.getElementById('chat_panel_body') ?? document ); } else if (/^\/note\/?/u.test(window.location.pathname)) { - const input = - document.querySelector('#note_message'); + const input = document.getElementById( + 'note_message' + ) as HTMLTextAreaElement; if (input) { const preview = document.createElement('pre'); preview.classList.add('input-group', 'form-control'); @@ -32,7 +33,7 @@ export default async (LSSM: Vue, showImg: boolean): Promise => { await scopedClickableLinks(document); } - document.querySelector('#chat_panel_body')?.addEventListener( + document.getElementById('chat_panel_body')?.addEventListener( 'error', e => { const img = e.target as HTMLElement | null; diff --git a/src/modules/generalExtensions/assets/inputMaxLen.ts b/src/modules/generalExtensions/assets/inputMaxLen.ts index 4420ae625a..3c167e5f3b 100644 --- a/src/modules/generalExtensions/assets/inputMaxLen.ts +++ b/src/modules/generalExtensions/assets/inputMaxLen.ts @@ -140,7 +140,7 @@ export default (LSSM: Vue): void => { `${target.id}_${entry[0]}`, true ); - let counter = document.querySelector(`#${counterId}`); + let counter = document.getElementById(counterId); if (!counter) { counter = document.createElement('small'); counter.id = counterId; diff --git a/src/modules/generalExtensions/assets/mapSearches.ts b/src/modules/generalExtensions/assets/mapSearches.ts index 6f79542738..343d2d92b6 100644 --- a/src/modules/generalExtensions/assets/mapSearches.ts +++ b/src/modules/generalExtensions/assets/mapSearches.ts @@ -8,7 +8,7 @@ export default ( LSSM: Vue ): void => { const addToMap = (map = window.map, id = 'map') => { - if (!(map && document.querySelector(`#${id}`))) return; + if (!(map && document.getElementById(id))) return; let form = document.createElement('form'); form.id = LSSM.$stores.root.nodeAttribute( diff --git a/src/modules/generalExtensions/assets/newBuilding.ts b/src/modules/generalExtensions/assets/newBuilding.ts index af8fcb91ee..e8e9cd7ccb 100644 --- a/src/modules/generalExtensions/assets/newBuilding.ts +++ b/src/modules/generalExtensions/assets/newBuilding.ts @@ -222,8 +222,7 @@ export default async ( }) ); - const buildingsElement = - document.querySelector('#buildings'); + const buildingsElement = document.getElementById('buildings'); if (buildingsElement) observer.observe(buildingsElement, { childList: true }); }; diff --git a/src/modules/generalExtensions/main.ts b/src/modules/generalExtensions/main.ts index 4836e4fec2..5a89a6bbde 100644 --- a/src/modules/generalExtensions/main.ts +++ b/src/modules/generalExtensions/main.ts @@ -89,7 +89,7 @@ export default (async ({ LSSM, MODULE_ID, $m, getSetting, setSetting }) => { ); const isDispatchCenter = /^\/buildings\/\d+\/?$/u.test(window.location.pathname) && - !!document.querySelector('#tab_projected_missions'); + !!document.getElementById('tab_projected_missions'); const mapSearchOnMap = await getSetting('mapSearchOnMap'); diff --git a/src/modules/hotkeys/assets/commands/building.ts b/src/modules/hotkeys/assets/commands/building.ts index 186d3e9a38..79aefa919a 100644 --- a/src/modules/hotkeys/assets/commands/building.ts +++ b/src/modules/hotkeys/assets/commands/building.ts @@ -198,8 +198,9 @@ export default >{ .getBuilding(buildingId, 'hotkeys-building-dispatch') .then(result => { if (dispatchType.includes(result?.building_type)) { - this.ulList = - document.querySelector('#tabs'); + this.ulList = document.getElementById( + 'tabs' + ) as HTMLUListElement; } return !!this.ulList; }) diff --git a/src/modules/hotkeys/assets/commands/main.ts b/src/modules/hotkeys/assets/commands/main.ts index 65b250a4f4..48ac4b50d9 100644 --- a/src/modules/hotkeys/assets/commands/main.ts +++ b/src/modules/hotkeys/assets/commands/main.ts @@ -5,9 +5,9 @@ export default < >{ chat: >{ validatorFunction() { - this.chatInput = document.querySelector( - '#alliance_chat_message' - ); + this.chatInput = document.getElementById( + 'alliance_chat_message' + ) as HTMLInputElement; return !!this.chatInput; }, focus() { @@ -16,14 +16,13 @@ export default < }, map: >{ validatorFunction() { - return !!document.querySelector('#map'); + return !!document.getElementById('map'); }, search: >{ validatorFunction() { - this.mapSearch = - document.querySelector( - '#map_adress_search' - ); + this.mapSearch = document.getElementById( + 'map_adress_search' + ) as HTMLInputElement; return !!this.mapSearch; }, focus() { @@ -81,16 +80,15 @@ export default < }, missionlist: >{ validatorFunction() { - return !!document.querySelector('#missions'); + return !!document.getElementById('missions'); }, search: < Scope<{ missionlistSearch: HTMLInputElement | null }, [], ['focus']> >{ validatorFunction() { - this.missionlistSearch = - document.querySelector( - '#search_input_field_missions' - ); + this.missionlistSearch = document.getElementById( + 'search_input_field_missions' + ) as HTMLInputElement; return !!this.missionlistSearch; }, focus() { @@ -162,8 +160,9 @@ export default < }, bigMap: >{ validatorFunction() { - this.bigMapMenu = - document.querySelector('#bigMapMenu'); + this.bigMapMenu = document.getElementById( + 'bigMapMenu' + ) as HTMLDivElement; return !!this.bigMapMenu; }, diff --git a/src/modules/hotkeys/assets/commands/mission.ts b/src/modules/hotkeys/assets/commands/mission.ts index 1a20d402c7..07d116f103 100644 --- a/src/modules/hotkeys/assets/commands/mission.ts +++ b/src/modules/hotkeys/assets/commands/mission.ts @@ -56,8 +56,11 @@ export default < }, alert_next() { if ( - document.querySelector(`#${this.toggleId}`) - ?.checked + ( + document.getElementById( + this.toggleId + ) as HTMLInputElement + )?.checked ) { document .querySelector( @@ -70,8 +73,11 @@ export default < }, prev() { if ( - document.querySelector(`#${this.toggleId}`) - ?.checked + ( + document.getElementById( + this.toggleId + ) as HTMLInputElement + )?.checked ) { document .querySelector( @@ -84,8 +90,11 @@ export default < }, next() { if ( - document.querySelector(`#${this.toggleId}`) - ?.checked + ( + document.getElementById( + this.toggleId + ) as HTMLInputElement + )?.checked ) { document .querySelector( @@ -98,8 +107,11 @@ export default < }, alert_share_next() { if ( - document.querySelector(`#${this.toggleId}`) - ?.checked + ( + document.getElementById( + this.toggleId + ) as HTMLInputElement + )?.checked ) { document .querySelector( @@ -122,12 +134,12 @@ export default < > >{ validatorFunction() { - this.responseInputbox = document.querySelector( - '#mission_reply_content' - ); - this.responseCheckbox = document.querySelector( - '#mission_reply_alliance_chat' - ); + this.responseInputbox = document.getElementById( + 'mission_reply_content' + ) as HTMLInputElement; + this.responseCheckbox = document.getElementById( + 'mission_reply_alliance_chat' + ) as HTMLInputElement; return !!this.responseInputbox && !!this.responseCheckbox; }, toggle() { @@ -142,8 +154,9 @@ export default < Scope<{ arrList: HTMLUListElement | null }, [], ['next', 'previous']> >{ validatorFunction() { - this.arrList = - document.querySelector('#aao-tabs'); + this.arrList = document.getElementById( + 'aao-tabs' + ) as HTMLUListElement; return !!this.arrList; }, next() { @@ -175,8 +188,9 @@ export default < > >{ validatorFunction() { - this.vehicleList = - document.querySelector('#tabs'); + this.vehicleList = document.getElementById( + 'tabs' + ) as HTMLUListElement; return !!this.vehicleList; }, next() { @@ -262,17 +276,13 @@ export default < ?.click(); }, alert_next() { - document.querySelector('#alert_next_btn')?.click(); + document.getElementById('alert_next_btn')?.click(); }, prev() { - document - .querySelector('#mission_previous_mission_btn') - ?.click(); + document.getElementById('mission_previous_mission_btn')?.click(); }, next() { - document - .querySelector('#mission_next_mission_btn') - ?.click(); + document.getElementById('mission_next_mission_btn')?.click(); }, alert_share_next() { document @@ -280,14 +290,12 @@ export default < ?.click(); }, share() { - document - .querySelector('#mission_alliance_share_btn') - ?.click(); + document.getElementById('mission_alliance_share_btn')?.click(); }, alert() { - document.querySelector('#alert_btn')?.click(); + document.getElementById('alert_btn')?.click(); }, easter_click() { - document.querySelector('#easter-egg-link')?.click(); + document.getElementById('easter-egg-link')?.click(); }, }; diff --git a/src/modules/messageTemplates/assets/conversations/main.ts b/src/modules/messageTemplates/assets/conversations/main.ts index b86214e06e..3ea90516e9 100644 --- a/src/modules/messageTemplates/assets/conversations/main.ts +++ b/src/modules/messageTemplates/assets/conversations/main.ts @@ -21,11 +21,13 @@ export default (messages: ConversationMessageTemplate[], $m: $m) => { optionList, {}, (subject, body) => { - const titleEl = - document.querySelector('#message_subject'); + const titleEl = document.getElementById( + 'message_subject' + ) as HTMLInputElement; if (titleEl) titleEl.value = subject; - const bodyEl = - document.querySelector('#message_body'); + const bodyEl = document.getElementById( + 'message_body' + ) as HTMLTextAreaElement; if (bodyEl) bodyEl.value = body; }, preselected diff --git a/src/modules/missionHelper/main.ts b/src/modules/missionHelper/main.ts index 715f6acd0f..1761b6472c 100644 --- a/src/modules/missionHelper/main.ts +++ b/src/modules/missionHelper/main.ts @@ -23,8 +23,7 @@ export default (async ({ LSSM, $m, $mc, getSetting, setSetting }) => { const clear = document.createElement('div'); clear.classList.add('clearfix'); - const missionForm = - document.querySelector('#mission-form'); + const missionForm = document.getElementById('mission-form'); missionForm?.before(clear); new LSSM.$vue({ diff --git a/src/modules/missionHelper/missionHelper.vue b/src/modules/missionHelper/missionHelper.vue index 34780f4c31..0ab04245a5 100644 --- a/src/modules/missionHelper/missionHelper.vue +++ b/src/modules/missionHelper/missionHelper.vue @@ -730,8 +730,7 @@ export default Vue.extend< async reloadSpecs() { this.isReloading = true; - const missionHelpBtn = - document.querySelector('#mission_help'); + const missionHelpBtn = document.getElementById('mission_help'); this.isDiyMission = !missionHelpBtn; this.missionSpecs = undefined; diff --git a/src/modules/shareAlliancePost/assets/largeScaleAllianceMission.ts b/src/modules/shareAlliancePost/assets/largeScaleAllianceMission.ts index 60bde69917..083940339b 100644 --- a/src/modules/shareAlliancePost/assets/largeScaleAllianceMission.ts +++ b/src/modules/shareAlliancePost/assets/largeScaleAllianceMission.ts @@ -370,8 +370,7 @@ export default async ({ }) ); - const buildingsElement = - document.querySelector('#buildings'); + const buildingsElement = document.getElementById('buildings'); if (buildingsElement) observer.observe(buildingsElement, { childList: true }); }; diff --git a/src/modules/shareAlliancePost/assets/missionWindow.ts b/src/modules/shareAlliancePost/assets/missionWindow.ts index 7e46eb65c9..34c43fcbfa 100644 --- a/src/modules/shareAlliancePost/assets/missionWindow.ts +++ b/src/modules/shareAlliancePost/assets/missionWindow.ts @@ -78,13 +78,13 @@ export default async ({ .length.toLocaleString(); const missingTextEl = - document.querySelector('#missing_text') ?? + (document.getElementById('missing_text') as HTMLDivElement) ?? document.createElement('div'); // that comes from emv if (!missingTextEl.id) { missingTextEl.innerHTML = - document.querySelector(`#${PREFIX}-missing_text`) - ?.dataset.rawHtml ?? '–'; + document.getElementById(`${PREFIX}-missing_text`)?.dataset + .rawHtml ?? '–'; } const remainingVehicles = @@ -134,8 +134,7 @@ export default async ({ typeof getMissingRequirementsListHandler >; - const vehicleAmountElement = - document.querySelector('#vehicle_amount'); + const vehicleAmountElement = document.getElementById('vehicle_amount'); if (vehicleAmountElement) { new MutationObserver(() => { const selectedVehicles = Array.from( @@ -205,7 +204,7 @@ export default async ({ attributes: true, }); - const allTable = document.querySelector('#vehicle_show_table_all'); + const allTable = document.getElementById('vehicle_show_table_all'); if (allTable && missingRequirementsListHandler) { new MutationObserver(missingRequirementsListHandler).observe( allTable, @@ -220,10 +219,7 @@ export default async ({ const missionName = missionType?.name ?? - Array.from( - document.querySelector(`#missionH1`) - ?.childNodes ?? [] - ) + Array.from(document.getElementById(`missionH1`)?.childNodes ?? []) .find(n => n.nodeType === Node.TEXT_NODE && n.textContent?.trim()) ?.textContent?.trim() ?? ''; diff --git a/src/natives/lightbox.ts b/src/natives/lightbox.ts index ac05e4dc96..d9b2d7a0d5 100644 --- a/src/natives/lightbox.ts +++ b/src/natives/lightbox.ts @@ -1,4 +1,4 @@ -if (!document.querySelector('#lightbox_background')) { +if (!document.getElementById('lightbox_background')) { const bg = document.createElement('div'); bg.id = 'lightbox_background'; bg.addEventListener('click', () => window.lightboxClose()); diff --git a/src/utils.ts b/src/utils.ts index 9f43b20b25..adfc26ac21 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -9,8 +9,7 @@ export default (Vue: VueConstructor): void => { return s.replace(/[$()*+.?[\\\]^|]/gu, '\\$&'); }, getMissionTypeInMissionWindow() { - const missionHelpBtn = - document.querySelector('#mission_help'); + const missionHelpBtn = document.getElementById('mission_help'); if (!missionHelpBtn) return '-1'; let missionType = new URL( @@ -115,7 +114,7 @@ export default (Vue: VueConstructor): void => { const $utils = (window[PREFIX] as Vue).$utils; if (initialCall && $utils.activeCountdowns.includes(id)) return; - const element = document.querySelector(`#${id}`); + const element = document.getElementById(id); const activeIndex = $utils.activeCountdowns.indexOf(id); if (!element || countdown <= 0) { if (activeIndex >= 0)