Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Automated Nexus Mod Downloader - 1
- // @version 1
- // @description Downloads mods from a list sequentially with timeouts in between each download
- // @author Igneez
- // @match https://www.nexusmods.com/skyrim
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- (function () {
- "use strict";
- let smallDownloadIDs = [
- ["3863", "0", "Sky UI"],
- ["11811", "0", "FNIS"],
- ["29624", "0", "Racemenu"],
- ["53996", "0", "HDT PE "],
- ["36213", "0", "HDT HighHeels"],
- ["68000", "0", "XP32"],
- ["9557", "0", "Alternate Start"],
- ["57046", "0", "UIExtensions"],
- ["64905", "0", "AddItemMenu"],
- ["14884", "0", "Silent Voice"],
- ["27371", "0", "Better Dialogue Controls"],
- ["28170", "0", "Better MessageBox Controls"],
- ["58705", "0", "PapyrusUtil"],
- ["95017", "0", "PaprusExtender"],
- ["75795", "0", "SKSE Preloader"],
- ["72725", "0", "Crash Fixes"],
- ["76747", "0", "Bug Fixes"],
- ["96734", "0", "Cobb Bug Fixes"],
- ["85443", "0", "Load Game CTD Fix"],
- ["40706", "0", "OneTweak"],
- ["49743", "0", "JContainers"],
- ["10753", "0", "Auto Unequip Ammo"],
- ["66257", "0", "ConsoleUtil"],
- ];
- let largeDownloadIDs = [
- ["2666", "0", "CBBE"],
- ["71214", "0", "Unofficial Skyrim Patch"],
- ["49015", "0", "Bodyslide"],
- ];
- let smallLowerBound = 10000;
- let smallUpperBound = 16000;
- let largeLowerBound = 30000;
- let largeUpperBound = 60000;
- //HTML Elements & CSS Declaration
- let myEle = {
- main: $("<div id='autoDownloaderContent'></div>"),
- modList: $("<div id='myModList'></div>"),
- smallModList: $("<ul id='mySmallModList'></ul>"),
- largeModList: $("<ul id='myLargeModList'></ul>"),
- smallModListTitle: $("<div id='mySmallModListTitle'>Small Mod List</div>"),
- largeModListTitle: $("<ul id='myLargeModListTitle'>Large Mod List</ul>"),
- };
- let myBtns = {
- smallDownloads: $("<button>", {
- text: "Small Downloads",
- click: function () { initDownload(smallDownloadIDs, getRndInteger(smallLowerBound, smallUpperBound)) },
- id: "smallDownloadBtn",
- class: "btn"
- }),
- largeDownloads: $("<button>", {
- text: "Large Downloads",
- click: function () { initDownload(largeDownloadIDs, getRndInteger(largeLowerBound, largeUpperBound)) },
- id: "largeDownloadBtn",
- class: "btn"
- }),
- showModList: $("<button>", {
- text: "Show/Hide Mod List",
- click: function() {
- myEle.modList.toggle();
- myEle.smallModList.toggle();
- myEle.largeModList.toggle();
- },
- id: "showModListBtn",
- class: "btn"
- })
- };
- let myCSS = {
- modList: {
- "display": "none",
- "list-style": "none",
- "column-count": "3",
- "margin": "0.5rem 0"
- },
- title: {
- "color": "white",
- "font-weight": "800",
- "margin-top": "0.5rem"
- }
- };
- myEle.modList.css("display", "none");
- myEle.smallModListTitle.css(myCSS.title);
- myEle.largeModListTitle.css(myCSS.title);
- myEle.smallModList.css(myCSS.modList);
- myEle.largeModList.css(myCSS.modList);
- myBtns.smallDownloads.css("margin", "0 0.5rem");
- myBtns.largeDownloads.css("margin", "0 0.5rem");
- myBtns.showModList.css("margin", "0 0.5rem");
- window.onload = init
- function init() {
- myEle.smallModList = createModList(smallDownloadIDs, myEle.smallModList);
- myEle.largeModList = createModList(largeDownloadIDs, myEle.largeModList);
- myEle.modList.append([myEle.smallModListTitle, myEle.smallModList, myEle.largeModListTitle, myEle.largeModList]);
- myEle.main.append([myBtns.smallDownloads, myBtns.largeDownloads, myBtns.showModList, myEle.modList]);
- $("#mainContent").prepend(myEle.main);
- }
- async function initDownload(list, time) {
- for (let i = 0; i < list.length; i++) {
- localStorage.setItem("downloadIt", "1");
- localStorage.setItem("fileIndex", list[i][1]);
- window.open(`https://www.nexusmods.com/skyrim/mods/${list[i][0]}?tab=files`, "_blank");
- $(`#${list[i][0]}`).css("color", "green");
- await timer(time);
- }
- }
- function createModList(list, listElement) {
- for (let i = 0; i < list.length; i++) {
- let item = $(`<li id="${list[i][0]}">${list[i][2]} - ${list[i][0]}</li>`);
- item.click(function () {
- localStorage.setItem("downloadIt", "1");
- localStorage.setItem("fileIndex", list[i][1]);
- window.open(`https://www.nexusmods.com/skyrim/mods/${list[i][0]}?tab=files`, "_blank");
- });
- item.css({
- "color": "white",
- "font-weight": "600",
- "font-size": "0.8rem"
- });
- listElement.append(item);
- }
- return listElement;
- }
- const timer = ms => new Promise(res => setTimeout(res, ms));
- const getRndInteger = (min, max) => Math.floor(Math.random() * (max - min)) + min;
- })();
Advertisement
Add Comment
Please, Sign In to add comment