diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-03-25 15:05:15 +0100 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-03-25 15:05:15 +0100 |
| commit | 3df4ebc26d93afed16670e37edb26aa3b5a17317 (patch) | |
| tree | 462838b07a70bf6a2aced9541bfe81f08be0e05c | |
| parent | ca297c3df1cacc902cadb21bea4dbf525913325a (diff) | |
| download | mlos-3df4ebc26d93afed16670e37edb26aa3b5a17317.tar.gz mlos-3df4ebc26d93afed16670e37edb26aa3b5a17317.tar.zst mlos-3df4ebc26d93afed16670e37edb26aa3b5a17317.zip | |
Hotfix, remove all JS
| -rw-r--r-- | api/add.php | 4 | ||||
| -rw-r--r-- | api/set-session.php | 4 | ||||
| -rw-r--r-- | index.html | 76 | ||||
| -rw-r--r-- | index.php | 45 | ||||
| -rw-r--r-- | package.json | 14 | ||||
| -rw-r--r-- | pnpm-lock.yaml | 324 | ||||
| -rw-r--r-- | src/db.xml | 4 | ||||
| -rw-r--r-- | src/main.js | 83 | ||||
| -rw-r--r-- | src/main.ts | 67 | ||||
| -rw-r--r-- | tsconfig.json | 17 |
10 files changed, 40 insertions, 598 deletions
diff --git a/api/add.php b/api/add.php index b2e4c2d..780a3b4 100644 --- a/api/add.php +++ b/api/add.php @@ -1,4 +1,5 @@ <?php +session_start(); $req_keys = ["name", "author", "thumbnail", "magazine"]; header("Location: " . $_SERVER["HTTP_REFERER"]); foreach ($req_keys as $key) { @@ -22,12 +23,11 @@ error_log("ID: " . $id); if ($id) { $xpath = new DOMXpath($doc); $game = $xpath->query('//game[@id="' . $id . '"]')->item(0); - var_dump($game); - var_dump($game->getElementsByTagName); $xpath->query('//game[@id="' . $id . '"]/name')->item(0)->nodeValue = $name; $xpath->query('//game[@id="' . $id . '"]/author')->item(0)->nodeValue = $author; $xpath->query('//game[@id="' . $id . '"]/thumbnail')->item(0)->nodeValue = $thumbnail; $xpath->query('//game[@id="' . $id . '"]/magazine')->item(0)->nodeValue = $magazine; + $_SESSION["eid"] = null; } else { $root = $doc->getElementsByTagName("root")->item(0); $game = $doc->createElement("game", ""); diff --git a/api/set-session.php b/api/set-session.php new file mode 100644 index 0000000..a644b12 --- /dev/null +++ b/api/set-session.php @@ -0,0 +1,4 @@ +<?php +session_start(); +$_SESSION["eid"] = $_GET["eid"]; +header("Location: " . $_SERVER["HTTP_REFERER"]); diff --git a/index.html b/index.html deleted file mode 100644 index a9e21d1..0000000 --- a/index.html +++ /dev/null @@ -1,76 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - -<head> - <meta charset="UTF-8" /> - <link rel="icon" type="image/svg+xml" href="favicon.svg" /> - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>Markup Language of Saddness</title> -</head> - -<body> - <header> - <button type="button"><a href="?a=2">Positions</a></button> - <button type="button"><a href="?a=1">Preview</a></button> - </header> - <table> - <thead> - <tr> - <th></th> - <th>Game name</th> - <th>Thumbnail</th> - <th>Author</th> - <th>Magazine</th> - <th></th> - </tr> - </thead> - <tbody> - <!-- <tr> --> - <!-- <form action="api/remove.php" method="post"> --> - <!-- <td><input type="submit" onclick="edit(event)" value="E" data-id="1"></td> --> - <!-- <td data-id="1">aaa</td> --> - <!-- <td data-id="1"><img --> - <!-- src="https://imgs.search.brave.com/KqHJJsmXK8iQNxtSGxWy2TljZv7KDdyCz9o6iGYoFRk/rs:fit:1200:1200:1/g:ce/aHR0cHM6Ly93d3cu/bGFrZXN1cGVyaW9y/LmNvbS9kb3dubG9h/ZHMvNzE1MC9kb3du/bG9hZC80MDFwYy5i/aG00LmpwZz9jYj1k/M2NiNTE1NzA5YjFl/M2IwMjc5YzBkMDZi/YWU4YzRiNCZ3PTEy/MDA" --> - <!-- width="200"></td> --> - <!-- <td data-id="1">aaa</td> --> - <!-- <td data-id="1">aaane</td> --> - <!-- <td><input type="submit" value="Remove" data-id="1"></td> --> - <!-- <input type="hidden" name="id" value="1" data-id="1" /> --> - <!-- </form> --> - <!-- </tr> --> - <tr> - <form action="api/remove.php" method="post"> - <td><input type="submit" onclick="edit(event)" value="E" data-id="1"></td> - <td data-id="1">aaa</td> - <td data-id="1">aaaail</td> - <td data-id="1">aaa</td> - <td data-id="1">aaane</td> - <td><input type="submit" value="Remove" data-id="1"></td> - </form> - </tr> - <tr> - <form action="api/remove.php" method="post"> - <td><input type="submit" onclick="edit(event)" value="E" data-id="2"></td> - <td data-id="2">aaa</td> - <td data-id="2">aaaail</td> - <td data-id="2">aaa</td> - <td data-id="2">aaane</td> - <td><input type="submit" value="Remove" data-id="2"></td> - </form> - </tr> - <!-- <tr> --> - <!-- <form action="api/add.php" method="post"> --> - <!-- <td></td> --> - <!-- <td><input type="text" name="name"></td> --> - <!-- <td><input type="text" name="thumbnail"></td> --> - <!-- <td><input type="text" name="author"></td> --> - <!-- <td><input type="text" name="magazine"></td> --> - <!-- <td><input type="submit" value="Add"></td> --> - <!-- </form> --> - <!-- </tr> --> - </tbody> - </table> - <script type="module" src="/src/main.ts"></script> -</body> - -</html> @@ -10,7 +10,9 @@ </head> <?php +session_start(); require_once "src/data.php"; +$eid = $_SESSION["eid"]; [$data, $count] = get_data(); function is_pos(): bool { @@ -38,29 +40,44 @@ function is_pos(): bool </thead> <tbody> <?php if (is_pos()) { ?> - <?php foreach ($data as $d) { ?> + <?php foreach ($data as $d) { + $id = $d['id']; ?> <tr> <form action="api/change-order.php" method="post"> <td> - <?php if ($d["order"] !== $count) { ?> + <?php if ($d["order"] !== $count && $eid === null) { ?> <input type="hidden" name="old-order" value="<?= $d["order"] ?>"> <input type="hidden" name="new-order" value="<?= intval($d["order"]) + 1 ?>"> <input type="submit" value="pos -" /> <?php } ?> </td> </form> - <form action="api/remove.php" method="post"> - <td><input type="submit" onclick="edit(event)" value="E" data-id="<?= $d['id'] ?>"></td> - <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["name"]) ?></td> - <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["thumbnail"]) ?></td> - <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["author"]) ?></td> - <td data-id="<?= $d['id'] ?>"><?= $d["magazine"] ?></td> - <td><input type="submit" value="Remove" data-id="<?= $d['id'] ?>"></td> - <input type="hidden" name="id" value="<?= $d['id'] ?>" data-id="<?= $d['id'] ?>" /> - </form> + <?php if ("$eid" === $d["id"]) { ?> + <td></td> + <form action="api/add.php" method="post"> + <td><input type="text" name="name" value="<?= htmlspecialchars($d["name"]) ?>" /></td> + <td><input type="text" name="thumbnail" value="<?= htmlspecialchars($d["thumbnail"]) ?>" /></td> + <td><input type="text" name="author" value="<?= htmlspecialchars($d["author"]) ?>" /></td> + <td><input type="text" name="magazine" value="<?= $d["magazine"] ?>" /></td> + <td><input type="submit" value="Edit"></td> + <input type="hidden" name="id" value="<?= $d['id'] ?>" /> + </form> + <?php } else { ?> + <td> + <form action="/api/set-session.php?eid=<?= $id ?>" method="post"><input type="submit" value="E"></form> + </td> + <form action="api/remove.php" method="post"> + <td><?= htmlspecialchars($d["name"]) ?></td> + <td><?= htmlspecialchars($d["thumbnail"]) ?></td> + <td><?= htmlspecialchars($d["author"]) ?></td> + <td><?= $d["magazine"] ?></td> + <td><input type="submit" value="Remove"></td> + <input type="hidden" name="id" value="<?= $d['id'] ?>" /> + </form> + <?php } ?> <form action="api/change-order.php" method="post"> <td> - <?php if ($d["order"] !== "1") { ?> + <?php if ($d["order"] !== "1" && $eid === null) { ?> <input type="hidden" name="old-order" value="<?= $d["order"] ?>"> <input type="hidden" name="new-order" value="<?= intval($d["order"]) - 1 ?>"> <input type="submit" value="pos +" /> @@ -75,11 +92,13 @@ function is_pos(): bool <tr> <form action="api/remove.php" method="post"> <td></td> + <td></td> <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["name"]) ?></td> <td data-id="<?= $d['id'] ?>"><img src="/imgs/<?= htmlspecialchars($d["thumbnail"]) ?>" width="200" /></td> <td data-id="<?= $d['id'] ?>"><?= htmlspecialchars($d["author"]) ?></td> <td data-id="<?= $d['id'] ?>"><?= $d["magazine"] ?></td> <td></td> + <td></td> </form> </tr> <?php } ?> @@ -100,7 +119,7 @@ function is_pos(): bool </tbody> </table> <a href="/api/export.php">Export to xlsx</a> - <script src="/src/main.js"></script> + <!-- <script src="/src/main.js"></script> --> </body> </html> diff --git a/package.json b/package.json deleted file mode 100644 index 1882668..0000000 --- a/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "mlos", - "private": true, - "version": "0.0.0", - "scripts": { - "dev": "vite", - "build": "tsc && vite build", - "preview": "vite preview" - }, - "devDependencies": { - "typescript": "^4.5.4", - "vite": "^2.8.0" - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 3503365..0000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,324 +0,0 @@ -lockfileVersion: 5.3 - -specifiers: - typescript: ^4.5.4 - vite: ^2.8.0 - -devDependencies: - typescript: 4.6.2 - vite: 2.8.6 - -packages: - - /esbuild-android-64/0.14.25: - resolution: {integrity: sha512-L5vCUk7TzFbBnoESNoXjU3x9+/+7TDIE/1mTfy/erAfvZAqC+S3sp/Qa9wkypFMcFvN9FzvESkTlpeQDolREtQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /esbuild-android-arm64/0.14.25: - resolution: {integrity: sha512-4jv5xPjM/qNm27T5j3ZEck0PvjgQtoMHnz4FzwF5zNP56PvY2CT0WStcAIl6jNlsuDdN63rk2HRBIsO6xFbcFw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /esbuild-darwin-64/0.14.25: - resolution: {integrity: sha512-TGp8tuudIxOyWd1+8aYPxQmC1ZQyvij/AfNBa35RubixD0zJ1vkKHVAzo0Zao1zcG6pNqiSyzfPto8vmg0s7oA==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-darwin-arm64/0.14.25: - resolution: {integrity: sha512-oTcDgdm0MDVEmw2DWu8BV68pYuImpFgvWREPErBZmNA4MYKGuBRaCiJqq6jZmBR1x+3y1DWCjez+5uLtuAm6mw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-freebsd-64/0.14.25: - resolution: {integrity: sha512-ueAqbnMZ8arnuLH8tHwTCQYeptnHOUV7vA6px6j4zjjQwDx7TdP7kACPf3TLZLdJQ3CAD1XCvQ2sPhX+8tacvQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-freebsd-arm64/0.14.25: - resolution: {integrity: sha512-+ZVWud2HKh+Ob6k/qiJWjBtUg4KmJGGmbvEXXW1SNKS7hW7HU+Zq2ZCcE1akFxOPkVB+EhOty/sSek30tkCYug==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-32/0.14.25: - resolution: {integrity: sha512-3OP/lwV3kCzEz45tobH9nj+uE4ubhGsfx+tn0L26WAGtUbmmcRpqy7XRG/qK7h1mClZ+eguIANcQntYMdYklfw==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-64/0.14.25: - resolution: {integrity: sha512-+aKHdHZmX9qwVlQmu5xYXh7GsBFf4TWrePgeJTalhXHOG7NNuUwoHmketGiZEoNsWyyqwH9rE5BC+iwcLY30Ug==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-arm/0.14.25: - resolution: {integrity: sha512-aTLcE2VBoLydL943REcAcgnDi3bHtmULSXWLbjtBdtykRatJVSxKMjK9YlBXUZC4/YcNQfH7AxwVeQr9fNxPhw==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-arm64/0.14.25: - resolution: {integrity: sha512-UxfenPx/wSZx55gScCImPtXekvZQLI2GW3qe5dtlmU7luiqhp5GWPzGeQEbD3yN3xg/pHc671m5bma5Ns7lBHw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-mips64le/0.14.25: - resolution: {integrity: sha512-wLWYyqVfYx9Ur6eU5RT92yJVsaBGi5RdkoWqRHOqcJ38Kn60QMlcghsKeWfe9jcYut8LangYZ98xO1LxIoSXrQ==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-ppc64le/0.14.25: - resolution: {integrity: sha512-0dR6Csl6Zas3g4p9ULckEl8Mo8IInJh33VCJ3eaV1hj9+MHGdmDOakYMN8MZP9/5nl+NU/0ygpd14cWgy8uqRw==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-riscv64/0.14.25: - resolution: {integrity: sha512-J4d20HDmTrgvhR0bdkDhvvJGaikH3LzXQnNaseo8rcw9Yqby9A90gKUmWpfwqLVNRILvNnAmKLfBjCKU9ajg8w==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-s390x/0.14.25: - resolution: {integrity: sha512-YI2d5V6nTE73ZnhEKQD7MtsPs1EtUZJ3obS21oxQxGbbRw1G+PtJKjNyur+3t6nzHP9oTg6GHQ3S3hOLLmbDIQ==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-netbsd-64/0.14.25: - resolution: {integrity: sha512-TKIVgNWLUOkr+Exrye70XTEE1lJjdQXdM4tAXRzfHE9iBA7LXWcNtVIuSnphTqpanPzTDFarF0yqq4kpbC6miA==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-openbsd-64/0.14.25: - resolution: {integrity: sha512-QgFJ37A15D7NIXBTYEqz29+uw3nNBOIyog+3kFidANn6kjw0GHZ0lEYQn+cwjyzu94WobR+fes7cTl/ZYlHb1A==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-sunos-64/0.14.25: - resolution: {integrity: sha512-rmWfjUItYIVlqr5EnTH1+GCxXiBOC42WBZ3w++qh7n2cS9Xo0lO5pGSG2N+huOU2fX5L+6YUuJ78/vOYvefeFw==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-32/0.14.25: - resolution: {integrity: sha512-HGAxVUofl3iUIz9W10Y9XKtD0bNsK9fBXv1D55N/ljNvkrAYcGB8YCm0v7DjlwtyS6ws3dkdQyXadbxkbzaKOA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-64/0.14.25: - resolution: {integrity: sha512-TirEohRkfWU9hXLgoDxzhMQD1g8I2mOqvdQF2RS9E/wbkORTAqJHyh7wqGRCQAwNzdNXdg3JAyhQ9/177AadWA==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-arm64/0.14.25: - resolution: {integrity: sha512-4ype9ERiI45rSh+R8qUoBtaj6kJvUOI7oVLhKqPEpcF4Pa5PpT3hm/mXAyotJHREkHpM87PAJcA442mLnbtlNA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild/0.14.25: - resolution: {integrity: sha512-4JHEIOMNFvK09ziiL+iVmldIhLbn49V4NAVo888tcGFKedEZY/Y8YapfStJ6zSE23tzYPKxqKwQBnQoIO0BI/Q==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - esbuild-android-64: 0.14.25 - esbuild-android-arm64: 0.14.25 - esbuild-darwin-64: 0.14.25 - esbuild-darwin-arm64: 0.14.25 - esbuild-freebsd-64: 0.14.25 - esbuild-freebsd-arm64: 0.14.25 - esbuild-linux-32: 0.14.25 - esbuild-linux-64: 0.14.25 - esbuild-linux-arm: 0.14.25 - esbuild-linux-arm64: 0.14.25 - esbuild-linux-mips64le: 0.14.25 - esbuild-linux-ppc64le: 0.14.25 - esbuild-linux-riscv64: 0.14.25 - esbuild-linux-s390x: 0.14.25 - esbuild-netbsd-64: 0.14.25 - esbuild-openbsd-64: 0.14.25 - esbuild-sunos-64: 0.14.25 - esbuild-windows-32: 0.14.25 - esbuild-windows-64: 0.14.25 - esbuild-windows-arm64: 0.14.25 - dev: true - - /fsevents/2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /function-bind/1.1.1: - resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} - dev: true - - /has/1.0.3: - resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} - engines: {node: '>= 0.4.0'} - dependencies: - function-bind: 1.1.1 - dev: true - - /is-core-module/2.8.1: - resolution: {integrity: sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==} - dependencies: - has: 1.0.3 - dev: true - - /nanoid/3.3.1: - resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - dev: true - - /path-parse/1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - dev: true - - /picocolors/1.0.0: - resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: true - - /postcss/8.4.8: - resolution: {integrity: sha512-2tXEqGxrjvAO6U+CJzDL2Fk2kPHTv1jQsYkSoMeOis2SsYaXRO2COxTdQp99cYvif9JTXaAk9lYGc3VhJt7JPQ==} - engines: {node: ^10 || ^12 || >=14} - dependencies: - nanoid: 3.3.1 - picocolors: 1.0.0 - source-map-js: 1.0.2 - dev: true - - /resolve/1.22.0: - resolution: {integrity: sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==} - hasBin: true - dependencies: - is-core-module: 2.8.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - dev: true - - /rollup/2.70.0: - resolution: {integrity: sha512-iEzYw+syFxQ0X9RefVwhr8BA2TNJsTaX8L8dhyeyMECDbmiba+8UQzcu+xZdji0+JQ+s7kouQnw+9Oz5M19XKA==} - engines: {node: '>=10.0.0'} - hasBin: true - optionalDependencies: - fsevents: 2.3.2 - dev: true - - /source-map-js/1.0.2: - resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} - engines: {node: '>=0.10.0'} - dev: true - - /supports-preserve-symlinks-flag/1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - dev: true - - /typescript/4.6.2: - resolution: {integrity: sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: true - - /vite/2.8.6: - resolution: {integrity: sha512-e4H0QpludOVKkmOsRyqQ7LTcMUDF3mcgyNU4lmi0B5JUbe0ZxeBBl8VoZ8Y6Rfn9eFKYtdXNPcYK97ZwH+K2ug==} - engines: {node: '>=12.2.0'} - hasBin: true - peerDependencies: - less: '*' - sass: '*' - stylus: '*' - peerDependenciesMeta: - less: - optional: true - sass: - optional: true - stylus: - optional: true - dependencies: - esbuild: 0.14.25 - postcss: 8.4.8 - resolve: 1.22.0 - rollup: 2.70.0 - optionalDependencies: - fsevents: 2.3.2 - dev: true @@ -1,6 +1,6 @@ <?xml version="1.0"?> <root> - <mid>14</mid> + <mid>18</mid> <count>5</count> <game id="1" order="5"> <name>Wiedzmiń</name> @@ -10,7 +10,7 @@ </game> <game id="2" order="3"> <name>Władca pierścieni</name> - <thumbnail>ring.png</thumbnail> + <thumbnail>ring.png222</thumbnail> <author>Tolkien Sapkowski</author> <magazine>CDAction 1999</magazine> </game> diff --git a/src/main.js b/src/main.js deleted file mode 100644 index db9a00f..0000000 --- a/src/main.js +++ /dev/null @@ -1,83 +0,0 @@ -//import './style.css'; -function edit(e) { - e.preventDefault(); - const tar = e.target; - const form = tar.parentNode; - form.onseeked; - const id = tar.dataset.id; - const tds = document.querySelectorAll(`[data-id="${id}"]`); - const names = ["name", "thumbnail", "author", "magazine",]; - tds.forEach((el, i) => { - if (el.tagName === "TD") { - const v = el.innerHTML; - el.innerHTML = `<input name="${names[i]}" value="${v}">`; - } - else if (el === tar) { - el.style.display = "none"; - } - else { - const iel = el; - if (iel.type !== "hidden") { - iel.value = "Save"; - el.onclick = e => save(e, tds); - } - } - }); -} -//@ts-expect-error -window.edit = edit; -async function save(e, tds) { - console.log(tds); - const tar = e.target; - const body = new FormData(); - e.preventDefault(); - let i = 0; - tds.forEach((el) => { - if (el.tagName === "TD") { - const v = el.firstChild.value; - - if (i === 3) - el.innerHTML = v; - else - el.innerText = v; - - switch (i) { - case 0: - body.append("name", v); - break; - case 1: - body.append("thumbnail", v); - break; - case 2: - body.append("author", v); - break; - case 3: - body.append("magazine", v); - break; - } - i++; - } - else if (el === tar) { - const iel = el; - iel.value = "Remove"; - iel.onclick = null; - } - else { - const iel = el; - if (iel.type === "hidden") { - body.append(iel.name, iel.value); - } - else { - iel.style.display = ""; - } - } - }); - console.log(await (await fetch("api/add.php", { - method: "POST", - headers: { - // "Content-Type": "multipart/form-data", - }, - body - })).text()); -} -//# sourceMappingURL=main.js.map diff --git a/src/main.ts b/src/main.ts deleted file mode 100644 index c4b616b..0000000 --- a/src/main.ts +++ /dev/null @@ -1,67 +0,0 @@ -import './style.css' - -function edit(e: PointerEvent) { - e.preventDefault(); - const tar = e.target as HTMLInputElement; - const form = tar.parentNode as HTMLFormElement - form.onseeked - const id = tar.dataset.id; - const tds = document.querySelectorAll(`[data-id="${id}"]`) as NodeListOf<HTMLElement> - const names = ["name", "thumbnail", "author", "magazine",] - tds.forEach((el, i) => { - if (el.tagName === "TD") { - const v = el.innerHTML; - el.innerHTML = `<input name="${names[i]}" value="${v}">` - } else if (el === tar) { - el.style.display = "none" - } else { - const iel = (el as HTMLInputElement) - if (iel.type !== "hidden") { - iel.value = "Save" - el.onclick = e => save(e, tds); - } - } - }) -} -//@ts-expect-error -window.edit = edit; - -async function save(e: MouseEvent, tds: NodeListOf<HTMLElement>) { - console.log(tds) - const tar = e.target as HTMLInputElement - const body = new FormData(); - e.preventDefault(); - let i = 0; - tds.forEach((el) => { - if (el.tagName === "TD") { - const v = (el.firstChild as HTMLInputElement).value; - el.innerHTML = v - switch (i) { - case 0: body.append("name", v); break; - case 1: body.append("thumbnail", v); break; - case 2: body.append("author", v); break; - case 3: body.append("magazine", v); break; - } - i++; - } else if (el === tar) { - const iel = (el as HTMLInputElement) - iel.value = "Remove" - iel.onclick = null; - } else { - const iel = (el as HTMLInputElement) - if (iel.type === "hidden") { - body.append(iel.name, iel.value); - } else { - iel.style.display = "" - } - } - }) - await fetch("api/add.php", { - method: "POST", - headers: { - "Content-Type": "multipart/form-data", - }, - body - }); -} - diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 6f1941d..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "sourceMap": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true - }, - "include": ["src"] -} |
