Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CXTST
## v4.1

* New rounding option added
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<head>

<!-- Typicals -->
<!-- Typicals CX -->

<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down
39 changes: 8 additions & 31 deletions js/api-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function getExchangeRate() {

// Check if coin is a privacy coin - if not, chop head off

checkIfPrivacyCoin(processedData.coinId, processedData.coinSymbol);
updatePrivacyCoinIndicator(processedData.coinSymbol, processedData.isPrivacyCoin);

// Dispatch custom event instead of relying on localStorage polling

Expand Down Expand Up @@ -128,7 +128,7 @@ function getExchangeRate() {

function extractCoinData(data) {
try {
const { id, symbol, image, links, market_cap_rank, market_data } = data;
const { id, symbol, image, links, market_cap_rank, market_data, categories = [] } = data;

return {
coinId: id,
Expand All @@ -144,7 +144,8 @@ function extractCoinData(data) {
coinSymbol: symbol.toUpperCase(),
coinRank: Number.isFinite(market_cap_rank) ? `#${market_cap_rank}` : "",
coinThumb: image.thumb,
coinURL: links.homepage[0]
coinURL: links.homepage[0],
isPrivacyCoin: categories.includes('Privacy Coins')
};
} catch (error) {
console.error("Error extracting coin data:", error);
Expand Down Expand Up @@ -231,33 +232,9 @@ function logCoinData(coinData) {

const cachedPrivacyElement = (() => document.getElementById("isPrivacyCoin"))();

async function checkIfPrivacyCoin(coinId, coinSymbol) {
try {
const url = `${API_CONFIG.BASE_URL}/coins/${coinId}?x_cg_demo_api_key=${API_CONFIG.API_KEY}`;
const response = await fetch(url);

if (!response.ok) {
throw new Error(`Failed to fetch coin data for: ${coinId}`);
}

const coinData = await response.json();
const categories = coinData.categories || [];
const isPrivacy = categories.includes('Privacy Coins');

// Log to console (not Xbox)

console.log(`${coinSymbol} - is privacy coin: ${isPrivacy}`);

// Update HTML element

cachedPrivacyElement && (cachedPrivacyElement.style.display = isPrivacy ? "block" : "none");

return isPrivacy;
} catch (error) {
console.error("Error checking privacy coin status:", error);
cachedPrivacyElement && (cachedPrivacyElement.style.display = "none");
return false;
}
function updatePrivacyCoinIndicator(coinSymbol, isPrivacyCoin) {
console.log(`${coinSymbol} - is privacy coin: ${isPrivacyCoin}`);
cachedPrivacyElement && (cachedPrivacyElement.style.display = isPrivacyCoin ? "block" : "none");
}

// Create a predictive search
Expand Down Expand Up @@ -449,4 +426,4 @@ async function loadCoinsList() {

// Export for use in other modules

window.getExchangeRate = getExchangeRate;
window.getExchangeRate = getExchangeRate;
32 changes: 27 additions & 5 deletions js/object-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ let mouseDown = false,
let dragSpeedX = 0,
dragSpeedY = 0;
let ambientLight, pointLight;
let cachedEnvMap;

// Cube rotation mappings for navigation buttons

Expand Down Expand Up @@ -303,7 +304,7 @@ function getUserLevel(id, fallback = 0) {
return Math.min(10, Math.max(0, v));
}

function createCubeGeometry(size, detail) {
function createCubeGeometry(size) {
const roundLevel = getUserLevel("rNumber", 0);
const smoothLevel = getUserLevel(
"smoothnessLevel",
Expand Down Expand Up @@ -334,10 +335,14 @@ function createCubeGeometry(size, detail) {
// Function to load a HDRI image and create an environment map non GPS

function createEnvironmentMap() {
if (cachedEnvMap) {
return cachedEnvMap;
}

const textureLoader = new THREE.TextureLoader();
const envMap = textureLoader.load("img/pc-reflection-2.jpg");
envMap.mapping = THREE.EquirectangularReflectionMapping;
return envMap;
cachedEnvMap = textureLoader.load("img/pc-reflection-2.jpg");
cachedEnvMap.mapping = THREE.EquirectangularReflectionMapping;
return cachedEnvMap;
}

// Shoving these material settings on to the 3D object
Expand Down Expand Up @@ -675,6 +680,21 @@ function renderTextWithoutTitle(

// Update these please

function disposeCube(targetCube) {
if (!targetCube) return;

targetCube.geometry?.dispose();

const materials = Array.isArray(targetCube.material)
? targetCube.material
: [targetCube.material];

materials.forEach((material) => {
material?.map?.dispose();
material?.dispose?.();
});
}

function refreshCube() {
if (!cube) {
createCube();
Expand All @@ -692,8 +712,10 @@ function refreshCube() {

// Remove the old cube and create a new one, because it's fun and trending to be new

scene.remove(cube);
const oldCube = cube;
scene.remove(oldCube);
createCube();
disposeCube(oldCube);

// Apply the saved rotation to the new cool cube

Expand Down
14 changes: 3 additions & 11 deletions js/ui-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function initializeUI() {
setupPlayPauseToggle();
setupURLManagement();
setupThemeControls();
setupMusicMuteToggle();
setupClipboardCopy();
setupPanelDragging();
setupBackgroundObserver();
Expand Down Expand Up @@ -176,20 +177,12 @@ function setupGetStatsButton() {
const currentCoin = document.getElementById("coin")?.value;
if (!currentCoin) return;

const exchangeRate = await window.getExchangeRate(currentCoin);
console.log(`Exchange Rate for ${currentCoin}: ${exchangeRate}`);
await window.getExchangeRate();
console.log(`Exchange Rate updated for ${currentCoin}`);

updateURLParam("coin", currentCoin);

if (window.coinSymbol) {
await window.getExchangeRate(window.coinSymbol);
console.log(`Button Press - Coin Symbol: ${window.coinSymbol}`);

updateURLParam("msg", window.coinSymbol);
const textInput = document.getElementById("textInput");
if (textInput) {
textInput.value = window.coinSymbol;
}
}
} catch (error) {
console.error("Error occurred:", error);
Expand Down Expand Up @@ -268,7 +261,6 @@ function setupMusicMuteToggle() {
});
}

setupMusicMuteToggle();
function setupThemeButtons() {
const goldButton = document.getElementById("goldTheme");
const blackButton = document.getElementById("blackTheme");
Expand Down