-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappstore.html
More file actions
177 lines (153 loc) · 4.91 KB
/
appstore.html
File metadata and controls
177 lines (153 loc) · 4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>YTV OS App Store</title>
<style>
/* ——— Base UI ——— */
body{
font-family:Arial, sans-serif;
background:#181818;
color:#fff;
margin:0;
padding:0;
}
header{
background:#232323;
padding:20px;
text-align:center;
font-size:2em;
letter-spacing:2px;
}
/* ——— Grid & cards ——— */
.app-grid{
display:grid;
grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
gap:24px;
padding:32px;
max-width:1200px;
margin:0 auto;
}
.app-card{
background:#242424;
border-radius:12px;
box-shadow:0 2px 8px rgba(0,0,0,.2);
padding:20px;
text-align:center;
transition:transform .2s;
}
.app-card:hover{transform:translateY(-5px) scale(1.03);}
/* ——— Icons & text ——— */
.app-icon{
width:64px;height:64px;
margin-bottom:16px;
border-radius:12px;
background:#333;
display:inline-flex;
align-items:center;
justify-content:center;
font-size:2em; /* big enough for emoji */
line-height:1;
}
.app-icon img{ /* when it *is* an <img> */
width:100%;height:100%;
border-radius:inherit;
object-fit:cover;
}
.app-title{font-size:1.2em;margin-bottom:8px;font-weight:bold;}
.app-desc{font-size:.95em;color:#bbb;margin-bottom:16px;}
/* ——— Button ——— */
.install-btn{
background:#1db954;color:#fff;
border:none;border-radius:6px;
padding:10px 24px;
font-size:1em;cursor:pointer;
transition:background .2s;
}
.install-btn:hover{background:#17a44a;}
</style>
</head>
<body>
<header>YTV OS App Store</header>
<a href="home.html" style="position:absolute;top:25px;right:20px;color:#fff;text-decoration:none;font-size:1.2em;">
Back to Home
</a>
<script>
const apps = [
{
id: "ytv-browser",
icon: "tvb.png",
title: "YTV Browser",
desc: "A fast and secure web browser for YTV OS.",
url: "tvb.html"
},
{
id: "ytv-music",
icon: "tvm.png",
title: "YTV Music",
desc: "Listen to your favorite music on YTV OS.",
url: "tvm.html"
},
{
id: "ytv-video",
icon: "tvv.png",
title: "YTV Video Player",
desc: "Watch videos seamlessly on YTV OS.",
url: "tvv.html"
}
];
window.addEventListener('DOMContentLoaded', () => {
const grid = document.createElement('div');
grid.className = 'app-grid';
const installed = JSON.parse(localStorage.getItem('ytv_installed_apps') || '[]');
apps.forEach(app => {
const card = document.createElement('div');
card.className = 'app-card';
const isInstalled = installed.includes(app.id);
const isImage = /\.(png|jpe?g|webp|gif|svg)$/i.test(app.icon);
const iconHTML = isImage
? `<span class="app-icon"><img src="${app.icon}" alt="${app.title} icon"></span>`
: `<span class="app-icon">${app.icon}</span>`;
const buttonHTML = isInstalled
? `<button class="install-btn" onclick="uninstallApp('${app.id}')">Uninstall</button>`
: `<button class="install-btn" onclick="installApp('${app.id}')">Install</button>`;
card.innerHTML = `
${iconHTML}
<div class="app-title">${app.title}</div>
<div class="app-desc">${app.desc}</div>
${buttonHTML}
`;
grid.appendChild(card);
});
document.body.appendChild(grid);
});
function installApp(appId) {
let installed = JSON.parse(localStorage.getItem('ytv_installed_apps') || '[]');
let appData = JSON.parse(localStorage.getItem('ytv_installed_data') || '{}');
const app = apps.find(a => a.id === appId);
if (!app) return alert("❌ App not found!");
if (!installed.includes(appId)) {
installed.push(appId);
localStorage.setItem('ytv_installed_apps', JSON.stringify(installed));
appData[appId] = app;
localStorage.setItem('ytv_installed_data', JSON.stringify(appData));
alert("✅ App installed!");
} else {
alert("ℹ️ App is already installed.");
}
}
function uninstallApp(appId){
let installed = JSON.parse(localStorage.getItem('ytv_installed_apps') || '[]');
if (installed.includes(appId)) {
installed = installed.filter(id => id !== appId);
localStorage.setItem('ytv_installed_apps', JSON.stringify(installed));
alert("🗑️ App uninstalled.");
location.reload();
} else {
alert("⚠️ App is not installed.");
}
}
</script>
</body>
</html>