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
58 changes: 45 additions & 13 deletions static/gui/app-store/002b.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,28 @@
<div id="apps-container" class="apps-container app-store-grid"></div>

<script>
function toggleAppInstallation(appId) {
if (appId === '999-999') return;
const appInstalled = localStorage.getItem(appId) === 'added';
localStorage.setItem(appId, appInstalled ? '' : 'added' );
// Removed updateHomeScreen() call here, as window.addEventListener('storage') will handle it
function isAddIconProtected() {
return /app-store\/006/i.test(window.location.pathname);
}

function toggleAppInstallation(appId, shouldBeInstalled) {
const isAddIcon = appId === '999-999';
const addIconProtected = isAddIcon && isAddIconProtected();
if (addIconProtected) {
const checkbox = document.getElementById(appId);
if (checkbox) {
checkbox.checked = true;
}
return;
}

if (shouldBeInstalled) {
localStorage.setItem(appId, 'added');
} else if (isAddIcon) {
localStorage.setItem(appId, 'removed');
} else {
localStorage.removeItem(appId);
}
}

function getAppLink(appId) {
Expand Down Expand Up @@ -76,25 +93,40 @@
const appIds = ['002-001', '002-002', '999-999']; // Using class-based IDs
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
const storedValue = localStorage.getItem(appId);
const appElement = document.createElement('a');
const isPlaceholder = appId === '999-999';
const addIconProtected = isPlaceholder && isAddIconProtected();
const shouldBeChecked = isPlaceholder
? (addIconProtected || storedValue !== 'removed')
: appInstalled;
const shouldRender = appInstalled || isPlaceholder;
if (!shouldRender) {
return;
}
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.className = `app-card-link${isPlaceholder ? ' app-card-link--inactive' : ''}`;
const linkClasses = ['app-card-link'];
if (isPlaceholder && addIconProtected) {
linkClasses.push('app-card-link--inactive');
}
appElement.className = linkClasses.join(' ');
appElement.dataset.appId = appId;
appElement.draggable = true;
appElement.style.cursor = isPlaceholder ? 'default' : 'pointer';
if (isPlaceholder) {
appElement.style.cursor = isPlaceholder && addIconProtected ? 'default' : 'pointer';
if (addIconProtected) {
appElement.setAttribute('aria-disabled', 'true');
} else {
appElement.removeAttribute('aria-disabled');
}

const toggleAttributes = [];
if (appInstalled || isPlaceholder) {
if (shouldBeChecked) {
toggleAttributes.push('checked');
}
if (isPlaceholder) {
if (addIconProtected) {
toggleAttributes.push('disabled');
}
const cardClasses = `app-card${isPlaceholder ? ' app-card--disabled' : ''}`;
const cardClasses = `app-card${isPlaceholder && addIconProtected ? ' app-card--disabled' : ''}`;
const altText = isPlaceholder ? 'Add new app' : `Hβnβ entertainment app icon ${appId}`;

appElement.innerHTML = `
Expand All @@ -115,8 +147,8 @@
// Re-attach click listeners to newly created checkboxes
const checkboxes = document.querySelectorAll('.app-checkbox');
checkboxes.forEach(checkbox => {
checkbox.addEventListener('click', function() {
toggleAppInstallation(this.id);
checkbox.addEventListener('change', function() {
toggleAppInstallation(this.id, this.checked);
});
});
}
Expand Down
30 changes: 25 additions & 5 deletions static/gui/app-store/js/app-toggle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(function () {
function isAddIconProtected() {
return /app-store\/006/i.test(window.location.pathname);
}

function syncCheckboxState(card) {
const appId = card.dataset.appId;
const checkbox = card.querySelector('.app-checkbox');
Expand All @@ -7,24 +11,40 @@
}

const storedValue = localStorage.getItem(appId);
const isInstalled = storedValue === 'added' || (appId === '999-999' && storedValue !== 'removed');
const addIconProtected = appId === '999-999' && isAddIconProtected();

let isInstalled = storedValue === 'added';
if (appId === '999-999') {
if (addIconProtected) {
isInstalled = true;
} else {
isInstalled = storedValue !== 'removed';
}
}

checkbox.checked = appId === '999-999' ? true : isInstalled;
checkbox.checked = isInstalled;

if (appId === '999-999') {
checkbox.setAttribute('disabled', 'disabled');
card.classList.add('app-card--disabled');
if (addIconProtected) {
checkbox.setAttribute('disabled', 'disabled');
} else {
checkbox.removeAttribute('disabled');
}
card.classList.toggle('app-card--disabled', addIconProtected);
}
}

function toggleAppInstallation(appId, checkbox) {
if (appId === '999-999') {
const addIconProtected = appId === '999-999' && isAddIconProtected();
if (addIconProtected) {
checkbox.checked = true;
return;
}

if (checkbox.checked) {
localStorage.setItem(appId, 'added');
} else if (appId === '999-999') {
localStorage.setItem(appId, 'removed');
} else {
localStorage.removeItem(appId);
}
Expand Down
9 changes: 8 additions & 1 deletion static/gui/dashboard/002-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,20 @@

<script>

function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
const appIds = ['002-001', '002-002', '999-999']; // Using class-based IDs
const addIconProtected = isAddIconProtected();
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
if (appInstalled || appId === '999-999') {
const storedValue = localStorage.getItem(appId);
const shouldDisplay = appInstalled || (appId === '999-999' && (addIconProtected || storedValue !== 'removed'));
if (shouldDisplay) {
const appElement = document.createElement('a');
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.style.cursor = 'pointer';
Expand Down
9 changes: 8 additions & 1 deletion static/gui/dashboard/002.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,20 @@

<script>

function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
const appIds = ['002-001', '002-002', '999-999']; // Using class-based IDs
const addIconProtected = isAddIconProtected();
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
if (appInstalled || appId === '999-999') {
const storedValue = localStorage.getItem(appId);
const shouldDisplay = appInstalled || (appId === '999-999' && (addIconProtected || storedValue !== 'removed'));
if (shouldDisplay) {
const appElement = document.createElement('a');
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.style.cursor = 'pointer';
Expand Down
9 changes: 8 additions & 1 deletion static/gui/dashboard/003.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,20 @@


<script>
function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
const appIds = ['003-001', '999-999']; // Using class-based IDs
const addIconProtected = isAddIconProtected();
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
if (appInstalled || appId === '999-999') {
const storedValue = localStorage.getItem(appId);
const shouldDisplay = appInstalled || (appId === '999-999' && (addIconProtected || storedValue !== 'removed'));
if (shouldDisplay) {
const appElement = document.createElement('a');
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.style.cursor = 'pointer';
Expand Down
9 changes: 8 additions & 1 deletion static/gui/dashboard/004.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,20 @@

<script>

function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
const appIds = ['004-001', '004-002', '004-003', '004-004', '999-999']; // Using class-based IDs
const addIconProtected = isAddIconProtected();
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
if (appInstalled || appId === '999-999') {
const storedValue = localStorage.getItem(appId);
const shouldDisplay = appInstalled || (appId === '999-999' && (addIconProtected || storedValue !== 'removed'));
if (shouldDisplay) {
const appElement = document.createElement('a');
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.style.cursor = 'pointer';
Expand Down
11 changes: 9 additions & 2 deletions static/gui/dashboard/005.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@
<script src="media/js/main.js"></script>

<script>
function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
Expand All @@ -162,8 +166,11 @@
}
});

// Add the 'Add+' icon last
appsToDisplay.push('999-999');
// Add the 'Add+' icon last when allowed
const addIconState = localStorage.getItem('999-999');
if (isAddIconProtected() || addIconState !== 'removed') {
appsToDisplay.push('999-999');
}

appsToDisplay.forEach(appId => {
const appElement = document.createElement('a');
Expand Down
9 changes: 8 additions & 1 deletion static/gui/dashboard/006-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,20 @@

<script>

function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
const appIds = ['002-001', '002-002', '999-999']; // Using class-based IDs
const addIconProtected = isAddIconProtected();
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
if (appInstalled || appId === '999-999') {
const storedValue = localStorage.getItem(appId);
const shouldDisplay = appInstalled || (appId === '999-999' && (addIconProtected || storedValue !== 'removed'));
if (shouldDisplay) {
const appElement = document.createElement('a');
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.style.cursor = 'pointer';
Expand Down
9 changes: 8 additions & 1 deletion static/gui/dashboard/006.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,20 @@

<script>

function isAddIconProtected() {
return /dashboard\/006/i.test(window.location.pathname);
}

function updateHomeScreen() {
const appsContainer = document.getElementById('apps-container');
appsContainer.innerHTML = ''; // Clear existing apps
const appIds = ['006-001', '006-002', '999-999']; // Using class-based IDs
const addIconProtected = isAddIconProtected();
appIds.forEach(appId => {
const appInstalled = localStorage.getItem(appId) === 'added';
if (appInstalled || appId === '999-999') {
const storedValue = localStorage.getItem(appId);
const shouldDisplay = appInstalled || (appId === '999-999' && (addIconProtected || storedValue !== 'removed'));
if (shouldDisplay) {
const appElement = document.createElement('a');
appElement.href = getAppLink(appId); // Set the hyperlink
appElement.style.cursor = 'pointer';
Expand Down