mobile.html 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>ArozOS</title>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
  7. <link rel="manifest" href="manifest.webmanifest">
  8. <script src="script/jquery.min.js"></script>
  9. <script src="script/ao_module.js"></script>
  10. <script src="script/applocale.js"></script>
  11. <style>
  12. /* ── Reset ── */
  13. *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  14. html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
  15. body {
  16. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  17. -webkit-font-smoothing: antialiased;
  18. user-select: none;
  19. -webkit-user-select: none;
  20. }
  21. /* ── Wallpaper ── */
  22. #backdrop {
  23. position: fixed; inset: 0; z-index: 0;
  24. background: url('img/desktop/bg/init.jpg') center/cover no-repeat;
  25. transition: background-image 0.5s;
  26. }
  27. #backdrop-dim {
  28. position: fixed; inset: 0; z-index: 1;
  29. background: rgba(0,0,0,0.28);
  30. pointer-events: none;
  31. transition: background 0.3s;
  32. }
  33. body.dark-mode #backdrop-dim { background: rgba(0,0,0,0.52); }
  34. /* ── Launchpad container ── */
  35. #launchpad { position: fixed; inset: 0; z-index: 2; overflow: hidden; }
  36. .lp-section {
  37. position: absolute; width: 100%; height: 100%; top: 0; left: 0;
  38. transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  39. will-change: transform;
  40. }
  41. /* ── Section 1: Home ── */
  42. #sec-home {
  43. display: flex; flex-direction: column; align-items: center;
  44. padding-top: max(env(safe-area-inset-top), 20px);
  45. }
  46. #clock-widget {
  47. margin-top: 14vh; text-align: center; color: #fff;
  48. text-shadow: 0 2px 14px rgba(0,0,0,0.45); pointer-events: none;
  49. }
  50. #clock-time { font-size: clamp(60px, 18vw, 92px); font-weight: 100; letter-spacing: -2px; line-height: 1; }
  51. #clock-date { font-size: clamp(14px, 4vw, 18px); font-weight: 300; margin-top: 8px; opacity: 0.88; }
  52. #home-hint {
  53. position: absolute; bottom: calc(max(env(safe-area-inset-bottom), 12px) + 120px);
  54. left: 0; right: 0; text-align: center;
  55. color: rgba(255,255,255,0.5); font-size: 11px; pointer-events: none;
  56. animation: hint 2.2s ease-in-out infinite;
  57. }
  58. @keyframes hint { 0%,100%{opacity:.5;transform:translateY(0)} 50%{opacity:.15;transform:translateY(-5px)} }
  59. #home-hint svg { display: block; margin: 0 auto 2px; }
  60. /* Dock */
  61. #dock {
  62. position: absolute;
  63. bottom: calc(max(env(safe-area-inset-bottom), 10px) + 8px);
  64. left: 14px; right: 14px;
  65. }
  66. #dock-inner {
  67. background: rgba(255,255,255,0.22);
  68. backdrop-filter: blur(22px) saturate(180%);
  69. -webkit-backdrop-filter: blur(22px) saturate(180%);
  70. border-radius: 26px; padding: 10px 6px;
  71. display: grid; grid-template-columns: repeat(4,1fr);
  72. }
  73. body.dark-mode #dock-inner { background: rgba(0,0,0,0.38); }
  74. .dock-item {
  75. display: flex; flex-direction: column; align-items: center; gap: 4px;
  76. cursor: pointer; padding: 7px 4px; border-radius: 16px;
  77. transition: opacity .15s; -webkit-tap-highlight-color: transparent;
  78. }
  79. .dock-item:active { opacity: .55; }
  80. .dock-item img { width: clamp(46px,13vw,60px); height: clamp(46px,13vw,60px); border-radius: 14px; object-fit: cover; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
  81. .dock-label { font-size: 10px; color: rgba(255,255,255,.9); text-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 68px; text-align: center; }
  82. /* ── Section 2: Apps ── */
  83. #sec-apps { display: flex; flex-direction: column; }
  84. #apps-header {
  85. padding: calc(max(env(safe-area-inset-top),16px) + 10px) 16px 8px;
  86. flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  87. }
  88. #apps-header h2 { font-size: 26px; font-weight: 700; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
  89. #apps-edit-btn {
  90. flex-shrink: 0;
  91. background: rgba(255,255,255,.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  92. border: 1px solid rgba(255,255,255,.28); border-radius: 14px;
  93. padding: 5px 16px; color: #fff; font-size: 14px; font-weight: 500;
  94. cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, color .15s;
  95. margin-right: 3em; /* Avoid the control panel button */
  96. }
  97. #apps-edit-btn.on { background: rgba(255,255,255,.9); color: #111; border-color: transparent; }
  98. #apps-edit-btn:active { opacity: .6; }
  99. /* drag states */
  100. .app-item.dragging { opacity: .25; }
  101. .app-item.drag-target .app-icon-wrap { outline: 2px solid rgba(255,255,255,.85); outline-offset: 3px; border-radius: 16px; }
  102. /* removed-app ghost tiles */
  103. .app-item.app-removed { opacity: .35; }
  104. .app-restore {
  105. position:absolute; top:-5px; left:-5px; width:26px; height:26px;
  106. border-radius:50%; background:#107c10;
  107. display:flex; align-items:center; justify-content:center;
  108. z-index:5; cursor:pointer; border:2px solid #fff;
  109. }
  110. .app-restore img { width:13px; height:13px; pointer-events:none; display:block; }
  111. #app-search-wrap {
  112. margin: 6px 14px 4px; flex-shrink: 0;
  113. display: flex; align-items: center; gap: 8px;
  114. background: rgba(255,255,255,.18); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  115. border-radius: 12px; padding: 8px 12px;
  116. border: 1px solid rgba(255,255,255,.22);
  117. }
  118. body.dark-mode #app-search-wrap { background: rgba(0,0,0,.3); border-color: rgba(255,255,255,.12); }
  119. #app-search-input { flex:1; background:transparent; border:none; outline:none; color:#fff; font-size:14px; }
  120. #app-search-input::placeholder { color: rgba(255,255,255,.55); }
  121. #edit-done-btn {
  122. position: absolute; top: calc(max(env(safe-area-inset-top),14px) + 12px); right: 14px;
  123. background: rgba(255,255,255,.92); color: #111; border: none; border-radius: 14px;
  124. padding: 6px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  125. display: none; z-index: 10; box-shadow: 0 2px 10px rgba(0,0,0,.18);
  126. }
  127. #app-grid-wrap {
  128. flex: 1; overflow-y: auto; overflow-x: hidden;
  129. -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  130. padding: 4px 8px calc(max(env(safe-area-inset-bottom),12px) + 8px);
  131. }
  132. #app-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 2px 0; }
  133. @media(min-width:460px){ #app-grid{grid-template-columns:repeat(5,1fr);} }
  134. @media(min-width:700px){ #app-grid{grid-template-columns:repeat(6,1fr);} }
  135. .app-item {
  136. display: flex; flex-direction: column; align-items: center; gap: 5px;
  137. padding: 9px 4px; cursor: pointer; border-radius: 18px;
  138. transition: background .15s; position: relative;
  139. -webkit-tap-highlight-color: transparent;
  140. }
  141. .app-item:active:not(.jiggling) { background: rgba(255,255,255,.12); }
  142. .app-icon-wrap { position: relative; width: clamp(52px,14vw,68px); height: clamp(52px,14vw,68px); }
  143. .app-icon-wrap img {
  144. width: 100%; height: 100%; border-radius: 16px; object-fit: cover;
  145. box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none;
  146. display: block;
  147. }
  148. .app-name { font-size: clamp(9px,2.4vw,11px); color: rgba(255,255,255,.94); text-shadow: 0 1px 3px rgba(0,0,0,.5); text-align: center; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
  149. /* Jiggle */
  150. @keyframes jiggle { 0%{transform:rotate(-1.8deg) scale(1.02)} 50%{transform:rotate(1.8deg) scale(1.02)} 100%{transform:rotate(-1.8deg) scale(1.02)} }
  151. .jiggling .app-icon-wrap { animation: jiggle .32s infinite ease-in-out; }
  152. /* Delete badge */
  153. .app-del { position:absolute; top:-5px; left:-5px; width:26px; height:26px; border-radius:50%; background:#c42b1c; display:none; z-index:5; cursor:pointer; border:2px solid #fff; align-items:center; justify-content:center; }
  154. .editing .app-del { display: flex; }
  155. .app-del img { width:13px; height:13px; pointer-events:none; display:block; }
  156. /* Drag ghost */
  157. #drag-ghost { position:fixed; pointer-events:none; z-index:999; width:clamp(52px,14vw,68px); height:clamp(52px,14vw,68px); border-radius:16px; overflow:hidden; opacity:.82; box-shadow:0 10px 28px rgba(0,0,0,.45); transform:scale(1.12); display:none; }
  158. #drag-ghost img { width:100%; height:100%; object-fit:cover; }
  159. /* ── Section 3: Files ── */
  160. #sec-files { display: flex; flex-direction: column; }
  161. #files-header {
  162. padding: calc(max(env(safe-area-inset-top),16px) + 10px) 16px 8px;
  163. flex-shrink: 0;
  164. }
  165. #files-header h2 { font-size: 26px; font-weight: 700; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
  166. #files-header p { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 3px; }
  167. #files-grid-wrap {
  168. flex:1; overflow-y:auto; overflow-x:hidden;
  169. -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
  170. padding: 10px 12px calc(max(env(safe-area-inset-bottom),12px)+8px);
  171. }
  172. #files-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
  173. @media(min-width:460px){#files-grid{grid-template-columns:repeat(4,1fr);}}
  174. .folder-item {
  175. display:flex; flex-direction:column; align-items:center; gap:6px;
  176. padding:14px 6px; border-radius:16px; cursor:pointer;
  177. background:rgba(255,255,255,.13); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  178. border:1px solid rgba(255,255,255,.18);
  179. transition:background .15s; -webkit-tap-highlight-color:transparent;
  180. }
  181. body.dark-mode .folder-item{background:rgba(0,0,0,.28);border-color:rgba(255,255,255,.1);}
  182. .folder-item:active{background:rgba(255,255,255,.24);}
  183. .folder-emoji{width:40px;height:40px;display:block;object-fit:contain;}
  184. .shortcut-icon{width:40px;height:40px;border-radius:10px;object-fit:cover;display:block;background:rgba(255,255,255,.25);}
  185. .folder-name{font-size:11px;color:rgba(255,255,255,.92);text-shadow:0 1px 3px rgba(0,0,0,.4);text-align:center;max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  186. #files-empty{text-align:center;color:rgba(255,255,255,.5);margin-top:64px;font-size:14px;display:none;}
  187. /* ── Page dots ── */
  188. #page-dots {
  189. position:fixed; bottom:36px;
  190. left:50%; transform:translateX(-50%); display:flex; gap:7px; z-index:50; pointer-events:none;
  191. }
  192. .pd{width:6px;height:6px;border-radius:50%;background:rgba(255,255,255,.35);transition:background .2s,transform .2s;}
  193. .pd.on{background:rgba(255,255,255,.9);transform:scale(1.35);}
  194. /* ── Control Panel ── */
  195. #cp-btn {
  196. position:fixed; top:max(env(safe-area-inset-top),10px); right:10px; z-index:82;
  197. width:36px; height:36px; border-radius:50%;
  198. background:rgba(0,0,0,.32); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  199. border:1px solid rgba(255,255,255,.22);
  200. display:flex; align-items:center; justify-content:center;
  201. cursor:pointer; -webkit-tap-highlight-color:transparent;
  202. }
  203. #cp-btn:active{opacity:.6;}
  204. #cp-backdrop{position:fixed;inset:0;z-index:80;display:none;}
  205. #cp-backdrop.on{display:block;}
  206. #cp-panel {
  207. position:fixed; top:0; right:0; z-index:81;
  208. width:min(310px,90vw); max-height:86vh; overflow-y:auto;
  209. background:rgba(235,235,235,.9); backdrop-filter:blur(40px) saturate(200%); -webkit-backdrop-filter:blur(40px) saturate(200%);
  210. border-radius:0 0 0 22px; box-shadow:0 8px 36px rgba(0,0,0,.28);
  211. padding-top:max(env(safe-area-inset-top),20px);
  212. transform:translateY(-110%); transition:transform .34s cubic-bezier(.4,0,.2,1);
  213. }
  214. body.dark-mode #cp-panel{background:rgba(28,28,28,.93);}
  215. #cp-panel.on{transform:translateY(0);}
  216. .cp-user{display:flex;align-items:center;gap:12px;padding:12px 16px 10px;}
  217. .cp-av{width:44px;height:44px;border-radius:50%;object-fit:cover;flex-shrink:0;}
  218. .cp-name{font-size:14px;font-weight:600;color:#111;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  219. body.dark-mode .cp-name{color:#f0f0f0;}
  220. .cp-grp{font-size:11px;color:#666;margin-top:1px;}
  221. body.dark-mode .cp-grp{color:#aaa;}
  222. .cp-sep{height:1px;background:rgba(0,0,0,.08);margin:0 16px;}
  223. body.dark-mode .cp-sep{background:rgba(255,255,255,.1);}
  224. .cp-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px;padding:10px 14px;}
  225. .cp-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:12px 8px;background:rgba(0,0,0,.06);border-radius:14px;border:none;cursor:pointer;font-size:11px;font-weight:500;color:#111;-webkit-tap-highlight-color:transparent;transition:opacity .15s;}
  226. body.dark-mode .cp-tile{background:rgba(255,255,255,.1);color:#f0f0f0;}
  227. .cp-tile:active{opacity:.55;}
  228. .cp-tile.on{background:#111;color:#fff;}
  229. body.dark-mode .cp-tile.on{background:#e8e8e8;color:#111;}
  230. .cp-tile-icon{display:flex;align-items:center;justify-content:center;}
  231. .cp-tile-icon img{width:26px;height:26px;display:block;}
  232. /* Light/dark icon pair switching */
  233. img.cp-ic-w{display:none !important;}
  234. body.dark-mode img.cp-ic-b{display:none !important;}
  235. body.dark-mode img.cp-ic-w{display:block !important;}
  236. .cp-list-lbl{font-size:10px;font-weight:700;color:#888;text-transform:uppercase;letter-spacing:.4px;padding:6px 16px 2px;}
  237. .cp-acc-item{display:flex;align-items:center;gap:10px;padding:8px 16px;cursor:pointer;-webkit-tap-highlight-color:transparent;}
  238. .cp-acc-item:active{background:rgba(0,0,0,.05);}
  239. body.dark-mode .cp-acc-item:active{background:rgba(255,255,255,.05);}
  240. .cp-acc-item img{width:32px;height:32px;border-radius:50%;}
  241. .cp-acc-name{font-size:13px;color:#111;}
  242. body.dark-mode .cp-acc-name{color:#f0f0f0;}
  243. .cp-btns{padding:4px 14px 16px;}
  244. .cp-btn{width:100%;padding:10px 14px;margin-top:7px;background:rgba(0,0,0,.06);border:none;border-radius:12px;font-size:13px;font-weight:500;color:#111;cursor:pointer;display:flex;align-items:center;gap:10px;-webkit-tap-highlight-color:transparent;}
  245. body.dark-mode .cp-btn{background:rgba(255,255,255,.1);color:#f0f0f0;}
  246. .cp-btn:active{opacity:.55;}
  247. .cp-btn.red{color:#c42b1c;}
  248. body.dark-mode .cp-btn.red{color:#ff6b6b;}
  249. .cp-btn-ic{width:22px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
  250. .cp-btn-ic img{width:18px;height:18px;display:block;}
  251. /* ── Float Window Layer ── */
  252. #fw-layer{position:fixed;inset:0;z-index:100;display:none;flex-direction:column;background:#000;}
  253. #fw-layer.on{display:flex;}
  254. #fw-bar {
  255. background:rgba(18,18,18,.96); backdrop-filter:blur(10px);
  256. padding:calc(max(env(safe-area-inset-top),10px)+4px) 10px 8px;
  257. display:flex; align-items:center; gap:7px; flex-shrink:0;
  258. overflow-x:auto; overflow-y:hidden; scrollbar-width:none;
  259. }
  260. #fw-bar::-webkit-scrollbar{display:none;}
  261. #fw-back{flex-shrink:0;background:rgba(255,255,255,.16);border:none;border-radius:8px;padding:5px 11px;color:#fff;font-size:13px;cursor:pointer;display:flex;align-items:center;gap:4px;-webkit-tap-highlight-color:transparent;}
  262. #fw-back:active{opacity:.55;}
  263. #fw-tabs{display:flex;gap:6px;flex-shrink:0;}
  264. .fw-tab{background:rgba(255,255,255,.12);border:none;border-radius:8px;padding:4px 10px;color:rgba(255,255,255,.65);font-size:12px;cursor:pointer;display:flex;align-items:center;gap:5px;min-width:60px;max-width:160px;-webkit-tap-highlight-color:transparent;transition:background .15s;}
  265. .fw-tab.on{background:rgba(255,255,255,.26);color:#fff;}
  266. .fw-tab img{width:16px;height:16px;border-radius:3px;flex-shrink:0;}
  267. .fw-tab-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  268. .fw-tab-x{width:14px;height:14px;border-radius:50%;background:rgba(255,255,255,.2);display:inline-flex;align-items:center;justify-content:center;font-size:9px;flex-shrink:0;cursor:pointer;}
  269. .fw-tab-x:active{background:#c42b1c;}
  270. #fw-body{flex:1;position:relative;overflow:hidden;}
  271. .floatWindowWrapper{position:absolute;inset:0;display:none;}
  272. .floatWindowWrapper.on{display:block;}
  273. .floatWindow{width:100%;height:100%;}
  274. .fwtab{width:100%;height:100%;}
  275. .fwtab iframe{width:100%;height:100%;border:none;}
  276. /* ── Connection lost ── */
  277. #conndrop{position:fixed;top:max(env(safe-area-inset-top),8px);left:50%;transform:translateX(-50%);z-index:200;background:rgba(196,43,28,.9);backdrop-filter:blur(8px);border-radius:20px;padding:5px 13px;display:none;align-items:center;gap:7px;font-size:12px;color:#fff;}
  278. #conndrop img{width:14px;height:14px;}
  279. /* ── FW Tab Context Menu ── */
  280. #fw-ctx-overlay{position:fixed;inset:0;z-index:210;display:none;}
  281. #fw-ctx-overlay.on{display:block;}
  282. #fw-ctx-menu{
  283. position:fixed;z-index:211;display:none;
  284. background:rgba(235,235,235,.94);backdrop-filter:blur(40px) saturate(200%);-webkit-backdrop-filter:blur(40px) saturate(200%);
  285. border-radius:16px;box-shadow:0 8px 32px rgba(0,0,0,.32);
  286. min-width:220px;overflow:hidden;
  287. transform-origin:top left;
  288. animation:fw-ctx-in .14s ease;
  289. }
  290. body.dark-mode #fw-ctx-menu{background:rgba(30,30,30,.96);}
  291. @keyframes fw-ctx-in{from{opacity:0;transform:scale(.88);}to{opacity:1;transform:scale(1);}}
  292. .fw-ctx-item{
  293. display:flex;align-items:center;gap:12px;
  294. padding:13px 16px;font-size:14px;color:#111;cursor:pointer;
  295. border:none;background:none;width:100%;text-align:left;
  296. -webkit-tap-highlight-color:transparent;transition:background .1s;
  297. }
  298. body.dark-mode .fw-ctx-item{color:#f0f0f0;}
  299. .fw-ctx-item:active{background:rgba(0,0,0,.07);}
  300. body.dark-mode .fw-ctx-item:active{background:rgba(255,255,255,.09);}
  301. .fw-ctx-item+.fw-ctx-item{border-top:1px solid rgba(0,0,0,.06);}
  302. body.dark-mode .fw-ctx-item+.fw-ctx-item{border-top-color:rgba(255,255,255,.08);}
  303. .fw-ctx-item.red{color:#c42b1c;}
  304. body.dark-mode .fw-ctx-item.red{color:#ff6b6b;}
  305. .fw-ctx-item svg{flex-shrink:0;opacity:.75;}
  306. </style>
  307. </head>
  308. <body>
  309. <div id="backdrop"></div>
  310. <div id="backdrop-dim"></div>
  311. <!-- Page indicator -->
  312. <div id="page-dots">
  313. <div class="pd on" data-s="0"></div>
  314. <div class="pd" data-s="1"></div>
  315. <div class="pd" data-s="2"></div>
  316. </div>
  317. <!-- Control panel trigger -->
  318. <div id="cp-btn" onclick="cpToggle()">
  319. <svg width="17" height="17" viewBox="0 0 17 17" fill="none">
  320. <circle cx="4.5" cy="4.5" r="1.8" fill="white"/>
  321. <circle cx="12.5" cy="4.5" r="1.8" fill="white"/>
  322. <circle cx="4.5" cy="12.5" r="1.8" fill="white"/>
  323. <circle cx="12.5" cy="12.5" r="1.8" fill="white"/>
  324. </svg>
  325. </div>
  326. <div id="cp-backdrop" onclick="cpClose()"></div>
  327. <div id="cp-panel">
  328. <div class="cp-user">
  329. <img class="cp-av" id="cp-av" src="img/desktop/system_icon/user.svg">
  330. <div style="flex:1;min-width:0;">
  331. <div class="cp-name" id="cp-name">User</div>
  332. <div class="cp-grp" id="cp-grp">@user</div>
  333. </div>
  334. </div>
  335. <div class="cp-sep"></div>
  336. <div class="cp-grid">
  337. <button class="cp-tile" id="cp-dark-btn" onclick="cpToggleDark()">
  338. <span class="cp-tile-icon">
  339. <img id="cp-dark-ic" src="SystemAO/desktop/img/icons/lightmode_black.svg">
  340. </span>
  341. <span id="cp-dark-lbl">Dark Mode</span>
  342. </button>
  343. <button class="cp-tile" onclick="cpFullscreen()">
  344. <span class="cp-tile-icon">
  345. <img class="cp-ic-b" src="SystemAO/desktop/img/icons/fullscreen_black.svg">
  346. <img class="cp-ic-w" src="SystemAO/desktop/img/icons/fullscreen_white.svg">
  347. </span>
  348. <span>Fullscreen</span>
  349. </button>
  350. <button class="cp-tile" onclick="cpWallpaper()">
  351. <span class="cp-tile-icon">
  352. <img class="cp-ic-b" src="SystemAO/desktop/img/icons/wallpaper_black.svg">
  353. <img class="cp-ic-w" src="SystemAO/desktop/img/icons/wallpaper_white.svg">
  354. </span>
  355. <span>Wallpaper</span>
  356. </button>
  357. <button class="cp-tile" onclick="cpSettings()">
  358. <span class="cp-tile-icon">
  359. <img class="cp-ic-b" src="SystemAO/desktop/img/icons/settings_black.svg">
  360. <img class="cp-ic-w" src="SystemAO/desktop/img/icons/settings_white.svg">
  361. </span>
  362. <span>Settings</span>
  363. </button>
  364. </div>
  365. <div class="cp-sep"></div>
  366. <div class="cp-list-lbl">Other Accounts</div>
  367. <div id="cp-acc-list"></div>
  368. <div class="cp-btns">
  369. <button class="cp-btn" onclick="cpAddAccount()">
  370. <span class="cp-btn-ic">
  371. <img class="cp-ic-b" src="SystemAO/desktop/img/icons/switch_user_black.svg">
  372. <img class="cp-ic-w" src="SystemAO/desktop/img/icons/switch_user_white.svg">
  373. </span>
  374. Add / Switch Account
  375. </button>
  376. <button class="cp-btn red" onclick="cpLogout()">
  377. <span class="cp-btn-ic">
  378. <img class="cp-ic-b" src="SystemAO/desktop/img/icons/signout_black.svg">
  379. <img class="cp-ic-w" src="SystemAO/desktop/img/icons/signout_white.svg">
  380. </span>
  381. Sign Out
  382. </button>
  383. </div>
  384. </div>
  385. <!-- Launchpad -->
  386. <div id="launchpad">
  387. <!-- Section 1: Home -->
  388. <div class="lp-section" id="sec-home">
  389. <div id="clock-widget">
  390. <div id="clock-time">00:00</div>
  391. <div id="clock-date">Saturday, January 1</div>
  392. </div>
  393. <div id="home-hint">
  394. <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
  395. <path d="M9 13V5M5 9L9 5L13 9" stroke="rgba(255,255,255,0.55)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  396. </svg>
  397. Swipe up for apps
  398. </div>
  399. <div id="dock">
  400. <div id="dock-inner">
  401. <div class="dock-item" onclick="launchShortcut(1)"><img id="d1" src="img/mobile/pending.svg"><span class="dock-label" id="dl1"></span></div>
  402. <div class="dock-item" onclick="launchShortcut(2)"><img id="d2" src="img/mobile/pending.svg"><span class="dock-label" id="dl2"></span></div>
  403. <div class="dock-item" onclick="launchShortcut(3)"><img id="d3" src="img/mobile/pending.svg"><span class="dock-label" id="dl3"></span></div>
  404. <div class="dock-item" onclick="launchShortcut(4)"><img id="d4" src="img/mobile/pending.svg"><span class="dock-label" id="dl4"></span></div>
  405. </div>
  406. </div>
  407. </div>
  408. <!-- Section 2: Apps -->
  409. <div class="lp-section" id="sec-apps">
  410. <div id="apps-header">
  411. <h2>Apps</h2>
  412. <button id="apps-edit-btn" onclick="toggleEdit()">Edit</button>
  413. </div>
  414. <div id="app-search-wrap">
  415. <svg width="14" height="14" viewBox="0 0 16 16" fill="none">
  416. <circle cx="6.5" cy="6.5" r="4.5" stroke="rgba(255,255,255,0.65)" stroke-width="1.4"/>
  417. <path d="M10 10L14 14" stroke="rgba(255,255,255,0.65)" stroke-width="1.4" stroke-linecap="round"/>
  418. </svg>
  419. <input id="app-search-input" type="text" placeholder="Search apps…" oninput="filterApps(this.value)" autocomplete="off">
  420. </div>
  421. <div id="app-grid-wrap"><div id="app-grid"></div></div>
  422. </div>
  423. <!-- Section 3: Files -->
  424. <div class="lp-section" id="sec-files">
  425. <div id="files-header"><h2>Desktop</h2><p>Folders &amp; Shortcuts</p></div>
  426. <div id="files-grid-wrap">
  427. <div id="files-grid"></div>
  428. <div id="files-empty">No folders or shortcuts on desktop</div>
  429. </div>
  430. </div>
  431. </div>
  432. <!-- Drag ghost -->
  433. <div id="drag-ghost"><img id="drag-ghost-img" src=""></div>
  434. <!-- Float window layer -->
  435. <div id="fw-layer">
  436. <div id="fw-bar">
  437. <button id="fw-back" onclick="fwBack()">
  438. <svg width="13" height="13" viewBox="0 0 16 16" fill="none"><path d="M10 3L5 8L10 13" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
  439. Back
  440. </button>
  441. <div id="fw-tabs"></div>
  442. </div>
  443. <div id="fw-body"></div>
  444. </div>
  445. <!-- FW tab context menu -->
  446. <div id="fw-ctx-overlay" onclick="fwCtxClose()"></div>
  447. <div id="fw-ctx-menu">
  448. <button class="fw-ctx-item" onclick="fwCtxNewTab()">
  449. <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
  450. <path d="M6 3H3a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-3" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
  451. <path d="M9 2h5v5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
  452. <path d="M14 2L8 8" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
  453. </svg>
  454. Open in New Tab
  455. </button>
  456. <button class="fw-ctx-item" onclick="fwCtxCopy()">
  457. <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
  458. <rect x="5" y="5" width="9" height="10" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
  459. <path d="M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-7A1.5 1.5 0 0 0 1 3.5v7A1.5 1.5 0 0 0 2.5 12H4" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
  460. </svg>
  461. Copy URL
  462. </button>
  463. <button class="fw-ctx-item red" onclick="fwCtxCloseWindow()">
  464. <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
  465. <circle cx="8" cy="8" r="6.5" stroke="currentColor" stroke-width="1.4"/>
  466. <path d="M5.5 5.5l5 5M10.5 5.5l-5 5" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
  467. </svg>
  468. Close Window
  469. </button>
  470. </div>
  471. <!-- Connection indicator -->
  472. <div id="conndrop">
  473. <img src="SystemAO/desktop/icons/connlost.svg">
  474. No connection
  475. </div>
  476. <script>
  477. /* ============================================================
  478. ArozOS Mobile Interface — Launchpad Design
  479. Maintains full float-window API compatibility with desktop.html
  480. ============================================================ */
  481. /* ── Virtual desktop flag (read by ao_module.js in loaded iframes) ── */
  482. window.isDesktopMode = true;
  483. window.ime = null;
  484. /* ── State ── */
  485. var moduleInstalled = [];
  486. var desktopThemeList = [];
  487. var userInfo = {};
  488. var shortcuts = {1:null, 2:null, 3:null, 4:null};
  489. var currentSec = 0;
  490. var isDark = false;
  491. var isEditMode = false;
  492. var appOrder = []; // ordered array of active module names
  493. var removedApps = []; // module names the user has hidden
  494. var dragSrcName = null;
  495. var dragTargetName = null;
  496. var dragGhostOff = {x:0, y:0};
  497. var isDragging = false;
  498. var _autoScrollRaf = null;
  499. var _autoScrollDir = 0;
  500. /* ── Locale ── */
  501. var mLoc = (typeof NewAppLocale === "function") ? NewAppLocale() : {getString:function(k,d){return d;},init:function(f,cb){if(cb)cb();},translate:function(){}};
  502. mLoc.init("SystemAO/locale/desktop.json", function(){ mLoc.translate(); });
  503. /* ── Clock data (must be defined before clockLoop() is called below) ── */
  504. var _mon=["January","February","March","April","May","June","July","August","September","October","November","December"];
  505. var _day=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
  506. /* ── Boot ── */
  507. initTheme();
  508. initBackdrop();
  509. initAccentColor();
  510. initModules();
  511. initShortcuts();
  512. initUserInfo();
  513. initFiles();
  514. initStartupAudio();
  515. clockLoop();
  516. connCheck();
  517. goSec(0); // initialise section positions so they don't all stack at translateY(0)
  518. $.get("system/desktop/host", function(d){ if(d.Hostname) document.title = d.Hostname; });
  519. /* ─────────────────────────────────────────────
  520. THEME
  521. ───────────────────────────────────────────── */
  522. function initTheme(){
  523. $.get("system/file_system/preference?key=file_explorer/theme", function(d){
  524. setDarkMode(d === "darkTheme");
  525. });
  526. }
  527. function setDarkMode(dark){
  528. isDark = dark;
  529. $("body").toggleClass("dark-mode", dark);
  530. if(dark){
  531. // Panel is dark → use white icon; button shows "Light Mode" (click to leave dark)
  532. $("#cp-dark-ic").attr("src","SystemAO/desktop/img/icons/darkmode_white.svg");
  533. $("#cp-dark-lbl").text("Light Mode");
  534. $("#cp-dark-btn").addClass("on");
  535. }else{
  536. // Panel is light → use black icon; button shows "Dark Mode" (click to enter dark)
  537. $("#cp-dark-ic").attr("src","SystemAO/desktop/img/icons/lightmode_black.svg");
  538. $("#cp-dark-lbl").text("Dark Mode");
  539. $("#cp-dark-btn").removeClass("on");
  540. }
  541. }
  542. /* Called by parent.desktopThemeChanged — not applicable here (standalone page),
  543. but defined for forward-compat if ever embedded */
  544. window.desktopThemeChanged = function(theme){ setDarkMode(theme === "dark"); };
  545. /* ─────────────────────────────────────────────
  546. WALLPAPER / ACCENT
  547. ───────────────────────────────────────────── */
  548. function initBackdrop(){
  549. $.get("system/desktop/theme", function(list){
  550. desktopThemeList = list;
  551. $.get("system/desktop/theme?get=true", function(t){ changeDesktopTheme(t); });
  552. });
  553. }
  554. function changeDesktopTheme(t){
  555. if(!t.includes(":/")){
  556. for(var i=0;i<desktopThemeList.length;i++){
  557. if(desktopThemeList[i].Theme===t){
  558. var bg = desktopThemeList[i].Bglist[0];
  559. $("#backdrop").css("background-image","url(img/desktop/bg/"+t+"/"+bg+")");
  560. return;
  561. }
  562. }
  563. }else{
  564. $.get("system/desktop/theme?load="+t,function(d){
  565. if(d.error){changeDesktopTheme("default");return;}
  566. $("#backdrop").css("background-image","url(media/?file="+d[0]+")");
  567. });
  568. }
  569. }
  570. function initAccentColor(){
  571. pref("themecolor",function(c){ if(c&&!c.error) setThemeColor(c); });
  572. }
  573. function setThemeColor(c){
  574. /* Backward-compat: modules call parent.setThemeColor() */
  575. document.documentElement.style.setProperty("--accent",c);
  576. }
  577. /* ─────────────────────────────────────────────
  578. MODULE LIST + APP GRID
  579. ───────────────────────────────────────────── */
  580. function initModules(){
  581. $.ajax({url:"system/modules/list",success:function(data){
  582. moduleInstalled = data;
  583. var saved = localStorage.getItem("mobile/appOrder");
  584. if(saved){try{appOrder=JSON.parse(saved);}catch(e){appOrder=[];}}
  585. var savedRm = localStorage.getItem("mobile/removedApps");
  586. if(savedRm){try{removedApps=JSON.parse(savedRm);}catch(e){removedApps=[];}}
  587. renderGrid("");
  588. }});
  589. }
  590. // Interface Modules (Desktop, Dashboard, ...) are what the user boots into, not apps to launch
  591. function isLaunchableModule(m){
  592. return !!m.StartDir && m.Group!=="Interface Module";
  593. }
  594. function getOrderedModules(){
  595. var result = [];
  596. appOrder.forEach(function(n){
  597. var m=moduleInstalled.find(function(x){return x.Name===n;});
  598. if(m && isLaunchableModule(m)) result.push(m);
  599. });
  600. // Auto-include newly installed modules (not in appOrder and not explicitly removed)
  601. moduleInstalled.forEach(function(m){
  602. if(isLaunchableModule(m)
  603. && !result.find(function(x){return x.Name===m.Name;})
  604. && removedApps.indexOf(m.Name)===-1){
  605. result.push(m);
  606. }
  607. });
  608. return result;
  609. }
  610. function renderGrid(filter){
  611. var grid = $("#app-grid"); grid.empty();
  612. // Rebuild appOrder from active (non-removed) modules when not filtering
  613. if(!filter){
  614. appOrder = getOrderedModules()
  615. .filter(isLaunchableModule)
  616. .map(function(m){return m.Name;});
  617. }
  618. var idx=0;
  619. getOrderedModules().forEach(function(m){
  620. if(!isLaunchableModule(m)) return;
  621. if(filter && !m.Name.toLowerCase().includes(filter.toLowerCase())) return;
  622. var ic = m.IconPath||"img/system/service.png";
  623. var name = escH(m.Name);
  624. var attr = escA(m.Name);
  625. grid.append('<div class="app-item" data-mod="'+attr+'" data-i="'+idx+'">'
  626. +'<div class="app-icon-wrap">'
  627. +'<img src="'+escA(ic)+'" onerror="this.src=\'img/system/service.png\'">'
  628. +'<div class="app-del" onclick="appDelTap(event,\''+attr+'\')">'
  629. +'<img src="SystemAO/desktop/img/icons/close_white.svg">'
  630. +'</div>'
  631. +'</div>'
  632. +'<span class="app-name">'+name+'</span>'
  633. +'</div>');
  634. idx++;
  635. });
  636. // In edit mode (no filter active) show removed apps as ghost tiles at the bottom
  637. if(isEditMode && !filter){
  638. removedApps.forEach(function(name){
  639. var m=moduleInstalled.find(function(x){return x.Name===name;});
  640. if(!m||!isLaunchableModule(m)) return;
  641. var ic = m.IconPath||"img/system/service.png";
  642. var attr = escA(m.Name);
  643. grid.append('<div class="app-item app-removed" data-mod="'+attr+'">'
  644. +'<div class="app-icon-wrap">'
  645. +'<img src="'+escA(ic)+'" onerror="this.src=\'img/system/service.png\'">'
  646. +'<div class="app-restore" onclick="appRestoreTap(event,\''+attr+'\')">'
  647. +'<img src="SystemAO/desktop/img/icons/add_white.svg">'
  648. +'</div>'
  649. +'</div>'
  650. +'<span class="app-name">'+escH(m.Name)+'</span>'
  651. +'</div>');
  652. });
  653. }
  654. bindAppTouch();
  655. }
  656. function filterApps(q){
  657. if(isEditMode) exitEdit();
  658. renderGrid(q||"");
  659. }
  660. function bindAppTouch(){
  661. $("#app-grid .app-item").off("touchstart pointerdown").on("touchstart pointerdown",function(e){
  662. if(!isEditMode) return;
  663. // Don't start drag when the touch lands on a badge button
  664. if($(e.target).closest(".app-del,.app-restore").length) return;
  665. startDrag(e,this);
  666. });
  667. $("#app-grid .app-item").off("click").on("click",function(){
  668. if(isEditMode)return;
  669. openModule($(this).data("mod"));
  670. });
  671. }
  672. /* ── Edit mode ── */
  673. function toggleEdit(){ isEditMode ? exitEdit() : enterEdit(); }
  674. function enterEdit(){
  675. isEditMode=true;
  676. $("#apps-edit-btn").text("Done").addClass("on");
  677. renderGrid(""); // rebuild DOM so ghost tiles appear
  678. // Apply edit-mode classes to the freshly created active items
  679. $("#app-grid .app-item:not(.app-removed)").addClass("jiggling editing");
  680. }
  681. function exitEdit(){
  682. isEditMode=false;
  683. $("#apps-edit-btn").text("Edit").removeClass("on");
  684. localStorage.setItem("mobile/appOrder",JSON.stringify(appOrder));
  685. renderGrid(""); // rebuild DOM to remove ghost tiles
  686. }
  687. function appDelTap(e,name){
  688. e.stopPropagation();
  689. var i=appOrder.indexOf(name);
  690. if(i>-1) appOrder.splice(i,1);
  691. if(removedApps.indexOf(name)===-1) removedApps.push(name);
  692. localStorage.setItem("mobile/appOrder",JSON.stringify(appOrder));
  693. localStorage.setItem("mobile/removedApps",JSON.stringify(removedApps));
  694. enterEdit(); // enterEdit renders + applies edit classes
  695. }
  696. function appRestoreTap(e,name){
  697. e.stopPropagation();
  698. var i=removedApps.indexOf(name);
  699. if(i>-1) removedApps.splice(i,1);
  700. if(appOrder.indexOf(name)===-1) appOrder.push(name);
  701. localStorage.setItem("mobile/appOrder",JSON.stringify(appOrder));
  702. localStorage.setItem("mobile/removedApps",JSON.stringify(removedApps));
  703. enterEdit(); // enterEdit renders + applies edit classes
  704. }
  705. /* ── Drag-to-reorder ── */
  706. function startDrag(e,el){
  707. e.preventDefault();
  708. isDragging=true;
  709. dragSrcName=$(el).data("mod");
  710. dragTargetName=null;
  711. var t=e.touches?e.touches[0]:e;
  712. var r=el.getBoundingClientRect();
  713. dragGhostOff={x:t.clientX-r.left,y:t.clientY-r.top};
  714. $("#drag-ghost-img").attr("src",$(el).find("img").first().attr("src"));
  715. $("#drag-ghost").css({display:"block",left:t.clientX-dragGhostOff.x,top:t.clientY-dragGhostOff.y});
  716. $(el).addClass("dragging");
  717. $(document).on("touchmove.dg pointermove.dg",onDragMove);
  718. $(document).on("touchend.dg pointerup.dg",onDragEnd);
  719. }
  720. function onDragMove(e){
  721. if(!isDragging)return;
  722. var t=e.touches?e.touches[0]:e;
  723. var gx=t.clientX-dragGhostOff.x, gy=t.clientY-dragGhostOff.y;
  724. $("#drag-ghost").css({left:gx,top:gy});
  725. /* ── auto-scroll when ghost nears the top/bottom edge of the list ── */
  726. var wrap=document.getElementById("app-grid-wrap");
  727. var wr=wrap.getBoundingClientRect();
  728. var threshold=60;
  729. var prev=_autoScrollDir;
  730. if(gy<wr.top+threshold) _autoScrollDir=-1;
  731. else if(gy+60>wr.bottom-threshold) _autoScrollDir=1;
  732. else _autoScrollDir=0;
  733. if(_autoScrollDir!==0&&prev===0) _runAutoScroll();
  734. /* ── highlight drop target (no re-render during drag) ── */
  735. var found=null;
  736. $("#app-grid .app-item").each(function(){
  737. var r=this.getBoundingClientRect();
  738. if(t.clientX>=r.left&&t.clientX<=r.right&&t.clientY>=r.top&&t.clientY<=r.bottom){
  739. var n=$(this).data("mod");
  740. if(n!==dragSrcName) found=n;
  741. }
  742. });
  743. if(found!==dragTargetName){
  744. $(".app-item").removeClass("drag-target");
  745. dragTargetName=found;
  746. if(found) $(".app-item[data-mod='"+found+"']").addClass("drag-target");
  747. }
  748. }
  749. function _runAutoScroll(){
  750. if(!isDragging||_autoScrollDir===0){_autoScrollRaf=null;return;}
  751. document.getElementById("app-grid-wrap").scrollTop+=_autoScrollDir*5;
  752. _autoScrollRaf=requestAnimationFrame(_runAutoScroll);
  753. }
  754. function onDragEnd(){
  755. isDragging=false;
  756. _autoScrollDir=0;
  757. if(_autoScrollRaf){cancelAnimationFrame(_autoScrollRaf);_autoScrollRaf=null;}
  758. $("#drag-ghost").hide();
  759. $(document).off("touchmove.dg pointermove.dg touchend.dg pointerup.dg");
  760. /* commit reorder on drop */
  761. if(dragTargetName){
  762. var a=appOrder.indexOf(dragSrcName), b=appOrder.indexOf(dragTargetName);
  763. if(a>-1&&b>-1){appOrder.splice(a,1);appOrder.splice(b,0,dragSrcName);}
  764. }
  765. localStorage.setItem("mobile/appOrder",JSON.stringify(appOrder));
  766. renderGrid(""); enterEdit();
  767. }
  768. /* ─────────────────────────────────────────────
  769. DESKTOP FILES (Section 3)
  770. ───────────────────────────────────────────── */
  771. function initFiles(){
  772. $.get("system/desktop/listDesktop",function(data){
  773. if(!data||data.error){$("#files-empty").show();return;}
  774. // URL shortcuts shown first
  775. var urlShortcuts=data.filter(function(f){return f.IsShortcut&&(f.ShortcutType==="url"||f.ShortcutType==="app");});
  776. // Folders shown after
  777. var folders=data.filter(function(f){return f.IsDir&&!f.IsShortcut;});
  778. if(!urlShortcuts.length&&!folders.length){$("#files-empty").show();return;}
  779. urlShortcuts.forEach(function(f){
  780. var icon=f.ShortcutImage||"";
  781. var name=escH(f.ShortcutName||f.Filename);
  782. //Container apps always resolve through app/<slug>/
  783. var url=escA(f.ShortcutType==="app"?"app/"+encodeURIComponent(f.ShortcutPath)+"/":f.ShortcutPath);
  784. $("#files-grid").append(
  785. '<div class="folder-item" onclick="openUrlShortcut(\''+url+'\')">'
  786. +'<img class="shortcut-icon" src="'+escA(icon)+'" onerror="this.src=\'img/system/favicon.png\'">'
  787. +'<span class="folder-name">'+name+'</span>'
  788. +'</div>'
  789. );
  790. });
  791. folders.forEach(function(f){
  792. $("#files-grid").append(
  793. '<div class="folder-item" onclick="openFolder(\''+escA(f.Filepath)+'\')">'
  794. +'<img class="folder-emoji" src="SystemAO/desktop/img/icons/folder_blue.svg">'
  795. +'<span class="folder-name">'+escH(f.Filename)+'</span>'
  796. +'</div>'
  797. );
  798. });
  799. });
  800. }
  801. function openFolder(fp){
  802. window.open("SystemAO/file_system/file_explorer.html#"+encodeURIComponent(fp),"_blank");
  803. }
  804. function openUrlShortcut(url){
  805. window.open(url,"_blank");
  806. }
  807. /* ─────────────────────────────────────────────
  808. DOCK SHORTCUTS
  809. ───────────────────────────────────────────── */
  810. function initShortcuts(){[1,2,3,4].forEach(function(i){initShortcut(i);});}
  811. function initShortcut(id){
  812. pref("ao/mobile/shorcut/"+id,function(name){
  813. if(!name){$("#d"+id).attr("src","img/mobile/pending.svg");return;}
  814. $.get("system/modules/getLaunchPara?module="+encodeURIComponent(name),function(p){
  815. if(p.error)return;
  816. shortcuts[id]=p;
  817. $("#d"+id).attr("src",p.IconPath||"img/system/service.png");
  818. $("#dl"+id).text(p.Name);
  819. });
  820. });
  821. }
  822. function launchShortcut(id){if(shortcuts[id])openModule(shortcuts[id].Name);}
  823. /* ─────────────────────────────────────────────
  824. SECTION NAVIGATION
  825. ───────────────────────────────────────────── */
  826. function goSec(n){
  827. if(n<0||n>2)return;
  828. if(n!==1&&isEditMode)exitEdit();
  829. currentSec=n;
  830. ["#sec-home","#sec-apps","#sec-files"].forEach(function(s,i){
  831. $(s).css("transform","translateY("+(i-n)*100+"%)");
  832. });
  833. $(".pd").removeClass("on");
  834. $(".pd[data-s='"+n+"']").addClass("on");
  835. }
  836. /* Swipe handling per-section */
  837. var _sy=0;
  838. function _trackStart(e){_sy=e.touches?e.touches[0].clientY:e.clientY;}
  839. function _swipeDelta(e){var y=e.changedTouches?e.changedTouches[0].clientY:e.clientY;return _sy-y;}
  840. // Section 1: anywhere swipe up → section 2
  841. $("#sec-home").on("touchstart",function(e){_sy=e.touches[0].clientY;})
  842. .on("touchend",function(e){if(_swipeDelta(e)>55)goSec(1);});
  843. // Section 2 header: swipe down → sec 1, swipe up → sec 3
  844. $("#apps-header,#app-search-wrap").on("touchstart",function(e){_sy=e.touches[0].clientY;})
  845. .on("touchend",function(e){var d=_swipeDelta(e);if(d<-55)goSec(0);else if(d>55)goSec(2);});
  846. // App grid edge-overscroll
  847. var _agw=document.getElementById("app-grid-wrap");
  848. _agw.addEventListener("touchstart",function(e){_sy=e.touches[0].clientY;},{passive:true});
  849. _agw.addEventListener("touchend",function(e){
  850. var d=_sy-e.changedTouches[0].clientY;
  851. if(_agw.scrollTop<=0&&d<-70)goSec(0);
  852. if(_agw.scrollTop+_agw.clientHeight>=_agw.scrollHeight-2&&d>70)goSec(2);
  853. },{passive:true});
  854. // Section 3 header: swipe down → sec 2
  855. $("#files-header").on("touchstart",function(e){_sy=e.touches[0].clientY;})
  856. .on("touchend",function(e){if(_swipeDelta(e)<-55)goSec(1);});
  857. var _fgw=document.getElementById("files-grid-wrap");
  858. _fgw.addEventListener("touchstart",function(e){_sy=e.touches[0].clientY;},{passive:true});
  859. _fgw.addEventListener("touchend",function(e){
  860. if(_fgw.scrollTop<=0&&(_sy-e.changedTouches[0].clientY)<-70)goSec(1);
  861. },{passive:true});
  862. /* ─────────────────────────────────────────────
  863. CLOCK
  864. ───────────────────────────────────────────── */
  865. var _mon=["January","February","March","April","May","June","July","August","September","October","November","December"];
  866. var _day=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
  867. function clockLoop(){updateClock();setInterval(updateClock,15000);}
  868. function updateClock(){
  869. var d=new Date();
  870. $("#clock-time").text(pad2(d.getHours())+":"+pad2(d.getMinutes()));
  871. $("#clock-date").text(_day[d.getDay()]+", "+_mon[d.getMonth()]+" "+d.getDate());
  872. }
  873. function pad2(n){return n<10?"0"+n:""+n;}
  874. /* ─────────────────────────────────────────────
  875. USER INFO
  876. ───────────────────────────────────────────── */
  877. function initUserInfo(){
  878. $.get("system/desktop/user",function(d){
  879. if(d.error)return;
  880. userInfo=d;
  881. $("#cp-name").text(d.Username);
  882. $("#cp-grp").text("@"+(d.UserGroups||[]).join("/"));
  883. if(d.UserIcon)$("#cp-av").attr("src",d.UserIcon);
  884. loadCpAccounts();
  885. });
  886. }
  887. function loadCpAccounts(){
  888. $("#cp-acc-list").empty();
  889. $.get("system/auth/u/list",function(data){
  890. if(!data||data.error)return;
  891. data.forEach(function(ac){
  892. if(ac.Username===userInfo.Username)return;
  893. $.get("system/desktop/user?target="+ac.Username,function(ud){
  894. var ic=ud.UserIcon||"img/desktop/system_icon/user.svg";
  895. $("#cp-acc-list").append(
  896. '<div class="cp-acc-item" onclick="cpSwitch(\''+escA(ac.Username)+'\')">'
  897. +'<img src="'+escA(ic)+'">'
  898. +'<span class="cp-acc-name">'+escH(ac.Username)+(ac.IsExpired?" (expired)":"")+"</span>"
  899. +'</div>'
  900. );
  901. });
  902. });
  903. });
  904. }
  905. /* ─────────────────────────────────────────────
  906. CONTROL PANEL
  907. ───────────────────────────────────────────── */
  908. function cpToggle(){cpOpen?cpClose():cpShow();}
  909. var cpOpen=false;
  910. function cpShow(){cpOpen=true;$("#cp-panel,#cp-backdrop").addClass("on");}
  911. function cpClose(){cpOpen=false;$("#cp-panel,#cp-backdrop").removeClass("on");}
  912. function cpToggleDark(){
  913. setDarkMode(!isDark);
  914. $.get("system/file_system/preference?key=file_explorer/theme&value="+(isDark?"darkTheme":"whiteTheme"));
  915. }
  916. function cpFullscreen(){
  917. cpClose();
  918. var el=document.documentElement;
  919. if(!document.fullscreenElement){(el.requestFullscreen||el.webkitRequestFullscreen||el.mozRequestFullScreen).call(el);}
  920. else{(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen).call(document);}
  921. }
  922. function cpWallpaper(){
  923. cpClose();
  924. newFloatWindow({
  925. url:"SystemAO/system_setting/index.html#"+encodeURIComponent(JSON.stringify({group:"Desktop",name:"Wallpaper"})),
  926. appicon:"SystemAO/desktop/img/personalization.png",
  927. title:"System Settings"
  928. });
  929. }
  930. function cpSettings(){cpClose();openModule("System Setting");}
  931. function cpLogout(){
  932. cpClose();
  933. if(confirm(mLoc.getString("quickAccess/logout/confirm","Sign out of ArozOS?"))){
  934. $.get("system/auth/logout",function(){window.location.href="/";});
  935. }
  936. }
  937. function cpAddAccount(){
  938. cpClose();
  939. newFloatWindow({url:"SystemAO/advance/switchAccount.html",appicon:"SystemAO/desktop/img/account-switch.png",title:"Switch Account"});
  940. }
  941. function cpSwitch(username){
  942. cpClose();
  943. $.ajax({url:"system/auth/u/switch",data:{username:username},success:function(d){
  944. if(d.error)alert(d.error);else window.location.reload();
  945. }});
  946. }
  947. /* ─────────────────────────────────────────────
  948. MODULE OPENING
  949. ───────────────────────────────────────────── */
  950. function openModule(name){
  951. $.get("system/modules/getLaunchPara?module="+encodeURIComponent(name),function(d){
  952. if(d.error){if(d.error==="Not logged in.")window.location.href="login.html";return;}
  953. var url=d.StartDir, ic=d.IconPath||"img/system/favicon.png";
  954. if(d.SupportFW&&d.LaunchFWDir)url=d.LaunchFWDir;
  955. newFloatWindow({url:url,appicon:ic,title:d.Name});
  956. });
  957. }
  958. function openFileWithModule(info,files){
  959. var url=info.StartDir, ic=info.IconPath||"img/system/favicon.png";
  960. if(info.SupportFW&&info.LaunchFWDir)url=info.LaunchFWDir;
  961. if(info.SupportEmb&&info.LaunchEmb)url=info.LaunchEmb;
  962. newFloatWindow({url:url+"#"+encodeURIComponent(JSON.stringify(files)),appicon:ic,title:info.Name});
  963. }
  964. /* ─────────────────────────────────────────────
  965. FLOAT WINDOW LAYER (full API compatibility)
  966. ───────────────────────────────────────────── */
  967. function newFloatWindow(opts){
  968. var wid = Date.now()+"";
  969. var par = opts.parent||"", cb = opts.callback||"";
  970. var url = opts.url||"", title = opts.title||"Window", ic = opts.appicon||"img/system/favicon.png";
  971. // Structure: .floatWindowWrapper > .floatWindow[windowId,parent,callback] > .fwtab > iframe
  972. var wrap=$('<div class="floatWindowWrapper" windowId="'+wid+'">'
  973. +'<div class="floatWindow" windowId="'+wid+'" parent="'+escA(par)+'" callback="'+escA(cb)+'">'
  974. +'<div class="fwtab">'
  975. +'<iframe src="'+escA(url)+'" allow="fullscreen"></iframe>'
  976. +'</div></div></div>');
  977. $("#fw-body").append(wrap);
  978. // Hide others, show this
  979. $(".floatWindowWrapper").removeClass("on").hide();
  980. wrap.addClass("on").show();
  981. // Tab button
  982. var tab=$('<div class="fw-tab on" data-wid="'+wid+'">'
  983. +'<img src="'+escA(ic)+'" onerror="this.src=\'img/system/favicon.png\'">'
  984. +'<span class="fw-tab-title">'+escH(title)+'</span>'
  985. +'<span class="fw-tab-x" onclick="fwTabClose(event,\''+wid+'\')">×</span>'
  986. +'</div>');
  987. tab.on("click",function(e){if(!$(e.target).hasClass("fw-tab-x"))fwFocus(wid);});
  988. $("#fw-tabs .fw-tab").removeClass("on");
  989. $("#fw-tabs").append(tab);
  990. $("#fw-layer").addClass("on");
  991. return wid;
  992. }
  993. function fwBack(){
  994. // Close all windows and return to launchpad
  995. $(".floatWindowWrapper").each(function(){closeFwProcess($(this).attr("windowId"));});
  996. $("#fw-layer").removeClass("on");
  997. }
  998. function fwFocus(wid){
  999. $(".floatWindowWrapper").removeClass("on").hide();
  1000. $(".fw-tab").removeClass("on");
  1001. var fw=getFloatWindowByID(wid);
  1002. if(fw)fw.addClass("on").show();
  1003. $(".fw-tab[data-wid='"+wid+"']").addClass("on");
  1004. }
  1005. function fwTabClose(e,wid){e.stopPropagation();closeFloatWindow(wid);}
  1006. function closeFwProcess(wid){
  1007. var prev=getPreviousWindowObject(wid);
  1008. $(".floatWindowWrapper[windowId='"+wid+"']").remove();
  1009. $(".fw-tab[data-wid='"+wid+"']").remove();
  1010. if(!$(".floatWindowWrapper").length){
  1011. $("#fw-layer").removeClass("on");
  1012. }else if(prev){
  1013. fwFocus(prev);
  1014. }else{
  1015. fwFocus($(".floatWindowWrapper").last().attr("windowId"));
  1016. }
  1017. }
  1018. function closeFloatWindow(wid){
  1019. var fw=getFloatWindowByID(wid);
  1020. if(!fw)return;
  1021. try{
  1022. var cw=fw.find("iframe")[0].contentWindow;
  1023. if(cw&&cw.ao_module_close){cw.ao_module_close();return;}
  1024. }catch(e){}
  1025. closeFwProcess(wid);
  1026. }
  1027. function getFloatWindowByID(id){
  1028. var f=null;
  1029. $(".floatWindowWrapper").each(function(){if($(this).attr("windowId")===""+id)f=$(this);});
  1030. return f;
  1031. }
  1032. function MoveFloatWindowToTop(fw){
  1033. var id=$(fw).attr("windowId")||$(fw).find(".floatWindow").attr("windowId");
  1034. if(id)fwFocus(id);
  1035. }
  1036. function setFloatWindowTitle(id,t){$(".fw-tab[data-wid='"+id+"'] .fw-tab-title").text(t);}
  1037. function setFloatWindowResizePolicy(){}
  1038. function setFloatWindowSize(){}
  1039. function setFloatWindowMinSize(){}
  1040. function setFloatWindowMinimizePolicy(){}
  1041. function PinFloatWindowToTopMostMode(){}
  1042. function UnpinFloatWindowFromTopMostMode(){}
  1043. function bindObjectToIMEEvents(){}
  1044. function getPreviousWindowObject(wid){
  1045. var prev=null,res=null;
  1046. $(".fw-tab").each(function(){
  1047. var w=$(this).data("wid");
  1048. if(w===wid)res=prev;else prev=w;
  1049. });
  1050. return res;
  1051. }
  1052. /* Legacy taskbar stubs (no sidebar in new design) */
  1053. function showTaskBar(){}
  1054. function hideTaskBar(){}
  1055. function showShortcuts(){}
  1056. function hideShortcuts(){}
  1057. function showDesktop(){$("#fw-layer").removeClass("on");}
  1058. function openDesktopCustomization(){cpWallpaper();}
  1059. function openDesktopAsFolder(){
  1060. window.open("SystemAO/file_system/file_explorer.html#"+encodeURIComponent("user:/Desktop/"),"_blank");
  1061. }
  1062. function openSystemSettings(){cpSettings();}
  1063. function initDesktop(){window.location.reload();}
  1064. function fullscreen(){cpFullscreen();}
  1065. function logout(){cpLogout();}
  1066. function toggleProfileInfo(){}
  1067. /* ─────────────────────────────────────────────
  1068. STARTUP AUDIO
  1069. ───────────────────────────────────────────── */
  1070. function initStartupAudio(){
  1071. pref("startup-audio",function(d){
  1072. if(!d)return;
  1073. var v=parseFloat(localStorage.getItem("global_volume"))||0.7;
  1074. var a=new Audio("media?file="+d);
  1075. a.volume=v; a.play().catch(function(){});
  1076. });
  1077. }
  1078. /* ─────────────────────────────────────────────
  1079. STORAGE HELPERS
  1080. ───────────────────────────────────────────── */
  1081. function pref(key,cb){
  1082. $.ajax({url:"system/desktop/preference",method:"POST",data:{preference:key},success:cb});
  1083. }
  1084. function setPref(key,val,cb){
  1085. $.ajax({url:"system/desktop/preference",method:"POST",data:{preference:key,value:val},
  1086. success:function(d){if(!d.error&&cb)cb();}});
  1087. }
  1088. function getStorage(key,cb){pref(key,cb);}
  1089. function setStorage(key,val,cb){setPref(key,val,cb);}
  1090. /* ─────────────────────────────────────────────
  1091. CONNECTION CHECK
  1092. ───────────────────────────────────────────── */
  1093. function connCheck(){
  1094. setInterval(function(){
  1095. $.ajax({url:"system/auth/checkLogin",timeout:15000,
  1096. success:function(d){if(!d)window.location.href="index.html";$("#conndrop").hide();},
  1097. error:function(){$("#conndrop").css("display","flex");}
  1098. });
  1099. },15000);
  1100. }
  1101. /* ─────────────────────────────────────────────
  1102. UTILITY
  1103. ───────────────────────────────────────────── */
  1104. function escH(s){return $("<span>").text(s||"").html();}
  1105. function escA(s){return(s||"").replace(/"/g,"&quot;").replace(/'/g,"&#39;");}
  1106. /* ─────────────────────────────────────────────
  1107. FW TAB LONG-PRESS CONTEXT MENU
  1108. ───────────────────────────────────────────── */
  1109. var _fwCtxWid = null;
  1110. var _fwLongPressTimer = null;
  1111. var _fwLongPressFired = false;
  1112. (function(){
  1113. var fwTabs = document.getElementById("fw-tabs");
  1114. var startX, startY;
  1115. fwTabs.addEventListener("touchstart", function(e){
  1116. var tab = e.target.closest(".fw-tab");
  1117. if(!tab || e.target.closest(".fw-tab-x")) return;
  1118. var wid = tab.getAttribute("data-wid");
  1119. var touch = e.touches[0];
  1120. startX = touch.clientX; startY = touch.clientY;
  1121. _fwLongPressFired = false;
  1122. _fwLongPressTimer = setTimeout(function(){
  1123. _fwLongPressFired = true;
  1124. fwCtxShow(wid, startX, startY);
  1125. if(navigator.vibrate) navigator.vibrate(35);
  1126. }, 500);
  1127. }, {passive: true});
  1128. fwTabs.addEventListener("touchmove", function(e){
  1129. if(!_fwLongPressTimer) return;
  1130. var t = e.touches[0];
  1131. if(Math.abs(t.clientX - startX) > 8 || Math.abs(t.clientY - startY) > 8){
  1132. clearTimeout(_fwLongPressTimer);
  1133. _fwLongPressTimer = null;
  1134. }
  1135. }, {passive: true});
  1136. fwTabs.addEventListener("touchend", function(){
  1137. clearTimeout(_fwLongPressTimer);
  1138. _fwLongPressTimer = null;
  1139. }, {passive: true});
  1140. // Suppress the click that follows a long-press
  1141. fwTabs.addEventListener("click", function(e){
  1142. if(_fwLongPressFired){
  1143. _fwLongPressFired = false;
  1144. e.stopPropagation();
  1145. e.preventDefault();
  1146. }
  1147. }, true);
  1148. })();
  1149. function fwCtxShow(wid, x, y){
  1150. _fwCtxWid = wid;
  1151. var menu = document.getElementById("fw-ctx-menu");
  1152. var menuW = 224, menuH = 150;
  1153. var left = Math.min(x, window.innerWidth - menuW - 10);
  1154. var top = Math.min(y, window.innerHeight - menuH - 10);
  1155. left = Math.max(10, left);
  1156. top = Math.max(10, top);
  1157. menu.style.left = left + "px";
  1158. menu.style.top = top + "px";
  1159. document.getElementById("fw-ctx-overlay").classList.add("on");
  1160. menu.style.display = "block";
  1161. // re-trigger animation
  1162. menu.style.animation = "none";
  1163. menu.offsetHeight; // reflow
  1164. menu.style.animation = "";
  1165. }
  1166. function fwCtxClose(){
  1167. _fwCtxWid = null;
  1168. document.getElementById("fw-ctx-overlay").classList.remove("on");
  1169. document.getElementById("fw-ctx-menu").style.display = "none";
  1170. }
  1171. function fwCtxGetUrl(){
  1172. if(!_fwCtxWid) return null;
  1173. var fw = getFloatWindowByID(_fwCtxWid);
  1174. if(!fw) return null;
  1175. try{ return fw.find("iframe")[0].src || null; }catch(e){ return null; }
  1176. }
  1177. function fwCtxNewTab(){
  1178. var url = fwCtxGetUrl();
  1179. fwCtxClose();
  1180. if(url) window.open(url, "_blank");
  1181. }
  1182. function fwCtxCopy(){
  1183. var url = fwCtxGetUrl();
  1184. fwCtxClose();
  1185. if(!url) return;
  1186. if(navigator.clipboard){
  1187. navigator.clipboard.writeText(url).catch(function(){});
  1188. } else {
  1189. var ta = document.createElement("textarea");
  1190. ta.value = url; ta.style.cssText = "position:fixed;opacity:0";
  1191. document.body.appendChild(ta); ta.select();
  1192. document.execCommand("copy"); document.body.removeChild(ta);
  1193. }
  1194. }
  1195. function fwCtxCloseWindow(){
  1196. var wid = _fwCtxWid;
  1197. fwCtxClose();
  1198. if(wid) closeFloatWindow(wid);
  1199. }
  1200. </script>
  1201. </body>
  1202. </html>