2020-06-24 21:47:54 +02:00
|
|
|
<h1 class="title">Random Skin</h1>
|
|
|
|
<div class="columns is-mobile">
|
|
|
|
<div class="column">
|
|
|
|
<img src="" class="skin" id="flat" alt="Current Skin" style="display: none;">
|
|
|
|
<div id="mesh" style="display: inline;"></div>
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<article class="message is-warning">
|
|
|
|
<div class="message-body">
|
|
|
|
I am not responsible for any explicit content displayed when using the random skin function.
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
<div class="buttons">
|
|
|
|
<button class="button" id="random">Random</button>
|
|
|
|
<button class="button" id="set">Use this skin</button>
|
|
|
|
</div>
|
|
|
|
<div class="buttons has-addons">
|
|
|
|
<button class="button" id="download">Download</button>
|
|
|
|
<button class="button" id="save">Save</button>
|
|
|
|
</div>
|
|
|
|
<div class="buttons">
|
|
|
|
<button class="button" id="switch" style="display: none;">Switch to 2D</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="../src/skin.js"></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var parser = new DOMParser();
|
|
|
|
var randomUrls = [];
|
|
|
|
|
|
|
|
axios({
|
|
|
|
method: "GET",
|
|
|
|
url: "https://nl.namemc.com/minecraft-skins/random"
|
|
|
|
}).then((data) => {
|
|
|
|
var namemc = parser.parseFromString(data.data, "text/html");
|
|
|
|
namemc.querySelectorAll("a").forEach((e) => {
|
|
|
|
var href = e.getAttribute("href");
|
|
|
|
if (href.includes("skin")) {
|
|
|
|
var id = href.split("/")[2];
|
|
|
|
if (id && id.length == 16 && !(id.includes("-"))) {
|
|
|
|
randomUrls.push("https://nl.namemc.com/texture/" + id + ".png");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function random() {
|
|
|
|
if (randomUrls.length == 0) {
|
2020-06-25 14:21:53 +02:00
|
|
|
load("/partials/random.html");
|
2020-06-24 21:47:54 +02:00
|
|
|
} else {
|
|
|
|
var id = Math.floor(Math.random() * (randomUrls.length - 0)) + 0;
|
|
|
|
setView(randomUrls[id]);
|
|
|
|
randomUrls.splice(id, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
random();
|
|
|
|
|
|
|
|
$("button#random")[0].addEventListener("click", (e) => {
|
|
|
|
random();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|