From 49c9603d8f2d175ecac7d2be5d12d5a6a69eb06f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 21 Nov 2023 10:43:10 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20Attorney?= =?UTF-8?q?Online/webDownloader@1ba9b76de546033323cde064d0ad6267a2a96abd?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index c34c827..aefdaeb 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ var lib; /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ downloadAndZip: () => (/* binding */ downloadAndZip),\n/* harmony export */ downloadAndZipBackgrounds: () => (/* binding */ downloadAndZipBackgrounds)\n/* harmony export */ });\n/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jszip */ \"./node_modules/jszip/dist/jszip.min.js\");\n/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! file-saver */ \"./node_modules/file-saver/dist/FileSaver.min.js\");\n/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _public_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./public/index */ \"./public/index.js\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_public_index__WEBPACK_IMPORTED_MODULE_2__]);\n_public_index__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];\n// stolen from https://huynvk.dev/blog/download-files-and-zip-them-in-your-browsers-using-javascript\n\n\n\n\nconst download = async (url) => {\n return fetch(url).then(resp => {\n const filename = url.slice(_public_index__WEBPACK_IMPORTED_MODULE_2__.BASE_CHARACTERS_URL.length); \n return {\n filename: filename,\n blob: resp.blob()\n }\n });\n};\n\nconst exportZip = (specificName, blobData) => {\n const zip = jszip__WEBPACK_IMPORTED_MODULE_0___default()();\n // const urlSearchParams = new URLSearchParams(window.location.search);\n const charname = specificName;\n blobData.forEach((blob) => {\n zip.file(`${decodeURI(blob.filename)}`, blob.blob);\n });\n zip.generateAsync({type: 'blob'}).then(zipFile => {\n const currentDate = new Date().getTime();\n const fileName = `${charname}.zip`;\n\n return file_saver__WEBPACK_IMPORTED_MODULE_1___default().saveAs(zipFile, fileName);\n });\n}\n\nconst downloadAndZip = (specificName, urls) => {\n Promise.all(urls.map(download)).then(blobData => exportZip(specificName, blobData)).finally(() => {\n document.getElementById('buttonText').style.display = 'block'\n document.getElementById('buttonLoading').style.display = 'none';\n document.getElementById('downloadButton').disabled = false\n })\n}\nconst downloadAndZipBackgrounds = (specificName, urls) => {\n Promise.all(urls.map(download)).then(blobData => exportZip(specificName, blobData)).finally(() => {\n document.getElementById('backgroundButtonText').style.display = 'block'\n document.getElementById('backgourndButtonLoading').style.display = 'none';\n document.getElementById('downloadBackgroundsButton').disabled = false\n })\n}\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://lib/./downloadandzip.js?"); +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ downloadAndZip: () => (/* binding */ downloadAndZip),\n/* harmony export */ downloadAndZipBackgrounds: () => (/* binding */ downloadAndZipBackgrounds)\n/* harmony export */ });\n/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jszip */ \"./node_modules/jszip/dist/jszip.min.js\");\n/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! file-saver */ \"./node_modules/file-saver/dist/FileSaver.min.js\");\n/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _public_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./public/index */ \"./public/index.js\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_public_index__WEBPACK_IMPORTED_MODULE_2__]);\n_public_index__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];\n// stolen from https://huynvk.dev/blog/download-files-and-zip-them-in-your-browsers-using-javascript\n\n\n\n\nconst download = async (url) => {\n return fetch(url).then(resp => {\n const filename = url.slice(_public_index__WEBPACK_IMPORTED_MODULE_2__.BASE_URL.length); \n return {\n filename: filename,\n blob: resp.blob()\n }\n });\n};\n\nconst exportZip = (specificName, blobData) => {\n const zip = jszip__WEBPACK_IMPORTED_MODULE_0___default()();\n // const urlSearchParams = new URLSearchParams(window.location.search);\n const charname = specificName;\n blobData.forEach((blob) => {\n zip.file(`${decodeURI(blob.filename)}`, blob.blob);\n });\n\n zip.generateAsync({type: 'blob'}).then(zipFile => {\n const currentDate = new Date().getTime();\n const fileName = `${charname}.zip`;\n\n return file_saver__WEBPACK_IMPORTED_MODULE_1___default().saveAs(zipFile, fileName);\n });\n}\n\nconst downloadAndZip = (specificName, urls) => {\n Promise.all(urls.map(download)).then(blobData => exportZip(specificName, blobData)).finally(() => {\n document.getElementById('buttonText').style.display = 'block'\n document.getElementById('buttonLoading').style.display = 'none';\n document.getElementById('downloadButton').disabled = false\n })\n}\nconst downloadAndZipBackgrounds = (specificName, urls) => {\n Promise.all(urls.map(download)).then(blobData => exportZip(specificName, blobData)).finally(() => {\n document.getElementById('backgroundButtonText').style.display = 'block'\n document.getElementById('backgourndButtonLoading').style.display = 'none';\n document.getElementById('downloadBackgroundsButton').disabled = false\n })\n}\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://lib/./downloadandzip.js?"); /***/ }), @@ -97,6 +97,16 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./node_modules/ini/lib/ini.js": +/*!*************************************!*\ + !*** ./node_modules/ini/lib/ini.js ***! + \*************************************/ +/***/ ((module) => { + +eval("const { hasOwnProperty } = Object.prototype\n\nconst encode = (obj, opt = {}) => {\n if (typeof opt === 'string') {\n opt = { section: opt }\n }\n opt.align = opt.align === true\n opt.newline = opt.newline === true\n opt.sort = opt.sort === true\n opt.whitespace = opt.whitespace === true || opt.align === true\n // The `typeof` check is required because accessing the `process` directly fails on browsers.\n /* istanbul ignore next */\n opt.platform = opt.platform || (typeof process !== 'undefined' && process.platform)\n opt.bracketedArray = opt.bracketedArray !== false\n\n /* istanbul ignore next */\n const eol = opt.platform === 'win32' ? '\\r\\n' : '\\n'\n const separator = opt.whitespace ? ' = ' : '='\n const children = []\n\n const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj)\n\n let padToChars = 0\n // If aligning on the separator, then padToChars is determined as follows:\n // 1. Get the keys\n // 2. Exclude keys pointing to objects unless the value is null or an array\n // 3. Add `[]` to array keys\n // 4. Ensure non empty set of keys\n // 5. Reduce the set to the longest `safe` key\n // 6. Get the `safe` length\n if (opt.align) {\n padToChars = safe(\n (\n keys\n .filter(k => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== 'object')\n .map(k => Array.isArray(obj[k]) ? `${k}[]` : k)\n )\n .concat([''])\n .reduce((a, b) => safe(a).length >= safe(b).length ? a : b)\n ).length\n }\n\n let out = ''\n const arraySuffix = opt.bracketedArray ? '[]' : ''\n\n for (const k of keys) {\n const val = obj[k]\n if (val && Array.isArray(val)) {\n for (const item of val) {\n out += safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + separator + safe(item) + eol\n }\n } else if (val && typeof val === 'object') {\n children.push(k)\n } else {\n out += safe(k).padEnd(padToChars, ' ') + separator + safe(val) + eol\n }\n }\n\n if (opt.section && out.length) {\n out = '[' + safe(opt.section) + ']' + (opt.newline ? eol + eol : eol) + out\n }\n\n for (const k of children) {\n const nk = splitSections(k, '.').join('\\\\.')\n const section = (opt.section ? opt.section + '.' : '') + nk\n const child = encode(obj[k], {\n ...opt,\n section,\n })\n if (out.length && child.length) {\n out += eol\n }\n\n out += child\n }\n\n return out\n}\n\nfunction splitSections (str, separator) {\n var lastMatchIndex = 0\n var lastSeparatorIndex = 0\n var nextIndex = 0\n var sections = []\n\n do {\n nextIndex = str.indexOf(separator, lastMatchIndex)\n\n if (nextIndex !== -1) {\n lastMatchIndex = nextIndex + separator.length\n\n if (nextIndex > 0 && str[nextIndex - 1] === '\\\\') {\n continue\n }\n\n sections.push(str.slice(lastSeparatorIndex, nextIndex))\n lastSeparatorIndex = nextIndex + separator.length\n }\n } while (nextIndex !== -1)\n\n sections.push(str.slice(lastSeparatorIndex))\n\n return sections\n}\n\nconst decode = (str, opt = {}) => {\n opt.bracketedArray = opt.bracketedArray !== false\n const out = Object.create(null)\n let p = out\n let section = null\n // section |key = value\n const re = /^\\[([^\\]]*)\\]\\s*$|^([^=]+)(=(.*))?$/i\n const lines = str.split(/[\\r\\n]+/g)\n const duplicates = {}\n\n for (const line of lines) {\n if (!line || line.match(/^\\s*[;#]/) || line.match(/^\\s*$/)) {\n continue\n }\n const match = line.match(re)\n if (!match) {\n continue\n }\n if (match[1] !== undefined) {\n section = unsafe(match[1])\n if (section === '__proto__') {\n // not allowed\n // keep parsing the section, but don't attach it.\n p = Object.create(null)\n continue\n }\n p = out[section] = out[section] || Object.create(null)\n continue\n }\n const keyRaw = unsafe(match[2])\n let isArray\n if (opt.bracketedArray) {\n isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'\n } else {\n duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1\n isArray = duplicates[keyRaw] > 1\n }\n const key = isArray ? keyRaw.slice(0, -2) : keyRaw\n if (key === '__proto__') {\n continue\n }\n const valueRaw = match[3] ? unsafe(match[4]) : true\n const value = valueRaw === 'true' ||\n valueRaw === 'false' ||\n valueRaw === 'null' ? JSON.parse(valueRaw)\n : valueRaw\n\n // Convert keys with '[]' suffix to an array\n if (isArray) {\n if (!hasOwnProperty.call(p, key)) {\n p[key] = []\n } else if (!Array.isArray(p[key])) {\n p[key] = [p[key]]\n }\n }\n\n // safeguard against resetting a previously defined\n // array by accidentally forgetting the brackets\n if (Array.isArray(p[key])) {\n p[key].push(value)\n } else {\n p[key] = value\n }\n }\n\n // {a:{y:1},\"a.b\":{x:2}} --> {a:{y:1,b:{x:2}}}\n // use a filter to return the keys that have to be deleted.\n const remove = []\n for (const k of Object.keys(out)) {\n if (!hasOwnProperty.call(out, k) ||\n typeof out[k] !== 'object' ||\n Array.isArray(out[k])) {\n continue\n }\n\n // see if the parent section is also an object.\n // if so, add it to that, and mark this one for deletion\n const parts = splitSections(k, '.')\n p = out\n const l = parts.pop()\n const nl = l.replace(/\\\\\\./g, '.')\n for (const part of parts) {\n if (part === '__proto__') {\n continue\n }\n if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {\n p[part] = Object.create(null)\n }\n p = p[part]\n }\n if (p === out && nl === l) {\n continue\n }\n\n p[nl] = out[k]\n remove.push(k)\n }\n for (const del of remove) {\n delete out[del]\n }\n\n return out\n}\n\nconst isQuoted = val => {\n return (val.startsWith('\"') && val.endsWith('\"')) ||\n (val.startsWith(\"'\") && val.endsWith(\"'\"))\n}\n\nconst safe = val => {\n if (\n typeof val !== 'string' ||\n val.match(/[=\\r\\n]/) ||\n val.match(/^\\[/) ||\n (val.length > 1 && isQuoted(val)) ||\n val !== val.trim()\n ) {\n return JSON.stringify(val)\n }\n return val.split(';').join('\\\\;').split('#').join('\\\\#')\n}\n\nconst unsafe = (val, doUnesc) => {\n val = (val || '').trim()\n if (isQuoted(val)) {\n // remove the single quotes before calling JSON.parse\n if (val.charAt(0) === \"'\") {\n val = val.slice(1, -1)\n }\n try {\n val = JSON.parse(val)\n } catch {\n // ignore errors\n }\n } else {\n // walk the val to find the first not-escaped ; character\n let esc = false\n let unesc = ''\n for (let i = 0, l = val.length; i < l; i++) {\n const c = val.charAt(i)\n if (esc) {\n if ('\\\\;#'.indexOf(c) !== -1) {\n unesc += c\n } else {\n unesc += '\\\\' + c\n }\n\n esc = false\n } else if (';#'.indexOf(c) !== -1) {\n break\n } else if (c === '\\\\') {\n esc = true\n } else {\n unesc += c\n }\n }\n if (esc) {\n unesc += '\\\\'\n }\n\n return unesc.trim()\n }\n return val\n}\n\nmodule.exports = {\n parse: decode,\n decode,\n stringify: encode,\n encode,\n safe,\n unsafe,\n}\n\n\n//# sourceURL=webpack://lib/./node_modules/ini/lib/ini.js?"); + +/***/ }), + /***/ "./node_modules/jszip/dist/jszip.min.js": /*!**********************************************!*\ !*** ./node_modules/jszip/dist/jszip.min.js ***! @@ -191,7 +201,7 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem /***/ ((module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BASE_BACKGROUND_URL: () => (/* binding */ BASE_BACKGROUND_URL),\n/* harmony export */ BASE_CHARACTERS_URL: () => (/* binding */ BASE_CHARACTERS_URL),\n/* harmony export */ getBackgroundUrls: () => (/* binding */ getBackgroundUrls),\n/* harmony export */ getCharacterUrls: () => (/* binding */ getCharacterUrls),\n/* harmony export */ searchForBackgrounds: () => (/* binding */ searchForBackgrounds),\n/* harmony export */ searchForCharacters: () => (/* binding */ searchForCharacters)\n/* harmony export */ });\n/* harmony import */ var fuzzy_search__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fuzzy-search */ \"./node_modules/fuzzy-search/src/FuzzySearch.js\");\n/* harmony import */ var _downloadandzip__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../downloadandzip */ \"./downloadandzip.js\");\n/* harmony import */ var _index_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.css */ \"./public/index.css\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_downloadandzip__WEBPACK_IMPORTED_MODULE_1__]);\n_downloadandzip__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];\n\n\n\nconst hintedCharacters = document.getElementById('hintedCharacters')\nconst hintedBackgrounds = document.getElementById('hintedBackgrounds')\n\nconst BASE_URL = \"https://attorneyoffline.de/base/\"\nconst BASE_CHARACTERS_URL = BASE_URL + \"characters/\"\nconst BASE_BACKGROUND_URL = BASE_URL + \"background/\"\nconst IGNORE_VALUES = new Set([\n \"Name\",\n \"Last modified\",\n \"Size\",\n \"Description\",\n \"Parent Directory\"\n])\nconst crawl = async (url, currentDepth, maximumDepth) => {\n if (currentDepth > maximumDepth) {\n return\n }\n const response = await fetch(`${url}`)\n if (response.status === 404) {\n return\n }\n // Create a fake webpage\n const websiteDirectoryPage = await response.text()\n const tempPage = document.createElement(\"html\");\n tempPage.innerHTML = websiteDirectoryPage;\n\n const tags = tempPage.getElementsByTagName('a')\n const validLinks = []\n for (const link of tags) {\n const aTagValue = link.getAttribute('href')\n if (IGNORE_VALUES.has(link.innerHTML)) {\n continue\n }\n \n const newUrl = url + aTagValue\n // Crawl all directories,\n if (aTagValue.endsWith('/')) {\n validLinks.push(...await crawl(newUrl, currentDepth+1, maximumDepth))\n } else {\n validLinks.push(newUrl)\n } \n }\n return validLinks\n}\n\nconst getAllCharacterNames = async () => {\n const response = await fetch(`${BASE_CHARACTERS_URL}`)\n if (response.status === 404) {\n return\n }\n\n // Create a fake webpage\n const websiteDirectoryPage = await response.text()\n const tempPage = document.createElement(\"html\");\n tempPage.innerHTML = websiteDirectoryPage;\n\n const tags = tempPage.getElementsByTagName('a')\n const validLinks = []\n for (const link of tags) {\n const aTagValue = link.getAttribute('href')\n if (IGNORE_VALUES.has(link.innerHTML)) {\n continue\n }\n \n // Crawl all directories,\n if (aTagValue.endsWith('/')) {\n validLinks.push(decodeURI(aTagValue.slice(0,-1)))\n } \n \n }\n return validLinks\n}\nconst getAllBackgroundNames = async () => {\n const response = await fetch(`${BASE_BACKGROUND_URL}`)\n if (response.status === 404) {\n return\n }\n\n // Create a fake webpage\n const websiteDirectoryPage = await response.text()\n const tempPage = document.createElement(\"html\");\n tempPage.innerHTML = websiteDirectoryPage;\n\n const tags = tempPage.getElementsByTagName('a')\n const validLinks = []\n for (const link of tags) {\n const aTagValue = link.getAttribute('href')\n if (IGNORE_VALUES.has(link.innerHTML)) {\n continue\n }\n \n // Crawl all directories,\n if (aTagValue.endsWith('/')) {\n validLinks.push(decodeURI(aTagValue.slice(0,-1)))\n } \n \n }\n return validLinks\n}\n\nconst failureText = document.getElementById('downloadFeedback')\nconst getCharacterUrls = async () => {\n failureText.innerHTML = \"\"\n const characterName = document.getElementById('characterNameInput').value\n if (window.sortedCharacters.length === 0) {\n failureText.innerHTML = \"Please select a valid character name\" \n return\n } else if (!window.sortedCharacters.includes(characterName)) {\n failureText.innerHTML = \"Please choose a valid name from the dropdown provided.\"\n return\n }\n // Disable button so cant click multiple times\n document.getElementById('downloadButton').disabled = true\n document.getElementById('buttonText').style.display = 'none'\n document.getElementById('buttonLoading').style.display = 'block';\n const validUrls = await crawl(`${BASE_CHARACTERS_URL}${characterName}/`, 0, 99)\n await (0,_downloadandzip__WEBPACK_IMPORTED_MODULE_1__.downloadAndZip)(characterName, validUrls);\n return\n}\ndocument.getElementById('downloadButton').onclick = getCharacterUrls\n\nwindow.characters = []\nconst createCharactersForDropdown = async () => {\n const allCharacterNames = await getAllCharacterNames()\n const uniqueNames = new Set(allCharacterNames)\n\n window.characters = Array.from(uniqueNames)\n document.getElementById('loadingContainer').style.display = 'none'\n document.getElementById('searchCharacter').style.display = \"block\"\n}\nwindow.backgrounds = []\nconst createBackgroundsForDropdown = async () => {\n const allBackgroundNames = await getAllBackgroundNames()\n const uniqueNames = new Set(allBackgroundNames)\n\n window.backgrounds = Array.from(uniqueNames)\n document.getElementById('loadingBackgroundContainer').style.display = 'none'\n document.getElementById('searchBackground').style.display = \"block\"\n}\n\nwindow.sortedCharacters = []\nconst searchForCharacters = () => {\n const userInput = document.getElementById('characterNameInput').value\n const searcher = new fuzzy_search__WEBPACK_IMPORTED_MODULE_0__[\"default\"](window.characters)\n window.sortedCharacters = searcher.search(userInput)\n hintedCharacters.innerHTML = \"\"\n document.getElementById('characterSearchResults').innerHTML = `${window.sortedCharacters.length} / ${window.characters.length}`\n if (window.sortedCharacters.length < 100) {\n window.sortedCharacters.forEach(character => {\n hintedCharacters.innerHTML += ``\n });\n } else if (window.sortedCharacters.length > 100){\n hintedCharacters.innerHTML = \"Too many characters like this! Filter better.\"\n } else if (window.sortedCharacters.length === 0) {\n hintedCharacters.innerHTML = \"We cant find any characters with that name.\"\n } \n}\nwindow.sortedBackgrounds = []\nconst searchForBackgrounds = () => {\n const userInput = document.getElementById('backgroundNameInput').value\n const searcher = new fuzzy_search__WEBPACK_IMPORTED_MODULE_0__[\"default\"](window.backgrounds)\n window.sortedBackgrounds = searcher.search(userInput)\n hintedBackgrounds.innerHTML = \"\"\n document.getElementById('backgroundSearchResults').innerHTML = `${window.sortedBackgrounds.length} / ${window.backgrounds.length}`\n if (window.sortedBackgrounds.length < 100) {\n window.sortedBackgrounds.forEach(background => {\n hintedBackgrounds.innerHTML += ``\n });\n } else if (window.sortedBackgrounds.length > 100){\n hintedBackgrounds.innerHTML = \"Too many backgrounds like this! Filter better.\"\n } else if (window.sortedBackgrounds.length === 0) {\n hintedBackgrounds.innerHTML = \"We cant find any backgrounds with that name.\"\n } \n}\nconst backgroundsFailureDiv = document.getElementById('backgroundDownloadFeedback')\nconst getBackgroundUrls = async () => {\n backgroundsFailureDiv.innerHTML = \"\"\n const backgroundName = document.getElementById('backgroundNameInput').value\n if (window.sortedBackgrounds.length === 0) {\n backgroundsFailureDiv.innerHTML = \"Please select a valid background name\" \n return\n } else if (!window.sortedBackgrounds.includes(backgroundName)) {\n backgroundsFailureDiv.innerHTML = \"Please choose a valid background from the dropdown provided.\"\n return\n }\n // Disable button so cant click multiple times\n document.getElementById('downloadBackgroundsButton').disabled = true\n document.getElementById('backgroundButtonText').style.display = 'none'\n document.getElementById('backgourndButtonLoading').style.display = 'block';\n const validUrls = await crawl(`${BASE_BACKGROUND_URL}${backgroundName}/`, 0, 99)\n await (0,_downloadandzip__WEBPACK_IMPORTED_MODULE_1__.downloadAndZipBackgrounds)(backgroundName, validUrls);\n return\n}\ndocument.getElementById('downloadBackgroundsButton').onclick = getBackgroundUrls\n\ndocument.getElementById('characterNameInput').oninput = searchForCharacters\ndocument.getElementById('backgroundNameInput').oninput = searchForBackgrounds\n\ncreateCharactersForDropdown()\ncreateBackgroundsForDropdown()\n\nconst queryString = window.location.search;\nconst urlParams = new URLSearchParams(queryString);\nif(urlParams.has('char')) {\n const characterName = urlParams.get('char')\n document.getElementById('characterNameInput').value = characterName\n const validUrls = await crawl(`${BASE_CHARACTERS_URL}${characterName}/`, 0, 99)\n document.getElementById('downloadButton').disabled = true\n document.getElementById('buttonText').style.display = 'none'\n document.getElementById('buttonLoading').style.display = 'block';\n await (0,_downloadandzip__WEBPACK_IMPORTED_MODULE_1__.downloadAndZip)(characterName, validUrls);\n}\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }, 1);\n\n//# sourceURL=webpack://lib/./public/index.js?"); +eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BASE_BACKGROUND_URL: () => (/* binding */ BASE_BACKGROUND_URL),\n/* harmony export */ BASE_CHARACTERS_URL: () => (/* binding */ BASE_CHARACTERS_URL),\n/* harmony export */ BASE_SOUNDS_URL: () => (/* binding */ BASE_SOUNDS_URL),\n/* harmony export */ BASE_URL: () => (/* binding */ BASE_URL),\n/* harmony export */ getBackgroundUrls: () => (/* binding */ getBackgroundUrls),\n/* harmony export */ getCharacterUrls: () => (/* binding */ getCharacterUrls),\n/* harmony export */ searchForBackgrounds: () => (/* binding */ searchForBackgrounds),\n/* harmony export */ searchForCharacters: () => (/* binding */ searchForCharacters)\n/* harmony export */ });\n/* harmony import */ var fuzzy_search__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fuzzy-search */ \"./node_modules/fuzzy-search/src/FuzzySearch.js\");\n/* harmony import */ var ini__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ini */ \"./node_modules/ini/lib/ini.js\");\n/* harmony import */ var ini__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ini__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _downloadandzip__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../downloadandzip */ \"./downloadandzip.js\");\n/* harmony import */ var _index_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./index.css */ \"./public/index.css\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_downloadandzip__WEBPACK_IMPORTED_MODULE_2__]);\n_downloadandzip__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];\n\n\n\n\nconst hintedCharacters = document.getElementById('hintedCharacters')\nconst hintedBackgrounds = document.getElementById('hintedBackgrounds')\n\nconst BASE_URL = \"https://attorneyoffline.de/base/\"\nconst BASE_CHARACTERS_URL = BASE_URL + \"characters/\"\nconst BASE_BACKGROUND_URL = BASE_URL + \"background/\"\nconst BASE_SOUNDS_URL = BASE_URL + \"sounds/\"\nconst IGNORE_VALUES = new Set([\n \"Name\",\n \"Last modified\",\n \"Size\",\n \"Description\",\n \"Parent Directory\"\n])\nconst crawl = async (url, currentDepth, maximumDepth) => {\n if (currentDepth > maximumDepth) {\n return\n }\n const response = await fetch(`${url}`)\n if (response.status === 404) {\n return\n }\n // Create a fake webpage\n const websiteDirectoryPage = await response.text()\n const tempPage = document.createElement(\"html\");\n tempPage.innerHTML = websiteDirectoryPage;\n\n const tags = tempPage.getElementsByTagName('a')\n const validLinks = []\n for (const link of tags) {\n const aTagValue = link.getAttribute('href')\n if (IGNORE_VALUES.has(link.innerHTML)) {\n continue\n }\n \n const newUrl = url + aTagValue\n // Crawl all directories,\n if (aTagValue.endsWith('/')) {\n validLinks.push(...await crawl(newUrl, currentDepth+1, maximumDepth))\n } else {\n validLinks.push(newUrl)\n } \n }\n return validLinks\n}\n\nconst getAllCharacterNames = async () => {\n const response = await fetch(`${BASE_CHARACTERS_URL}`)\n if (response.status === 404) {\n return\n }\n\n // Create a fake webpage\n const websiteDirectoryPage = await response.text()\n const tempPage = document.createElement(\"html\");\n tempPage.innerHTML = websiteDirectoryPage;\n\n const tags = tempPage.getElementsByTagName('a')\n const validLinks = []\n for (const link of tags) {\n const aTagValue = link.getAttribute('href')\n if (IGNORE_VALUES.has(link.innerHTML)) {\n continue\n }\n \n // Crawl all directories,\n if (aTagValue.endsWith('/')) {\n validLinks.push(decodeURI(aTagValue.slice(0,-1)))\n } \n \n }\n return validLinks\n}\nconst getAllBackgroundNames = async () => {\n const response = await fetch(`${BASE_BACKGROUND_URL}`)\n if (response.status === 404) {\n return\n }\n\n // Create a fake webpage\n const websiteDirectoryPage = await response.text()\n const tempPage = document.createElement(\"html\");\n tempPage.innerHTML = websiteDirectoryPage;\n\n const tags = tempPage.getElementsByTagName('a')\n const validLinks = []\n for (const link of tags) {\n const aTagValue = link.getAttribute('href')\n if (IGNORE_VALUES.has(link.innerHTML)) {\n continue\n }\n \n // Crawl all directories,\n if (aTagValue.endsWith('/')) {\n validLinks.push(decodeURI(aTagValue.slice(0,-1)))\n } \n \n }\n return validLinks\n}\n\nconst failureText = document.getElementById('downloadFeedback')\nconst getCharacterUrls = async () => {\n failureText.innerHTML = \"\"\n const characterName = document.getElementById('characterNameInput').value\n if (window.sortedCharacters.length === 0) {\n failureText.innerHTML = \"Please select a valid character name\" \n return\n } else if (!window.sortedCharacters.includes(characterName)) {\n failureText.innerHTML = \"Please choose a valid name from the dropdown provided.\"\n return\n }\n // Disable button so cant click multiple times\n document.getElementById('downloadButton').disabled = true\n document.getElementById('buttonText').style.display = 'none'\n document.getElementById('buttonLoading').style.display = 'block';\n const validUrls = await crawl(`${BASE_CHARACTERS_URL}${characterName}/`, 0, 99)\n\n // include blip sound, SoundN and frameSFX files\n await fetch(`${BASE_CHARACTERS_URL}${characterName}/char.ini`).then(resp => resp.blob()).then(blob => blob.text()).then(text => {\n const charIni = ini__WEBPACK_IMPORTED_MODULE_1___default().parse(text.toLowerCase());\n\n const blip = (charIni.options.blips != null) ? charIni.options.blips : (charIni.options.gender != null) ? charIni.options.gender : null;\n if (blip !== null)\n validUrls.push(`${BASE_SOUNDS_URL}` + \"blips/\" + blip + \".opus\");\n\n for (const key in charIni) {\n if (key !== \"soundn\" && !key.endsWith(\"_framesfx\"))\n continue;\n\n for (const value in charIni[key]) {\n const sfx = charIni[key][value];\n const sfxUrl = `${BASE_SOUNDS_URL}` + \"general/\" + sfx + \".opus\";\n if (sfx != null && sfx != \"0\" && sfx != \"1\" && !validUrls.find((existing) => existing == sfxUrl))\n validUrls.push(sfxUrl);\n }\n }\n });\n\n await (0,_downloadandzip__WEBPACK_IMPORTED_MODULE_2__.downloadAndZip)(characterName, validUrls);\n return\n}\ndocument.getElementById('downloadButton').onclick = getCharacterUrls\n\nwindow.characters = []\nconst createCharactersForDropdown = async () => {\n const allCharacterNames = await getAllCharacterNames()\n const uniqueNames = new Set(allCharacterNames)\n\n window.characters = Array.from(uniqueNames)\n document.getElementById('loadingContainer').style.display = 'none'\n document.getElementById('searchCharacter').style.display = \"block\"\n}\nwindow.backgrounds = []\nconst createBackgroundsForDropdown = async () => {\n const allBackgroundNames = await getAllBackgroundNames()\n const uniqueNames = new Set(allBackgroundNames)\n\n window.backgrounds = Array.from(uniqueNames)\n document.getElementById('loadingBackgroundContainer').style.display = 'none'\n document.getElementById('searchBackground').style.display = \"block\"\n}\n\nwindow.sortedCharacters = []\nconst searchForCharacters = () => {\n const userInput = document.getElementById('characterNameInput').value\n const searcher = new fuzzy_search__WEBPACK_IMPORTED_MODULE_0__[\"default\"](window.characters)\n window.sortedCharacters = searcher.search(userInput)\n hintedCharacters.innerHTML = \"\"\n document.getElementById('characterSearchResults').innerHTML = `${window.sortedCharacters.length} / ${window.characters.length}`\n if (window.sortedCharacters.length < 100) {\n window.sortedCharacters.forEach(character => {\n hintedCharacters.innerHTML += ``\n });\n } else if (window.sortedCharacters.length > 100){\n hintedCharacters.innerHTML = \"Too many characters like this! Filter better.\"\n } else if (window.sortedCharacters.length === 0) {\n hintedCharacters.innerHTML = \"We cant find any characters with that name.\"\n } \n}\nwindow.sortedBackgrounds = []\nconst searchForBackgrounds = () => {\n const userInput = document.getElementById('backgroundNameInput').value\n const searcher = new fuzzy_search__WEBPACK_IMPORTED_MODULE_0__[\"default\"](window.backgrounds)\n window.sortedBackgrounds = searcher.search(userInput)\n hintedBackgrounds.innerHTML = \"\"\n document.getElementById('backgroundSearchResults').innerHTML = `${window.sortedBackgrounds.length} / ${window.backgrounds.length}`\n if (window.sortedBackgrounds.length < 100) {\n window.sortedBackgrounds.forEach(background => {\n hintedBackgrounds.innerHTML += ``\n });\n } else if (window.sortedBackgrounds.length > 100){\n hintedBackgrounds.innerHTML = \"Too many backgrounds like this! Filter better.\"\n } else if (window.sortedBackgrounds.length === 0) {\n hintedBackgrounds.innerHTML = \"We cant find any backgrounds with that name.\"\n } \n}\nconst backgroundsFailureDiv = document.getElementById('backgroundDownloadFeedback')\nconst getBackgroundUrls = async () => {\n backgroundsFailureDiv.innerHTML = \"\"\n const backgroundName = document.getElementById('backgroundNameInput').value\n if (window.sortedBackgrounds.length === 0) {\n backgroundsFailureDiv.innerHTML = \"Please select a valid background name\" \n return\n } else if (!window.sortedBackgrounds.includes(backgroundName)) {\n backgroundsFailureDiv.innerHTML = \"Please choose a valid background from the dropdown provided.\"\n return\n }\n // Disable button so cant click multiple times\n document.getElementById('downloadBackgroundsButton').disabled = true\n document.getElementById('backgroundButtonText').style.display = 'none'\n document.getElementById('backgourndButtonLoading').style.display = 'block';\n const validUrls = await crawl(`${BASE_BACKGROUND_URL}${backgroundName}/`, 0, 99)\n await (0,_downloadandzip__WEBPACK_IMPORTED_MODULE_2__.downloadAndZipBackgrounds)(backgroundName, validUrls);\n return\n}\ndocument.getElementById('downloadBackgroundsButton').onclick = getBackgroundUrls\n\ndocument.getElementById('characterNameInput').oninput = searchForCharacters\ndocument.getElementById('backgroundNameInput').oninput = searchForBackgrounds\n\ncreateCharactersForDropdown()\ncreateBackgroundsForDropdown()\n\nconst queryString = window.location.search;\nconst urlParams = new URLSearchParams(queryString);\nif(urlParams.has('char')) {\n const characterName = urlParams.get('char')\n document.getElementById('characterNameInput').value = characterName\n const validUrls = await crawl(`${BASE_CHARACTERS_URL}${characterName}/`, 0, 99)\n document.getElementById('downloadButton').disabled = true\n document.getElementById('buttonText').style.display = 'none'\n document.getElementById('buttonLoading').style.display = 'block';\n await (0,_downloadandzip__WEBPACK_IMPORTED_MODULE_2__.downloadAndZip)(characterName, validUrls);\n}\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } }, 1);\n\n//# sourceURL=webpack://lib/./public/index.js?"); /***/ }), @@ -242,7 +252,7 @@ eval("module.exports = __webpack_require__.p + \"bb0edff5e6226e5b16da.webp\";\n\ /******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__"; /******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__"; /******/ var resolveQueue = (queue) => { -/******/ if(queue && !queue.d) { +/******/ if(queue && queue.d < 1) { /******/ queue.d = 1; /******/ queue.forEach((fn) => (fn.r--)); /******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn())); @@ -273,7 +283,7 @@ eval("module.exports = __webpack_require__.p + \"bb0edff5e6226e5b16da.webp\";\n\ /******/ })); /******/ __webpack_require__.a = (module, body, hasAwait) => { /******/ var queue; -/******/ hasAwait && ((queue = []).d = 1); +/******/ hasAwait && ((queue = []).d = -1); /******/ var depQueues = new Set(); /******/ var exports = module.exports; /******/ var currentDeps; @@ -301,7 +311,7 @@ eval("module.exports = __webpack_require__.p + \"bb0edff5e6226e5b16da.webp\";\n\ /******/ }); /******/ return fn.r ? promise : getResult(); /******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue))); -/******/ queue && (queue.d = 0); +/******/ queue && queue.d < 0 && (queue.d = 0); /******/ }; /******/ })(); /******/