-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
175 lines (170 loc) · 7.08 KB
/
Copy pathindex.html
File metadata and controls
175 lines (170 loc) · 7.08 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LT2 Private Servers</title>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta property="og:title" content="Free LT2 Private Servers">
<meta property="og:description" content="Constantly updating list of free private servers for Lumber Tycoon 2! Made by @not_py.">
<meta property="og:image" content="https://raw.githubusercontent.com/not-python/LT2-VIPs/main/embed.png">
<meta property="og:url" content="https://not-python.github.io/LT2-VIPs/">
<meta property="og:type" content="website">
<meta name="theme-color" content="#eb17d4">
<meta name="twitter:card" content="summary_large_image">
<style>
body {
font-family: Arial;
background: #121212;
color: #eee;
padding: 2rem;
min-width: 500px;
max-width: 80%;
margin: 0 auto;
text-align: center;
}
a {
color: #4ea1ff;
text-decoration: none;
}
a:hover {
color: #7fbaff;
text-decoration: underline;
}
.code_display {
font-size: 1.2rem;
}
.link_item {
margin-bottom: 1.2rem;
padding: 1rem;
background: #1e1e1e;
border-radius: 8px;
}
.item_details {
color: #aaa;
font-size: 1rem;
margin-top: .3rem;
display: block;
text-align: center;
}
.header_text {
font-size: 1.3rem;
margin-bottom: 1.5rem;
color: #ccc;
text-align: center;
}
.info_box {
background: #1a1a1a;
padding: 1.2rem;
border-radius: 8px;
margin-bottom: 2rem;
}
.info_title {
font-size: 1.1rem;
font-weight: bold;
margin-bottom: 0.5rem;
color: #fff;
}
.info_description {
color: #ccc;
margin-bottom: 0.8rem;
font-size: 0.95rem;
line-height: 1.4;
}
.info_credits {
color: #aaa;
font-size: 1rem;
}
</style>
</head>
<body>
<div class="info_box">
<div class="info_title">How to Use</div>
<div class="info_description">
Click any hyperlink below to join that private server. Links update automatically every few minutes, if one is invalid try another.<br>
Please contact my discord below with any questions or requests. Feel free to ⭐ at the main page below if you found this helpful.<br>
<b>These servers are owned by the community, please stay respectful.</b>
</div>
<div class="info_credits">
Created and maintained by @not_py ·
<a href="https://github.com/not-python/LT2-VIPs" target="_blank">View main page</a>
</div>
</div>
<div class="info_box">
<div class="info_title">Statistics</div>
<div class="info_description" id="total_links">
Loading...
</div>
</div>
<div id="link_list"></div>
<script>
function get_time_ago(timestamp) {
let seconds_now = Math.floor(Date.now() / 1000)
let seconds_diff = seconds_now - timestamp
if (seconds_diff < 60) return 'just now'
if (seconds_diff < 3600) {
let minutes = Math.floor(seconds_diff / 60)
return "<b>" + minutes + "</b> minute" + (minutes > 1 ? "s" : "") + " ago"
}
if (seconds_diff < 86400) {
let hours = Math.floor(seconds_diff / 3600)
return "<b>" + hours + "</b> hour" + (hours > 1 ? "s" : "") + " ago"
}
if (seconds_diff < 2592000) {
let days = Math.floor(seconds_diff / 86400)
return "<b>" + days + "</b> day" + (days > 1 ? "s" : "") + " ago"
}
if (seconds_diff < 31536000) {
let months = Math.floor(seconds_diff / 2592000)
return "<b>" + months + "</b> month" + (months > 1 ? "s" : "") + " ago"
}
let years = Math.floor(seconds_diff / 31536000)
return "<b>" + years + "</b> year" + (years > 1 ? "s" : "") + " ago"
}
fetch("https://gist.githubusercontent.com/not-python/740ff0bd751febc3ad1bf8399f411435/raw/links.json")
.then(response => response.json())
.then(link_data => {
let container = document.getElementById("link_list")
let header = document.getElementById("total_links")
function update_header() {
let now = Math.floor(Date.now() / 1000)
let past_3_hour = link_data.filter(item => now - item.timestamp <= 10800).length
header.innerHTML =
"We have found a total of <b>" + link_data.length + "</b> links, <b>" + past_3_hour + "</b> were added in the past three hours.<br>More information coming soon."
}
link_data.sort((a, b) => b.timestamp - a.timestamp)
let now = Math.floor(Date.now() / 1000)
link_data_24 = link_data.filter(item => now - item.timestamp <= 172800)
update_header()
link_data_24.forEach(item => {
let div = document.createElement("div")
div.className = "link_item"
let code_match = item.url.match(/code=([a-f0-9]{32})|privateServerLinkCode=(\d+)/i)
let display_code = code_match ? (code_match[1] || code_match[2]) : "0"
let seen_count = item.seen || 1
let source = item.source || "Coming Soon"
div.innerHTML = `
<a href="${item.url}" target="_blank"><span class="code_display">Server ${display_code}</span></a>
<span class="item_details">Found ${get_time_ago(item.timestamp)} · Seen <b>${seen_count}</b> ${seen_count > 1 ? "times" : "time"} · From <b>${source}</b></span>
`
container.appendChild(div)
})
setInterval(() => {
let all_items = document.querySelectorAll(".link_item")
link_data_24.forEach((item, index) => {
if (all_items[index]) {
let seen_count = item.seen || 1
let source = item.source || "Coming Soon"
all_items[index].querySelector(".item_details").innerHTML = `Found ${get_time_ago(item.timestamp)} · Seen <b>${seen_count}</b> ${seen_count > 1 ? "times" : "time"} · From <b>${source}</b>`
}
})
update_header()
}, 60000)
})
.catch(() => {
document.getElementById("link_list").innerHTML = '<p style="color: #ff6b6b">Error loading links</p>'
})
</script>
</body>
</html>