Skip to content

Commit a74570e

Browse files
author
BuildTools
committed
Translated text from initial
1 parent b5cf594 commit a74570e

File tree

1 file changed

+33
-77
lines changed

1 file changed

+33
-77
lines changed

content-enhancer.js

Lines changed: 33 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,24 @@ Promise.all([
123123
// Verificar si los elementos existen
124124
if (rbxBody && rootElement) {
125125
// Hacer que #rbx-body se haga más pequeño y se ajuste al espacio restante
126-
rbxBody.style.marginRight = friendsPanelWidth+"px"; // Añadir espacio a la derecha
127-
rbxBody.style.width = "calc(100% - " + (friendsPanelWidth2+offsetWidth) + "px" + ")"; // Reducir el ancho para dejar espacio a la derecha
126+
rbxBody.style.marginRight = friendsPanelWidth + "px"; // Añadir espacio a la derecha
127+
rbxBody.style.width = "calc(100% - " + (friendsPanelWidth2 + offsetWidth) + "px" + ")"; // Reducir el ancho para dejar espacio a la derecha
128128
document.querySelector("#container-main > div.content").style.paddingLeft = "10px"
129129
}
130130

131131
const rbxFooter = document.querySelector("#footer-container");
132132

133133
if (rbxFooter) {
134-
rbxFooter.style.marginRight = friendsPanelWidth+"px"; // Añadir espacio a la derecha
135-
rbxFooter.style.width = "calc(100% - " + friendsPanelWidth+"px" + ")"; // Reducir el ancho para dejar espacio a la derecha
134+
rbxFooter.style.marginRight = friendsPanelWidth + "px"; // Añadir espacio a la derecha
135+
rbxFooter.style.width = "calc(100% - " + friendsPanelWidth + "px" + ")"; // Reducir el ancho para dejar espacio a la derecha
136136
}
137137

138138
// Estilos iniciales para fijar el elemento a la derecha
139139
element.style.position = "fixed";
140140
element.style.right = "0";
141141
element.style.top = "0";
142142
element.style.height = "";
143-
element.style.width = friendsPanelWidth+"px"; // Ancho del panel
143+
element.style.width = friendsPanelWidth + "px"; // Ancho del panel
144144
element.style.zIndex = "999"; // Asegura que esté por encima de otros elementos
145145
element.style.background = body.style.backgroundColor;
146146

@@ -403,61 +403,16 @@ Promise.all([
403403

404404
waitForElm('#root > div > div > div > div > div > div > div.listContentContainer').then((elm) => {
405405

406-
407-
// Añade el HTML personalizado al elemento encontrado
406+
// Add custom HTML to the found element
408407
elm.insertAdjacentHTML('beforeend', MyCustomInnerHTML);
409-
elm.style.backgroundColor = body.style.backgroundColor
410-
// Función para exportar datos
411-
function exportData(format) {
412-
const data = localStorage.getItem("LastOnlineBetterFriendList");
413-
414-
if (!data) {
415-
alert("No hay datos para exportar.");
416-
return;
417-
}
408+
elm.style.backgroundColor = body.style.backgroundColor;
418409

419-
if (format === "json") {
420-
const blob = new Blob([data], { type: "application/json" });
421-
const url = URL.createObjectURL(blob);
422-
const a = document.createElement("a");
423-
a.href = url;
424-
a.download = "LastOnlineBetterFriendList.json";
425-
a.click();
426-
URL.revokeObjectURL(url);
427-
} else if (format === "text") {
428-
// Codificar los datos en Base64
429-
const encodedData = btoa(unescape(encodeURIComponent(data)));
430-
// Copiar al portapapeles
431-
navigator.clipboard.writeText(encodedData)
432-
.then(() => {
433-
alert("Datos codificados copiados al portapapeles.");
434-
})
435-
.catch((error) => {
436-
alert("Error al copiar al portapapeles: " + error.message);
437-
});
438-
}
439-
}
440-
441-
// Función para combinar datos existentes con nuevos datos
442-
function mergeData(existingData, newData) {
443-
const existing = JSON.parse(existingData || "{}");
444-
const newEntries = JSON.parse(newData);
445-
446-
for (const [friend, timestamp] of Object.entries(newEntries)) {
447-
if (!existing[friend] || existing[friend] < timestamp) {
448-
existing[friend] = timestamp; // Actualiza solo si el amigo no existe o el timestamp es más reciente
449-
}
450-
}
451-
452-
return JSON.stringify(existing, null, 2); // Devuelve el JSON formateado
453-
}
454-
455-
// Función para exportar datos
410+
// Function to export data
456411
function exportData(format) {
457412
const data = localStorage.getItem("LastOnlineBetterFriendList");
458413

459414
if (!data) {
460-
alert("No hay datos para exportar.");
415+
alert("No data to export.");
461416
return;
462417
}
463418

@@ -470,34 +425,34 @@ Promise.all([
470425
a.click();
471426
URL.revokeObjectURL(url);
472427
} else if (format === "text") {
473-
// Codificar los datos en Base64
428+
// Encode data in Base64
474429
const encodedData = btoa(unescape(encodeURIComponent(data)));
475-
// Copiar al portapapeles
430+
// Copy to clipboard
476431
navigator.clipboard.writeText(encodedData)
477432
.then(() => {
478-
alert("Datos codificados copiados al portapapeles.");
433+
alert("Encoded data copied to clipboard.");
479434
})
480435
.catch((error) => {
481-
alert("Error al copiar al portapapeles: " + error.message);
436+
alert("Error copying to clipboard: " + error.message);
482437
});
483438
}
484439
}
485440

486-
// Función para combinar datos existentes con nuevos datos
441+
// Function to merge existing data with new data
487442
function mergeData(existingData, newData) {
488443
const existing = JSON.parse(existingData || "{}");
489444
const newEntries = JSON.parse(newData);
490445

491446
for (const [friend, timestamp] of Object.entries(newEntries)) {
492447
if (!existing[friend] || existing[friend] < timestamp) {
493-
existing[friend] = timestamp; // Actualiza solo si el amigo no existe o el timestamp es más reciente
448+
existing[friend] = timestamp; // Only update if the friend doesn't exist or the timestamp is newer
494449
}
495450
}
496451

497-
return JSON.stringify(existing, null, 2); // Devuelve el JSON formateado
452+
return JSON.stringify(existing, null, 2); // Return formatted JSON
498453
}
499454

500-
// Función para importar datos desde un archivo
455+
// Function to import data from a file
501456
function importDataFromFile(file) {
502457
const reader = new FileReader();
503458
reader.onload = function (e) {
@@ -507,45 +462,45 @@ Promise.all([
507462
const mergedData = mergeData(existingData, newData);
508463

509464
localStorage.setItem("LastOnlineBetterFriendList", mergedData);
510-
alert("Datos importados y combinados correctamente.");
465+
alert("Data imported and merged successfully.");
511466
} catch (error) {
512-
alert("Error al importar los datos. Asegúrate de que el archivo es válido.");
467+
alert("Error importing data. Ensure the file is valid.");
513468
}
514469
};
515470
reader.readAsText(file);
516471
}
517472

518-
// Función para importar datos desde texto pegado
473+
// Function to import data from pasted text
519474
function importDataFromText(text) {
520475
try {
521-
// Decodificar los datos desde Base64
476+
// Decode data from Base64
522477
const decodedData = decodeURIComponent(escape(atob(text)));
523478
const existingData = localStorage.getItem("LastOnlineBetterFriendList");
524479
const mergedData = mergeData(existingData, decodedData);
525480

526481
localStorage.setItem("LastOnlineBetterFriendList", mergedData);
527-
alert("Datos importados y combinados correctamente.");
482+
alert("Data imported and merged successfully.");
528483
} catch (error) {
529-
alert("Error al importar los datos. Asegúrate de que el texto es válido.");
484+
alert("Error importing data. Ensure the text is valid.");
530485
}
531486
}
532487

533-
// Menú de opciones para exportar
488+
// Options menu to export
534489
document.getElementById("BetterFriendListExport").addEventListener("click", () => {
535-
const option = prompt("Selecciona el formato de exportación:\n\n1. JSON (Archivo)\n2. Texto\n\nEscribe 1 o 2:");
490+
const option = prompt("Select the export format:\n\n1. JSON (File)\n2. Text\n\nEnter 1 or 2:");
536491

537492
if (option === "1") {
538-
exportData("json"); // Exportar como JSON
493+
exportData("json"); // Export as JSON
539494
} else if (option === "2") {
540-
exportData("text"); // Exportar como texto (Base64)
495+
exportData("text"); // Export as text (Base64)
541496
} else {
542-
alert("Opción no válida. Debes escribir 1 o 2.");
497+
alert("Invalid option. You must enter 1 or 2.");
543498
}
544499
});
545500

546-
// Menú de opciones para importar
501+
// Options menu to import
547502
document.getElementById("BetterFriendListAdd").addEventListener("click", () => {
548-
const option = prompt("Selecciona el método de importación:\n\n1. Desde archivo\n2. Pegar texto\n\nEscribe 1 o 2:");
503+
const option = prompt("Select the import method:\n\n1. From file\n2. Paste text\n\nEnter 1 or 2:");
549504

550505
if (option === "1") {
551506
const input = document.createElement("input");
@@ -559,13 +514,14 @@ Promise.all([
559514
};
560515
input.click();
561516
} else if (option === "2") {
562-
const text = prompt("Pega aquí los datos codificados:");
517+
const text = prompt("Paste the encoded data here:");
563518
if (text) {
564519
importDataFromText(text);
565520
}
566521
} else {
567-
alert("Opción no válida. Debes escribir 1 o 2.");
522+
alert("Invalid option. You must enter 1 or 2.");
568523
}
524+
569525
});
570526
}, 1000);
571527
});

0 commit comments

Comments
 (0)