Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0b046f1
I think that was useless. If I'm wrong, I'm wrong.
DespicableGoose Apr 1, 2022
5994c53
It does break :/
DespicableGoose Apr 4, 2022
1c96ca5
Add files via upload
DespicableGoose Apr 4, 2022
c826026
Update index.html
DespicableGoose Apr 7, 2022
7f1aeb3
Update index.html
DespicableGoose Apr 7, 2022
50c1b3b
Update index.html
DespicableGoose Apr 7, 2022
104c8ec
Update index.html
DespicableGoose Apr 7, 2022
eb8edbe
Update index.html
DespicableGoose Apr 7, 2022
fdf6a71
Update calculate.js
DespicableGoose Apr 7, 2022
0dbfd57
Update calculate.js
DespicableGoose Apr 7, 2022
d6f9481
Update calculate.js
DespicableGoose Apr 7, 2022
f35bf37
Update calculate.js
DespicableGoose Apr 7, 2022
a665571
Update calculate.js
DespicableGoose Apr 7, 2022
b76cc58
Update calculate.js
DespicableGoose Apr 7, 2022
b6a865c
Update calculate.js
DespicableGoose Apr 7, 2022
933e073
Update calculate.js
DespicableGoose Apr 7, 2022
b8895c9
Damn it... How did I miss that?
DespicableGoose Apr 7, 2022
374efa9
Attempt #2
DespicableGoose Apr 7, 2022
cc72f96
Update calculate.js
DespicableGoose Apr 7, 2022
1ff0ae2
Attempting to fix crashes
DespicableGoose Apr 7, 2022
b4b4009
It didn't work, idk how to fix the issue.
DespicableGoose Apr 7, 2022
7ef9b85
Update calculate.js
DespicableGoose Apr 7, 2022
99d4067
Update calculate.js
DespicableGoose May 7, 2022
cd2741a
Update calculate.js
DespicableGoose May 7, 2022
fef2a3b
This should fix a serious bug.
DespicableGoose May 7, 2022
559b318
This should fix the issue
DespicableGoose May 7, 2022
767075b
Except if I forget a comma...
DespicableGoose May 7, 2022
88335f7
I believe I've finally fixed the issue!
DespicableGoose May 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 51 additions & 33 deletions auctions-viewer/calculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ function display_results(results) {
}
}

function better_stringify(item) {
let keys = Object.keys(item);
var stringified = "{"
var key;
for(var i = 0; i < keys.length - 1; i++){
key = keys[i]
stringified += "\"" + key + "\"" + ":" + JSON.stringify(item[key]) + ",";
}
stringified += "\"" + keys[keys.length - 1] + "\"" + ":" + JSON.stringify(item[keys[keys.length - 1]]) + "}";
return stringified;
}

function draw_inventory() {
let results_amount= window.items.length;
if (results_amount % 9 != 0) {
Expand All @@ -125,7 +137,7 @@ function draw_inventory() {
document.getElementById('inventoryview').innerHTML = document.getElementById('inventoryview').innerHTML + '<div class="inventoryslot"></div>';
}
for (let i = window.index; i < Math.min((window.items.length - window.index), 54 + window.index); i++) {
let command = "write_slot(" + JSON.stringify(convertNbtToJson(window.items[i]['item_bytes'])[0]) + ")";
let command = "write_slot(" + better_stringify(convertNbtToJson(window.items[i]['item_bytes'])[0]) + ")";
document.getElementsByClassName("inventoryslot")[i].setAttribute("onmouseover", command);
document.getElementsByClassName("inventoryslot")[i].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';");
document.getElementsByClassName("inventoryslot")[i].innerHTML = draw_slot(convertNbtToJson(window.items[i]['item_bytes'])[0]);
Expand All @@ -134,38 +146,43 @@ function draw_inventory() {


function write_slot(slot) {
if (slot.tag) {
let display = "";
let line = "";
let stylecodes = {
"§0": "color: #000000",
"§1": "color: #0000aa",
"§2": "color: #00aa00",
"§3": "color: #00aaaa",
"§4": "color: #aa0000",
"§5": "color: #aa00aa",
"§6": "color: #ffaa00",
"§7": "color: #aaaaaa",
"§8": "color: #555555",
"§9": "color: #5555ff",
"§a": "color: #55ff55",
"§b": "color: #55ffff",
"§c": "color: #ff5555",
"§d": "color: #ff55ff",
"§e": "color: #ffff55",
"§f": "color: #ffffff",
"§l": "font-weight:bold"
}
display = display + format_line(slot.tag.display.Name, stylecodes);
display = display + format_line("", stylecodes);
for (let i = 0; i < slot.tag.display.Lore.length; i++) {
display = display + format_line(slot.tag.display.Lore[i], stylecodes);
}
document.getElementById("itemview").innerHTML = display;
}
if (slot.tag) {
let display = "";
let line = "";
let stylecodes = {
"§0": "color: #000000",
"§1": "color: #0000aa",
"§2": "color: #00aa00",
"§3": "color: #00aaaa",
"§4": "color: #aa0000",
"§5": "color: #aa00aa",
"§6": "color: #ffaa00",
"§7": "color: #aaaaaa",
"§8": "color: #555555",
"§9": "color: #5555ff",
"§a": "color: #55ff55",
"§b": "color: #55ffff",
"§c": "color: #ff5555",
"§d": "color: #ff55ff",
"§e": "color: #ffff55",
"§f": "color: #ffffff",
"§l": "font-weight:bold",
"§m": "text-decoration: line-through",
"§n": "text-decoration: underline",
"§o": "font-style: italic;",
}
display = display + format_line(slot.tag.display.Name, stylecodes);
display = display + format_line("", stylecodes);
for (let i = 0; i < slot.tag.display.Lore.length; i++) {
display = display + format_line(slot.tag.display.Lore[i], stylecodes);
}
document.getElementById("itemview").innerHTML = display;
}
}

function format_line(line, stylecodes) {
line = line.replaceAll('§k','');
line = line.replaceAll('§r','');
let display_line = "<span class=\"loreline\">";
let where = line.search("§");
let style;
Expand All @@ -183,13 +200,13 @@ function format_line(line, stylecodes) {
}
y = y + 1;
}

if (close == true) {
display_line = display_line + line.slice(0, where) + "</span>";
} else {
close = true;
}
let styles_string = "";
for (const property in styles) {
styles_string = styles_string + stylecodes[`${property}`] + "; ";
Expand All @@ -199,11 +216,12 @@ function format_line(line, stylecodes) {
} else {
display_line = display_line + "<span>"
}

line = line.slice(where + (2*(y-1)));
where = line.search("§");
lineadd = true;
}

if (lineadd == true) {
display_line = display_line + line + "</span>";
}
Expand Down
3 changes: 2 additions & 1 deletion auctions-viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
.selection button:hover {
background-color: #ccc;
}
</style>
</style>
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
</head>
<script src="nbt.js"></script>
<script src="calculate.js"></script>
Expand Down
Binary file added favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
background-color: #ccc;
}
</style>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<div class="header">
Expand Down
3 changes: 2 additions & 1 deletion profile-viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
text-shadow: 0.1em 0.1em 0.1em black;
font-weight: 600;
}
</style>
</style>
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
</head>
<body onload="getURL()">
<script src="nbt.js"></script>
Expand Down