mirror of
https://github.com/Gabi-Zar/Silk-Fly-Launcher.git
synced 2026-04-17 05:26:04 +02:00
Front end for adding thunderstore.
This commit is contained in:
@@ -8,6 +8,152 @@ Hollow Knight: Silksong is property of Team Cherry.
|
||||
This project is not affiliated with or endorsed by Team Cherry.
|
||||
|
||||
|
||||
LibreICONS
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Diemen Design
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Iconbuddy Simple Icons
|
||||
CC0 1.0
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
|
||||
|
||||
7zip-bin 5.2.0
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
10
main.js
10
main.js
@@ -401,7 +401,7 @@ ipcMain.handle("delete-bepinex-backup", async () => {
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/////////////////////// NEXUS ////////////////////////
|
||||
//////////////// NEXUS / THUNDERSTORE ////////////////
|
||||
|
||||
async function createNexus(api) {
|
||||
if (api == undefined) {
|
||||
@@ -576,6 +576,14 @@ async function searchNexusMods(keywords, offset = 0, count = 10, sortFilter = "d
|
||||
onlineTotalModsCount = data.mods.totalCount;
|
||||
}
|
||||
|
||||
ipcMain.handle("search-thunderstore-mods", async (event, keywords, offset, count, sortFilter, sortOrder) => {
|
||||
searchThunderstoreMods(keywords, offset, count, sortFilter, sortOrder);
|
||||
});
|
||||
|
||||
async function searchThunderstoreMods(keywords, offset = 0, count = 10, sortFilter = "downloads", sortOrder = "DESC") {
|
||||
console.log("WIP");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
//////////////////////// MODS ////////////////////////
|
||||
|
||||
|
||||
@@ -56,3 +56,7 @@ contextBridge.exposeInMainWorld("mods", {
|
||||
activateMods: (modId) => ipcRenderer.invoke("activate-mod", modId),
|
||||
deactivateMods: (modId) => ipcRenderer.invoke("deactivate-mod", modId),
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld("thunderstore", {
|
||||
search: (keywords, offset, count, sortFilter, sortOrder) => ipcRenderer.invoke("search-thunderstore-mods", keywords, offset, count, sortFilter, sortOrder),
|
||||
});
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg role="img" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path d="m 1,8.3051015 c 0,-0.6641 0.2078922,-1.253128 0.6236766,-1.772859 0.4157844,-0.51973 0.9412897,-0.854668 1.5822907,-0.999037 0.1790183,-0.791146 0.5890279,-1.437922 1.2184793,-1.946102 0.6294514,-0.508181 1.3570741,-0.762272 2.1713184,-0.762272 0.79692,0 1.507219,0.248316 2.130895,0.739172 0.623677,0.490857 1.027912,1.126083 1.212705,1.899904 l 0.190568,0 c 0.51973,0 0.999037,0.127045 1.437921,0.375361 0.438883,0.248316 0.791145,0.594803 1.045236,1.033686 C 12.86718,7.3118385 13,7.7853705 13,8.3051015 c 0,0.508181 -0.12127,0.981713 -0.363811,1.414822 -0.242541,0.4331085 -0.577479,0.7795955 -0.999038,1.0394605 -0.421559,0.259866 -0.889317,0.398461 -1.391723,0.415785 l -6.4735319,0 C 2.9980751,11.14052 2.3455245,10.846006 1.8084697,10.291627 1.2714148,9.7430225 1,9.0789225 1,8.3051015 Z m 0.987488,0 c 0,0.502406 0.1732435,0.935515 0.5197305,1.305101 0.346487,0.369586 0.7680462,0.5659275 1.2646776,0.5948015 l 6.4619829,0 c 0.496631,-0.0231 0.91819,-0.2252155 1.264677,-0.5948015 0.352262,-0.369586 0.525506,-0.80847 0.525506,-1.305101 0,-0.508181 -0.190568,-0.94129 -0.565929,-1.310876 -0.375361,-0.369586 -0.820019,-0.554379 -1.33975,-0.554379 l -0.923965,0 c -0.06352,0 -0.09817,-0.03465 -0.09817,-0.103947 L 9.055828,6.0067375 C 8.992308,5.3830605 8.72089,4.8575555 8.247358,4.4359965 7.773826,4.0144375 7.225222,3.8007705 6.59577,3.8007705 c -0.6294512,0 -1.1838304,0.213667 -1.6458131,0.635226 -0.4677575,0.421559 -0.7333975,0.947064 -0.7911454,1.570741 l -0.046198,0.329162 c 0,0.0693 -0.040424,0.103947 -0.1154957,0.103947 l -0.3060635,0 c -0.4850818,0.05775 -0.8893167,0.26564 -1.2127045,0.617901 -0.3233879,0.352262 -0.4908566,0.768047 -0.4908566,1.247354 z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
1
renderer/assets/icons/nexus-mods.svg
Normal file
1
renderer/assets/icons/nexus-mods.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="#ffffff"><path fill="#ffffff" d="M17.376 0c-.993 0-2.18.686-2.907 1.182c-1.676-.36-4.036-.545-6.787.635c-1.365-.513-2.425-.562-3.32-.488a2.16 2.16 0 0 0-1.27.429c-.33.22-2.788 2.69-3.069 4.652C-.15 7.508.68 8.932 1.218 9.718c-.44 1.76-.2 4.572.517 6.188c-.353 1.041-.713 2.089-.664 3.205c.01.584.061 1.188.398 1.684C1.72 21.19 4.528 24 6.545 24c.957 0 1.93-.428 3.07-1.24c2.16.383 4.402.348 6.448-.532c2.573 1.001 4.224.625 4.84.162c.587-.457 2.826-2.915 3.07-4.622c.1-.672-.023-1.638-1.226-3.397a11 11 0 0 0-.501-6.455c.396-1.069.673-2.188.59-3.337c-.015-.68-.221-1.167-.487-1.507c-.209-.335-2.415-2.39-4.028-2.91A3.1 3.1 0 0 0 17.376 0m-.03 2.082c.65.015 2.155 1.093 3.01 1.906l.355.34c-.959-.163-2.125.428-3.26 1.55a10.3 10.3 0 0 0-1.358 1.595c-.28.384-.517.768-.753 1.285l1.18.635l-3.895 1.477l-1.122-4.18l1.033.547c1.358-3.102 2.524-3.973 3.232-4.416h.015a5.1 5.1 0 0 1 1.49-.724zM12 3.065a9 9 0 0 1 2.22.279a8 8 0 0 0-.42.488a8.4 8.4 0 0 0-1.8-.196a8.34 8.34 0 0 0-5.897 2.432a8 8 0 0 1-.37-.433A8.9 8.9 0 0 1 12 3.065m-7.076.305c.71-.002 1.309.127 2.2.466a9.5 9.5 0 0 0-1.713 1.337c-.327-.542-.624-1.156-.488-1.803m-.606.042c-.162.96.428 2.126 1.55 3.264c.457.487 1.003.945 1.594 1.358c.383.281.767.517 1.283.754l.62-1.182l1.49 3.914l-4.176 1.122l.546-1.033c-3.099-1.36-3.969-2.526-4.412-3.235v-.015a5.1 5.1 0 0 1-.723-1.491l-.015-.074c.015-.65 1.092-2.156 1.904-3.013Zm16.035 1.483a1.3 1.3 0 0 1 .26.015l.14.023a5 5 0 0 1-.13 1.137v.015q-.152.574-.377 1.148a9.5 9.5 0 0 0-1.346-1.776c.547-.357 1.051-.546 1.453-.562M18.43 5.8a8.9 8.9 0 0 1 2.506 6.2a9 9 0 0 1-.27 2.183a8 8 0 0 0-.488-.425A8.4 8.4 0 0 0 20.364 12A8.33 8.33 0 0 0 18 6.173a8 8 0 0 1 .429-.373M3.315 9.905q.235.222.488.425A8.4 8.4 0 0 0 3.636 12c0 2.248.887 4.286 2.327 5.788a8 8 0 0 1-.426.376A8.9 8.9 0 0 1 3.065 12a9 9 0 0 1 .25-2.095m13.988 1.541l-.546 1.034c3.098 1.359 3.969 2.526 4.412 3.235v.014c.34.488.575.99.723 1.492l.014.074c-.014.65-1.092 2.156-1.903 3.013l-.34.354c.163-.96-.427-2.127-1.549-3.264a10.3 10.3 0 0 0-1.594-1.359a7 7 0 0 0-1.283-.753l-.605 1.152l-1.505-3.87zm-6.006 1.684l1.121 4.18l-1.033-.547c-1.357 3.102-2.523 3.973-3.231 4.416h-.015c-.487.34-.989.576-1.49.724l-.074.015c-.65-.015-2.154-1.093-3.01-1.906l-.354-.34c.959.163 2.124-.428 3.26-1.55c.488-.458.945-1.004 1.358-1.595c.28-.384.517-.768.753-1.285l-1.166-.635ZM3.72 16.663A9.5 9.5 0 0 0 5.086 18.5c-.697.47-1.33.665-1.777.59l-.138-.024c0-.367.038-.748.128-1.137v-.015c.11-.417.254-.835.42-1.252m14.131 1.314q.194.21.372.43A8.9 8.9 0 0 1 12 20.936a9 9 0 0 1-2.282-.296a8 8 0 0 0 .417-.487a8.34 8.34 0 0 0 7.716-2.175m.696.889c.43.666.607 1.267.534 1.698l-.023.138a5 5 0 0 1-1.136-.128h-.014a11 11 0 0 1-1.114-.366a9.5 9.5 0 0 0 1.753-1.342"/></svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
1
renderer/assets/icons/thunderstore.svg
Normal file
1
renderer/assets/icons/thunderstore.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 24 24" fill="#ffffff"><path fill="#ffffff" d="m.322 13.174l4.706 8.192L7.2 16.855L4.824 12.72a1.416 1.416 0 0 1 0-1.444l2.965-5.16c.265-.46.718-.723 1.245-.723h1.595l-3.086 6.953h3.812L6.171 22.403L16.583 9.914h-3.201l2.184-4.52h6.052L24 1.25H7.175c-.86 0-1.598.428-2.028 1.174l-4.825 8.4a2.306 2.306 0 0 0 0 2.35m7.213 9.576h9.29a2.29 2.29 0 0 0 2.03-1.176l4.825-8.4a2.317 2.317 0 0 0 0-2.35l-1.93-3.36h-4.763l2.19 3.813c.262.46.262.987 0 1.444l-2.964 5.162a1.41 1.41 0 0 1-1.248.723h-2.154l-1.497-.017z"/></svg>
|
||||
|
After Width: | Height: | Size: 591 B |
@@ -36,9 +36,13 @@
|
||||
<img src="assets/icons/folder.svg" class="icons invert-color" />
|
||||
Installed
|
||||
</button>
|
||||
<button class="horizontal-div" onclick="navigate('mods-thunderstore')">
|
||||
<img src="assets/icons/thunderstore.svg" class="icons" />
|
||||
Thunderstore
|
||||
</button>
|
||||
<button class="horizontal-div" onclick="navigate('mods-online')">
|
||||
<img src="assets/icons/cloud.svg" class="icons invert-color" />
|
||||
Online
|
||||
<img src="assets/icons/nexus-mods.svg" class="icons" />
|
||||
Nexus
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -122,7 +126,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="online-mods-template">
|
||||
<template id="nexus-mods-template">
|
||||
<h2>List Of Nexus Mods</h2>
|
||||
<div class="horizontal-div">
|
||||
<form class="horizontal-div input-form" id="search-form">
|
||||
@@ -155,6 +159,38 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="thunderstore-mods-template">
|
||||
<h2>List Of Thunderstore Mods</h2>
|
||||
<div class="horizontal-div">
|
||||
<form class="horizontal-div input-form" id="search-form">
|
||||
<input class="input" id="search-input" type="text" placeholder="Search For Mods..." />
|
||||
<button class="default-button" onclick="searchThunderstoreMods()">Search</button>
|
||||
</form>
|
||||
<div class="list-div">
|
||||
<div class="default-button smaller-button" id="sort-button" onclick="toggleSortMenu()">Sort</div>
|
||||
<div class="list-menu longer-button list-menu-inverted" id="sort-menu">
|
||||
<li id="name" onclick="changeSort('name')">by name</li>
|
||||
<li id="downloads" onclick="changeSort('downloads')">by downloads count</li>
|
||||
<li id="endorsements" onclick="changeSort('endorsements')">by rating count</li>
|
||||
<li id="createdAt" onclick="changeSort('createdAt')">by date of creation</li>
|
||||
<li id="updatedAt" onclick="changeSort('updatedAt')">by date of updating</li>
|
||||
</div>
|
||||
</div>
|
||||
<button class="default-button square-button" onclick="inverseSort()"><img class="icons invert-color" id="sort-order-image" src="assets/icons/sort-order-1.svg" /></button>
|
||||
</div>
|
||||
<div class="mods-container" id="mods-container"></div>
|
||||
<div class="separated-div">
|
||||
<div class="horizontal-div">
|
||||
<button class="default-button" onclick="changeModsPage('min')">First page</button>
|
||||
<button class="default-button" onclick="changeModsPage(-1)">Previous</button>
|
||||
</div>
|
||||
<div class="horizontal-div">
|
||||
<button class="default-button" onclick="changeModsPage(1)">Next</button>
|
||||
<button class="default-button" onclick="changeModsPage('max')">Last page</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="installed-mod-template">
|
||||
<div class="mod-container">
|
||||
<div class="mod-text">
|
||||
|
||||
@@ -4,7 +4,8 @@ const view = document.getElementById("view");
|
||||
|
||||
const HomeTemplate = document.getElementById("home-template");
|
||||
const installedModsTemplate = document.getElementById("installed-mods-template");
|
||||
const onlineModsTemplate = document.getElementById("online-mods-template");
|
||||
const nexusModsTemplate = document.getElementById("nexus-mods-template");
|
||||
const thunderstoreModsTemplate = document.getElementById("thunderstore-mods-template");
|
||||
const settingsTemplate = document.getElementById("settings-template");
|
||||
const installedModTemplate = document.getElementById("installed-mod-template");
|
||||
const modTemplate = document.getElementById("mod-template");
|
||||
@@ -14,18 +15,31 @@ let actualTheme = [];
|
||||
|
||||
let searchValueNexus = "";
|
||||
let searchValueInstalled = "";
|
||||
let searchValueThunderstore = "";
|
||||
|
||||
let onlineSortFilter = "downloads";
|
||||
let installedSortFilter = "name";
|
||||
let thunderstoreSortFilter = "downloads";
|
||||
|
||||
let onlineSortOrder = "DESC";
|
||||
let installedSortOrder = "ASC";
|
||||
let thunderstoreSortOrder = "DESC";
|
||||
|
||||
let onlineOffset = 0;
|
||||
let installedOffset = 0;
|
||||
let thunderstoreOffset = 0;
|
||||
|
||||
let lastOnlineOffset = 0;
|
||||
let lastInstalledOffset = 0;
|
||||
let lastThunderstoreOffset = 0;
|
||||
|
||||
let onlineModsCount = 10;
|
||||
let installedModsCount = 10;
|
||||
let thunderstoreModsCount = 10;
|
||||
|
||||
let onlineModsTotalCount;
|
||||
let installedModsTotalCount;
|
||||
let thunderstoreModsTotalCount;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
///////////////// CONST FOR WELCOME //////////////////
|
||||
@@ -183,8 +197,8 @@ async function navigate(page) {
|
||||
break;
|
||||
|
||||
case "mods-online":
|
||||
title.innerText = "Online Mods";
|
||||
const onlineModsTemplateCopy = onlineModsTemplate.content.cloneNode(true);
|
||||
title.innerText = "Nexus Mods";
|
||||
const onlineModsTemplateCopy = nexusModsTemplate.content.cloneNode(true);
|
||||
const ModsContainer = onlineModsTemplateCopy.getElementById("mods-container");
|
||||
const searchFormNexus = onlineModsTemplateCopy.getElementById("search-form");
|
||||
const searchInputNexus = onlineModsTemplateCopy.getElementById("search-input");
|
||||
@@ -266,6 +280,22 @@ async function navigate(page) {
|
||||
}
|
||||
break;
|
||||
|
||||
case "mods-thunderstore":
|
||||
title.innerText = "Thunderstore Mods";
|
||||
const thunderstoreModsTemplateCopy = thunderstoreModsTemplate.content.cloneNode(true);
|
||||
const thunderstoreModsContainer = thunderstoreModsTemplateCopy.getElementById("mods-container");
|
||||
const searchFormThunderstore = thunderstoreModsTemplateCopy.getElementById("search-form");
|
||||
const searchInputThunderstore = thunderstoreModsTemplateCopy.getElementById("search-input");
|
||||
|
||||
searchFormThunderstore.addEventListener("submit", async function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
searchInputThunderstore.value = searchValueThunderstore;
|
||||
|
||||
view.appendChild(thunderstoreModsTemplateCopy);
|
||||
toggleSelectedListButton("sort-menu", thunderstoreSortFilter);
|
||||
setSortOrderButton();
|
||||
break;
|
||||
case "general-settings":
|
||||
title.innerText = "Settings";
|
||||
const settingsTemplateCopy = settingsTemplate.content.cloneNode(true);
|
||||
@@ -469,7 +499,7 @@ async function searchInstalledMods() {
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/////////////////////// NEXUS ////////////////////////
|
||||
//////////////// NEXUS / THUNDERSTORE ////////////////
|
||||
|
||||
async function verifyNexusAPI() {
|
||||
response = await nexus.verifyAPI();
|
||||
@@ -521,6 +551,15 @@ async function resetNexusAPI() {
|
||||
}
|
||||
}
|
||||
|
||||
async function searchThunderstoreMods() {
|
||||
let searchInput = document.getElementById("search-input");
|
||||
searchValueThunderstore = searchInput.value;
|
||||
await thunderstore.search(searchValueThunderstore, thunderstoreOffset, thunderstoreModsCount, thunderstoreSortFilter, thunderstoreSortOrder);
|
||||
await navigate("refresh");
|
||||
searchInput = document.getElementById("search-input");
|
||||
searchInput.value = searchValueThunderstore;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
//////////////// THEMES / SORT / LIST ////////////////
|
||||
|
||||
@@ -599,6 +638,8 @@ function setSortOrderButton() {
|
||||
sortOrder = installedSortOrder;
|
||||
} else if (oldPage == "mods-online") {
|
||||
sortOrder = onlineSortOrder;
|
||||
} else if (oldPage == "mods-thunderstore") {
|
||||
sortOrder = thunderstoreSortOrder;
|
||||
}
|
||||
|
||||
const sortOrderButton = document.getElementById("sort-order-image");
|
||||
@@ -621,6 +662,9 @@ function changeSort(sortFilterParameter) {
|
||||
} else if (oldPage == "mods-online") {
|
||||
onlineSortFilter = sortFilterParameter;
|
||||
searchNexusMods();
|
||||
} else if (oldPage == "mods-thunderstore") {
|
||||
thunderstoreSortFilter = sortFilterParameter;
|
||||
searchThunderstoreMods();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,6 +683,13 @@ function inverseSort() {
|
||||
onlineSortOrder = "ASC";
|
||||
}
|
||||
searchNexusMods();
|
||||
} else if (oldPage == "mods-thunderstore") {
|
||||
if (thunderstoreSortOrder == "ASC") {
|
||||
thunderstoreSortOrder = "DESC";
|
||||
} else {
|
||||
thunderstoreSortOrder = "ASC";
|
||||
}
|
||||
searchThunderstoreMods();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,6 +768,20 @@ function changeModsPage(offsetChange) {
|
||||
lastOnlineOffset = onlineOffset;
|
||||
searchNexusMods();
|
||||
}
|
||||
} else if (oldPage == "mods-thunderstore") {
|
||||
if (offsetChange == "min") {
|
||||
thunderstoreOffset = 0;
|
||||
} else if (offsetChange == "max") {
|
||||
thunderstoreOffset = thunderstoreModsTotalCount;
|
||||
} else {
|
||||
thunderstoreOffset += thunderstoreModsCount * offsetChange;
|
||||
thunderstoreOffset = clamp(thunderstoreOffset, 0, thunderstoreModsTotalCount);
|
||||
}
|
||||
thunderstoreOffset = Math.floor(thunderstoreOffset / 10) * 10;
|
||||
if (lastThunderstoreOffset != thunderstoreOffset) {
|
||||
lastThunderstoreOffset = thunderstoreOffset;
|
||||
searchNexusMods();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user