1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
$(document).ready(function () {
/* Every time the window is scrolled ... */
$(window).scroll(function () {
/* Check the location of each desired element */
$('.hideme').each(function (i) {
var bottom_of_object = $(this).position().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if (bottom_of_window > bottom_of_object) {
$(this).animate({
'opacity': '1'
}, 500);
}
});
});
$('.hideme').each(function (i) {
var bottom_of_object = $(this).position().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if (bottom_of_window > bottom_of_object) {
$(this).animate({
'opacity': '1'
}, 500);
}
if (document.getElementById("heading")) {
$(document.getElementById("heading")).animate({
'opacity': '1'
}, 500);
}
if (document.getElementById("title-quotes")) {
$(document.getElementById("title-quotes")).animate({
'opacity': '1'
}, 1500);
}
// document.getElementById("heading").animate({
// 'opacity': '1'
// }, 500);
});
});
//
$.getJSON("/discord/bots/uwufier/assets/json/pun.json", function (data) {
var items = [];
let quoteNum = Math.floor(Math.random() * data.length);
document.getElementById("title-quotes").innerHTML = `
${data[quoteNum]}
`;
// $.each(data, function (key, val) {
// items.push("<li id='" + key + "'>" + val + "</li>");
// });
// $("<ul/>", {
// "class": "my-new-list",
// html: items.join("")
// }).appendTo("body");
});
fetch('https://uppity-bot.herokuapp.com/?token=1337')
.then(function (response) {
// When the page is loaded convert it to text
return response.text();
})
.then(function (html) {
// Initialize the DOM parser
var parser = new DOMParser();
// Parse the text
var doc = parser.parseFromString(html, "text/html");
// You can now even select part of that html as you would in the regular DOM
// Example:
// var docArticle = doc.querySelector('article').innerHTML;
console.log(doc.body.textContent);
if (doc.body.textContent == 'maintenance') {
document.getElementById("uwufier-status").innerHTML = `
<a class="nav-link disabled" href="#" style="color: #ff9966; opacity: 1;">
Maintenance
</a>
`;
} else if (doc.body.textContent == 'online') {
document.getElementById("uwufier-status").innerHTML = `
<a class="nav-link disabled" href="#" style="color: #99CC33; opacity: 1;">
Online
</a>
`;
} else if (doc.body.textContent == 'offline') {
document.getElementById("uwufier-status").innerHTML = `
<a class="nav-link disabled" href="#" style="color: #CC3300; opacity: 1;">
Offline
</a>
`;
} else {
document.getElementById("uwufier-status").innerHTML = `
<a class="nav-link disabled" href="#" style="color: #CC3300; opacity: 1;">
Error
</a>
`;
}
})
.catch(function (err) {
console.log('Failed to fetch page: ', err);
document.getElementById("uwufier-status").innerHTML = `
<a class="nav-link disabled" href="#" style="color: #CC3300; opacity: 1;">
Error
</a>
`;
});
|