├── .gitignore ├── css ├── skinContainer.css ├── blocked.css ├── fixDropdown.css ├── followBtn.css ├── popup.css └── removeAds.css ├── icons ├── icon128.png ├── icon16.png └── icon48.png ├── js ├── removeAds.js ├── fixDropdown.js ├── popup.js ├── global.js ├── time.js ├── removeLocation.js ├── toggleSettings.js ├── profile.js ├── capeTester.js ├── nameSearch.js ├── icons.js ├── capesPage.js ├── customCapes.js └── bootstrap.bundle.min.js ├── .github └── FUNDING.yml ├── manifest.json ├── README.md └── html └── popup.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore skinview3d source 2 | /skinview3d -------------------------------------------------------------------------------- /css/skinContainer.css: -------------------------------------------------------------------------------- 1 | #skin_container { 2 | cursor: move; 3 | } 4 | -------------------------------------------------------------------------------- /icons/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NameMCPlus/NameMCplus/HEAD/icons/icon128.png -------------------------------------------------------------------------------- /icons/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NameMCPlus/NameMCplus/HEAD/icons/icon16.png -------------------------------------------------------------------------------- /icons/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NameMCPlus/NameMCplus/HEAD/icons/icon48.png -------------------------------------------------------------------------------- /css/blocked.css: -------------------------------------------------------------------------------- 1 | main.container { 2 | display: none; 3 | } 4 | 5 | .bg-blocked { 6 | background-color: gray !important; 7 | } 8 | -------------------------------------------------------------------------------- /css/fixDropdown.css: -------------------------------------------------------------------------------- 1 | [data-toggle=dropdown] { 2 | pointer-events: none; 3 | } 4 | 5 | .pointer-all { 6 | pointer-events: all; 7 | } -------------------------------------------------------------------------------- /css/followBtn.css: -------------------------------------------------------------------------------- 1 | #followingMenuButton, #followMenuButton { 2 | color: #d6d8e1; 3 | background-color: #346cb0; 4 | border-color: #346cb0; 5 | } 6 | -------------------------------------------------------------------------------- /js/removeAds.js: -------------------------------------------------------------------------------- 1 | try { 2 | document.body.style = "padding-top: 0"; 3 | } catch {} 4 | 5 | try { 6 | $("#nn_bfa_wrapper,#nn_skinl,#nn_skinr,#nn_mpu1,#nn_mobile_mpu1,#nn_mobile_mpu2,#mys-wrapper,#nn_mobile_lb1_wrap,#sticky_wrapper,#nn_mobile_lb1,#nn_1by1").remove(); 7 | } catch {} 8 | -------------------------------------------------------------------------------- /js/fixDropdown.js: -------------------------------------------------------------------------------- 1 | $('[data-toggle=dropdown]').dropdown({ 2 | selector: '[data-toggle=dropdown]', 3 | display: "static" 4 | }); 5 | 6 | document.querySelectorAll('[data-toggle=dropdown]').forEach( 7 | function (element) { 8 | element.classList.add("pointer-all"); 9 | }); 10 | 11 | document.querySelector("#header > div:nth-child(1) > nav > a > span").innerText = "NameMC+"; 12 | -------------------------------------------------------------------------------- /css/popup.css: -------------------------------------------------------------------------------- 1 | /* css by Faav */ 2 | 3 | body { 4 | text-align: center; 5 | width: 185px; 6 | } 7 | 8 | h1 { 9 | padding-top: 15px; 10 | } 11 | 12 | input { 13 | margin-left: -1.5em !important; 14 | } 15 | 16 | a { 17 | text-decoration: none; 18 | } 19 | 20 | footer { 21 | padding-bottom: 20px; 22 | } 23 | 24 | .title { 25 | color: white; 26 | } 27 | 28 | .title:hover, .title:active { 29 | color: lightgray; 30 | } 31 | -------------------------------------------------------------------------------- /css/removeAds.css: -------------------------------------------------------------------------------- 1 | @media screen and (min-width: 900px) { 2 | body { 3 | padding-top: 0 !important; 4 | } 5 | } 6 | 7 | body { 8 | padding-top: 0 !important; 9 | } 10 | 11 | #nn_bfa_wrapper, 12 | #nn_skinl, 13 | #nn_skinr, 14 | #nn_mpu1, 15 | #nn_mobile_mpu1, 16 | #nn_mobile_mpu2, 17 | #mys-wrapper, 18 | #nn_mobile_lb1_wrap, 19 | #sticky_wrapper, 20 | #nn_mobile_lb1, 21 | #nn_1by1 { 22 | display: none !important; 23 | } 24 | 25 | div.ad-container { 26 | display: none !important; 27 | } 28 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: namemcplus 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: namemcplus 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | -------------------------------------------------------------------------------- /js/popup.js: -------------------------------------------------------------------------------- 1 | document.getElementById("othercapesopenmenu").onclick = function() { 2 | document.getElementById("third-party-capes-menu").style = ""; 3 | document.getElementById("main-menu").style = "display: none;"; 4 | chrome.storage.local.get(result => { 5 | if (!result.customApis) result.customApis = ""; 6 | document.getElementById("apistextinput").value = result.customApis; 7 | }) 8 | } 9 | 10 | document.getElementById("othercapesclosemenu").onclick = function() { 11 | document.getElementById("third-party-capes-menu").style = "display: none;"; 12 | document.getElementById("main-menu").style = ""; 13 | } 14 | 15 | document.getElementById("savecustomapisbutton").onclick = function() { 16 | chrome.storage.local.set({ 17 | "customApis": document.getElementById("apistextinput").value 18 | }) 19 | } -------------------------------------------------------------------------------- /js/global.js: -------------------------------------------------------------------------------- 1 | chrome.storage.local.get(result => { 2 | if (result.browniePoints) { 3 | document.title = document.title.replace(/NameMC$/g, "NameMC+").replace(/NameMC /g, "NameMC+ "); 4 | document.querySelector("nav > a").setAttribute("title", "Coding their website for them since 2021!") 5 | document.querySelector("nav > a > svg").setAttribute("viewBox", "-7 -7 14 14"); 6 | document.querySelector("nav > a > svg > path").setAttribute("d", "M -1 1 L -1 5 L 1 5 L 1 1 L 5 1 L 5 -1 L 1 -1 L 1 -5 L -1 -5 L -1 -1 L -5 -1 L -5 1 L -1 1"); 7 | document.querySelector("nav > a > span").innerHTML += "+"; 8 | 9 | var link = document.querySelector("link[rel~='icon']"); 10 | if (!link) { 11 | link = document.createElement('link'); 12 | link.rel = 'icon'; 13 | document.getElementsByTagName('head')[0].appendChild(link); 14 | } 15 | link.href = 'https://namemc.plus/icon128.png'; 16 | } 17 | }) 18 | 19 | const navigationBar = document.querySelector("nav > ul"); 20 | 21 | const testerMenuItem = document.createElement("li"); 22 | testerMenuItem.className = "nav-item"; 23 | testerMenuItem.innerHTML = ` 24 | 25 | Tester 26 | 27 | ` 28 | 29 | navigationBar.appendChild(testerMenuItem); -------------------------------------------------------------------------------- /js/time.js: -------------------------------------------------------------------------------- 1 | function formatTimezoneOffset(time){let offset=time.getTimezoneOffset();let sign;if(offset>0){sign='−';}else{sign='+';offset=-offset;} 2 | let hourOffset=Math.floor(offset/60);let minuteOffset=offset-60*hourOffset;return '(UTC'+sign+(hourOffset<=9?'0':'')+hourOffset+':'+(minuteOffset<=9?'0':'')+minuteOffset+')';} 3 | function localizeTimes(){$('time').each(function(i,e){let time=new Date(e.getAttribute('datetime'));switch(e.getAttribute('data-type')){case 'date':e.textContent=time.toLocaleDateString();break;case 'time':e.textContent=time.toLocaleTimeString();break;case 'timezone':e.textContent=formatTimezoneOffset(time);break;default:e.textContent=time.toLocaleString();}});$('.title-time').each(function(i,e){let title=e.getAttribute('title');if(title){let time=new Date(title);e.setAttribute('title',time.toLocaleString());}});} 4 | function startTimer(e,clock){let dateString=e.attr('data-datetime');let updateTitle=e.attr('data-update-title');if(!dateString)return;let date=Date.parse(dateString);let title=document.title;let tick=function(){let now=clock();let secondsRemaining=Math.round((date-now.getTime())/1000);if(secondsRemaining<=0)secondsRemaining=0;let s=secondsRemaining;let d=Math.floor(s/(60*60*24));s-=d*(60*60*24);let h=Math.floor(s/(60*60));s-=h*(60*60);let m=Math.floor(s/60);s-=m*60;let text;if(d){text=`${d}:${h.toString().padStart(2,'0')}:${m.toString().padStart(2,'0')}:${s.toString().padStart(2,'0')}`;}else if(h){text=`${h}:${m.toString().padStart(2,'0')}:${s.toString().padStart(2,'0')}`;}else{text=`${m}:${s.toString().padStart(2,'0')}`;} 5 | e.text(text);if(secondsRemaining>0){setTimeout(tick,1000-now.getMilliseconds());}else{$('#status-bar').removeClass('bg-info').addClass('bg-success');}};tick();} 6 | function makeClock(callback){const now=Date.now();$.getJSON('https://api.namemc.com/time',function(time){const offset=new Date(time).getTime()-(Date.now()+now)/2;callback(function(){return new Date(Date.now()+offset);});});} 7 | function startTimers(){const timers=$('.countdown-timer');if(timers.length>0){makeClock(function(clock){timers.each(function(i,e){startTimer($(e),clock);});});}} 8 | localizeTimes(); 9 | -------------------------------------------------------------------------------- /js/removeLocation.js: -------------------------------------------------------------------------------- 1 | chrome.storage.local.get(function (result) { 2 | if (result.hideLocation == true) { 3 | 4 | const DEL_SELECTOR = 'body > main > div.row > div.col-12.col-md-6.col-lg-5 > div:nth-child(2) > img'; 5 | const mo = new MutationObserver(onMutation); 6 | // in case the content script was injected after the page is partially loaded 7 | onMutation([{addedNodes: [document.documentElement]}]); 8 | observe(); 9 | function onMutation(mutations) { 10 | const toRemove = []; 11 | for (const {addedNodes} of mutations) { 12 | for (const n of addedNodes) { 13 | if (n.tagName) { 14 | if (n.matches(DEL_SELECTOR)) { 15 | fixText(); 16 | toRemove.push(n); 17 | } else if (n.firstElementChild && n.querySelector(DEL_SELECTOR)) { 18 | toRemove.push(...n.querySelectorAll(DEL_SELECTOR)); 19 | } 20 | } 21 | } 22 | } 23 | if (toRemove.length) { 24 | mo.disconnect(); 25 | for (const el of toRemove) el.remove(); 26 | observe(); 27 | } 28 | } 29 | function observe() { 30 | mo.observe(document, { 31 | subtree: true, 32 | childList: true, 33 | }); 34 | } 35 | function fixText() { 36 | document.querySelector("body > main > div.row > div.col-12.col-md-6.col-lg-5 > div:nth-child(2) > div.card-body.py-1 > div:nth-child(4) > div.col-auto.text-nowrap > strong").innerHTML = "Ping"; 37 | a = document.querySelector("body > main > div.row > div.col-12.col-md-6.col-lg-5 > div:nth-child(2) > div.card-body.py-1 > div:nth-child(4) > div.col.text-nowrap.text-right").innerHTML; 38 | b = a.indexOf("("); 39 | c = a.slice(b) 40 | document.querySelector("body > main > div.row > div.col-12.col-md-6.col-lg-5 > div:nth-child(2) > div.card-body.py-1 > div:nth-child(4) > div.col.text-nowrap.text-right").innerHTML = c; 41 | } 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /js/toggleSettings.js: -------------------------------------------------------------------------------- 1 | class Setting { 2 | constructor(name, button, defaultOption = false) { 3 | this.name = name; 4 | this.button = button; 5 | this.defaultOption = defaultOption; 6 | } 7 | } 8 | 9 | const options = [ 10 | // main options 11 | new Setting("otherCapes", document.getElementById("othercapesbutton"), true), 12 | new Setting("namemcplusBadges", document.getElementById("badgesbutton"), true), 13 | new Setting("accountTypes", document.getElementById("acctypebutton"), true), 14 | new Setting("creationDates", document.getElementById("creationbutton"), true), 15 | new Setting("blockedNames", document.getElementById("blockedbutton"), true), 16 | new Setting("oldLayout", document.getElementById("searchbutton"), false), 17 | new Setting("hideLocation", document.getElementById("hidelocationbutton"), false), 18 | new Setting("hideSeparation", document.getElementById("hideseparationbutton"), false), 19 | new Setting("browniePoints", document.getElementById("browniepointsbutton"), false), 20 | new Setting("mcusername", document.getElementById("mcusernamebutton"), false), 21 | 22 | // more capes options 23 | new Setting("capePages", document.getElementById("capepagesbutton"), true), 24 | new Setting("namemcpluscape", document.getElementById("namemcpluscapebutton"), true), 25 | new Setting("optifine", document.getElementById("optifinebutton"), true), 26 | // new Setting("mantle", document.getElementById("mantlebutton"), true), 27 | new Setting("cloaksplus", document.getElementById("cloaksplusbutton"), true), 28 | new Setting("labymod", document.getElementById("labymodbutton"), true), 29 | new Setting("capesmod", document.getElementById("capesmodbutton"), true) 30 | ] 31 | 32 | options.forEach(option => { 33 | option.button.onclick = () => { 34 | toggleSetting(option.name, option.button.checked) 35 | }; 36 | }) 37 | 38 | function toggleSetting(key, value) { 39 | const obj = {}; 40 | obj[key] = value; 41 | chrome.storage.local.set(obj, console.log(`Successfully set "${key}" to "${value}"`)) 42 | } 43 | 44 | function restoreOptions() { 45 | chrome.storage.local.get(function (result) { 46 | options.forEach(option => { 47 | 48 | if (typeof result[option.name] == "undefined") { 49 | option.button.checked = option.defaultOption; 50 | toggleSetting(option.name, option.defaultOption); 51 | console.log(`Option ${option.name} didn't exist`) 52 | return; 53 | } 54 | 55 | console.log(`Option ${option.name} is set to ${result[option.name]}`) 56 | option.button.checked = result[option.name]; 57 | 58 | }) 59 | }); 60 | } 61 | document.addEventListener('DOMContentLoaded', restoreOptions); 62 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NameMC+", 3 | "description": "A browser extension that adds cool features to NameMC!", 4 | "version": "4.0", 5 | "author": "M6, Faav, and Orius", 6 | "icons": { 7 | "16": "icons/icon16.png", 8 | "48": "icons/icon48.png", 9 | "128": "icons/icon128.png" 10 | }, 11 | "action": { 12 | "default_icon": { 13 | "16": "icons/icon16.png", 14 | "48": "icons/icon48.png" 15 | }, 16 | "default_title": "NameMC+", 17 | "default_popup": "html/popup.html" 18 | }, 19 | "manifest_version": 3, 20 | "content_scripts": [ 21 | { 22 | "matches": [ 23 | "https://*.namemc.com/*" 24 | ], 25 | "run_at": "document_start", 26 | "js": [ 27 | "js/jquery.min.js", 28 | "js/bootstrap.bundle.min.js", 29 | "js/time.js", 30 | "js/icons.js" 31 | ], 32 | "css": [ 33 | "css/removeAds.css", 34 | "css/followBtn.css", 35 | "css/fixDropdown.css", 36 | "css/skinContainer.css" 37 | ] 38 | }, 39 | { 40 | "matches": [ 41 | "https://*.namemc.com/*" 42 | ], 43 | "js": [ 44 | "js/fixDropdown.js", 45 | "js/removeAds.js", 46 | "js/global.js" 47 | ] 48 | }, 49 | { 50 | "matches": [ 51 | "https://*.namemc.com/search*", 52 | "https://*.namemc.com/name/*" 53 | ], 54 | "js": [ 55 | "js/nameSearch.js" 56 | ], 57 | "css": [ 58 | "css/blocked.css" 59 | ] 60 | }, 61 | { 62 | "matches": [ 63 | "https://*.namemc.com/profile/*" 64 | ], 65 | "js": [ 66 | "js/profile.js", 67 | "js/skinview3d.bundle.js", 68 | "js/customCapes.js" 69 | ] 70 | }, 71 | { 72 | "matches": [ 73 | "https://*.namemc.com/server/*" 74 | ], 75 | "run_at": "document_start", 76 | "all_frames": true, 77 | "js": ["js/removeLocation.js" 78 | ] 79 | }, 80 | { 81 | "matches": [ 82 | "https://*.namemc.com/cape*", 83 | "https://*.namemc.com/nmcp-cape/*", 84 | "https://*.namemc.com/custom-cape/*", 85 | "https://*.namemc.com/optifine-cape/*" 86 | ], 87 | "run_at": "document_start", 88 | "js": [ 89 | "js/skinview3d.bundle.js", 90 | "js/capesPage.js" 91 | ] 92 | }, 93 | { 94 | "matches": [ 95 | "https://*.namemc.com/plus/cape-tester*" 96 | ], 97 | "js": [ 98 | "js/skinview3d.bundle.js", 99 | "js/capeTester.js" 100 | ] 101 | } 102 | ], 103 | "permissions": [ 104 | "activeTab", 105 | "storage" 106 | ], 107 | "web_accessible_resources": [ 108 | { 109 | "resources": [ "json/*.json" ], 110 | "matches": [ "https://*.namemc.com/*" ] 111 | } 112 | ] 113 | } 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NameMC+ (DISCONTINUED) 2 | USE THE BETTER VERSION [NAMEMC EXTRAS](https://github.com/bribes/NameMC-Extras)! 3 | 4 | 5 | A browser extension that adds cool features to NameMC! 6 | 7 | [Website](https://namemc.plus) - [API](https://api.namemc.plus) - [Discord](https://namemc.plus/discord) 8 | 9 | Currently only supports Chromium-based browsers. (Google Chrome, Microsoft Edge, Brave, etc.) 10 | Support for other browsers will come in the future! 11 | 12 | # Features 13 | 14 | - [NEW] Cape Tester 15 | - Custom Capes 16 | - Badge System 17 | - Support for __[LabyMod](https://labymod.net)__, __[Cloaks+](https://cloaksplus.com)__, and __[MinecraftCapes Mod](https://minecraftcapes.net)__ 18 | - Renders elytras 19 | - View all OptiFine special capes 20 | - Displays user creation dates (Inaccurate for a lot of accounts due to a breaking change on Mojang's end. We are currently fetching dates from Ashcon's API. Please yell at Mojang ([WEB-3367](https://bugs.mojang.com/browse/WEB-3367)) in order for accurate creation dates to return) 21 | - Shows users' account type (Legacy, Mojang, Microsoft, Migrated Microsoft, etc) 22 | - Detects if a name is blocked 23 | - Hides the Seperation card 24 | - Shows descriptions for capes 25 | - Hides the Location card on servers 26 | - Can revert NameMC's new search page 27 | - Removes most ads (If you don't want any ads at all, try using [uBlock Origin](https://ublockorigin.com)) 28 | - Adds a button to view the user's [mcuserna.me](https://mcuserna.me) profile 29 | 30 | # Installation 31 | 32 | 1. [Download](https://github.com/NameMCPlus/NameMCplus/archive/refs/heads/main.zip) the extension 33 | 2. Extract the .zip file 34 | 3. Go to chrome://extensions 35 | 4. Enable __Developer Mode__ then select __Load Unpacked Extension__ 36 | 5. Select the extracted folder 37 | 6. Refresh or open a new tab for NameMC! 38 | 39 | # The Basics 40 | 41 | - Most features can be toggled on or off from the extension's pop-up menu. 42 | - Some special __capes__ and __badges__ are given out for donating to NameMC+ or by the developers themselves. Join the [Discord](https://discord.gg/ZwxFpPTpjt) to be alerted when you can earn one! 43 | - You can view a user's elytra by going to their skinview and pressing the "Show Elytra" button in the top right corner. 44 | - If you hover over the account type, a tooltip pops up showing the specifics. (Migrated from Mojang, Newly Created (Microsoft), etc.) 45 | - Visiting a cape page will show you a description of how/why the cape was given out. 46 | 47 | # APIs Used 48 | 49 | - [Gapple API](https://api.gapple.pw/) 50 | - [Ashcon API](https://github.com/Electroid/mojang-api) 51 | - [MCHeads API](https://www.mc-heads.net/) 52 | 53 | # Credits 54 | 55 | - [M6](https://github.com/m6yo) for creating the extension, creating the early versions, and contributing to the project/codebase. 56 | - [Faav](https://github.com/withdrew) for contributing immensely to the project and adding the first core features. 57 | - [james090500](https://github.com/james090500) for letting us use some of the code from his [skinview3d fork](https://github.com/james090500/skinview3d) and [Chrome Extension](https://github.com/james090500/minecraftcapes-for-namemc). 58 | - [Orius](https://github.com/ItsOrius) for his massive contributions to the project by making the code more efficient, etc. 59 | -------------------------------------------------------------------------------- /html/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | NameMC+ 8 | 9 | 10 |

NameMC+

11 |
12 | 13 | 52 | 53 | 86 | 87 |
88 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /js/profile.js: -------------------------------------------------------------------------------- 1 | var username = document.querySelector("[name='profile:username']").content; 2 | var profileUUID = document.querySelector(".card-body .row:nth-child(2) samp").innerText; 3 | var template = document.createElement("template"); 4 | var htmlForBadges = ''; 5 | var delta = 5; 6 | var g = document.querySelector("#header").innerHTML; 7 | var q = g.includes("namemc-rank namemc-rank-10\" translate="); 8 | 9 | if (q == true) delta = 3; 10 | 11 | $('body').tooltip({ 12 | selector: '[data-toggle=tooltip]' 13 | }); 14 | 15 | chrome.storage.local.get(function (result) { 16 | if (result.mcusername) addMCUNButton(); 17 | if (result.hideSeparation) { 18 | document.querySelectorAll("a").forEach(element => { 19 | if (element.href == "https://en.wikipedia.org/wiki/Six_degrees_of_separation") element.parentElement.parentElement.parentElement.remove() 20 | }) 21 | } 22 | }); 23 | 24 | //Formats Creation Dates 25 | function formatCreation(date) { 26 | var d = date.split("-"); 27 | var date = `${d[1]}/${d[2]}/${d[0]}`; 28 | return date; 29 | } 30 | 31 | function removeAccents(invalidName) { 32 | return encodeURIComponent(decodeURIComponent(invalidName).normalize('NFD').replace(/[\u0300-\u036f]/g, '')); 33 | } 34 | 35 | // Removes Accents from invalids LOL 36 | username = removeAccents(username); 37 | 38 | chrome.storage.local.get(function (result) { 39 | if (result.namemcplusBadges) { 40 | fetch(`https://api.namemc.plus/badges/${profileUUID}`) 41 | .then((response) => response.json()) 42 | .then((json) => { 43 | const badges = []; 44 | for (let [key, name] of Object.entries(json)) { 45 | var checkForErrors = JSON.stringify(json); 46 | if (checkForErrors.includes("404 Not Found") == false) { 47 | badges.push(name) 48 | console.log(name) 49 | } 50 | } 51 | console.log(JSON.stringify(badges)) 52 | setStatus(username, profileUUID, badges) 53 | }); 54 | } 55 | }); 56 | 57 | document.querySelector(".mt-3 div div").classList.remove("col-auto") 58 | 59 | function setStatus(username, profileUUID, badges) { 60 | fetch(`https://api.gapple.pw/cors/username/${username}`) 61 | .then(response => response.json()) 62 | .then(toUUID => { 63 | var uuid = toUUID.id; 64 | fetch(`https://api.ashcon.app/mojang/v2/user/${profileUUID}`) 65 | .then(response => response.json()) 66 | .then(ashcon => { 67 | fetch(`https://api.gapple.pw/status/${profileUUID}`) 68 | .then(response => response.json()) 69 | .then(gapple => { 70 | chrome.storage.local.get(function (result) { 71 | var type = gapple.status; 72 | var createdAt = ashcon.created_at; 73 | var accountType; 74 | var tooltip; 75 | 76 | switch (type) { 77 | case "msa": 78 | accountType = "Microsoft"; 79 | tooltip = "Microsoft Account"; 80 | break; 81 | case "migrated_msa": 82 | accountType = "Microsoft"; 83 | tooltip = "Migrated from Mojang"; 84 | break; 85 | case "new_msa": 86 | accountType = 'Microsoft'; 87 | tooltip = "Newly Created"; 88 | break; 89 | case "mojang": 90 | accountType = "Mojang"; 91 | tooltip = "Mojang Account"; 92 | break; 93 | case "normal": 94 | accountType = "Normal (Mojang OR Microsoft)"; 95 | tooltip = "Mojang or Microsoft Account"; 96 | break; 97 | case "legacy": 98 | accountType = "Legacy"; 99 | tooltip = "Unmigrated (2009 - Late 2012)"; 100 | break; 101 | } 102 | if (profileUUID == "cc7ba16bb2c540fca18eb87b6949270e") { // homara- breaks the API lol) 103 | accountType = "Legacy"; 104 | tooltip = "Unmigrated (2009 - Late 2012)"; 105 | } 106 | var createdAtBtn = result.creationDates; 107 | var AccTypeBtn = result.accountTypes; 108 | 109 | const accTypeText = ` 110 |
111 |
Account Type
112 |
${accountType}
113 |
114 | ` 115 | 116 | const createdAtText = ` 117 |
118 |
Created At
119 |
NMCP_PLACEHOLDER_DATE
120 |
121 | ` 122 | 123 | template.innerHTML = ` 124 | ${AccTypeBtn && accountType ? accTypeText : ""} 125 | ${createdAtBtn && createdAt ? createdAtText.replace("NMCP_PLACEHOLDER_DATE", formatCreation(createdAt)) : ""} 126 | ` 127 | 128 | if (badges.length > 0) { 129 | let badgesHTML = ""; 130 | badges.forEach(badge => { 131 | badgesHTML += ` 132 | 133 | ` 134 | }) 135 | htmlForBadges += ` 136 |
137 |
NameMC+ Badges
138 |
${badgesHTML}
139 |
`; 140 | } 141 | 142 | var viewsElement = document.querySelectorAll(".col-lg-4")[3].parentElement; 143 | var accountTypeElement = template.content; 144 | viewsElement.parentNode.insertBefore(accountTypeElement, viewsElement.nextSibling); 145 | document.querySelector(`body > main > div > div.col-md.order-md-2 > div:nth-child(${delta}) > div.card-body.py-1`).innerHTML += htmlForBadges; 146 | 147 | var discordBtn = document.querySelector('[data-toggle="popover"]'); 148 | if (discordBtn) { 149 | function discordPopoverRemover() { 150 | var popovers = document.querySelectorAll(".popover.show"); 151 | try { 152 | if (popovers[1] || popovers[0].style.willChange.includes("top,")) { 153 | popovers[0].remove(); 154 | } 155 | } catch {} 156 | } 157 | $('[data-toggle="popover"]').popover(); 158 | discordPopoverRemover(); 159 | discordBtn.onclick = function () { 160 | discordPopoverRemover(); 161 | }; 162 | } 163 | }); 164 | }); 165 | }); 166 | }); 167 | } 168 | 169 | function addMCUNButton() { 170 | const parentDiv = document.createElement("a"); 171 | parentDiv.href = `https://mcuserna.me/?lookup=${profileUUID}`; 172 | parentDiv.target = "_blank"; 173 | 174 | const button = document.createElement("button"); 175 | button.innerHTML = "mcuserna.me"; 176 | button.classList = "btn btn-sm text-nowrap btn-success"; 177 | 178 | parentDiv.appendChild(button); 179 | const bigUsername = document.querySelector("div h1"); 180 | bigUsername.innerHTML += " " + parentDiv.outerHTML; 181 | } 182 | -------------------------------------------------------------------------------- /js/capeTester.js: -------------------------------------------------------------------------------- 1 | // remove the 404 error 2 | document.querySelector("main > div").remove(); 3 | document.title = "Cape Tester | NameMC+" 4 | document.querySelector("header").innerHTML += ` 5 |
6 |

Minecraft Cape Tester

7 |
8 |
9 | ` 10 | 11 | // declare variables 12 | const skinViewer = null; 13 | const skinViewerWalk = null; 14 | 15 | // create skin viewer 16 | document.querySelector("main").innerHTML = ` 17 |
18 |
19 |
20 |
21 | `; 22 | createSkinViewer(document.querySelector("main > div > div")) 23 | 24 | // create skin viewer options parent 25 | const settingsParent = document.createElement("div"); 26 | settingsParent.className = "card mb-3" 27 | document.querySelectorAll("main > div > div")[1].appendChild(settingsParent); 28 | 29 | 30 | 31 | // go crazy, go stupid aaaaah 32 | settingsParent.innerHTML = ` 33 |
Settings
34 |
35 | 36 | 37 | 38 | 44 |
45 | 46 |
47 | 48 | 49 |
50 | `; 51 | 52 | 53 | 54 | // when a user for the skin is entered 55 | document.getElementById("skin-input").onkeydown = event => { 56 | if(event.key != 'Enter') return; 57 | const value = document.getElementById("skin-input").value; 58 | this.skinViewer.loadSkin(`https://www.mc-heads.net/skin/${value.trim()}`); 59 | } 60 | 61 | 62 | 63 | // add upside down change register 64 | document.getElementById("upside-down-input").onchange = (event) => { 65 | if (document.getElementById("upside-down-input").checked) { 66 | this.skinViewer.playerObject.rotation.y = -10 67 | this.skinViewer.scene.rotation.z = Math.PI; 68 | this.skinViewer.scene.position.y = -17.5; 69 | } else { 70 | this.skinViewer.playerObject.rotation.y = 10 71 | this.skinViewer.scene.rotation.z = 0; 72 | this.skinViewer.scene.position.y = 0; 73 | } 74 | } 75 | 76 | 77 | 78 | // add select register 79 | document.getElementById("cape-input").onchange = (event) => { 80 | this.skinViewer.loadCape(document.getElementById("cape-input").value) 81 | } 82 | 83 | 84 | 85 | // add select file register 86 | var reader = new FileReader(); 87 | reader.addEventListener("load", () => {this.skinViewer.loadCape(reader.result)}, false); 88 | 89 | document.getElementById("cape-file-input").onchange = (event) => { 90 | reader.readAsDataURL(document.getElementById("cape-file-input").files[0]); 91 | } 92 | 93 | 94 | 95 | // add cape options 96 | loadCapeOptions(); 97 | 98 | async function loadCapeOptions() { 99 | fetch("https://api.namemc.plus/capeInfo").then(response => response.json()).then(json => { 100 | let parentElement = document.getElementById("java-capes-group") 101 | Object.entries(json).sort().forEach(cape => { 102 | parentElement.innerHTML += `` 103 | }) 104 | this.skinViewer.loadCape(document.getElementById("cape-input").value) 105 | }) 106 | 107 | fetch("https://api.namemc.plus/bedrockCapes").then(response => response.json()).then(json => { 108 | let parentElement = document.getElementById("bedrock-capes-group") 109 | Object.entries(json).sort().forEach(cape => { 110 | parentElement.innerHTML += `` 111 | }) 112 | this.skinViewer.loadCape(document.getElementById("cape-input").value) 113 | }) 114 | 115 | fetch("https://api.namemc.plus/OFcapes").then(response => response.json()).then(json => { 116 | let parentElement = document.getElementById("optifine-capes-group") 117 | Object.entries(json).forEach(cape => { 118 | parentElement.innerHTML += `` 119 | }) 120 | this.skinViewer.loadCape(document.getElementById("cape-input").value) 121 | }) 122 | 123 | fetch("https://api.namemc.plus/capes").then(response => response.json()).then(json => { 124 | let parentElement = document.getElementById("namemcplus-capes-group") 125 | chrome.storage.local.get(result => { 126 | if (result.hiddenCapes) { 127 | Object.entries(result.hiddenCapes).forEach(obj => { 128 | json[obj[0]] = obj[1]; 129 | }) 130 | } 131 | Object.entries(json).sort().forEach(cape => { 132 | parentElement.innerHTML += `` 133 | }) 134 | }) 135 | this.skinViewer.loadCape(document.getElementById("cape-input").value) 136 | }); 137 | } 138 | 139 | 140 | 141 | function createSkinViewer(parent) { 142 | // Skin 143 | let featureDiv = document.createElement("div"); 144 | featureDiv.id = "skin-viewer"; 145 | featureDiv.className = "card mb-3"; 146 | 147 | // Add a button for animation 148 | let featureAnimateButton = document.createElement("button"); 149 | featureAnimateButton.className = "btn btn-secondary play-pause-btn position-absolute top-0 left-0 m-2 p-0"; 150 | featureAnimateButton.style.cssText = "width:32px;height:32px;z-index:1;"; 151 | featureAnimateButton.addEventListener('click', (event) => { 152 | this.skinViewerWalk.paused = !this.skinViewerWalk.paused; 153 | }) 154 | let featureButtonIcon = document.createElement("i") 155 | featureButtonIcon.className = "fas fa-play"; 156 | featureAnimateButton.appendChild(featureButtonIcon); 157 | featureDiv.appendChild(featureAnimateButton); 158 | 159 | // Add a button for Elytra 160 | let featureElytraButton = document.createElement("button"); 161 | featureElytraButton.innerHTML = "Show Elytra" 162 | featureElytraButton.className = "btn btn-secondary play-pause-btn position-absolute top-0 right-0 m-2 p-0"; 163 | featureElytraButton.style.cssText = "height:32px;padding:0px 10px !important;z-index:1;"; 164 | featureElytraButton.addEventListener('click', (event) => { 165 | if (this.skinViewer.playerObject.backEquipment == "cape") { 166 | featureElytraButton.innerHTML = "Show Cape" 167 | this.skinViewer.loadCape(this.skinViewer.capeImage, { 168 | backEquipment: 'elytra' 169 | }) 170 | } else { 171 | featureElytraButton.innerHTML = "Show Elytra" 172 | this.skinViewer.loadCape(this.skinViewer.capeImage, { 173 | backEquipment: 'cape' 174 | }) 175 | } 176 | }) 177 | featureDiv.appendChild(featureElytraButton); 178 | 179 | // Add the body 180 | let featureBody = document.createElement("div"); 181 | featureBody.className = "card-body text-center checkered"; 182 | 183 | featureDiv.appendChild(featureBody); 184 | 185 | // Add the canvas 186 | let featureCanvas = document.createElement("canvas"); 187 | featureCanvas.id = "skin_container"; 188 | featureBody.appendChild(featureCanvas); 189 | 190 | //Get skin model 191 | let skinModel = $(".skin-3d").attr("data-model"); 192 | 193 | //Insert the div 194 | parent.appendChild(featureDiv); 195 | 196 | this.skinViewer = new skinview3d.FXAASkinViewer({ 197 | canvas: document.getElementById("skin_container"), 198 | width: 270, 199 | height: 330, 200 | skin: "https://texture.namemc.com/12/b9/12b92a9206470fe2.png", 201 | model: skinModel, 202 | cape: this.finalCape, 203 | ears: this.finalEars 204 | }); 205 | 206 | let control = skinview3d.createOrbitControls(this.skinViewer); 207 | control.enableRotate = true; 208 | control.enableZoom = false; 209 | control.enablePan = false; 210 | 211 | this.skinViewerWalk = this.skinViewer.animations.add(skinview3d.WalkingAnimation); 212 | this.skinViewerWalk.paused = true; 213 | 214 | this.skinViewer.camera.position.set(0, 10, 50); 215 | control.update(); 216 | 217 | this.skinViewer.playerObject.rotation.y = 10; 218 | 219 | document.getElementById("skin_container").addEventListener( 220 | "contextmenu", 221 | (event) => event.stopImmediatePropagation(), 222 | true 223 | ); 224 | 225 | //Set style 226 | document.getElementById("skin_container").style.filter = "drop-shadow(-9px 4px 9px rgba(0,0,0,0.4))" 227 | document.getElementById("skin_container").style.outline = "none" 228 | 229 | return featureDiv; 230 | } 231 | 232 | 233 | 234 | 235 | /* Cape scaling (height) */ 236 | function capeScale(height) { 237 | if (height % 22 === 0) { 238 | return height / 22; 239 | } else if (height % 17 === 0) { 240 | return height / 17; 241 | } else if (height >= 32 && (height & (height - 1)) === 0) { 242 | return height / 32; 243 | } 244 | return Math.max(1, Math.floor(height / 22)); 245 | } -------------------------------------------------------------------------------- /js/nameSearch.js: -------------------------------------------------------------------------------- 1 | //by M6 (M6yo) & Faav (withdrew) 2 | 3 | var isWildcard = false; 4 | 5 | try { 6 | if (document.querySelector(".container.mt-3 small").innerText) { 7 | isWildcard = true; 8 | } 9 | } catch {} 10 | 11 | function unhide() { 12 | var main = document.querySelector("main.container"); 13 | main.classList.add("d-block"); 14 | } 15 | 16 | function removeFinePrint() { 17 | // removes fine print under name availability 18 | try { 19 | document.querySelector("#status-bar").parentElement.children[1].remove(); 20 | } catch {} 21 | } 22 | 23 | function betterNameMC(username) { 24 | var namemcStatus = document.querySelector("#status-bar div").firstElementChild.lastElementChild.innerText.replaceAll("*", ""); 25 | var namemcStatusNoReplace = document.querySelector("#status-bar div").firstElementChild.lastElementChild; 26 | var searches = document.querySelector(".tabular").innerText; 27 | var statusClass = document.querySelector("#status-bar").classList[1]; 28 | var statusColor = document.querySelector("#status-bar").classList[2]; 29 | var main = document.querySelector("main.container"); 30 | var textColor = ""; 31 | var results = ""; 32 | var profiles = ""; 33 | var serverCount = ""; 34 | var servers = ""; 35 | var Skin = ""; 36 | var skinCount = ""; 37 | var toa = ""; 38 | var dateTime = ""; 39 | 40 | try { 41 | const resultsElement = document.querySelector("#status-bar").parentElement.parentElement.parentElement.getElementsByTagName("h6")[1].innerText; 42 | if (resultsElement.includes("Profiles")) { 43 | results = document.querySelector("#status-bar").parentElement.parentElement.parentElement.getElementsByTagName("h6")[1].innerText; 44 | } 45 | } catch {} 46 | 47 | try { 48 | document.querySelectorAll(".card-header.py-2").forEach(function (element) { 49 | profiles += element.parentElement.outerHTML; 50 | }) 51 | } catch {} 52 | 53 | try { 54 | serverCount = document.querySelector(".table.table-sm.mb-0").parentElement.parentElement.parentElement.parentElement.querySelector("h6").innerText; 55 | } catch {} 56 | 57 | try { 58 | servers = document.querySelector(".table.table-sm.mb-0").parentElement.parentElement.parentElement.outerHTML; 59 | } catch {} 60 | 61 | try { 62 | Skin = document.querySelector("#status-bar").parentElement.parentElement.parentElement.parentElement.querySelector(".order-md-1").children[0].children[1].outerHTML; 63 | } catch {} 64 | 65 | try { 66 | skinCount = document.querySelector("#status-bar").parentElement.parentElement.parentElement.parentElement.querySelector(".order-md-1").children[0].children[0].innerText; 67 | } catch {} 68 | 69 | try { 70 | toa = document.querySelector("#availability-time").innerHTML; 71 | } catch {} 72 | 73 | try { 74 | dateTime = document.querySelector("#availability-time").dateTime; 75 | } catch {} 76 | 77 | if (statusColor) { 78 | textColor = statusColor; 79 | } 80 | 81 | fetch(`https://api.gapple.pw/blocked/${encodeURIComponent(username)}`) 82 | .then(response => { 83 | if (response.ok) return response.json(); 84 | return response.json().then(response => response); 85 | }) 86 | .then(gapple => { 87 | chrome.storage.local.get(function (result) { 88 | var status = gapple.status; 89 | var blockedNameBtn = result.blockedNames; 90 | var BTSearchbtn = result.oldLayout; 91 | unhide(); 92 | console.log(BTSearchbtn); 93 | console.log(blockedNameBtn); 94 | if (BTSearchbtn !== false) { 95 | if (blockedNameBtn !== false) { 96 | if (status == "blocked" || status == "blocked_or_dropping" && namemcStatus == "Available") { 97 | main.innerHTML = `

${username}


Status
Blocked
Searches
${searches}

${skinCount}

${Skin}

${results}

${profiles}

${serverCount}

${servers}
`; 98 | } else if (namemcStatus == "Available Later") { 99 | main.innerHTML = `

${username}


Status
Available Later
Searches
${searches}
Time of Availability
Time Remaining

${skinCount}

${Skin}

${results}

${profiles}

${serverCount}

${servers}
`; 100 | } else { 101 | main.innerHTML = `

${username}


Status
${namemcStatus}
Searches
${searches}

${skinCount}

${Skin}

${results}

${profiles}

${serverCount}

${servers}
`; 102 | } 103 | } else if (namemcStatus == "Available Later") { 104 | main.innerHTML = `

${username}


Status
Available Later
Searches
${searches}
Time of Availability
Time Remaining

${skinCount}

${Skin}

${results}

${profiles}

${serverCount}

${servers}
`; 105 | } else { 106 | main.innerHTML = `

${username}


Status
${namemcStatus}
Searches
${searches}

${skinCount}

${Skin}

${results}

${profiles}

${serverCount}

${servers}
`; 107 | } 108 | try { 109 | drawSkin2D(); 110 | } catch {} 111 | } else { 112 | if (blockedNameBtn !== false) { 113 | if (status == "blocked" || status == "blocked_or_dropping" && namemcStatus == "Available") { 114 | removeFinePrint(); 115 | namemcStatusNoReplace.innerHTML = "Blocked"; 116 | var element = document.getElementById('status-bar'); 117 | element.classList.remove("bg-success"); 118 | element.classList.add("bg-blocked"); 119 | } else if (namemcStatus.innerHTML == "Available") { 120 | removeFinePrint(); 121 | namemcStatusNoReplace.innerHTML = "Available"; 122 | } else { 123 | removeFinePrint(); 124 | } 125 | } 126 | } 127 | 128 | document.querySelectorAll(".text-muted").forEach(text => { 129 | if (text.innerHTML === "") text.remove(); 130 | }); 131 | 132 | try { 133 | const timers = $('.countdown-timer'); 134 | if (timers.length > 0) { 135 | makeClock(function (clock) { 136 | timers.each(function (i, e) { 137 | startTimer($(e), clock); 138 | }); 139 | }); 140 | } 141 | } catch {} 142 | }); 143 | }); 144 | } 145 | 146 | if (isWildcard == false) { 147 | var username = document.querySelector("#search-box").getAttribute("value"); 148 | betterNameMC(username); 149 | } else { 150 | unhide(); 151 | } 152 | -------------------------------------------------------------------------------- /js/icons.js: -------------------------------------------------------------------------------- 1 | function textureUrl(hash) { 2 | return 'https://texture.namemc.com/' + hash[0] + hash[1] + '/' + hash[2] + hash[3] + '/' + hash + '.png'; 3 | } 4 | 5 | function toCanvas(image, x, y, w, h) { 6 | x = (typeof x === 'undefined' ? 0 : x); 7 | y = (typeof y === 'undefined' ? 0 : y); 8 | w = (typeof w === 'undefined' ? image.width : w); 9 | h = (typeof h === 'undefined' ? image.height : h); 10 | let canvas = document.createElement('canvas'); 11 | canvas.width = w; 12 | canvas.height = h; 13 | let ctx = canvas.getContext('2d'); 14 | ctx.drawImage(image, x, y, w, h, 0, 0, w, h); 15 | return canvas; 16 | } 17 | 18 | function makeOpaque(image) { 19 | let canvas = toCanvas(image); 20 | let ctx = canvas.getContext('2d'); 21 | let data = ctx.getImageData(0, 0, canvas.width, canvas.height); 22 | let pixels = data.data; 23 | for (let p = 3; p < pixels.length; p += 4) { 24 | pixels[p] = 255; 25 | } 26 | ctx.putImageData(data, 0, 0); 27 | return canvas; 28 | } 29 | 30 | function hasAlphaLayer(image) { 31 | let canvas = toCanvas(image); 32 | let ctx = canvas.getContext('2d'); 33 | let data = ctx.getImageData(0, 0, canvas.width, canvas.height); 34 | let pixels = data.data; 35 | for (let p = 3; p < pixels.length; p += 4) { 36 | if (pixels[p] !== 255) { 37 | return true; 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | function capeScale(height) { 44 | if (height % 22 === 0) { 45 | return height / 22; 46 | } else if (height % 17 === 0) { 47 | return height / 17; 48 | } else if (height >= 32 && (height & (height - 1)) === 0) { 49 | return height / 32; 50 | } else { 51 | return Math.max(1, Math.floor(height / 22)); 52 | } 53 | } 54 | 55 | function drawSkin2D() { 56 | $('canvas.skin-2d').each(function(i, e) { 57 | let url = textureUrl(e.getAttribute('data-skin-hash')); 58 | let flip = e.getAttribute('data-flip') === 'true'; 59 | let image = new Image(); 60 | image.crossOrigin = ''; 61 | image.src = url; 62 | image.onload = function() { 63 | let opaque = makeOpaque(image); 64 | let ctx = e.getContext('2d'); 65 | ctx.mozImageSmoothingEnabled = false; 66 | ctx.webkitImageSmoothingEnabled = false; 67 | ctx.msImageSmoothingEnabled = false; 68 | ctx.imageSmoothingEnabled = false; 69 | if (flip) { 70 | ctx.translate(e.width, e.height); 71 | ctx.scale(-1, -1); 72 | } 73 | ctx.drawImage(opaque, 8, 8, 8, 8, 0, 0, e.width, e.height); 74 | if (hasAlphaLayer(image)) { 75 | ctx.drawImage(image, 40, 8, 8, 8, 0, 0, e.width, e.height); 76 | } 77 | }; 78 | image.onerror = function() { 79 | console.error('Error loading ' + image.src); 80 | }; 81 | }); 82 | $('canvas.cape-2d').each(function(i, e) { 83 | let url = textureUrl(e.getAttribute('data-cape-hash')); 84 | let flip = e.getAttribute('data-flip') === 'true'; 85 | let image = new Image(); 86 | image.crossOrigin = ''; 87 | image.src = url; 88 | image.onload = function() { 89 | let cs = image ? capeScale(image.height) : null; 90 | let opaque = makeOpaque(image); 91 | let ctx = e.getContext('2d'); 92 | ctx.mozImageSmoothingEnabled = false; 93 | ctx.webkitImageSmoothingEnabled = false; 94 | ctx.msImageSmoothingEnabled = false; 95 | ctx.imageSmoothingEnabled = false; 96 | if (flip) { 97 | ctx.translate(e.width, e.height); 98 | ctx.scale(-1, -1); 99 | } 100 | ctx.drawImage(opaque, cs, cs, 10 * cs, 16 * cs, 0, 0, e.width, e.height); 101 | }; 102 | image.onerror = function() { 103 | console.error('Error loading ' + image.src); 104 | }; 105 | }); 106 | } 107 | 108 | function colorFaces(geometry, canvas, rectangles) { 109 | if (!rectangles) return null; 110 | let pixels = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height).data; 111 | let f = 0; 112 | let faces = []; 113 | let materials = []; 114 | let materialIndexMap = {}; 115 | let side = THREE.FrontSide; 116 | Object.keys(rectangles).forEach(function(k) { 117 | let rect = rectangles[k]; 118 | let width = Math.abs(rect.w); 119 | let height = Math.abs(rect.h); 120 | let dj = Math.sign(rect.w); 121 | let di = Math.sign(rect.h); 122 | for (let y = 0, i = rect.y; y < height; y++, i += di) { 123 | for (let x = 0, j = rect.x; x < width; x++, j += dj, f += 2) { 124 | let p = 4 * (i * canvas.width + j); 125 | let a = pixels[p + 3]; 126 | if (a === 0) { 127 | side = THREE.DoubleSide; 128 | continue; 129 | } 130 | let materialIndex = materialIndexMap[a]; 131 | if (typeof materialIndex === 'undefined') { 132 | materials.push(new THREE.MeshLambertMaterial({ 133 | vertexColors: THREE.FaceColors, 134 | opacity: a / 255, 135 | transparent: (a !== 255) 136 | })); 137 | materialIndex = materials.length - 1; 138 | materialIndexMap[a] = materialIndex; 139 | if (a !== 255) { 140 | side = THREE.DoubleSide; 141 | } 142 | } 143 | let face1 = geometry.faces[f]; 144 | let face2 = geometry.faces[f + 1]; 145 | face1.color.r = pixels[p] / 255; 146 | face1.color.g = pixels[p + 1] / 255; 147 | face1.color.b = pixels[p + 2] / 255; 148 | face2.color = face1.color; 149 | face1.materialIndex = materialIndex; 150 | face2.materialIndex = materialIndex; 151 | faces.push(face1); 152 | faces.push(face2); 153 | } 154 | } 155 | }); 156 | if (faces.length === 0) return null; 157 | geometry.faces = faces; 158 | materials.forEach(function(m) { 159 | m.side = side; 160 | }); 161 | return new THREE.Mesh(new THREE.BufferGeometry().fromGeometry(geometry), materials); 162 | } 163 | 164 | function buildMinecraftModel(skinImage, capeImage, slim, flip) { 165 | if (skinImage.width < 64 || skinImage.height < 32) { 166 | return null; 167 | } 168 | let version = (skinImage.height >= 64 ? 1 : 0); 169 | let cs = capeImage ? capeScale(capeImage.height) : null; 170 | let opaqueSkinCanvas = makeOpaque(skinImage); 171 | let transparentSkinCanvas = toCanvas(skinImage); 172 | let hasAlpha = hasAlphaLayer(skinImage); 173 | let headGroup = new THREE.Object3D(); 174 | headGroup.position.x = 0; 175 | headGroup.position.y = 12; 176 | headGroup.position.z = 0; 177 | let box = new THREE.BoxGeometry(8, 8, 8, 8, 8, 8); 178 | let headMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['head'][0]); 179 | headGroup.add(headMesh); 180 | if (hasAlpha) { 181 | box = new THREE.BoxGeometry(9, 9, 9, 8, 8, 8); 182 | let hatMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['head'][1]); 183 | hatMesh && headGroup.add(hatMesh); 184 | } 185 | let torsoGroup = new THREE.Object3D(); 186 | torsoGroup.position.x = 0; 187 | torsoGroup.position.y = 2; 188 | torsoGroup.position.z = 0; 189 | box = new THREE.BoxGeometry(8 + EPSILON, 12 + EPSILON, 4 + EPSILON, 8, 12, 4); 190 | let torsoMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['torso'][0]); 191 | torsoGroup.add(torsoMesh); 192 | if (version >= 1 && hasAlpha) { 193 | box = new THREE.BoxGeometry(8.5 + EPSILON, 12.5 + EPSILON, 4.5 + EPSILON, 8, 12, 4); 194 | let jacketMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['torso'][1]); 195 | jacketMesh && torsoGroup.add(jacketMesh); 196 | } 197 | let rightArmGroup = new THREE.Object3D(); 198 | rightArmGroup.position.x = slim ? -5.5 : -6; 199 | rightArmGroup.position.y = 6; 200 | rightArmGroup.position.z = 0; 201 | let rightArmMesh; 202 | if (slim) { 203 | box = new THREE.BoxGeometry(3, 12, 4, 3, 12, 4).translate(0, -4, 0); 204 | rightArmMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['armRS'][0]); 205 | } else { 206 | box = new THREE.BoxGeometry(4, 12, 4, 4, 12, 4).translate(0, -4, 0); 207 | rightArmMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['armR'][0]); 208 | } 209 | rightArmGroup.add(rightArmMesh); 210 | if (version >= 1 && hasAlpha) { 211 | let rightSleeveMesh; 212 | if (slim) { 213 | box = new THREE.BoxGeometry(3.5 + EPSILON * 4, 12.5 + EPSILON * 4, 4.5 + EPSILON * 4, 3, 12, 4).translate(0, -4, 0); 214 | rightSleeveMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['armRS'][1]); 215 | } else { 216 | box = new THREE.BoxGeometry(4.5 + EPSILON * 4, 12.5 + EPSILON * 4, 4.5 + EPSILON * 4, 4, 12, 4).translate(0, -4, 0); 217 | rightSleeveMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['armR'][1]); 218 | } 219 | rightSleeveMesh && rightArmGroup.add(rightSleeveMesh); 220 | } 221 | let leftArmGroup = new THREE.Object3D(); 222 | leftArmGroup.position.x = slim ? 5.5 : 6; 223 | leftArmGroup.position.y = 6; 224 | leftArmGroup.position.z = 0; 225 | let leftArmMesh; 226 | if (slim) { 227 | box = new THREE.BoxGeometry(3, 12, 4, 3, 12, 4).translate(0, -4, 0); 228 | leftArmMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['armLS'][0]); 229 | } else { 230 | box = new THREE.BoxGeometry(4, 12, 4, 4, 12, 4).translate(0, -4, 0); 231 | leftArmMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['armL'][0]); 232 | } 233 | leftArmGroup.add(leftArmMesh); 234 | if (version >= 1 && hasAlpha) { 235 | let leftSleeveMesh; 236 | if (slim) { 237 | box = new THREE.BoxGeometry(3.5 + EPSILON * 4, 12.5 + EPSILON * 4, 4.5 + EPSILON * 4, 3, 12, 4).translate(0, -4, 0); 238 | leftSleeveMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['armLS'][1]); 239 | } else { 240 | box = new THREE.BoxGeometry(4.5 + EPSILON * 4, 12.5 + EPSILON * 4, 4.5 + EPSILON * 4, 4, 12, 4).translate(0, -4, 0); 241 | leftSleeveMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['armL'][1]); 242 | } 243 | leftSleeveMesh && leftArmGroup.add(leftSleeveMesh); 244 | } 245 | let rightLegGroup = new THREE.Object3D(); 246 | rightLegGroup.position.x = -2; 247 | rightLegGroup.position.y = -4; 248 | rightLegGroup.position.z = 0; 249 | box = new THREE.BoxGeometry(4, 12, 4, 4, 12, 4).translate(0, -6, 0); 250 | let rightLegMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['legR'][0]); 251 | rightLegGroup.add(rightLegMesh); 252 | if (version >= 1 && hasAlpha) { 253 | box = new THREE.BoxGeometry(4.5 + EPSILON * 2, 12.5 + EPSILON * 2, 4.5 + EPSILON * 2, 4, 12, 4).translate(0, -6, 0); 254 | let rightPantMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['legR'][1]); 255 | rightPantMesh && rightLegGroup.add(rightPantMesh); 256 | } 257 | let leftLegGroup = new THREE.Object3D(); 258 | leftLegGroup.position.x = 2; 259 | leftLegGroup.position.y = -4; 260 | leftLegGroup.position.z = 0; 261 | box = new THREE.BoxGeometry(4, 12, 4, 4, 12, 4).translate(0, -6, 0); 262 | let leftLegMesh = colorFaces(box, opaqueSkinCanvas, skinLayout[version]['legL'][0]); 263 | leftLegGroup.add(leftLegMesh); 264 | if (version >= 1 && hasAlpha) { 265 | box = new THREE.BoxGeometry(4.5 + EPSILON * 3, 12.5 + EPSILON * 3, 4.5 + EPSILON * 3, 4, 12, 4).translate(0, -6, 0); 266 | let leftPantMesh = colorFaces(box, transparentSkinCanvas, skinLayout[version]['legL'][1]); 267 | leftPantMesh && leftLegGroup.add(leftPantMesh); 268 | } 269 | let playerGroup = new THREE.Object3D(); 270 | playerGroup.add(headGroup); 271 | playerGroup.add(torsoGroup); 272 | playerGroup.add(rightArmGroup); 273 | playerGroup.add(leftArmGroup); 274 | playerGroup.add(rightLegGroup); 275 | playerGroup.add(leftLegGroup); 276 | if (capeImage) { 277 | let capeCanvas = makeOpaque(capeImage); 278 | let capeGroup = new THREE.Object3D(); 279 | capeGroup.position.x = 0; 280 | capeGroup.position.y = 8; 281 | capeGroup.position.z = -2; 282 | capeGroup.rotation.y += radians(180); 283 | let capeMesh; 284 | box = new THREE.BoxGeometry(10, 16, 1, 10 * cs, 16 * cs, cs).translate(0, -8, 0.5); 285 | capeMesh = colorFaces(box, capeCanvas, { 286 | left: { 287 | x: 11 * cs, 288 | y: cs, 289 | w: cs, 290 | h: 16 * cs 291 | }, 292 | right: { 293 | x: 0, 294 | y: cs, 295 | w: cs, 296 | h: 16 * cs 297 | }, 298 | top: { 299 | x: cs, 300 | y: 0, 301 | w: 10 * cs, 302 | h: cs 303 | }, 304 | bottom: { 305 | x: 11 * cs, 306 | y: cs - 1, 307 | w: 10 * cs, 308 | h: -cs 309 | }, 310 | front: { 311 | x: cs, 312 | y: cs, 313 | w: 10 * cs, 314 | h: 16 * cs 315 | }, 316 | back: { 317 | x: 12 * cs, 318 | y: cs, 319 | w: 10 * cs, 320 | h: 16 * cs 321 | } 322 | }); 323 | capeGroup.add(capeMesh); 324 | playerGroup.add(capeGroup); 325 | } 326 | if (flip) { 327 | playerGroup.rotation.z += radians(180); 328 | } 329 | return playerGroup; 330 | } 331 | -------------------------------------------------------------------------------- /js/capesPage.js: -------------------------------------------------------------------------------- 1 | class CapeTemplate { 2 | /** 3 | * 4 | * @param {string} src 5 | * @param {string[]} users 6 | * @param {string} name 7 | * @param {string} description 8 | * @param {string} redirect 9 | */ 10 | constructor(src, users, name, description = null, redirect = null, image = null) { 11 | this.src = src; 12 | this.users = users; 13 | this.name = name; 14 | this.description = description; 15 | this.redirect = redirect; 16 | this.image = image; 17 | } 18 | } 19 | 20 | console.log(`Address: ${location.href}`) 21 | 22 | 23 | 24 | // Runs when viewing page with all capes listed 25 | if (location.href == "https://namemc.com/capes") { 26 | chrome.storage.local.get(result => { 27 | if (!result.capePages) return; 28 | 29 | fetch("https://api.namemc.plus/capes").then(response => response.json()).then(json => { 30 | if (result.namemcpluscape) { 31 | if (result.hiddenCapes) { 32 | Object.entries(result.hiddenCapes).forEach(element => { 33 | json[element[0]] = element[1]; 34 | }); 35 | } 36 | loadCapes(json, "NameMC+ Capes", "nmcp-cape"); 37 | } 38 | fetch("https://api.namemc.plus/OFcapes").then(response => response.json()).then(SpecialOptifine => { 39 | loadCapes(SpecialOptifine, "OptiFine Capes", "optifine-cape"); 40 | }) 41 | }) 42 | 43 | }) 44 | } 45 | 46 | 47 | 48 | // Runs when checking a NameMC+ Cape 49 | chrome.storage.local.get(result => { 50 | if (location.href.includes("namemc.com/nmcp-cape/")) { 51 | const capeKey = location.href.split("namemc.com/nmcp-cape/")[1]; 52 | fetch(`https://api.namemc.plus/capes/${capeKey}`).then(response => response.json()).then(json => { 53 | if (Object.keys(json).length < 1) return; 54 | 55 | console.log("Hidden capes storage: " + JSON.stringify(result.hiddenCapes)) 56 | 57 | document.querySelector("main > div").remove(); 58 | if (!result.hiddenCapes) result.hiddenCapes = {}; 59 | if (json.invisible) { 60 | const storageObj = result.hiddenCapes; 61 | storageObj[json.name] = json; 62 | chrome.storage.local.set({hiddenCapes: storageObj}); 63 | json.description += 64 | "

Congratulations, you found a hidden cape!
This cape can now be viewed from the capes page."; 65 | } 66 | 67 | loadCapeInfo(json, "NameMC+ Cape"); 68 | }) 69 | } 70 | }) 71 | 72 | 73 | 74 | // Runs when checking for an OptiFine cape 75 | if (location.href.includes("namemc.com/optifine-cape/")) { 76 | let displayCape = null; 77 | fetch("https://api.namemc.plus/OFcapes").then(response => response.json()).then(SpecialOptifine => { 78 | Object.entries(SpecialOptifine).sort().forEach(obj => { 79 | if (obj[0].toLowerCase().replace(" ", "-") == location.href.split("namemc.com/optifine-cape/")[1]) { 80 | displayCape = new CapeTemplate(obj[1].src, obj[1].users, obj[0], obj[1].description, null, obj[1].image); 81 | } 82 | }) 83 | if (displayCape == null) return; 84 | document.querySelector("main > div").remove(); 85 | loadCapeInfo(displayCape, "OptiFine Cape"); 86 | }) 87 | } 88 | 89 | 90 | 91 | // Runs when on a normal cape page 92 | if (location.href.includes("namemc.com/cape/")) { 93 | const capeHash = location.href.split("namemc.com/cape/")[1]; 94 | fetch(`https://api.namemc.plus/capeInfo/${capeHash}`).then(response => response.json()).then(capeJson => { 95 | 96 | const descriptionCard = document.createElement("div"); 97 | descriptionCard.className = "card mb-3"; 98 | descriptionCard.innerHTML = ` 99 |
100 |
101 | Description 102 |
103 |
104 | ${capeJson.description} 105 |
106 |
107 | `; 108 | 109 | 110 | let skin = null; 111 | const playerListObjs = document.getElementsByClassName("card-body player-list py-2"); 112 | if (playerListObjs.length == 1) { 113 | console.log(`Inner text: ${playerListObjs[0].innerHTML.split(">")[1].split("<")[0]}`); 114 | skin = [playerListObjs[0].innerHTML.split(">")[1].split("<")[0]]; 115 | } 116 | const lengthObj = { 117 | skin: skin, 118 | amount: parseInt(document.getElementsByClassName("position-absolute bottom-0 right-0 m-1 text-muted")[0].innerHTML.substr(1)) 119 | } 120 | createSkinViewer(document.getElementsByClassName("skin-3d")[0].parentElement.parentElement, new CapeTemplate(textureURL(capeHash), lengthObj, "Cape")); 121 | document.getElementsByClassName("skin-3d")[0].parentElement.remove(); 122 | 123 | const insertBeforeDiv = document.getElementsByClassName("card-body player-list py-2")[0].parentElement.parentElement.parentElement.parentElement.childNodes[0]; 124 | insertBeforeDiv.appendChild(descriptionCard); 125 | }) 126 | } 127 | 128 | 129 | 130 | async function loadCapes(json, title, urlPath) { 131 | const capesDiv = document.querySelector("main > div > div"); 132 | 133 | const capes = Object.entries(json).sort((a, b) => b[1].users.length - a[1].users.length); 134 | for(let i = 0; i < Object.keys(json).length; i++) { 135 | if (i == 0) { 136 | capesDiv.innerHTML += ` 137 |
138 |

${title}

139 |
140 |
141 |
142 | ` 143 | } 144 | // Make it so that if there's five capes in a row, it starts a new row 145 | if (i / 5 == Math.round(i / 5)) { 146 | const breakLine = document.createElement("div"); 147 | breakLine.classList = "d-none d-md-block w-100"; 148 | capesDiv.appendChild(breakLine); 149 | } 150 | // Create the cape card 151 | const capeDiv = document.createElement("div"); 152 | capeDiv.className = "col-6 col-md"; 153 | capeDiv.innerHTML = ` 154 | 155 |
156 |
${capes[i][0]}
157 |
158 |
159 | ${capes[i][0]} 160 |
161 |
★${capes[i][1].users.length}
162 |
163 |
164 |
165 | `; 166 | capesDiv.appendChild(capeDiv); 167 | } 168 | } 169 | 170 | /** 171 | * 172 | * @param {CapeTemplate} cape 173 | * @param {string} type 174 | */ 175 | async function loadCapeInfo(cape, type) { 176 | document.title = `${cape.name} | ${type} | NameMC`; 177 | const headerDiv = document.querySelector("body > header").appendChild(document.createElement("div")); 178 | headerDiv.className = "container mt-3"; 179 | headerDiv.innerHTML = ` 180 |

${cape.name} ${type}

181 |
182 | `; 183 | 184 | document.querySelector("main").innerHTML = ` 185 |
186 |
187 |
188 |
189 |
190 |
191 | Description 192 |
193 |
194 | ${cape.description} 195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 | Profiles (${cape.users.length}) 204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 | `; 212 | 213 | createSkinViewer(document.getElementById("skinViewerDiv"), cape); 214 | 215 | const namesDiv = document.getElementsByClassName("card-body player-list py-2")[0]; 216 | cape.users.forEach(user => { 217 | fetch(`https://api.gapple.pw/cors/sessionserver/${user}`).then(response => response.json()).then(json => { 218 | namesDiv.innerHTML += `${json.name} `; 219 | }) 220 | }) 221 | } 222 | 223 | async function createSkinViewer(parent, cape) { 224 | // Skin 225 | let featureDiv = document.createElement("div"); 226 | featureDiv.id = "skinviewer"; 227 | featureDiv.className = "card"; 228 | 229 | // User count 230 | featureDiv.innerHTML += ` 231 |
★${cape.users.length ?? cape.users.amount}
232 | `; 233 | 234 | // Add a button for animation 235 | let featureAnimateButton = document.createElement("button"); 236 | featureAnimateButton.className = "btn btn-secondary play-pause-btn position-absolute top-0 left-0 m-2 p-0"; 237 | featureAnimateButton.style.cssText = "width:32px;height:32px;z-index:1;"; 238 | featureAnimateButton.addEventListener('click', event => { 239 | this.skinViewerWalk.paused = !this.skinViewerWalk.paused; 240 | }) 241 | let featureButtonIcon = document.createElement("i") 242 | featureButtonIcon.className = "fas fa-play"; 243 | featureAnimateButton.appendChild(featureButtonIcon); 244 | featureDiv.appendChild(featureAnimateButton); 245 | 246 | // Add a button for Elytra 247 | let featureElytraButton = document.createElement("button"); 248 | featureElytraButton.innerHTML = "Show Elytra" 249 | featureElytraButton.className = "btn btn-secondary play-pause-btn position-absolute top-0 right-0 m-2 p-0"; 250 | featureElytraButton.style.cssText = "height:32px;padding:0px 10px !important;z-index:1;"; 251 | featureElytraButton.addEventListener('click', event => { 252 | if(this.skinViewer.playerObject.backEquipment == "cape") { 253 | featureElytraButton.innerHTML = "Show Cape" 254 | this.skinViewer.loadCape(this.skinViewer.capeImage, { backEquipment: 'elytra' }) 255 | } else { 256 | featureElytraButton.innerHTML = "Show Elytra" 257 | this.skinViewer.loadCape(this.skinViewer.capeImage, { backEquipment: 'cape' }) 258 | } 259 | }) 260 | featureDiv.appendChild(featureElytraButton); 261 | 262 | // Add the body 263 | let featureBody = document.createElement("div"); 264 | featureBody.className = "card-body text-center checkered"; 265 | 266 | featureDiv.appendChild(featureBody); 267 | 268 | // Add the canvas 269 | let featureCanvas = document.createElement("canvas"); 270 | featureCanvas.id = "skin_container" 271 | featureBody.appendChild(featureCanvas); 272 | 273 | //Insert the div 274 | parent.appendChild(featureDiv); 275 | 276 | const usedSkin = skinCalculator(cape.users); 277 | 278 | console.log(`Using cape: ${cape.src}`); 279 | 280 | this.skinViewer = new skinview3d.FXAASkinViewer({ 281 | canvas: document.getElementById("skin_container"), 282 | width: 300, 283 | height: 400, 284 | skin: usedSkin.url, 285 | cape: cape.src 286 | }); 287 | 288 | if (usedSkin.player) { 289 | fetch(`https://api.ashcon.app/mojang/v2/user/${usedSkin.player}`).then(response => response.json()).then(json => { 290 | let skinType = "classic"; 291 | if (json.textures.slim) skinType = "slim"; 292 | this.skinViewer.loadSkin(usedSkin.url, skinType) 293 | }) 294 | } 295 | 296 | let control = skinview3d.createOrbitControls(this.skinViewer); 297 | control.enableRotate = true; 298 | control.enableZoom = false; 299 | control.enablePan = false; 300 | 301 | this.skinViewerWalk = this.skinViewer.animations.add(skinview3d.WalkingAnimation); 302 | this.skinViewerWalk.paused = true; 303 | 304 | this.skinViewer.camera.position.set(0, 10, 50); 305 | control.update(); 306 | 307 | this.skinViewer.playerObject.rotation.y = 10; 308 | 309 | //Set style 310 | document.getElementById("skin_container").style.filter = "drop-shadow(-9px 4px 9px rgba(0,0,0,0.4))" 311 | document.getElementById("skin_container").style.outline = "none" 312 | } 313 | 314 | 315 | 316 | function textureURL(hash) { 317 | return 'https://texture.namemc.com/' + hash[0] + hash[1] + '/' + hash[2] + hash[3] + '/' + hash + '.png'; 318 | } 319 | 320 | 321 | 322 | const skinCalculator = users => { 323 | if (users.length == 1) { 324 | return { 325 | url: `https://www.mc-heads.net/skin/${users[0]}`, 326 | player: users[0] 327 | }; 328 | } else if (users.skin && users.amount == 1) { 329 | return { 330 | url: `https://www.mc-heads.net/skin/${users.skin}`, 331 | player: users.skin 332 | }; 333 | } 334 | 335 | return { 336 | url: "https://texture.namemc.com/12/b9/12b92a9206470fe2.png" 337 | }; 338 | } 339 | -------------------------------------------------------------------------------- /js/customCapes.js: -------------------------------------------------------------------------------- 1 | const skinViewer = null; 2 | const skinViewerWalk = null; 3 | var username = document.querySelector("[name='profile:username']").content; 4 | var profileUuid = document.querySelector("body > main > div > div.col-md.order-md-2 > div:nth-child(1) > div.card-body.py-1 > div:nth-child(2) > div.col-12.order-lg-2.col-lg > samp").innerText 5 | const capeDB = {} 6 | 7 | 8 | class CapeTemplate { 9 | /** 10 | * 11 | * @param {string} src 12 | * @param {string} name 13 | * @param {string} description 14 | * @param {string} redirect 15 | */ 16 | constructor(src, name, description = null, redirect = null) { 17 | this.src = src; 18 | this.name = name; 19 | this.description = description; 20 | this.redirect = redirect; 21 | } 22 | } 23 | 24 | 25 | String.prototype.addDashes = function () { 26 | var uuid = this; 27 | var isUUIDwithDashes = /^[A-F\d]{8}-[A-F\d]{4}-4[A-F\d]{3}-[89AB][A-F\d]{3}-[A-F\d]{12}$/i.test(uuid); 28 | var isUUIDwithoutDashes = /^[A-F\d]{8}[A-F\d]{4}4[A-F\d]{3}[89AB][A-F\d]{3}[A-F\d]{12}$/i.test(uuid); 29 | if (isUUIDwithoutDashes == true) { 30 | return uuid.substr(0, 8) + "-" + uuid.substr(8, 4) + "-" + uuid.substr(12, 4) + "-" + uuid.substr(16, 4) + "-" + uuid.substr(20); 31 | } else if (isUUIDwithDashes == true) { 32 | return uuid; 33 | } else { 34 | throw new Error("Can only add dashes to a valid UUID: " + uuid); 35 | } 36 | }; 37 | 38 | 39 | /* Add NMCP and JSON capes to profile */ 40 | fetch(`https://api.namemc.plus/capes/user/${profileUuid}`).then(response => response.json()).then(json => createNMCPCapeCard(json)); 41 | 42 | function createNMCPCapeCard(db) { 43 | createSkinViewer(); 44 | createSkinEvents(); 45 | createCapeEvents(); 46 | 47 | chrome.storage.local.get(result => { 48 | if (!result.otherCapes) return; 49 | if (result.namemcpluscape) { 50 | const capes = []; 51 | Object.entries(db).forEach(obj => { 52 | capes.push(new CapeTemplate(obj[1].src, obj[0], obj[1].description, "https://namemc.com/nmcp-cape/" + obj[0].toLowerCase().replace(" ", "-"))) 53 | }) 54 | 55 | if (Object.keys(capes).length > 0) { 56 | return createCapeCard(capes, "NameMC+ Capes", createThirdPartyCapeCard, true, null) 57 | } 58 | 59 | createThirdPartyCapeCard(); 60 | } 61 | }); 62 | } 63 | 64 | 65 | /* 66 | Add third-party capes to profile 67 | {username} is replaced with the username (capitalization) 68 | {uuid} is replaced with the UUID (no dashes) 69 | {uuid-dashes} is replaced with the UUID (dashes) 70 | */ 71 | function createThirdPartyCapeCard(_) { 72 | chrome.storage.local.get(result => { 73 | if (!result.otherCapes) return; 74 | const capes = []; 75 | 76 | const optifineCapeCard = Array.from(document.querySelectorAll('a')) 77 | .find(el => el.textContent.toLowerCase() === 'optifine'); 78 | 79 | if (optifineCapeCard) { 80 | optifineCapeCard.parentElement.parentElement.parentElement.remove(); 81 | } 82 | 83 | if (result.mantle) { 84 | // createCapeCard([], "Mantle Capes", console.log("Created Mantle cape card!"), true, "https://mantle.gg"); 85 | } 86 | 87 | if (result.cloaksplus) { 88 | capes.push({ 89 | "name": "Cloaks+", 90 | "url": "https://server.cloaksplus.com/capes/{username}.png" 91 | }) 92 | } 93 | 94 | if (result.labymod) { 95 | capes.push({ 96 | "name": "LabyMod", 97 | "url": "https://api.gapple.pw/cors/labymod/cape/{uuid-dashes}" 98 | }) 99 | } 100 | 101 | if (result.capesmod) { 102 | capes.push({ 103 | "name": "MinecraftCapes", 104 | "url": `https://minecraftcapes.net/profile/{uuid}/cape/map?${Date.now()}` 105 | }) 106 | } 107 | 108 | if (result.optifine) { 109 | capes.push({ 110 | "name": "OptiFine", 111 | "url": "https://api.gapple.pw/cors/optifine/{username}" 112 | }) 113 | } 114 | 115 | if (result.customApis) { 116 | const array = result.customApis.split(" "); 117 | array.forEach(link => { 118 | capes.push({ 119 | "name": link.split("-")[0].replace(/_/g, " "), 120 | "url": link.split("-")[1] 121 | }) 122 | }) 123 | } 124 | 125 | createCapeCard([], "Third-Party Capes", capeCard => { 126 | capeCard.style = "display: none;"; 127 | const capeDiv = capeCard.querySelector("div.card-body.text-center"); 128 | 129 | for (let i = 0; i < capes.length; i++) { 130 | capes[i].url = capes[i].url.replace("{username}", username).replace("{uuid}", profileUuid).replace("{uuid-dashes}", profileUuid.addDashes()); 131 | 132 | fetch(capes[i].url).then(data => { 133 | if (data.ok) { 134 | createCape(capes[i].url, capeDiv, capes[i].name, "", capes[i].url); 135 | capeCard.style = ""; 136 | } 137 | }) 138 | } 139 | }) 140 | }); 141 | } 142 | 143 | 144 | /* Cape card creator */ 145 | /** 146 | * @param {CapeTemplate[]} capes 147 | * @param {string} title 148 | * @param {function} callback 149 | * @param {boolean} showAmount 150 | * @param {string} redirect 151 | */ 152 | function createCapeCard(capes, title, callback = console.log("Successfully made cape card!"), showAmount = false, redirect = null) { 153 | let titleArray = title.split(" "); 154 | titleArray.shift(); 155 | 156 | // Create cape card 157 | const cardDiv = document.createElement("div"); 158 | cardDiv.id = title.toLowerCase().replace(" ", "-"); 159 | cardDiv.className = "card mb-3"; 160 | cardDiv.innerHTML = ` 161 |
162 | 163 | ${redirect ? `` : ""}${title.split(" ")[0]}${redirect ? `` : ""}${" " + titleArray.join(" ")}${showAmount ? " (" + capes.length + ")" : ""} 164 | 165 |
166 |
167 |
168 | `; 169 | 170 | // Render capes 171 | capes.forEach(cape => { 172 | createCape(cape.src, cardDiv.querySelector("div.card-body.text-center"), cape.name, cape.description, cape.redirect ?? capes[i]) 173 | }) 174 | 175 | // Remove cape selected glow 176 | const capeChildren = document.getElementsByClassName("cape-2d") 177 | for (var i = 0; i < capeChildren.length; i++) { 178 | capeChildren[i].classList.remove("skin-button-selected"); 179 | } 180 | 181 | let profileLeft = document.querySelector(".input-group.input-group-sm.my-2").parentElement.parentElement; 182 | profileLeft.parentElement.insertBefore(cardDiv, profileLeft); 183 | 184 | callback(cardDiv); 185 | } 186 | 187 | 188 | /* Cape canvas creator */ 189 | /** 190 | * @param {string} src 191 | * @param {HTMLElement} parentElement 192 | * @param {string} name 193 | * @param {string} description 194 | * @param {string} redirect 195 | */ 196 | function createCape(src, parentElement, name = "", description = "", redirect = "") { 197 | let capeCanvas = document.createElement("canvas"); 198 | capeCanvas.className = "cape-2d align-top skin-button skin-button-selected"; 199 | let capeDataHash = `custom-${name.replace(" ", "-").toLowerCase()}`; 200 | capeCanvas.setAttribute("data-cape-hash", capeDataHash); 201 | capeDB[capeDataHash] = src; 202 | capeCanvas.width = 40; 203 | capeCanvas.height = 64; 204 | capeImage = new Image(); 205 | capeImage.src = src; 206 | 207 | capeImage.onload = () => { 208 | const ctx = capeCanvas.getContext('2d'); 209 | ctx.mozImageSmoothingEnabled = false; 210 | ctx.webkitImageSmoothingEnabled = false; 211 | ctx.msImageSmoothingEnabled = false; 212 | ctx.imageSmoothingEnabled = false; 213 | if (capeImage.src != src) capeImage.src = src; 214 | const localCapeScale = capeScale(capeImage.height) 215 | ctx.drawImage(capeImage, localCapeScale, localCapeScale, 10 * localCapeScale, 16 * localCapeScale, 0, 0, capeCanvas.width, capeCanvas.height) 216 | createCapeEvents(); 217 | } 218 | 219 | // Puts the image in a href 220 | let featureImageHref = document.createElement("a"); 221 | featureImageHref.href = redirect ? redirect : src; 222 | featureImageHref.target = "_blank"; 223 | featureImageHref.setAttribute("data-toggle", "tooltip"), 224 | featureImageHref.setAttribute("data-html", "true") 225 | if (typeof name != 'undefined') { 226 | featureImageHref.setAttribute("title", ` 227 | ${name}${description ? `
${description}` : ""} 228 | `) 229 | } 230 | featureImageHref.appendChild(capeCanvas); 231 | parentElement.appendChild(featureImageHref); 232 | } 233 | 234 | 235 | /* Creates cape events for the custom viewer */ 236 | function createCapeEvents() { 237 | let capeChildren = document.getElementsByClassName("cape-2d") 238 | console.log(`Found ${capeChildren.length} capes`) 239 | for (var i = 0; i < capeChildren.length; i++) { 240 | capeChildren[i].addEventListener('mouseover', (event) => { 241 | for (var i = 0; i < capeChildren.length; i++) { 242 | capeChildren[i].classList.remove("skin-button-selected"); 243 | } 244 | event.target.classList.add("skin-button-selected"); 245 | let capeHash = event.target.getAttribute("data-cape-hash") 246 | 247 | if (capeHash != undefined && !capeHash.startsWith("custom-")) { 248 | let capeUrl = "https://texture.namemc.com/" + capeHash.substring(0, 2) + "/" + capeHash.substring(2, 4) + "/" + capeHash + ".png"; 249 | this.skinViewer.loadCape(capeUrl) 250 | console.log("capeEvent: Mojang/Optifine") 251 | } else if (capeHash.startsWith("custom-")) { 252 | this.skinViewer.loadCape(capeDB[capeHash]) 253 | console.log("capeEvent: Custom") 254 | } 255 | }) 256 | } 257 | } 258 | 259 | 260 | /* Creates a custom skin and cape viewer */ 261 | function createSkinViewer() { 262 | // Skin 263 | let featureDiv = document.createElement("div"); 264 | featureDiv.id = "skin-viewer"; 265 | featureDiv.className = "card mb-3"; 266 | 267 | // Add a button for animation 268 | let featureAnimateButton = document.createElement("button"); 269 | featureAnimateButton.className = "btn btn-secondary play-pause-btn position-absolute top-0 left-0 m-2 p-0"; 270 | featureAnimateButton.style.cssText = "width:32px;height:32px;z-index:1;"; 271 | featureAnimateButton.addEventListener('click', (event) => { 272 | this.skinViewerWalk.paused = !this.skinViewerWalk.paused; 273 | }) 274 | let featureButtonIcon = document.createElement("i") 275 | featureButtonIcon.className = "fas fa-play"; 276 | featureAnimateButton.appendChild(featureButtonIcon); 277 | featureDiv.appendChild(featureAnimateButton); 278 | 279 | // Add a button for Elytra 280 | let featureElytraButton = document.createElement("button"); 281 | featureElytraButton.innerHTML = "Show Elytra" 282 | featureElytraButton.className = "btn btn-secondary play-pause-btn position-absolute top-0 right-0 m-2 p-0"; 283 | featureElytraButton.style.cssText = "height:32px;padding:0px 10px !important;z-index:1;"; 284 | featureElytraButton.addEventListener('click', (event) => { 285 | if (this.skinViewer.playerObject.backEquipment == "cape") { 286 | featureElytraButton.innerHTML = "Show Cape" 287 | this.skinViewer.loadCape(this.skinViewer.capeImage, { 288 | backEquipment: 'elytra' 289 | }) 290 | } else { 291 | featureElytraButton.innerHTML = "Show Elytra" 292 | this.skinViewer.loadCape(this.skinViewer.capeImage, { 293 | backEquipment: 'cape' 294 | }) 295 | } 296 | }) 297 | featureDiv.appendChild(featureElytraButton); 298 | 299 | // Add the body 300 | let featureBody = document.createElement("div"); 301 | featureBody.className = "card-body text-center checkered"; 302 | 303 | featureDiv.appendChild(featureBody); 304 | 305 | // Add the canvas 306 | let featureCanvas = document.createElement("canvas"); 307 | featureCanvas.id = "skin_container"; 308 | featureBody.appendChild(featureCanvas); 309 | 310 | //Get skin 311 | let skinHash = $(".skin-3d").attr("data-skin-hash"); 312 | let skinUrl = textureURL(skinHash); 313 | 314 | //Get skin model 315 | let skinModel = $(".skin-3d").attr("data-model"); 316 | 317 | //Insert the div 318 | let profileLeft = document.querySelectorAll(".order-md-1 > .card.mb-3")[1] 319 | profileLeft.parentElement.insertBefore(featureDiv, profileLeft); 320 | 321 | this.skinViewer = new skinview3d.FXAASkinViewer({ 322 | canvas: document.getElementById("skin_container"), 323 | width: 270, 324 | height: 330, 325 | skin: skinUrl, 326 | model: skinModel, 327 | cape: this.finalCape, 328 | ears: this.finalEars 329 | }); 330 | 331 | let control = skinview3d.createOrbitControls(this.skinViewer); 332 | control.enableRotate = true; 333 | control.enableZoom = false; 334 | control.enablePan = false; 335 | 336 | this.skinViewerWalk = this.skinViewer.animations.add(skinview3d.WalkingAnimation); 337 | this.skinViewerWalk.paused = true; 338 | 339 | this.skinViewer.camera.position.set(0, 10, 50); 340 | control.update(); 341 | 342 | if (username == "Dinnerbone" || username == "Grumm") { 343 | this.skinViewer.playerObject.rotation.y = -6.75 344 | this.skinViewer.scene.rotation.z = Math.PI; 345 | this.skinViewer.scene.position.y = -17.5; 346 | } else { 347 | this.skinViewer.playerObject.rotation.y = 6.75 348 | } 349 | 350 | document.getElementById("skin_container").addEventListener( 351 | "contextmenu", 352 | (event) => event.stopImmediatePropagation(), 353 | true 354 | ); 355 | 356 | //Set style 357 | document.getElementById("skin_container").style.filter = "drop-shadow(-9px 4px 9px rgba(0,0,0,0.4))" 358 | document.getElementById("skin_container").style.outline = "none" 359 | 360 | document.querySelectorAll(".order-md-1 > .card.mb-3")[0].remove(); 361 | } 362 | 363 | 364 | /* Creates skin events for the custom viewer */ 365 | function createSkinEvents() { 366 | let skinChildren = document.querySelectorAll("div a .skin-button"); 367 | for (var i = 0; i < skinChildren.length; i++) { 368 | skinChildren[i].addEventListener('mouseover', (event) => { 369 | if (event.target != undefined) { 370 | if (event.target.getAttribute("data-skin-hash")) { 371 | let skinHash = event.target.getAttribute("data-skin-hash") 372 | let skinModel = event.target.getAttribute("data-model") 373 | let skinUrl = "https://texture.namemc.com/" + skinHash.substring(0, 2) + "/" + skinHash.substring(2, 4) + "/" + skinHash + ".png"; 374 | this.skinViewer.loadSkin(skinUrl, skinModel); 375 | } 376 | } 377 | }) 378 | } 379 | } 380 | 381 | 382 | /* Cape scaling (height) */ 383 | function capeScale(height) { 384 | if (height % 22 === 0) { 385 | return height / 22; 386 | } else if (height % 17 === 0) { 387 | return height / 17; 388 | } else if (height >= 32 && (height & (height - 1)) === 0) { 389 | return height / 32; 390 | } 391 | return Math.max(1, Math.floor(height / 22)); 392 | } 393 | 394 | 395 | /* Returns a NameMC texture URL */ 396 | function textureURL(hash) { 397 | return 'https://texture.namemc.com/' + hash[0] + hash[1] + '/' + hash[2] + hash[3] + '/' + hash + '.png'; 398 | } 399 | -------------------------------------------------------------------------------- /js/bootstrap.bundle.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v4.6.0 (https://getbootstrap.com/) 3 | * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5 | */ 6 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap={},t.jQuery)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=n(e);function o(t,e){for(var n=0;n=4)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};l.jQueryDetection(),i.default.fn.emulateTransitionEnd=s,i.default.event.special[l.TRANSITION_END]={bindType:"transitionend",delegateType:"transitionend",handle:function(t){if(i.default(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var u="alert",f=i.default.fn[u],d=function(){function t(t){this._element=t}var e=t.prototype;return e.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},e.dispose=function(){i.default.removeData(this._element,"bs.alert"),this._element=null},e._getRootElement=function(t){var e=l.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=i.default(t).closest(".alert")[0]),n},e._triggerCloseEvent=function(t){var e=i.default.Event("close.bs.alert");return i.default(t).trigger(e),e},e._removeElement=function(t){var e=this;if(i.default(t).removeClass("show"),i.default(t).hasClass("fade")){var n=l.getTransitionDurationFromElement(t);i.default(t).one(l.TRANSITION_END,(function(n){return e._destroyElement(t,n)})).emulateTransitionEnd(n)}else this._destroyElement(t)},e._destroyElement=function(t){i.default(t).detach().trigger("closed.bs.alert").remove()},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.alert");o||(o=new t(this),n.data("bs.alert",o)),"close"===e&&o[e](this)}))},t._handleDismiss=function(t){return function(e){e&&e.preventDefault(),t.close(this)}},r(t,null,[{key:"VERSION",get:function(){return"4.6.0"}}]),t}();i.default(document).on("click.bs.alert.data-api",'[data-dismiss="alert"]',d._handleDismiss(new d)),i.default.fn[u]=d._jQueryInterface,i.default.fn[u].Constructor=d,i.default.fn[u].noConflict=function(){return i.default.fn[u]=f,d._jQueryInterface};var c=i.default.fn.button,h=function(){function t(t){this._element=t,this.shouldAvoidTriggerChange=!1}var e=t.prototype;return e.toggle=function(){var t=!0,e=!0,n=i.default(this._element).closest('[data-toggle="buttons"]')[0];if(n){var o=this._element.querySelector('input:not([type="hidden"])');if(o){if("radio"===o.type)if(o.checked&&this._element.classList.contains("active"))t=!1;else{var r=n.querySelector(".active");r&&i.default(r).removeClass("active")}t&&("checkbox"!==o.type&&"radio"!==o.type||(o.checked=!this._element.classList.contains("active")),this.shouldAvoidTriggerChange||i.default(o).trigger("change")),o.focus(),e=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(e&&this._element.setAttribute("aria-pressed",!this._element.classList.contains("active")),t&&i.default(this._element).toggleClass("active"))},e.dispose=function(){i.default.removeData(this._element,"bs.button"),this._element=null},t._jQueryInterface=function(e,n){return this.each((function(){var o=i.default(this),r=o.data("bs.button");r||(r=new t(this),o.data("bs.button",r)),r.shouldAvoidTriggerChange=n,"toggle"===e&&r[e]()}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.0"}}]),t}();i.default(document).on("click.bs.button.data-api",'[data-toggle^="button"]',(function(t){var e=t.target,n=e;if(i.default(e).hasClass("btn")||(e=i.default(e).closest(".btn")[0]),!e||e.hasAttribute("disabled")||e.classList.contains("disabled"))t.preventDefault();else{var o=e.querySelector('input:not([type="hidden"])');if(o&&(o.hasAttribute("disabled")||o.classList.contains("disabled")))return void t.preventDefault();"INPUT"!==n.tagName&&"LABEL"===e.tagName||h._jQueryInterface.call(i.default(e),"toggle","INPUT"===n.tagName)}})).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',(function(t){var e=i.default(t.target).closest(".btn")[0];i.default(e).toggleClass("focus",/^focus(in)?$/.test(t.type))})),i.default(window).on("load.bs.button.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-toggle="buttons"] .btn')),e=0,n=t.length;e0,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var e=t.prototype;return e.next=function(){this._isSliding||this._slide("next")},e.nextWhenVisible=function(){var t=i.default(this._element);!document.hidden&&t.is(":visible")&&"hidden"!==t.css("visibility")&&this.next()},e.prev=function(){this._isSliding||this._slide("prev")},e.pause=function(t){t||(this._isPaused=!0),this._element.querySelector(".carousel-item-next, .carousel-item-prev")&&(l.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},e.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},e.to=function(t){var e=this;this._activeElement=this._element.querySelector(".active.carousel-item");var n=this._getItemIndex(this._activeElement);if(!(t>this._items.length-1||t<0))if(this._isSliding)i.default(this._element).one("slid.bs.carousel",(function(){return e.to(t)}));else{if(n===t)return this.pause(),void this.cycle();var o=t>n?"next":"prev";this._slide(o,this._items[t])}},e.dispose=function(){i.default(this._element).off(m),i.default.removeData(this._element,"bs.carousel"),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},e._getConfig=function(t){return t=a({},v,t),l.typeCheckConfig(p,t,_),t},e._handleSwipe=function(){var t=Math.abs(this.touchDeltaX);if(!(t<=40)){var e=t/this.touchDeltaX;this.touchDeltaX=0,e>0&&this.prev(),e<0&&this.next()}},e._addEventListeners=function(){var t=this;this._config.keyboard&&i.default(this._element).on("keydown.bs.carousel",(function(e){return t._keydown(e)})),"hover"===this._config.pause&&i.default(this._element).on("mouseenter.bs.carousel",(function(e){return t.pause(e)})).on("mouseleave.bs.carousel",(function(e){return t.cycle(e)})),this._config.touch&&this._addTouchEventListeners()},e._addTouchEventListeners=function(){var t=this;if(this._touchSupported){var e=function(e){t._pointerEvent&&b[e.originalEvent.pointerType.toUpperCase()]?t.touchStartX=e.originalEvent.clientX:t._pointerEvent||(t.touchStartX=e.originalEvent.touches[0].clientX)},n=function(e){t._pointerEvent&&b[e.originalEvent.pointerType.toUpperCase()]&&(t.touchDeltaX=e.originalEvent.clientX-t.touchStartX),t._handleSwipe(),"hover"===t._config.pause&&(t.pause(),t.touchTimeout&&clearTimeout(t.touchTimeout),t.touchTimeout=setTimeout((function(e){return t.cycle(e)}),500+t._config.interval))};i.default(this._element.querySelectorAll(".carousel-item img")).on("dragstart.bs.carousel",(function(t){return t.preventDefault()})),this._pointerEvent?(i.default(this._element).on("pointerdown.bs.carousel",(function(t){return e(t)})),i.default(this._element).on("pointerup.bs.carousel",(function(t){return n(t)})),this._element.classList.add("pointer-event")):(i.default(this._element).on("touchstart.bs.carousel",(function(t){return e(t)})),i.default(this._element).on("touchmove.bs.carousel",(function(e){return function(e){e.originalEvent.touches&&e.originalEvent.touches.length>1?t.touchDeltaX=0:t.touchDeltaX=e.originalEvent.touches[0].clientX-t.touchStartX}(e)})),i.default(this._element).on("touchend.bs.carousel",(function(t){return n(t)})))}},e._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next()}},e._getItemIndex=function(t){return this._items=t&&t.parentNode?[].slice.call(t.parentNode.querySelectorAll(".carousel-item")):[],this._items.indexOf(t)},e._getItemByDirection=function(t,e){var n="next"===t,i="prev"===t,o=this._getItemIndex(e),r=this._items.length-1;if((i&&0===o||n&&o===r)&&!this._config.wrap)return e;var a=(o+("prev"===t?-1:1))%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]},e._triggerSlideEvent=function(t,e){var n=this._getItemIndex(t),o=this._getItemIndex(this._element.querySelector(".active.carousel-item")),r=i.default.Event("slide.bs.carousel",{relatedTarget:t,direction:e,from:o,to:n});return i.default(this._element).trigger(r),r},e._setActiveIndicatorElement=function(t){if(this._indicatorsElement){var e=[].slice.call(this._indicatorsElement.querySelectorAll(".active"));i.default(e).removeClass("active");var n=this._indicatorsElement.children[this._getItemIndex(t)];n&&i.default(n).addClass("active")}},e._updateInterval=function(){var t=this._activeElement||this._element.querySelector(".active.carousel-item");if(t){var e=parseInt(t.getAttribute("data-interval"),10);e?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=e):this._config.interval=this._config.defaultInterval||this._config.interval}},e._slide=function(t,e){var n,o,r,a=this,s=this._element.querySelector(".active.carousel-item"),u=this._getItemIndex(s),f=e||s&&this._getItemByDirection(t,s),d=this._getItemIndex(f),c=Boolean(this._interval);if("next"===t?(n="carousel-item-left",o="carousel-item-next",r="left"):(n="carousel-item-right",o="carousel-item-prev",r="right"),f&&i.default(f).hasClass("active"))this._isSliding=!1;else if(!this._triggerSlideEvent(f,r).isDefaultPrevented()&&s&&f){this._isSliding=!0,c&&this.pause(),this._setActiveIndicatorElement(f),this._activeElement=f;var h=i.default.Event("slid.bs.carousel",{relatedTarget:f,direction:r,from:u,to:d});if(i.default(this._element).hasClass("slide")){i.default(f).addClass(o),l.reflow(f),i.default(s).addClass(n),i.default(f).addClass(n);var p=l.getTransitionDurationFromElement(s);i.default(s).one(l.TRANSITION_END,(function(){i.default(f).removeClass(n+" "+o).addClass("active"),i.default(s).removeClass("active "+o+" "+n),a._isSliding=!1,setTimeout((function(){return i.default(a._element).trigger(h)}),0)})).emulateTransitionEnd(p)}else i.default(s).removeClass("active"),i.default(f).addClass("active"),this._isSliding=!1,i.default(this._element).trigger(h);c&&this.cycle()}},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data("bs.carousel"),o=a({},v,i.default(this).data());"object"==typeof e&&(o=a({},o,e));var r="string"==typeof e?e:o.slide;if(n||(n=new t(this,o),i.default(this).data("bs.carousel",n)),"number"==typeof e)n.to(e);else if("string"==typeof r){if("undefined"==typeof n[r])throw new TypeError('No method named "'+r+'"');n[r]()}else o.interval&&o.ride&&(n.pause(),n.cycle())}))},t._dataApiClickHandler=function(e){var n=l.getSelectorFromElement(this);if(n){var o=i.default(n)[0];if(o&&i.default(o).hasClass("carousel")){var r=a({},i.default(o).data(),i.default(this).data()),s=this.getAttribute("data-slide-to");s&&(r.interval=!1),t._jQueryInterface.call(i.default(o),r),s&&i.default(o).data("bs.carousel").to(s),e.preventDefault()}}},r(t,null,[{key:"VERSION",get:function(){return"4.6.0"}},{key:"Default",get:function(){return v}}]),t}();i.default(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",y._dataApiClickHandler),i.default(window).on("load.bs.carousel.data-api",(function(){for(var t=[].slice.call(document.querySelectorAll('[data-ride="carousel"]')),e=0,n=t.length;e0&&(this._selector=a,this._triggerArray.push(r))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var e=t.prototype;return e.toggle=function(){i.default(this._element).hasClass("show")?this.hide():this.show()},e.show=function(){var e,n,o=this;if(!this._isTransitioning&&!i.default(this._element).hasClass("show")&&(this._parent&&0===(e=[].slice.call(this._parent.querySelectorAll(".show, .collapsing")).filter((function(t){return"string"==typeof o._config.parent?t.getAttribute("data-parent")===o._config.parent:t.classList.contains("collapse")}))).length&&(e=null),!(e&&(n=i.default(e).not(this._selector).data("bs.collapse"))&&n._isTransitioning))){var r=i.default.Event("show.bs.collapse");if(i.default(this._element).trigger(r),!r.isDefaultPrevented()){e&&(t._jQueryInterface.call(i.default(e).not(this._selector),"hide"),n||i.default(e).data("bs.collapse",null));var a=this._getDimension();i.default(this._element).removeClass("collapse").addClass("collapsing"),this._element.style[a]=0,this._triggerArray.length&&i.default(this._triggerArray).removeClass("collapsed").attr("aria-expanded",!0),this.setTransitioning(!0);var s="scroll"+(a[0].toUpperCase()+a.slice(1)),u=l.getTransitionDurationFromElement(this._element);i.default(this._element).one(l.TRANSITION_END,(function(){i.default(o._element).removeClass("collapsing").addClass("collapse show"),o._element.style[a]="",o.setTransitioning(!1),i.default(o._element).trigger("shown.bs.collapse")})).emulateTransitionEnd(u),this._element.style[a]=this._element[s]+"px"}}},e.hide=function(){var t=this;if(!this._isTransitioning&&i.default(this._element).hasClass("show")){var e=i.default.Event("hide.bs.collapse");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){var n=this._getDimension();this._element.style[n]=this._element.getBoundingClientRect()[n]+"px",l.reflow(this._element),i.default(this._element).addClass("collapsing").removeClass("collapse show");var o=this._triggerArray.length;if(o>0)for(var r=0;r=0)return 1;return 0}();var k=D&&window.Promise?function(t){var e=!1;return function(){e||(e=!0,window.Promise.resolve().then((function(){e=!1,t()})))}}:function(t){var e=!1;return function(){e||(e=!0,setTimeout((function(){e=!1,t()}),N))}};function A(t){return t&&"[object Function]"==={}.toString.call(t)}function I(t,e){if(1!==t.nodeType)return[];var n=t.ownerDocument.defaultView.getComputedStyle(t,null);return e?n[e]:n}function O(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function x(t){if(!t)return document.body;switch(t.nodeName){case"HTML":case"BODY":return t.ownerDocument.body;case"#document":return t.body}var e=I(t),n=e.overflow,i=e.overflowX,o=e.overflowY;return/(auto|scroll|overlay)/.test(n+o+i)?t:x(O(t))}function j(t){return t&&t.referenceNode?t.referenceNode:t}var L=D&&!(!window.MSInputMethodContext||!document.documentMode),P=D&&/MSIE 10/.test(navigator.userAgent);function F(t){return 11===t?L:10===t?P:L||P}function R(t){if(!t)return document.documentElement;for(var e=F(10)?document.body:null,n=t.offsetParent||null;n===e&&t.nextElementSibling;)n=(t=t.nextElementSibling).offsetParent;var i=n&&n.nodeName;return i&&"BODY"!==i&&"HTML"!==i?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===I(n,"position")?R(n):n:t?t.ownerDocument.documentElement:document.documentElement}function H(t){return null!==t.parentNode?H(t.parentNode):t}function M(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,i=n?t:e,o=n?e:t,r=document.createRange();r.setStart(i,0),r.setEnd(o,0);var a,s,l=r.commonAncestorContainer;if(t!==l&&e!==l||i.contains(o))return"BODY"===(s=(a=l).nodeName)||"HTML"!==s&&R(a.firstElementChild)!==a?R(l):l;var u=H(t);return u.host?M(u.host,e):M(t,H(e).host)}function q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",n="top"===e?"scrollTop":"scrollLeft",i=t.nodeName;if("BODY"===i||"HTML"===i){var o=t.ownerDocument.documentElement,r=t.ownerDocument.scrollingElement||o;return r[n]}return t[n]}function B(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=q(e,"top"),o=q(e,"left"),r=n?-1:1;return t.top+=i*r,t.bottom+=i*r,t.left+=o*r,t.right+=o*r,t}function Q(t,e){var n="x"===e?"Left":"Top",i="Left"===n?"Right":"Bottom";return parseFloat(t["border"+n+"Width"])+parseFloat(t["border"+i+"Width"])}function W(t,e,n,i){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],F(10)?parseInt(n["offset"+t])+parseInt(i["margin"+("Height"===t?"Top":"Left")])+parseInt(i["margin"+("Height"===t?"Bottom":"Right")]):0)}function U(t){var e=t.body,n=t.documentElement,i=F(10)&&getComputedStyle(n);return{height:W("Height",e,n,i),width:W("Width",e,n,i)}}var V=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Y=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]&&arguments[2],i=F(10),o="HTML"===e.nodeName,r=G(t),a=G(e),s=x(t),l=I(e),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var d=K({top:r.top-a.top-u,left:r.left-a.left-f,width:r.width,height:r.height});if(d.marginTop=0,d.marginLeft=0,!i&&o){var c=parseFloat(l.marginTop),h=parseFloat(l.marginLeft);d.top-=u-c,d.bottom-=u-c,d.left-=f-h,d.right-=f-h,d.marginTop=c,d.marginLeft=h}return(i&&!n?e.contains(s):e===s&&"BODY"!==s.nodeName)&&(d=B(d,e)),d}function J(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.ownerDocument.documentElement,i=$(t,n),o=Math.max(n.clientWidth,window.innerWidth||0),r=Math.max(n.clientHeight,window.innerHeight||0),a=e?0:q(n),s=e?0:q(n,"left"),l={top:a-i.top+i.marginTop,left:s-i.left+i.marginLeft,width:o,height:r};return K(l)}function Z(t){var e=t.nodeName;if("BODY"===e||"HTML"===e)return!1;if("fixed"===I(t,"position"))return!0;var n=O(t);return!!n&&Z(n)}function tt(t){if(!t||!t.parentElement||F())return document.documentElement;for(var e=t.parentElement;e&&"none"===I(e,"transform");)e=e.parentElement;return e||document.documentElement}function et(t,e,n,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r={top:0,left:0},a=o?tt(t):M(t,j(e));if("viewport"===i)r=J(a,o);else{var s=void 0;"scrollParent"===i?"BODY"===(s=x(O(e))).nodeName&&(s=t.ownerDocument.documentElement):s="window"===i?t.ownerDocument.documentElement:i;var l=$(s,a,o);if("HTML"!==s.nodeName||Z(a))r=l;else{var u=U(t.ownerDocument),f=u.height,d=u.width;r.top+=l.top-l.marginTop,r.bottom=f+l.top,r.left+=l.left-l.marginLeft,r.right=d+l.left}}var c="number"==typeof(n=n||0);return r.left+=c?n:n.left||0,r.top+=c?n:n.top||0,r.right-=c?n:n.right||0,r.bottom-=c?n:n.bottom||0,r}function nt(t){return t.width*t.height}function it(t,e,n,i,o){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===t.indexOf("auto"))return t;var a=et(n,i,r,o),s={top:{width:a.width,height:e.top-a.top},right:{width:a.right-e.right,height:a.height},bottom:{width:a.width,height:a.bottom-e.bottom},left:{width:e.left-a.left,height:a.height}},l=Object.keys(s).map((function(t){return X({key:t},s[t],{area:nt(s[t])})})).sort((function(t,e){return e.area-t.area})),u=l.filter((function(t){var e=t.width,i=t.height;return e>=n.clientWidth&&i>=n.clientHeight})),f=u.length>0?u[0].key:l[0].key,d=t.split("-")[1];return f+(d?"-"+d:"")}function ot(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=i?tt(e):M(e,j(n));return $(n,o,i)}function rt(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(e.marginTop||0)+parseFloat(e.marginBottom||0),i=parseFloat(e.marginLeft||0)+parseFloat(e.marginRight||0);return{width:t.offsetWidth+i,height:t.offsetHeight+n}}function at(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,(function(t){return e[t]}))}function st(t,e,n){n=n.split("-")[0];var i=rt(t),o={width:i.width,height:i.height},r=-1!==["right","left"].indexOf(n),a=r?"top":"left",s=r?"left":"top",l=r?"height":"width",u=r?"width":"height";return o[a]=e[a]+e[l]/2-i[l]/2,o[s]=n===s?e[s]-i[u]:e[at(s)],o}function lt(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function ut(t,e,n){return(void 0===n?t:t.slice(0,function(t,e,n){if(Array.prototype.findIndex)return t.findIndex((function(t){return t[e]===n}));var i=lt(t,(function(t){return t[e]===n}));return t.indexOf(i)}(t,"name",n))).forEach((function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var n=t.function||t.fn;t.enabled&&A(n)&&(e.offsets.popper=K(e.offsets.popper),e.offsets.reference=K(e.offsets.reference),e=n(e,t))})),e}function ft(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=ot(this.state,this.popper,this.reference,this.options.positionFixed),t.placement=it(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.positionFixed=this.options.positionFixed,t.offsets.popper=st(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",t=ut(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function dt(t,e){return t.some((function(t){var n=t.name;return t.enabled&&n===e}))}function ct(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),i=0;i1&&void 0!==arguments[1]&&arguments[1],n=Tt.indexOf(t),i=Tt.slice(n+1).concat(Tt.slice(0,n));return e?i.reverse():i}var St="flip",Dt="clockwise",Nt="counterclockwise";function kt(t,e,n,i){var o=[0,0],r=-1!==["right","left"].indexOf(i),a=t.split(/(\+|\-)/).map((function(t){return t.trim()})),s=a.indexOf(lt(a,(function(t){return-1!==t.search(/,|\s/)})));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=-1!==s?[a.slice(0,s).concat([a[s].split(l)[0]]),[a[s].split(l)[1]].concat(a.slice(s+1))]:[a];return(u=u.map((function(t,i){var o=(1===i?!r:r)?"height":"width",a=!1;return t.reduce((function(t,e){return""===t[t.length-1]&&-1!==["+","-"].indexOf(e)?(t[t.length-1]=e,a=!0,t):a?(t[t.length-1]+=e,a=!1,t):t.concat(e)}),[]).map((function(t){return function(t,e,n,i){var o=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+o[1],a=o[2];if(!r)return t;if(0===a.indexOf("%")){var s=void 0;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=i}return K(s)[e]/100*r}if("vh"===a||"vw"===a)return("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*r;return r}(t,o,e,n)}))}))).forEach((function(t,e){t.forEach((function(n,i){_t(n)&&(o[e]+=n*("-"===t[i-1]?-1:1))}))})),o}var At={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(t){var e=t.placement,n=e.split("-")[0],i=e.split("-")[1];if(i){var o=t.offsets,r=o.reference,a=o.popper,s=-1!==["bottom","top"].indexOf(n),l=s?"left":"top",u=s?"width":"height",f={start:z({},l,r[l]),end:z({},l,r[l]+r[u]-a[u])};t.offsets.popper=X({},a,f[i])}return t}},offset:{order:200,enabled:!0,fn:function(t,e){var n=e.offset,i=t.placement,o=t.offsets,r=o.popper,a=o.reference,s=i.split("-")[0],l=void 0;return l=_t(+n)?[+n,0]:kt(n,r,a,s),"left"===s?(r.top+=l[0],r.left-=l[1]):"right"===s?(r.top+=l[0],r.left+=l[1]):"top"===s?(r.left+=l[0],r.top-=l[1]):"bottom"===s&&(r.left+=l[0],r.top+=l[1]),t.popper=r,t},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(t,e){var n=e.boundariesElement||R(t.instance.popper);t.instance.reference===n&&(n=R(n));var i=ct("transform"),o=t.instance.popper.style,r=o.top,a=o.left,s=o[i];o.top="",o.left="",o[i]="";var l=et(t.instance.popper,t.instance.reference,e.padding,n,t.positionFixed);o.top=r,o.left=a,o[i]=s,e.boundaries=l;var u=e.priority,f=t.offsets.popper,d={primary:function(t){var n=f[t];return f[t]l[t]&&!e.escapeWithReference&&(i=Math.min(f[n],l[t]-("right"===t?f.width:f.height))),z({},n,i)}};return u.forEach((function(t){var e=-1!==["left","top"].indexOf(t)?"primary":"secondary";f=X({},f,d[e](t))})),t.offsets.popper=f,t},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(t){var e=t.offsets,n=e.popper,i=e.reference,o=t.placement.split("-")[0],r=Math.floor,a=-1!==["top","bottom"].indexOf(o),s=a?"right":"bottom",l=a?"left":"top",u=a?"width":"height";return n[s]r(i[s])&&(t.offsets.popper[l]=r(i[s])),t}},arrow:{order:500,enabled:!0,fn:function(t,e){var n;if(!wt(t.instance.modifiers,"arrow","keepTogether"))return t;var i=e.element;if("string"==typeof i){if(!(i=t.instance.popper.querySelector(i)))return t}else if(!t.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),t;var o=t.placement.split("-")[0],r=t.offsets,a=r.popper,s=r.reference,l=-1!==["left","right"].indexOf(o),u=l?"height":"width",f=l?"Top":"Left",d=f.toLowerCase(),c=l?"left":"top",h=l?"bottom":"right",p=rt(i)[u];s[h]-pa[h]&&(t.offsets.popper[d]+=s[d]+p-a[h]),t.offsets.popper=K(t.offsets.popper);var m=s[d]+s[u]/2-p/2,g=I(t.instance.popper),v=parseFloat(g["margin"+f]),_=parseFloat(g["border"+f+"Width"]),b=m-t.offsets.popper[d]-v-_;return b=Math.max(Math.min(a[u]-p,b),0),t.arrowElement=i,t.offsets.arrow=(z(n={},d,Math.round(b)),z(n,c,""),n),t},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(t,e){if(dt(t.instance.modifiers,"inner"))return t;if(t.flipped&&t.placement===t.originalPlacement)return t;var n=et(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement,t.positionFixed),i=t.placement.split("-")[0],o=at(i),r=t.placement.split("-")[1]||"",a=[];switch(e.behavior){case St:a=[i,o];break;case Dt:a=Ct(i);break;case Nt:a=Ct(i,!0);break;default:a=e.behavior}return a.forEach((function(s,l){if(i!==s||a.length===l+1)return t;i=t.placement.split("-")[0],o=at(i);var u=t.offsets.popper,f=t.offsets.reference,d=Math.floor,c="left"===i&&d(u.right)>d(f.left)||"right"===i&&d(u.left)d(f.top)||"bottom"===i&&d(u.top)d(n.right),m=d(u.top)d(n.bottom),v="left"===i&&h||"right"===i&&p||"top"===i&&m||"bottom"===i&&g,_=-1!==["top","bottom"].indexOf(i),b=!!e.flipVariations&&(_&&"start"===r&&h||_&&"end"===r&&p||!_&&"start"===r&&m||!_&&"end"===r&&g),y=!!e.flipVariationsByContent&&(_&&"start"===r&&p||_&&"end"===r&&h||!_&&"start"===r&&g||!_&&"end"===r&&m),w=b||y;(c||v||w)&&(t.flipped=!0,(c||v)&&(i=a[l+1]),w&&(r=function(t){return"end"===t?"start":"start"===t?"end":t}(r)),t.placement=i+(r?"-"+r:""),t.offsets.popper=X({},t.offsets.popper,st(t.instance.popper,t.offsets.reference,t.placement)),t=ut(t.instance.modifiers,t,"flip"))})),t},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(t){var e=t.placement,n=e.split("-")[0],i=t.offsets,o=i.popper,r=i.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return o[a?"left":"top"]=r[n]-(s?o[a?"width":"height"]:0),t.placement=at(e),t.offsets.popper=K(o),t}},hide:{order:800,enabled:!0,fn:function(t){if(!wt(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=lt(t.instance.modifiers,(function(t){return"preventOverflow"===t.name})).boundaries;if(e.bottomn.right||e.top>n.bottom||e.right2&&void 0!==arguments[2]?arguments[2]:{};V(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(i.update)},this.update=k(this.update.bind(this)),this.options=X({},t.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=e&&e.jquery?e[0]:e,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(X({},t.Defaults.modifiers,o.modifiers)).forEach((function(e){i.options.modifiers[e]=X({},t.Defaults.modifiers[e]||{},o.modifiers?o.modifiers[e]:{})})),this.modifiers=Object.keys(this.options.modifiers).map((function(t){return X({name:t},i.options.modifiers[t])})).sort((function(t,e){return t.order-e.order})),this.modifiers.forEach((function(t){t.enabled&&A(t.onLoad)&&t.onLoad(i.reference,i.popper,i.options,t,i.state)})),this.update();var r=this.options.eventsEnabled;r&&this.enableEventListeners(),this.state.eventsEnabled=r}return Y(t,[{key:"update",value:function(){return ft.call(this)}},{key:"destroy",value:function(){return ht.call(this)}},{key:"enableEventListeners",value:function(){return gt.call(this)}},{key:"disableEventListeners",value:function(){return vt.call(this)}}]),t}();It.Utils=("undefined"!=typeof window?window:global).PopperUtils,It.placements=Et,It.Defaults=At;var Ot="dropdown",xt=i.default.fn[Ot],jt=new RegExp("38|40|27"),Lt={offset:0,flip:!0,boundary:"scrollParent",reference:"toggle",display:"dynamic",popperConfig:null},Pt={offset:"(number|string|function)",flip:"boolean",boundary:"(string|element)",reference:"(string|element)",display:"string",popperConfig:"(null|object)"},Ft=function(){function t(t,e){this._element=t,this._popper=null,this._config=this._getConfig(e),this._menu=this._getMenuElement(),this._inNavbar=this._detectNavbar(),this._addEventListeners()}var e=t.prototype;return e.toggle=function(){if(!this._element.disabled&&!i.default(this._element).hasClass("disabled")){var e=i.default(this._menu).hasClass("show");t._clearMenus(),e||this.show(!0)}},e.show=function(e){if(void 0===e&&(e=!1),!(this._element.disabled||i.default(this._element).hasClass("disabled")||i.default(this._menu).hasClass("show"))){var n={relatedTarget:this._element},o=i.default.Event("show.bs.dropdown",n),r=t._getParentFromElement(this._element);if(i.default(r).trigger(o),!o.isDefaultPrevented()){if(!this._inNavbar&&e){if("undefined"==typeof It)throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");var a=this._element;"parent"===this._config.reference?a=r:l.isElement(this._config.reference)&&(a=this._config.reference,"undefined"!=typeof this._config.reference.jquery&&(a=this._config.reference[0])),"scrollParent"!==this._config.boundary&&i.default(r).addClass("position-static"),this._popper=new It(a,this._menu,this._getPopperConfig())}"ontouchstart"in document.documentElement&&0===i.default(r).closest(".navbar-nav").length&&i.default(document.body).children().on("mouseover",null,i.default.noop),this._element.focus(),this._element.setAttribute("aria-expanded",!0),i.default(this._menu).toggleClass("show"),i.default(r).toggleClass("show").trigger(i.default.Event("shown.bs.dropdown",n))}}},e.hide=function(){if(!this._element.disabled&&!i.default(this._element).hasClass("disabled")&&i.default(this._menu).hasClass("show")){var e={relatedTarget:this._element},n=i.default.Event("hide.bs.dropdown",e),o=t._getParentFromElement(this._element);i.default(o).trigger(n),n.isDefaultPrevented()||(this._popper&&this._popper.destroy(),i.default(this._menu).toggleClass("show"),i.default(o).toggleClass("show").trigger(i.default.Event("hidden.bs.dropdown",e)))}},e.dispose=function(){i.default.removeData(this._element,"bs.dropdown"),i.default(this._element).off(".bs.dropdown"),this._element=null,this._menu=null,null!==this._popper&&(this._popper.destroy(),this._popper=null)},e.update=function(){this._inNavbar=this._detectNavbar(),null!==this._popper&&this._popper.scheduleUpdate()},e._addEventListeners=function(){var t=this;i.default(this._element).on("click.bs.dropdown",(function(e){e.preventDefault(),e.stopPropagation(),t.toggle()}))},e._getConfig=function(t){return t=a({},this.constructor.Default,i.default(this._element).data(),t),l.typeCheckConfig(Ot,t,this.constructor.DefaultType),t},e._getMenuElement=function(){if(!this._menu){var e=t._getParentFromElement(this._element);e&&(this._menu=e.querySelector(".dropdown-menu"))}return this._menu},e._getPlacement=function(){var t=i.default(this._element.parentNode),e="bottom-start";return t.hasClass("dropup")?e=i.default(this._menu).hasClass("dropdown-menu-right")?"top-end":"top-start":t.hasClass("dropright")?e="right-start":t.hasClass("dropleft")?e="left-start":i.default(this._menu).hasClass("dropdown-menu-right")&&(e="bottom-end"),e},e._detectNavbar=function(){return i.default(this._element).closest(".navbar").length>0},e._getOffset=function(){var t=this,e={};return"function"==typeof this._config.offset?e.fn=function(e){return e.offsets=a({},e.offsets,t._config.offset(e.offsets,t._element)||{}),e}:e.offset=this._config.offset,e},e._getPopperConfig=function(){var t={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(t.modifiers.applyStyle={enabled:!1}),a({},t,this._config.popperConfig)},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this).data("bs.dropdown");if(n||(n=new t(this,"object"==typeof e?e:null),i.default(this).data("bs.dropdown",n)),"string"==typeof e){if("undefined"==typeof n[e])throw new TypeError('No method named "'+e+'"');n[e]()}}))},t._clearMenus=function(e){if(!e||3!==e.which&&("keyup"!==e.type||9===e.which))for(var n=[].slice.call(document.querySelectorAll('[data-toggle="dropdown"]')),o=0,r=n.length;o0&&a--,40===e.which&&adocument.documentElement.clientHeight;n||(this._element.style.overflowY="hidden"),this._element.classList.add("modal-static");var o=l.getTransitionDurationFromElement(this._dialog);i.default(this._element).off(l.TRANSITION_END),i.default(this._element).one(l.TRANSITION_END,(function(){t._element.classList.remove("modal-static"),n||i.default(t._element).one(l.TRANSITION_END,(function(){t._element.style.overflowY=""})).emulateTransitionEnd(t._element,o)})).emulateTransitionEnd(o),this._element.focus()}},e._showElement=function(t){var e=this,n=i.default(this._element).hasClass("fade"),o=this._dialog?this._dialog.querySelector(".modal-body"):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),i.default(this._dialog).hasClass("modal-dialog-scrollable")&&o?o.scrollTop=0:this._element.scrollTop=0,n&&l.reflow(this._element),i.default(this._element).addClass("show"),this._config.focus&&this._enforceFocus();var r=i.default.Event("shown.bs.modal",{relatedTarget:t}),a=function(){e._config.focus&&e._element.focus(),e._isTransitioning=!1,i.default(e._element).trigger(r)};if(n){var s=l.getTransitionDurationFromElement(this._dialog);i.default(this._dialog).one(l.TRANSITION_END,a).emulateTransitionEnd(s)}else a()},e._enforceFocus=function(){var t=this;i.default(document).off("focusin.bs.modal").on("focusin.bs.modal",(function(e){document!==e.target&&t._element!==e.target&&0===i.default(t._element).has(e.target).length&&t._element.focus()}))},e._setEscapeEvent=function(){var t=this;this._isShown?i.default(this._element).on("keydown.dismiss.bs.modal",(function(e){t._config.keyboard&&27===e.which?(e.preventDefault(),t.hide()):t._config.keyboard||27!==e.which||t._triggerBackdropTransition()})):this._isShown||i.default(this._element).off("keydown.dismiss.bs.modal")},e._setResizeEvent=function(){var t=this;this._isShown?i.default(window).on("resize.bs.modal",(function(e){return t.handleUpdate(e)})):i.default(window).off("resize.bs.modal")},e._hideModal=function(){var t=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((function(){i.default(document.body).removeClass("modal-open"),t._resetAdjustments(),t._resetScrollbar(),i.default(t._element).trigger("hidden.bs.modal")}))},e._removeBackdrop=function(){this._backdrop&&(i.default(this._backdrop).remove(),this._backdrop=null)},e._showBackdrop=function(t){var e=this,n=i.default(this._element).hasClass("fade")?"fade":"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className="modal-backdrop",n&&this._backdrop.classList.add(n),i.default(this._backdrop).appendTo(document.body),i.default(this._element).on("click.dismiss.bs.modal",(function(t){e._ignoreBackdropClick?e._ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"===e._config.backdrop?e._triggerBackdropTransition():e.hide())})),n&&l.reflow(this._backdrop),i.default(this._backdrop).addClass("show"),!t)return;if(!n)return void t();var o=l.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(l.TRANSITION_END,t).emulateTransitionEnd(o)}else if(!this._isShown&&this._backdrop){i.default(this._backdrop).removeClass("show");var r=function(){e._removeBackdrop(),t&&t()};if(i.default(this._element).hasClass("fade")){var a=l.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(l.TRANSITION_END,r).emulateTransitionEnd(a)}else r()}else t&&t()},e._adjustDialog=function(){var t=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},e._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},e._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(t.left+t.right)
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",customClass:"",sanitize:!0,sanitizeFn:null,whiteList:Qt,popperConfig:null},Zt={HIDE:"hide.bs.tooltip",HIDDEN:"hidden.bs.tooltip",SHOW:"show.bs.tooltip",SHOWN:"shown.bs.tooltip",INSERTED:"inserted.bs.tooltip",CLICK:"click.bs.tooltip",FOCUSIN:"focusin.bs.tooltip",FOCUSOUT:"focusout.bs.tooltip",MOUSEENTER:"mouseenter.bs.tooltip",MOUSELEAVE:"mouseleave.bs.tooltip"},te=function(){function t(t,e){if("undefined"==typeof It)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var e=t.prototype;return e.enable=function(){this._isEnabled=!0},e.disable=function(){this._isEnabled=!1},e.toggleEnabled=function(){this._isEnabled=!this._isEnabled},e.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=i.default(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(i.default(this.getTipElement()).hasClass("show"))return void this._leave(null,this);this._enter(null,this)}},e.dispose=function(){clearTimeout(this._timeout),i.default.removeData(this.element,this.constructor.DATA_KEY),i.default(this.element).off(this.constructor.EVENT_KEY),i.default(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&i.default(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},e.show=function(){var t=this;if("none"===i.default(this.element).css("display"))throw new Error("Please use show on visible elements");var e=i.default.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){i.default(this.element).trigger(e);var n=l.findShadowRoot(this.element),o=i.default.contains(null!==n?n:this.element.ownerDocument.documentElement,this.element);if(e.isDefaultPrevented()||!o)return;var r=this.getTipElement(),a=l.getUID(this.constructor.NAME);r.setAttribute("id",a),this.element.setAttribute("aria-describedby",a),this.setContent(),this.config.animation&&i.default(r).addClass("fade");var s="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,u=this._getAttachment(s);this.addAttachmentClass(u);var f=this._getContainer();i.default(r).data(this.constructor.DATA_KEY,this),i.default.contains(this.element.ownerDocument.documentElement,this.tip)||i.default(r).appendTo(f),i.default(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new It(this.element,r,this._getPopperConfig(u)),i.default(r).addClass("show"),i.default(r).addClass(this.config.customClass),"ontouchstart"in document.documentElement&&i.default(document.body).children().on("mouseover",null,i.default.noop);var d=function(){t.config.animation&&t._fixTransition();var e=t._hoverState;t._hoverState=null,i.default(t.element).trigger(t.constructor.Event.SHOWN),"out"===e&&t._leave(null,t)};if(i.default(this.tip).hasClass("fade")){var c=l.getTransitionDurationFromElement(this.tip);i.default(this.tip).one(l.TRANSITION_END,d).emulateTransitionEnd(c)}else d()}},e.hide=function(t){var e=this,n=this.getTipElement(),o=i.default.Event(this.constructor.Event.HIDE),r=function(){"show"!==e._hoverState&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),i.default(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(i.default(this.element).trigger(o),!o.isDefaultPrevented()){if(i.default(n).removeClass("show"),"ontouchstart"in document.documentElement&&i.default(document.body).children().off("mouseover",null,i.default.noop),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,i.default(this.tip).hasClass("fade")){var a=l.getTransitionDurationFromElement(n);i.default(n).one(l.TRANSITION_END,r).emulateTransitionEnd(a)}else r();this._hoverState=""}},e.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},e.isWithContent=function(){return Boolean(this.getTitle())},e.addAttachmentClass=function(t){i.default(this.getTipElement()).addClass("bs-tooltip-"+t)},e.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},e.setContent=function(){var t=this.getTipElement();this.setElementContent(i.default(t.querySelectorAll(".tooltip-inner")),this.getTitle()),i.default(t).removeClass("fade show")},e.setElementContent=function(t,e){"object"!=typeof e||!e.nodeType&&!e.jquery?this.config.html?(this.config.sanitize&&(e=Vt(e,this.config.whiteList,this.config.sanitizeFn)),t.html(e)):t.text(e):this.config.html?i.default(e).parent().is(t)||t.empty().append(e):t.text(i.default(e).text())},e.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},e._getPopperConfig=function(t){var e=this;return a({},{placement:t,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}},this.config.popperConfig)},e._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=a({},e.offsets,t.config.offset(e.offsets,t.element)||{}),e}:e.offset=this.config.offset,e},e._getContainer=function(){return!1===this.config.container?document.body:l.isElement(this.config.container)?i.default(this.config.container):i.default(document).find(this.config.container)},e._getAttachment=function(t){return $t[t.toUpperCase()]},e._setListeners=function(){var t=this;this.config.trigger.split(" ").forEach((function(e){if("click"===e)i.default(t.element).on(t.constructor.Event.CLICK,t.config.selector,(function(e){return t.toggle(e)}));else if("manual"!==e){var n="hover"===e?t.constructor.Event.MOUSEENTER:t.constructor.Event.FOCUSIN,o="hover"===e?t.constructor.Event.MOUSELEAVE:t.constructor.Event.FOCUSOUT;i.default(t.element).on(n,t.config.selector,(function(e){return t._enter(e)})).on(o,t.config.selector,(function(e){return t._leave(e)}))}})),this._hideModalHandler=function(){t.element&&t.hide()},i.default(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=a({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},e._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},e._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||i.default(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?"focus":"hover"]=!0),i.default(e.getTipElement()).hasClass("show")||"show"===e._hoverState?e._hoverState="show":(clearTimeout(e._timeout),e._hoverState="show",e.config.delay&&e.config.delay.show?e._timeout=setTimeout((function(){"show"===e._hoverState&&e.show()}),e.config.delay.show):e.show())},e._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||i.default(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),i.default(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?"focus":"hover"]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState="out",e.config.delay&&e.config.delay.hide?e._timeout=setTimeout((function(){"out"===e._hoverState&&e.hide()}),e.config.delay.hide):e.hide())},e._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},e._getConfig=function(t){var e=i.default(this.element).data();return Object.keys(e).forEach((function(t){-1!==Kt.indexOf(t)&&delete e[t]})),"number"==typeof(t=a({},this.constructor.Default,e,"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),l.typeCheckConfig(Yt,t,this.constructor.DefaultType),t.sanitize&&(t.template=Vt(t.template,t.whiteList,t.sanitizeFn)),t},e._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},e._cleanTipClass=function(){var t=i.default(this.getTipElement()),e=t.attr("class").match(Xt);null!==e&&e.length&&t.removeClass(e.join(""))},e._handlePopperPlacementChange=function(t){this.tip=t.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},e._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(i.default(t).removeClass("fade"),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.tooltip"),r="object"==typeof e&&e;if((o||!/dispose|hide/.test(e))&&(o||(o=new t(this,r),n.data("bs.tooltip",o)),"string"==typeof e)){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.0"}},{key:"Default",get:function(){return Jt}},{key:"NAME",get:function(){return Yt}},{key:"DATA_KEY",get:function(){return"bs.tooltip"}},{key:"Event",get:function(){return Zt}},{key:"EVENT_KEY",get:function(){return".bs.tooltip"}},{key:"DefaultType",get:function(){return Gt}}]),t}();i.default.fn[Yt]=te._jQueryInterface,i.default.fn[Yt].Constructor=te,i.default.fn[Yt].noConflict=function(){return i.default.fn[Yt]=zt,te._jQueryInterface};var ee="popover",ne=i.default.fn[ee],ie=new RegExp("(^|\\s)bs-popover\\S+","g"),oe=a({},te.Default,{placement:"right",trigger:"click",content:"",template:''}),re=a({},te.DefaultType,{content:"(string|element|function)"}),ae={HIDE:"hide.bs.popover",HIDDEN:"hidden.bs.popover",SHOW:"show.bs.popover",SHOWN:"shown.bs.popover",INSERTED:"inserted.bs.popover",CLICK:"click.bs.popover",FOCUSIN:"focusin.bs.popover",FOCUSOUT:"focusout.bs.popover",MOUSEENTER:"mouseenter.bs.popover",MOUSELEAVE:"mouseleave.bs.popover"},se=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var a=o.prototype;return a.isWithContent=function(){return this.getTitle()||this._getContent()},a.addAttachmentClass=function(t){i.default(this.getTipElement()).addClass("bs-popover-"+t)},a.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},a.setContent=function(){var t=i.default(this.getTipElement());this.setElementContent(t.find(".popover-header"),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(".popover-body"),e),t.removeClass("fade show")},a._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},a._cleanTipClass=function(){var t=i.default(this.getTipElement()),e=t.attr("class").match(ie);null!==e&&e.length>0&&t.removeClass(e.join(""))},o._jQueryInterface=function(t){return this.each((function(){var e=i.default(this).data("bs.popover"),n="object"==typeof t?t:null;if((e||!/dispose|hide/.test(t))&&(e||(e=new o(this,n),i.default(this).data("bs.popover",e)),"string"==typeof t)){if("undefined"==typeof e[t])throw new TypeError('No method named "'+t+'"');e[t]()}}))},r(o,null,[{key:"VERSION",get:function(){return"4.6.0"}},{key:"Default",get:function(){return oe}},{key:"NAME",get:function(){return ee}},{key:"DATA_KEY",get:function(){return"bs.popover"}},{key:"Event",get:function(){return ae}},{key:"EVENT_KEY",get:function(){return".bs.popover"}},{key:"DefaultType",get:function(){return re}}]),o}(te);i.default.fn[ee]=se._jQueryInterface,i.default.fn[ee].Constructor=se,i.default.fn[ee].noConflict=function(){return i.default.fn[ee]=ne,se._jQueryInterface};var le="scrollspy",ue=i.default.fn[le],fe={offset:10,method:"auto",target:""},de={offset:"number",method:"string",target:"(string|element)"},ce=function(){function t(t,e){var n=this;this._element=t,this._scrollElement="BODY"===t.tagName?window:t,this._config=this._getConfig(e),this._selector=this._config.target+" .nav-link,"+this._config.target+" .list-group-item,"+this._config.target+" .dropdown-item",this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,i.default(this._scrollElement).on("scroll.bs.scrollspy",(function(t){return n._process(t)})),this.refresh(),this._process()}var e=t.prototype;return e.refresh=function(){var t=this,e=this._scrollElement===this._scrollElement.window?"offset":"position",n="auto"===this._config.method?e:this._config.method,o="position"===n?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map((function(t){var e,r=l.getSelectorFromElement(t);if(r&&(e=document.querySelector(r)),e){var a=e.getBoundingClientRect();if(a.width||a.height)return[i.default(e)[n]().top+o,r]}return null})).filter((function(t){return t})).sort((function(t,e){return t[0]-e[0]})).forEach((function(e){t._offsets.push(e[0]),t._targets.push(e[1])}))},e.dispose=function(){i.default.removeData(this._element,"bs.scrollspy"),i.default(this._scrollElement).off(".bs.scrollspy"),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},e._getConfig=function(t){if("string"!=typeof(t=a({},fe,"object"==typeof t&&t?t:{})).target&&l.isElement(t.target)){var e=i.default(t.target).attr("id");e||(e=l.getUID(le),i.default(t.target).attr("id",e)),t.target="#"+e}return l.typeCheckConfig(le,t,de),t},e._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},e._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},e._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},e._process=function(){var t=this._getScrollTop()+this._config.offset,e=this._getScrollHeight(),n=this._config.offset+e-this._getOffsetHeight();if(this._scrollHeight!==e&&this.refresh(),t>=n){var i=this._targets[this._targets.length-1];this._activeTarget!==i&&this._activate(i)}else{if(this._activeTarget&&t0)return this._activeTarget=null,void this._clear();for(var o=this._offsets.length;o--;){this._activeTarget!==this._targets[o]&&t>=this._offsets[o]&&("undefined"==typeof this._offsets[o+1]||t li > .active":".active";n=(n=i.default.makeArray(i.default(o).find(a)))[n.length-1]}var s=i.default.Event("hide.bs.tab",{relatedTarget:this._element}),u=i.default.Event("show.bs.tab",{relatedTarget:n});if(n&&i.default(n).trigger(s),i.default(this._element).trigger(u),!u.isDefaultPrevented()&&!s.isDefaultPrevented()){r&&(e=document.querySelector(r)),this._activate(this._element,o);var f=function(){var e=i.default.Event("hidden.bs.tab",{relatedTarget:t._element}),o=i.default.Event("shown.bs.tab",{relatedTarget:n});i.default(n).trigger(e),i.default(t._element).trigger(o)};e?this._activate(e,e.parentNode,f):f()}}},e.dispose=function(){i.default.removeData(this._element,"bs.tab"),this._element=null},e._activate=function(t,e,n){var o=this,r=(!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?i.default(e).children(".active"):i.default(e).find("> li > .active"))[0],a=n&&r&&i.default(r).hasClass("fade"),s=function(){return o._transitionComplete(t,r,n)};if(r&&a){var u=l.getTransitionDurationFromElement(r);i.default(r).removeClass("show").one(l.TRANSITION_END,s).emulateTransitionEnd(u)}else s()},e._transitionComplete=function(t,e,n){if(e){i.default(e).removeClass("active");var o=i.default(e.parentNode).find("> .dropdown-menu .active")[0];o&&i.default(o).removeClass("active"),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!1)}if(i.default(t).addClass("active"),"tab"===t.getAttribute("role")&&t.setAttribute("aria-selected",!0),l.reflow(t),t.classList.contains("fade")&&t.classList.add("show"),t.parentNode&&i.default(t.parentNode).hasClass("dropdown-menu")){var r=i.default(t).closest(".dropdown")[0];if(r){var a=[].slice.call(r.querySelectorAll(".dropdown-toggle"));i.default(a).addClass("active")}t.setAttribute("aria-expanded",!0)}n&&n()},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.tab");if(o||(o=new t(this),n.data("bs.tab",o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e]()}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.0"}}]),t}();i.default(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',(function(t){t.preventDefault(),pe._jQueryInterface.call(i.default(this),"show")})),i.default.fn.tab=pe._jQueryInterface,i.default.fn.tab.Constructor=pe,i.default.fn.tab.noConflict=function(){return i.default.fn.tab=he,pe._jQueryInterface};var me=i.default.fn.toast,ge={animation:"boolean",autohide:"boolean",delay:"number"},ve={animation:!0,autohide:!0,delay:500},_e=function(){function t(t,e){this._element=t,this._config=this._getConfig(e),this._timeout=null,this._setListeners()}var e=t.prototype;return e.show=function(){var t=this,e=i.default.Event("show.bs.toast");if(i.default(this._element).trigger(e),!e.isDefaultPrevented()){this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");var n=function(){t._element.classList.remove("showing"),t._element.classList.add("show"),i.default(t._element).trigger("shown.bs.toast"),t._config.autohide&&(t._timeout=setTimeout((function(){t.hide()}),t._config.delay))};if(this._element.classList.remove("hide"),l.reflow(this._element),this._element.classList.add("showing"),this._config.animation){var o=l.getTransitionDurationFromElement(this._element);i.default(this._element).one(l.TRANSITION_END,n).emulateTransitionEnd(o)}else n()}},e.hide=function(){if(this._element.classList.contains("show")){var t=i.default.Event("hide.bs.toast");i.default(this._element).trigger(t),t.isDefaultPrevented()||this._close()}},e.dispose=function(){this._clearTimeout(),this._element.classList.contains("show")&&this._element.classList.remove("show"),i.default(this._element).off("click.dismiss.bs.toast"),i.default.removeData(this._element,"bs.toast"),this._element=null,this._config=null},e._getConfig=function(t){return t=a({},ve,i.default(this._element).data(),"object"==typeof t&&t?t:{}),l.typeCheckConfig("toast",t,this.constructor.DefaultType),t},e._setListeners=function(){var t=this;i.default(this._element).on("click.dismiss.bs.toast",'[data-dismiss="toast"]',(function(){return t.hide()}))},e._close=function(){var t=this,e=function(){t._element.classList.add("hide"),i.default(t._element).trigger("hidden.bs.toast")};if(this._element.classList.remove("show"),this._config.animation){var n=l.getTransitionDurationFromElement(this._element);i.default(this._element).one(l.TRANSITION_END,e).emulateTransitionEnd(n)}else e()},e._clearTimeout=function(){clearTimeout(this._timeout),this._timeout=null},t._jQueryInterface=function(e){return this.each((function(){var n=i.default(this),o=n.data("bs.toast");if(o||(o=new t(this,"object"==typeof e&&e),n.data("bs.toast",o)),"string"==typeof e){if("undefined"==typeof o[e])throw new TypeError('No method named "'+e+'"');o[e](this)}}))},r(t,null,[{key:"VERSION",get:function(){return"4.6.0"}},{key:"DefaultType",get:function(){return ge}},{key:"Default",get:function(){return ve}}]),t}();i.default.fn.toast=_e._jQueryInterface,i.default.fn.toast.Constructor=_e,i.default.fn.toast.noConflict=function(){return i.default.fn.toast=me,_e._jQueryInterface},t.Alert=d,t.Button=h,t.Carousel=y,t.Collapse=S,t.Dropdown=Ft,t.Modal=qt,t.Popover=se,t.Scrollspy=ce,t.Tab=pe,t.Toast=_e,t.Tooltip=te,t.Util=l,Object.defineProperty(t,"__esModule",{value:!0})})); 7 | //# sourceMappingURL=bootstrap.bundle.min.js.map 8 | --------------------------------------------------------------------------------