Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Oct 14, 2023
1 parent 6e529ec commit f24cb5a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 41 deletions.
33 changes: 18 additions & 15 deletions Configuration/ESBuild.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import type { PluginBuild, BuildOptions } from "esbuild";

import { copy as Copy } from "esbuild-plugin-copy";
import { rm as Remove } from "fs/promises";

const outDir = "Target";

/**
* @module ESBuild
*
*/
export default {
format: "esm",
minify: true,
outdir: outDir,
outdir: "Target",
bundle: true,
platform: "browser",
target: ["edge104", "esnext"],
plugins: [
{
name: "Target",
setup: (Build: PluginBuild) =>
Build.onStart(async () => {
setup: ({ onStart, initialOptions: { outdir } }) =>
onStart(async () => {
try {
await Remove(outDir, {
recursive: true,
});
outdir
? await (
await import("fs/promises")
).rm(outdir, {
recursive: true,
})
: {};
} catch (_Error) {}
}),
},
Copy({
(await import("esbuild-plugin-copy")).copy({
resolveFrom: "out",
assets: [
{
Expand All @@ -34,4 +35,6 @@ export default {
],
}),
],
} satisfies Type;
} satisfies BuildOptions;

import type { BuildOptions } from "esbuild";
20 changes: 11 additions & 9 deletions Source/Script/Fa.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import DOM from "../Library/DOM.js";

declare global {
interface Window {
interval: NodeJS.Timer;
Expand All @@ -16,20 +14,20 @@ const refresh = async () => {
window.timeout = setTimeout(
async () =>
(
await DOM.getElement(
await getElement(
'[data-testid="aircraft-panel__header"] button.rounded-md'
)
).forEach((el) => el.click()),
25000
);

const Focus = await DOM.getElement(
const Focus = await getElement(
'[data-testid="most-tracked-flights-widget"] [data-testid="list-wrapper"] > div'
);

const Identifier = Math.floor(Math.random() * Focus.length);

(await DOM.getElement('[data-testid="map-controls__zoom-in"]')).forEach(
(await getElement('[data-testid="map-controls__zoom-in"]')).forEach(
(el) =>
setTimeout(() => {
el?.click();
Expand All @@ -40,7 +38,7 @@ const refresh = async () => {
Focus.item(Identifier)?.click();

(
await DOM.getElement(
await getElement(
'.ui-icon.ui-icon-closethick,[data-testid="aircraft__not-live-flight"] [data-testid="base-button"]'
)
).forEach((el) => {
Expand All @@ -49,24 +47,28 @@ const refresh = async () => {

setTimeout(async () => {
(
await DOM.getElement(
await getElement(
'[data-testid="aircraft__follow-flight-button"]:not(.text-yellow-500)'
)
)
.item(0)
?.click();

(
await DOM.getElement(
await getElement(
'[data-testid="aircraft-panel__more__hide-not-selected-btn"] [aria-checked="false"]'
)
).forEach((el) => el?.parentElement?.click());
}, 3000);

(
await DOM.getElement(".overlay-views-panel,.section.search-overlay")
await getElement(".overlay-views-panel,.section.search-overlay")
).forEach((el) => el.remove());
}, 30000);
};

await refresh();

export const {
default: { getElement },
} = await import("../Library/DOM.js");
27 changes: 13 additions & 14 deletions Source/Script/Ta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import DOM from "../Library/DOM.js";

declare global {
interface Window {
interval: NodeJS.Timer;
Expand All @@ -12,28 +10,25 @@ const refresh = async () => {
window.interval = setInterval(async () => {
clearInterval(window.interval);

(await DOM.getElement(".js-column")).forEach(async (el) => {
const focus = await DOM.getElement(".js-stream-item", el);
(await getElement(".js-column")).forEach(async (el) => {
const focus = await getElement(".js-stream-item", el);
const length = focus.length;
const id = Math.floor(Math.random() * length);

if (
(await DOM.getElement(".btd-content-warning", focus.item(id)))
(await getElement(".btd-content-warning", focus.item(id)))
.length === 0
) {
(
await DOM.getElement(
".js-stream-item-content",
focus.item(id)
)
await getElement(".js-stream-item-content", focus.item(id))
).forEach(async (el) => {
el?.click();
});
}

setTimeout(
async () => {
const focus = await DOM.getElement(".js-column-back");
const focus = await getElement(".js-column-back");

focus.forEach((el) => {
el?.click();
Expand All @@ -46,7 +41,7 @@ const refresh = async () => {

setTimeout(
async () => {
const focus = await DOM.getElement(".column-type-icon");
const focus = await getElement(".column-type-icon");

focus.forEach((el) => {
el?.click();
Expand All @@ -62,14 +57,14 @@ const refresh = async () => {

setInterval(
async () =>
(await DOM.getElement(".btd-clear-column-link")).forEach((el) => {
(await getElement(".btd-clear-column-link")).forEach((el) => {
el?.click();
}),
55000
);

setInterval(async () => {
const translations = await DOM.getElement(".js-translate-call-to-action");
const translations = await getElement(".js-translate-call-to-action");

let index = 0;

Expand All @@ -83,7 +78,7 @@ setInterval(async () => {
setTimeout(
async () =>
(
await DOM.getElement(
await getElement(
".js-tweet-detail.tweet-detail-wrapper .js-tweet-translation-text.tweet-translation-text"
)
).forEach((el) => {
Expand All @@ -101,3 +96,7 @@ setInterval(async () => {
}, 15000);

await refresh();

export const {
default: { getElement },
} = await import("../Library/DOM.js");
4 changes: 1 addition & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { defineConfig } from "vite";

export default defineConfig({
export default (await import("vite")).defineConfig({
publicDir: "./Public",
clearScreen: false,
server: {
Expand Down

0 comments on commit f24cb5a

Please sign in to comment.