<div id="result" class="result-container text-light mt-3"></div>
</div>
<div id="appContent">
<button class="btn btn-secondary" onclick="closeApp()">Close</button>
<iframe id="appIframe" style="width: 100%; height: 90%; border: none;"></iframe>
</div>
<a-scene>
<a-camera position="0 1.6 0">
<a-cursor></a-cursor>
</a-camera>
</a-scene>
<script>
let appIds = [];
function processBatchURL() {
const inputElement = document.getElementById('urlInput');
const urls = inputElement.value.trim().split('\n');
const ids = urls.map(url => url.replace('https://www.literallyanything.io/app/', '').trim());
ids.forEach(id => {
if (id && !appIds.includes(id)) {
createCrystal(id);
appIds.push(id);
}
});
appIds.sort();
inputElement.value = appIds.join('\n'); // Update input with sorted and unique IDs
}
function createCrystal(appId) {
const crystal = document.createElement('a-entity');
const x = (Math.random() - 0.5) * 10;
const y = (Math.random() - 0.5) * 5 + 1.6;
const z = (Math.random() - 0.5) * 10 - 5;
crystal.setAttribute('geometry', 'primitive: dodecahedron; radius: 0.3');
crystal.setAttribute('material', `color: #${Math.floor(Math.random()*16777215).toString(16)}; opacity: 0.8`);
crystal.setAttribute('position', `${x} ${y} ${z}`);
crystal.setAttribute('animation', 'property: rotation; to: 0 360 0; loop: true; dur: 3000');
crystal.setAttribute('app-id', appId);
crystal.addEventListener('click', () => {
openApp(appId);
crystal.parentNode.removeChild(crystal); // Remove crystal after click
});
const deleteButton = document.createElement('button');
deleteButton.innerText = 'X';
deleteButton.style.position = 'absolute';
deleteButton.style.left = `${x * 10 + 50}%`;
deleteButton.style.top = `${y * 10 + 50}%`;
deleteButton.style.transform = 'translate(-50%, -50%)';
deleteButton.style.zIndex = 1001;
deleteButton.style.background = 'red';
deleteButton.style.color = 'white';
deleteButton.style.border = 'none';
deleteButton.style.borderRadius = '50%';
deleteButton.style.padding = '5px';
deleteButton.style.cursor = 'pointer';
deleteButton.addEventListener('click', (e) => {
e.stopPropagation(); // Prevent crystal click event
deleteAppId(appId, crystal, deleteButton);
});
document.querySelector('a-scene').appendChild(crystal);
document.body.appendChild(deleteButton);
}
function deleteAppId(appId, crystal, deleteButton) {
appIds = appIds.filter(id => id !== appId);
crystal.parentNode.removeChild(crystal);
deleteButton.parentNode.removeChild(deleteButton);
document.getElementById('urlInput').value = appIds.join('\n'); // Update input field
}
function openApp(appId) {
const appIframe = document.getElementById('appIframe');
const appContent = document.getElementById('appContent');
appIframe.src = `https://www.literallyanything.io/iterate?id=${appId}`;
appContent.style.display = 'block';
}
function closeApp() {
const appContent = document.getElementById('appContent');
appContent.style.display = 'none';
}
function exportAndClear() {
const content = appIds.join('\n');
const blob = new Blob([content], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'app_ids.txt';
a.click();
URL.revokeObjectURL(url);
// Clear existing app IDs
appIds = [];
document.querySelector('a-scene').innerHTML = ''; // Remove all crystals
document.getElementById('urlInput').value = ''; // Clear the input field
}
</script>
Shared snapshot