quota.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. <style>
  2. #quota-root {
  3. --q-bg: #ffffff;
  4. --q-border: #e5e5e5;
  5. --q-text: #1d1d1f;
  6. --q-dim: #6e6e73;
  7. --q-muted: #98989d;
  8. --q-soft: #f5f5f7;
  9. --q-shadow: 0 4px 20px rgba(0,0,0,0.08);
  10. --q-accent: #0071e3;
  11. --q-track: #e0e0e0;
  12. --q-divider: #e0e0e0;
  13. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  14. font-size: 14px;
  15. -webkit-font-smoothing: antialiased;
  16. color: var(--q-text);
  17. background: var(--q-bg);
  18. border: 1px solid var(--q-border);
  19. border-radius: 12px;
  20. /* box-shadow: var(--q-shadow); */
  21. padding: 20px;
  22. margin-bottom: 4px;
  23. }
  24. #quota-root.dark {
  25. --q-bg: #2b2b2b;
  26. --q-border: #3b3b3b;
  27. --q-text: #ececec;
  28. --q-dim: #aaaaaa;
  29. --q-muted: #636368;
  30. --q-soft: #343434;
  31. --q-shadow: 0 8px 22px rgba(0,0,0,0.3);
  32. --q-accent: #2997ff;
  33. --q-track: #4a4a4a;
  34. --q-divider: #3b3b3b;
  35. }
  36. /* ── Header ─────────────────────────────────────────────── */
  37. #quota-header {
  38. display: flex;
  39. align-items: baseline;
  40. justify-content: space-between;
  41. gap: 8px;
  42. margin-bottom: 14px;
  43. }
  44. #quota-title {
  45. font-size: 15px;
  46. font-weight: 600;
  47. letter-spacing: -0.15px;
  48. color: var(--q-text);
  49. }
  50. #quota-summary {
  51. font-size: 12px;
  52. color: var(--q-dim);
  53. white-space: nowrap;
  54. }
  55. /* ── Quota usage bar ─────────────────────────────────────── */
  56. #quota-bar-track {
  57. width: 100%;
  58. height: 10px;
  59. border-radius: 5px;
  60. background: var(--q-track);
  61. overflow: hidden;
  62. margin-bottom: 6px;
  63. }
  64. #quota-bar-fill {
  65. height: 100%;
  66. border-radius: 5px;
  67. background: var(--q-accent);
  68. transition: width 0.5s cubic-bezier(.4,0,.2,1);
  69. width: 0%;
  70. }
  71. #quota-bar-fill.quota-warn { background: #ff9f0a; }
  72. #quota-bar-fill.quota-critical { background: #ff3b30; }
  73. #quota-bar-labels {
  74. display: flex;
  75. justify-content: space-between;
  76. font-size: 11px;
  77. color: var(--q-muted);
  78. margin-bottom: 18px;
  79. }
  80. /* ── Divider ─────────────────────────────────────────────── */
  81. #quota-divider {
  82. height: 1px;
  83. background: var(--q-divider);
  84. margin: 2px 0 16px;
  85. }
  86. /* ── Distribution section ────────────────────────────────── */
  87. #quota-dist-label {
  88. font-size: 11px;
  89. font-weight: 500;
  90. color: var(--q-muted);
  91. letter-spacing: 0.4px;
  92. text-transform: uppercase;
  93. margin-bottom: 10px;
  94. }
  95. #quota-dist-bar {
  96. width: 100%;
  97. height: 14px;
  98. border-radius: 7px;
  99. overflow: hidden;
  100. display: flex;
  101. background: var(--q-track);
  102. margin-bottom: 14px;
  103. gap: 1px;
  104. }
  105. .quota-seg {
  106. height: 100%;
  107. min-width: 3px;
  108. transition: width 0.5s cubic-bezier(.4,0,.2,1);
  109. flex-shrink: 0;
  110. }
  111. /* ── Legend grid ─────────────────────────────────────────── */
  112. #quota-legend {
  113. display: grid;
  114. grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  115. gap: 6px 14px;
  116. }
  117. .quota-legend-row {
  118. display: flex;
  119. align-items: center;
  120. gap: 7px;
  121. font-size: 12px;
  122. min-width: 0;
  123. }
  124. .quota-legend-dot {
  125. width: 9px;
  126. height: 9px;
  127. border-radius: 2px;
  128. flex-shrink: 0;
  129. }
  130. .quota-legend-name {
  131. flex: 1;
  132. min-width: 0;
  133. overflow: hidden;
  134. text-overflow: ellipsis;
  135. white-space: nowrap;
  136. color: var(--q-text);
  137. }
  138. .quota-legend-size {
  139. color: var(--q-muted);
  140. white-space: nowrap;
  141. flex-shrink: 0;
  142. }
  143. /* ── Skeleton / loading states ───────────────────────────── */
  144. #quota-dist-loading {
  145. font-size: 12px;
  146. color: var(--q-muted);
  147. padding: 4px 0 2px;
  148. }
  149. /* ── Detail table ────────────────────────────────────────── */
  150. #quota-table-wrap {
  151. margin-top: 14px;
  152. padding-top: 14px;
  153. border-top: 1px solid var(--q-divider);
  154. display: none;
  155. }
  156. #quota-table-label {
  157. font-size: 11px;
  158. font-weight: 500;
  159. color: var(--q-muted);
  160. letter-spacing: 0.4px;
  161. text-transform: uppercase;
  162. margin-bottom: 10px;
  163. }
  164. #quota-table {
  165. width: 100%;
  166. border-collapse: collapse;
  167. }
  168. #quota-table thead th {
  169. font-size: 11px;
  170. font-weight: 500;
  171. color: var(--q-muted);
  172. text-align: left;
  173. padding: 0 0 8px;
  174. border-bottom: 1px solid var(--q-divider);
  175. }
  176. #quota-table thead th:not(:first-child) { text-align: right; }
  177. #quota-table tbody tr { border-bottom: 1px solid var(--q-divider); }
  178. #quota-table tbody tr:last-child { border-bottom: none; }
  179. #quota-table tbody td {
  180. padding: 8px 0;
  181. font-size: 12.5px;
  182. vertical-align: middle;
  183. color: var(--q-dim);
  184. white-space: nowrap;
  185. padding-left: 12px;
  186. }
  187. #quota-table tbody td:first-child {
  188. padding-left: 0;
  189. width: 100%;
  190. }
  191. #quota-table tbody td:not(:first-child) { text-align: right; }
  192. .quota-table-type {
  193. display: flex;
  194. align-items: center;
  195. gap: 8px;
  196. color: var(--q-text);
  197. min-width: 0;
  198. }
  199. .quota-table-dot {
  200. width: 9px;
  201. height: 9px;
  202. border-radius: 2px;
  203. flex-shrink: 0;
  204. }
  205. /* ── Space finder ──────────────────────────────────────────── */
  206. #quota-finder-wrap {
  207. margin-top: 14px;
  208. padding-top: 14px;
  209. border-top: 1px solid var(--q-divider);
  210. }
  211. #quota-finder-label {
  212. font-size: 11px;
  213. font-weight: 500;
  214. color: var(--q-muted);
  215. letter-spacing: 0.4px;
  216. text-transform: uppercase;
  217. margin-bottom: 10px;
  218. }
  219. .quota-finder-row {
  220. display: flex;
  221. align-items: center;
  222. gap: 8px;
  223. padding: 8px 0;
  224. border-bottom: 1px solid var(--q-divider);
  225. min-width: 0;
  226. }
  227. .quota-finder-row:last-child { border-bottom: none; }
  228. .quota-finder-info {
  229. flex: 1;
  230. min-width: 0;
  231. overflow: hidden;
  232. }
  233. .quota-finder-name {
  234. font-size: 13px;
  235. font-weight: 500;
  236. color: var(--q-text);
  237. overflow: hidden;
  238. text-overflow: ellipsis;
  239. white-space: nowrap;
  240. }
  241. .quota-finder-path {
  242. font-size: 11px;
  243. color: var(--q-muted);
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. white-space: nowrap;
  247. margin-top: 2px;
  248. }
  249. .quota-finder-size {
  250. font-size: 12px;
  251. color: var(--q-dim);
  252. white-space: nowrap;
  253. flex-shrink: 0;
  254. }
  255. .quota-finder-btn {
  256. display: inline-flex;
  257. align-items: center;
  258. gap: 4px;
  259. background: none;
  260. border: 1px solid var(--q-border);
  261. border-radius: 6px;
  262. padding: 4px 8px;
  263. cursor: pointer;
  264. color: var(--q-dim);
  265. font-size: 11px;
  266. font-family: inherit;
  267. white-space: nowrap;
  268. flex-shrink: 0;
  269. transition: background 0.1s, color 0.1s, border-color 0.1s;
  270. }
  271. .quota-finder-btn:hover {
  272. background: var(--q-soft);
  273. color: var(--q-text);
  274. }
  275. .quota-finder-btn.quota-finder-del:hover {
  276. background: rgba(255, 59, 48, 0.08);
  277. color: #ff3b30;
  278. border-color: rgba(255, 59, 48, 0.4);
  279. }
  280. #quota-finder-more {
  281. margin-top: 12px;
  282. }
  283. #quota-finder-more-btn {
  284. background: none;
  285. border: 1px solid var(--q-border);
  286. border-radius: 8px;
  287. padding: 7px 0;
  288. cursor: pointer;
  289. color: var(--q-accent);
  290. font-size: 12px;
  291. font-family: inherit;
  292. width: 100%;
  293. transition: background 0.1s;
  294. }
  295. #quota-finder-more-btn:hover { background: var(--q-soft); }
  296. @media (max-width: 480px) {
  297. #quota-root { padding: 14px; }
  298. #quota-legend { grid-template-columns: 1fr; }
  299. }
  300. </style>
  301. <div id="quota-root">
  302. <!-- Header -->
  303. <div id="quota-header">
  304. <span id="quota-title" locale="quota/title">Storage Quota</span>
  305. <span id="quota-summary">-</span>
  306. </div>
  307. <!-- Main quota bar -->
  308. <div id="quota-bar-track">
  309. <div id="quota-bar-fill"></div>
  310. </div>
  311. <div id="quota-bar-labels">
  312. <span id="quota-used-lbl">-</span>
  313. <span id="quota-total-lbl">-</span>
  314. </div>
  315. <div id="quota-divider"></div>
  316. <!-- File-type distribution -->
  317. <div id="quota-dist-label" locale="quota/dist_title">File Type Distribution</div>
  318. <div id="quota-dist-bar"><!-- filled by JS --></div>
  319. <div id="quota-legend">
  320. <div id="quota-dist-loading"><span locale="quota/loading">Calculating…</span></div>
  321. </div>
  322. <!-- Detail table -->
  323. <div id="quota-table-wrap">
  324. <div id="quota-table-label" locale="quota/table_title">File Details</div>
  325. <table id="quota-table">
  326. <thead>
  327. <tr>
  328. <th locale="quota/table_category">Category</th>
  329. <th locale="quota/table_files">Files</th>
  330. <th locale="quota/table_size">Size</th>
  331. </tr>
  332. </thead>
  333. <tbody id="quota-table-body"></tbody>
  334. </table>
  335. </div>
  336. <!-- Space Finder -->
  337. <div id="quota-finder-wrap" style="display:none">
  338. <div id="quota-finder-label" locale="quota/finder_title">Largest Files</div>
  339. <div id="quota-finder-list"></div>
  340. <div id="quota-finder-more" style="display:none">
  341. <button id="quota-finder-more-btn" onclick="quotaFinderLoadMore()">
  342. <span id="quota-finder-more-lbl"></span>
  343. </button>
  344. </div>
  345. </div>
  346. </div>
  347. <script>
  348. (function () {
  349. var quotaLocale = NewAppLocale();
  350. var QUOTA_COLORS = [
  351. '#5ac8fa', '#007aff', '#34c759', '#ff9f0a',
  352. '#ff3b30', '#af52de', '#ff2d55', '#5856d6',
  353. '#30b0c7', '#a2845e', '#8e8e93', '#636366'
  354. ];
  355. function quotaColor(i) {
  356. return QUOTA_COLORS[i % QUOTA_COLORS.length];
  357. }
  358. function quotaStr(key, fallback) {
  359. return (quotaLocale && quotaLocale.getString) ? quotaLocale.getString(key, fallback) : fallback;
  360. }
  361. /* ── Theme ── */
  362. function quotaApplyTheme() {
  363. var root = document.getElementById('quota-root');
  364. if (!root) return;
  365. try {
  366. if (typeof preferredTheme !== 'undefined') {
  367. root.classList.toggle('dark', preferredTheme === 'dark' || preferredTheme === 'darkTheme');
  368. } else {
  369. ao_module_getSystemThemeColor(function (c) {
  370. root.classList.toggle('dark', c !== 'whiteTheme');
  371. });
  372. }
  373. } catch (e) {}
  374. }
  375. /* ── Quota bar ── */
  376. function quotaInitBar() {
  377. $.get('../../../system/disk/quota/quotaInfo', function (data) {
  378. if (!data || data.error !== undefined) return;
  379. var used = data.Used;
  380. var total = data.Total;
  381. var usedFmt = ao_module_utils.formatBytes(used, 2);
  382. var totalFmt, pct = 0;
  383. if (total < 0) {
  384. totalFmt = quotaStr('quota/unlimited', 'Unlimited');
  385. pct = 0;
  386. } else if (total === 0) {
  387. totalFmt = quotaStr('quota/readonly', 'Read Only');
  388. pct = 100;
  389. } else {
  390. totalFmt = ao_module_utils.formatBytes(total, 2);
  391. pct = Math.min((used / total) * 100, 100);
  392. }
  393. var pctLabel = (total > 0 && total !== -1) ? ' · ' + pct.toFixed(1) + '%' : '';
  394. $('#quota-used-lbl').text(usedFmt + pctLabel);
  395. $('#quota-total-lbl').text(totalFmt);
  396. $('#quota-summary').text(usedFmt + ' / ' + totalFmt);
  397. var fill = document.getElementById('quota-bar-fill');
  398. fill.style.width = pct + '%';
  399. fill.className = 'quota-bar-fill' +
  400. (pct >= 90 ? ' quota-critical' : pct >= 75 ? ' quota-warn' : '');
  401. });
  402. }
  403. /* ── Distribution bar ── */
  404. function quotaInitDist() {
  405. $.get('../../../system/disk/quota/quotaDist', function (list) {
  406. var loadingEl = document.getElementById('quota-dist-loading');
  407. var barEl = document.getElementById('quota-dist-bar');
  408. var legendEl = document.getElementById('quota-legend');
  409. var tableWrap = document.getElementById('quota-table-wrap');
  410. var tableBody = document.getElementById('quota-table-body');
  411. if (!list || list.length === 0) {
  412. if (loadingEl) loadingEl.innerHTML =
  413. '<span>' + quotaStr('quota/no_data', 'No data available') + '</span>';
  414. return;
  415. }
  416. var totalBytes = list.reduce(function (s, item) { return s + item.Size; }, 0);
  417. /* Accurate used-space update */
  418. var accurateFmt = ao_module_utils.formatBytes(totalBytes, 2);
  419. var prevLabel = $('#quota-used-lbl').text();
  420. var dotIdx = prevLabel.indexOf(' · ');
  421. $('#quota-used-lbl').text(accurateFmt + (dotIdx >= 0 ? prevLabel.slice(dotIdx) : ''));
  422. $('#quota-summary').text(function (_, old) {
  423. return accurateFmt + old.slice(old.indexOf(' / '));
  424. });
  425. /* Build distribution bar, legend, and table */
  426. barEl.innerHTML = '';
  427. legendEl.innerHTML = '';
  428. tableBody.innerHTML = '';
  429. list.forEach(function (item, i) {
  430. var color = quotaColor(i);
  431. var pct = totalBytes > 0 ? (item.Size / totalBytes) * 100 : 0;
  432. /* Bar segment */
  433. var seg = document.createElement('div');
  434. seg.className = 'quota-seg';
  435. seg.style.cssText = 'width:' + pct + '%;background:' + color;
  436. seg.title = quotaEsc(item.Mime) + ': ' + ao_module_utils.formatBytes(item.Size, 2);
  437. barEl.appendChild(seg);
  438. /* Legend row */
  439. var row = document.createElement('div');
  440. row.className = 'quota-legend-row';
  441. row.innerHTML =
  442. '<span class="quota-legend-dot" style="background:' + color + '"></span>' +
  443. '<span class="quota-legend-name">' + quotaEsc(item.Mime) + '</span>' +
  444. '<span class="quota-legend-size">' + ao_module_utils.formatBytes(item.Size, 2) + '</span>';
  445. legendEl.appendChild(row);
  446. /* Table row */
  447. var tr = document.createElement('tr');
  448. tr.innerHTML =
  449. '<td><div class="quota-table-type">' +
  450. '<span class="quota-table-dot" style="background:' + color + '"></span>' +
  451. quotaEsc(item.Mime) +
  452. '</div></td>' +
  453. '<td>' + (item.Count || 0) + '</td>' +
  454. '<td>' + ao_module_utils.formatBytes(item.Size, 2) + '</td>';
  455. tableBody.appendChild(tr);
  456. });
  457. tableWrap.style.display = '';
  458. });
  459. }
  460. function quotaEsc(str) {
  461. return String(str)
  462. .replace(/&/g, '&amp;').replace(/</g, '&lt;')
  463. .replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  464. }
  465. /* ── Space finder ── */
  466. var quotaFinderAll = [];
  467. var quotaFinderShown = 0;
  468. var QUOTA_FINDER_STEPS = [20, 50, 100];
  469. function quotaInitFinder() {
  470. $.get('../../../system/disk/space/largeFiles?number=100', function (data) {
  471. if (!data || data.length === 0) return;
  472. quotaFinderAll = data;
  473. quotaFinderShown = 0;
  474. document.getElementById('quota-finder-list').innerHTML = '';
  475. document.getElementById('quota-finder-wrap').style.display = '';
  476. quotaFinderRender(Math.min(QUOTA_FINDER_STEPS[0], data.length));
  477. });
  478. }
  479. function quotaFinderRender(upTo) {
  480. var listEl = document.getElementById('quota-finder-list');
  481. var limit = Math.min(upTo, quotaFinderAll.length);
  482. for (var i = quotaFinderShown; i < limit; i++) {
  483. var file = quotaFinderAll[i];
  484. var parts = file.Filepath.split('/');
  485. parts.pop();
  486. var dir = parts.join('/');
  487. var row = document.createElement('div');
  488. row.className = 'quota-finder-row';
  489. row.setAttribute('data-filepath', file.Filepath);
  490. row.innerHTML =
  491. '<div class="quota-finder-info">' +
  492. '<div class="quota-finder-name">' + quotaEsc(file.Filename) + '</div>' +
  493. '<div class="quota-finder-path">' + quotaEsc(dir + '/') + '</div>' +
  494. '</div>' +
  495. '<span class="quota-finder-size">' + ao_module_utils.formatBytes(file.Size, 2) + '</span>' +
  496. '<button class="quota-finder-btn" onclick="quotaFinderOpenBtn(this)" title="' + quotaStr('quota/finder_open', 'Open in File Manager') + '">' +
  497. '<svg width="12" height="12" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 5.5a1 1 0 011-1h3.086a1 1 0 01.707.293L7.207 5.707A1 1 0 007.914 6H13.5a1 1 0 011 1v6.5a1 1 0 01-1 1h-11a1 1 0 01-1-1V5.5z" stroke="currentColor" stroke-width="1.3"/></svg>' +
  498. ' ' + quotaStr('quota/finder_open', 'Open') +
  499. '</button>' +
  500. '<button class="quota-finder-btn quota-finder-del" onclick="quotaFinderDeleteBtn(this)" title="' + quotaStr('quota/finder_delete', 'Delete') + '">' +
  501. '<svg width="12" height="12" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 4h12M6 4V2.5h4V4M3.5 4l1 8.5a1 1 0 001 1h5a1 1 0 001-1l1-8.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>' +
  502. ' ' + quotaStr('quota/finder_delete', 'Delete') +
  503. '</button>';
  504. listEl.appendChild(row);
  505. }
  506. quotaFinderShown = limit;
  507. quotaFinderUpdateMore();
  508. }
  509. function quotaFinderUpdateMore() {
  510. var moreDiv = document.getElementById('quota-finder-more');
  511. var moreLbl = document.getElementById('quota-finder-more-lbl');
  512. var nextStep = null;
  513. for (var i = 0; i < QUOTA_FINDER_STEPS.length; i++) {
  514. if (QUOTA_FINDER_STEPS[i] > quotaFinderShown) {
  515. nextStep = Math.min(QUOTA_FINDER_STEPS[i], quotaFinderAll.length);
  516. break;
  517. }
  518. }
  519. if (nextStep !== null && nextStep > quotaFinderShown) {
  520. moreDiv.style.display = '';
  521. moreLbl.textContent = quotaStr('quota/finder_load_more', 'Load More') +
  522. ' (' + quotaFinderShown + ' / ' + quotaFinderAll.length + ')';
  523. } else {
  524. moreDiv.style.display = 'none';
  525. }
  526. }
  527. function quotaFinderLoadMore() {
  528. var nextStep = null;
  529. for (var i = 0; i < QUOTA_FINDER_STEPS.length; i++) {
  530. if (QUOTA_FINDER_STEPS[i] > quotaFinderShown) {
  531. nextStep = Math.min(QUOTA_FINDER_STEPS[i], quotaFinderAll.length);
  532. break;
  533. }
  534. }
  535. if (nextStep === null) nextStep = quotaFinderAll.length;
  536. quotaFinderRender(nextStep);
  537. }
  538. function quotaFinderGetRow(btn) {
  539. var el = btn;
  540. while (el && !(el.className && el.className.indexOf('quota-finder-row') >= 0)) {
  541. el = el.parentNode;
  542. }
  543. return el;
  544. }
  545. function quotaFinderOpenBtn(btn) {
  546. var row = quotaFinderGetRow(btn);
  547. if (!row) return;
  548. var fp = row.getAttribute('data-filepath');
  549. var parts = fp.split('/');
  550. parts.pop();
  551. ao_module_openPath(parts.join('/'));
  552. }
  553. function quotaFinderDeleteBtn(btn) {
  554. var row = quotaFinderGetRow(btn);
  555. if (!row) return;
  556. var fp = row.getAttribute('data-filepath');
  557. var filename = fp.split('/').pop();
  558. if (!confirm(quotaStr('quota/finder_confirm', 'Confirm delete') + ': ' + filename)) return;
  559. btn.disabled = true;
  560. $.get('../../../system/csrf/new', function (token) {
  561. $.ajax({
  562. url: '../../../system/file_system/fileOpr',
  563. method: 'POST',
  564. data: { opr: 'delete', src: JSON.stringify([fp]), csrft: token },
  565. success: function (data) {
  566. if (data.error !== undefined) {
  567. alert(data.error);
  568. btn.disabled = false;
  569. return;
  570. }
  571. for (var i = 0; i < quotaFinderAll.length; i++) {
  572. if (quotaFinderAll[i].Filepath === fp) {
  573. quotaFinderAll.splice(i, 1);
  574. break;
  575. }
  576. }
  577. quotaFinderShown = Math.max(0, quotaFinderShown - 1);
  578. row.remove();
  579. quotaFinderUpdateMore();
  580. }
  581. });
  582. });
  583. }
  584. /* expose to onclick attributes */
  585. window.quotaFinderLoadMore = quotaFinderLoadMore;
  586. window.quotaFinderOpenBtn = quotaFinderOpenBtn;
  587. window.quotaFinderDeleteBtn = quotaFinderDeleteBtn;
  588. /* ── Boot ── */
  589. quotaApplyTheme();
  590. window.detailPageThemeCallback = function(isDark) {
  591. var el = document.getElementById('quota-root');
  592. if (el) el.classList.toggle('dark', isDark);
  593. };
  594. quotaLocale.init('../locale/users/quota.json', function () {
  595. quotaLocale.translate();
  596. quotaInitBar();
  597. quotaInitDist();
  598. quotaInitFinder();
  599. });
  600. })();
  601. </script>