Guest User

Untitled

a guest
Aug 11th, 2026
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.63 KB | None | 0 0
  1. // ==UserScript==
  2. // @name EyeWire Mystic Open+ Registry Scanner
  3. // @namespace eyewire-mystic-open-plus
  4. // @version 1.3.0
  5. // @description Scans marked EyeWire registry cells for genuine unresolved Scout's Log entries and persistently remembers progress/results.
  6. // @match https://eyewire.org/*
  7. // @run-at document-start
  8. // @grant GM_xmlhttpRequest
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @grant GM_deleteValue
  12. // @grant GM_listValues
  13. // @connect script.google.com
  14. // @connect script.googleusercontent.com
  15. // @connect eyewire.org
  16. // @connect scoutslog2.eyewire.org
  17. // ==/UserScript==
  18.  
  19. (function () {
  20. 'use strict';
  21.  
  22. const REGISTRY_EXEC_URL =
  23. 'https://script.google.com/macros/s/AKfycbz5W8WNyqhjn9D3IHE32FGEBM1SjfY4IONl5C_yHvBSi7kAmheHOFhVcoqfe5BiFvIt/exec';
  24.  
  25. const TAB_ID = 'mystic-open-plus-tab';
  26. const PANEL_ID = 'mystic-open-plus-panel';
  27. const STYLE_ID = 'mystic-open-plus-style';
  28.  
  29. // Old page-owned checkpoint, kept for migration from your existing script.
  30. const OLD_PAGE_STATE_KEY = 'mystic-open-plus-registry-state-v110';
  31.  
  32. // Tampermonkey-owned durable storage. These survive F5, Ctrl+F5 and normal browser restarts.
  33. const STATE_KEY = 'mystic-open-plus-persistent-state-v130';
  34. const RESULT_PREFIX = 'mystic-open-plus-persistent-result-v130:';
  35.  
  36. // Existing IndexedDB cache from the previous script is still read/migrated.
  37. const DB_NAME = 'MysticOpenPlusDB';
  38. const DB_VERSION = 1;
  39. const RESULT_STORE = 'results';
  40.  
  41. const CELL_BATCH_SIZE = 4;
  42. const ACTION_CONCURRENCY = 5;
  43. const BETWEEN_ACTION_DELAY_MS = 35;
  44. const BETWEEN_BATCH_DELAY_MS = 100;
  45. const RESOLVED_STATUSES = new Set(['good', 'resolved', 'closed']);
  46.  
  47. let registryCells = [];
  48. let groupedResults = [];
  49. let running = false;
  50. let pauseRequested = false;
  51. let lastRenderTime = 0;
  52. let database = null;
  53. let resultsLoaded = false;
  54.  
  55. /******************************************************************
  56. * PERSISTENT STATE
  57. ******************************************************************/
  58.  
  59. function defaultState() {
  60. return {
  61. registryHash: '',
  62. registryCount: 0,
  63. nextCellIndex: 0,
  64. cellsCompleted: 0,
  65. cubesChecked: 0,
  66. errors: 0,
  67. startedAt: '',
  68. updatedAt: '',
  69. completed: false,
  70. scannedCellIds: []
  71. };
  72. }
  73.  
  74. function normalizeState(raw) {
  75. const state = { ...defaultState(), ...(raw || {}) };
  76. state.registryHash = String(state.registryHash || '');
  77. state.registryCount = Number(state.registryCount || 0);
  78. state.nextCellIndex = Number(state.nextCellIndex || 0);
  79. state.cellsCompleted = Number(state.cellsCompleted || 0);
  80. state.cubesChecked = Number(state.cubesChecked || 0);
  81. state.errors = Number(state.errors || 0);
  82. state.startedAt = String(state.startedAt || '');
  83. state.updatedAt = String(state.updatedAt || '');
  84. state.completed = Boolean(state.completed);
  85. state.scannedCellIds = Array.from(
  86. new Set(
  87. (Array.isArray(state.scannedCellIds) ? state.scannedCellIds : [])
  88. .map(v => String(v || '').trim())
  89. .filter(Boolean)
  90. )
  91. );
  92. return state;
  93. }
  94.  
  95. function loadState() {
  96. try {
  97. const saved = GM_getValue(STATE_KEY, null);
  98. if (saved) return normalizeState(typeof saved === 'string' ? JSON.parse(saved) : saved);
  99. } catch (error) {
  100. console.warn('[Mystic Open+] Could not read Tampermonkey checkpoint:', error);
  101. }
  102.  
  103. // Migrate the existing v1.2.x page checkpoint if present.
  104. for (const storage of [localStorage, sessionStorage]) {
  105. try {
  106. const raw = storage.getItem(OLD_PAGE_STATE_KEY);
  107. if (!raw) continue;
  108. const migrated = normalizeState(JSON.parse(raw));
  109. saveState(migrated);
  110. return migrated;
  111. } catch (error) {
  112. console.warn('[Mystic Open+] Could not migrate old checkpoint:', error);
  113. }
  114. }
  115.  
  116. return defaultState();
  117. }
  118.  
  119. function saveState(state) {
  120. const clean = normalizeState({
  121. ...state,
  122. updatedAt: new Date().toISOString()
  123. });
  124.  
  125. try {
  126. GM_setValue(STATE_KEY, clean);
  127. } catch (error) {
  128. console.warn('[Mystic Open+] Could not persist Tampermonkey checkpoint:', error);
  129. }
  130.  
  131. // Keep a compatibility copy. The script no longer depends on this copy.
  132. try {
  133. localStorage.setItem(OLD_PAGE_STATE_KEY, JSON.stringify(clean));
  134. } catch (_) {}
  135.  
  136. Object.assign(state, clean);
  137. }
  138.  
  139. function clearPersistentState() {
  140. try { GM_deleteValue(STATE_KEY); } catch (_) {}
  141. try { localStorage.removeItem(OLD_PAGE_STATE_KEY); } catch (_) {}
  142. try { sessionStorage.removeItem(OLD_PAGE_STATE_KEY); } catch (_) {}
  143. }
  144.  
  145. function resultKey(taskId) {
  146. return RESULT_PREFIX + String(taskId);
  147. }
  148.  
  149. function loadGMResults() {
  150. const results = [];
  151. try {
  152. for (const key of GM_listValues()) {
  153. if (!String(key).startsWith(RESULT_PREFIX)) continue;
  154. try {
  155. const entry = GM_getValue(key, null);
  156. if (entry && entry.taskId) results.push(entry);
  157. } catch (error) {
  158. console.warn('[Mystic Open+] Could not read saved entry:', key, error);
  159. }
  160. }
  161. } catch (error) {
  162. console.warn('[Mystic Open+] Could not list saved entries:', error);
  163. }
  164. return results;
  165. }
  166.  
  167. function saveGMResult(entry) {
  168. try {
  169. GM_setValue(resultKey(entry.taskId), entry);
  170. } catch (error) {
  171. console.warn('[Mystic Open+] Could not persist entry:', entry && entry.taskId, error);
  172. }
  173. }
  174.  
  175. function deleteGMResult(taskId) {
  176. try { GM_deleteValue(resultKey(taskId)); } catch (_) {}
  177. }
  178.  
  179. function clearGMResults() {
  180. try {
  181. for (const key of GM_listValues()) {
  182. if (String(key).startsWith(RESULT_PREFIX)) GM_deleteValue(key);
  183. }
  184. } catch (error) {
  185. console.warn('[Mystic Open+] Could not clear persistent entries:', error);
  186. }
  187. }
  188.  
  189. /******************************************************************
  190. * INDEXEDDB CACHE + MIGRATION
  191. ******************************************************************/
  192.  
  193. function openDatabase() {
  194. if (database) return Promise.resolve(database);
  195.  
  196. return new Promise((resolve, reject) => {
  197. const request = indexedDB.open(DB_NAME, DB_VERSION);
  198.  
  199. request.onupgradeneeded = event => {
  200. const db = event.target.result;
  201. if (!db.objectStoreNames.contains(RESULT_STORE)) {
  202. const store = db.createObjectStore(RESULT_STORE, { keyPath: 'taskId' });
  203. store.createIndex('cellId', 'cellId', { unique: false });
  204. }
  205. };
  206.  
  207. request.onsuccess = event => {
  208. database = event.target.result;
  209. resolve(database);
  210. };
  211.  
  212. request.onerror = () => reject(request.error);
  213. });
  214. }
  215.  
  216. async function readIndexedResults() {
  217. try {
  218. await openDatabase();
  219. return await new Promise((resolve, reject) => {
  220. const tx = database.transaction(RESULT_STORE, 'readonly');
  221. const request = tx.objectStore(RESULT_STORE).getAll();
  222. request.onsuccess = () => resolve(request.result || []);
  223. request.onerror = () => reject(request.error);
  224. });
  225. } catch (error) {
  226. console.warn('[Mystic Open+] IndexedDB read unavailable:', error);
  227. return [];
  228. }
  229. }
  230.  
  231. async function putIndexedResult(entry) {
  232. try {
  233. await openDatabase();
  234. await new Promise((resolve, reject) => {
  235. const tx = database.transaction(RESULT_STORE, 'readwrite');
  236. tx.objectStore(RESULT_STORE).put(entry);
  237. tx.oncomplete = resolve;
  238. tx.onerror = () => reject(tx.error);
  239. });
  240. } catch (error) {
  241. console.warn('[Mystic Open+] IndexedDB write unavailable:', error);
  242. }
  243. }
  244.  
  245. async function deleteIndexedResult(taskId) {
  246. try {
  247. await openDatabase();
  248. await new Promise((resolve, reject) => {
  249. const tx = database.transaction(RESULT_STORE, 'readwrite');
  250. tx.objectStore(RESULT_STORE).delete(String(taskId));
  251. tx.oncomplete = resolve;
  252. tx.onerror = () => reject(tx.error);
  253. });
  254. } catch (error) {
  255. console.warn('[Mystic Open+] IndexedDB delete unavailable:', error);
  256. }
  257. }
  258.  
  259. async function clearIndexedResults() {
  260. try {
  261. await openDatabase();
  262. await new Promise((resolve, reject) => {
  263. const tx = database.transaction(RESULT_STORE, 'readwrite');
  264. tx.objectStore(RESULT_STORE).clear();
  265. tx.oncomplete = resolve;
  266. tx.onerror = () => reject(tx.error);
  267. });
  268. } catch (error) {
  269. console.warn('[Mystic Open+] IndexedDB clear unavailable:', error);
  270. }
  271. }
  272.  
  273. async function loadSavedResults() {
  274. const merged = new Map();
  275.  
  276. // Read the old/current IndexedDB so upgrading does not lose existing discoveries.
  277. for (const entry of await readIndexedResults()) {
  278. if (entry && entry.taskId) merged.set(String(entry.taskId), entry);
  279. }
  280.  
  281. // Tampermonkey storage is authoritative when both copies exist.
  282. for (const entry of loadGMResults()) {
  283. if (entry && entry.taskId) merged.set(String(entry.taskId), entry);
  284. }
  285.  
  286. groupedResults = [];
  287. for (const entry of merged.values()) addResultToMemory(entry);
  288.  
  289. // Self-heal both storage layers.
  290. for (const entry of merged.values()) {
  291. saveGMResult(entry);
  292. await putIndexedResult(entry);
  293. }
  294.  
  295. resultsLoaded = true;
  296. sortGroupedResults();
  297. renderRows();
  298. }
  299.  
  300. async function saveResult(entry) {
  301. saveGMResult(entry); // durable copy first
  302. await putIndexedResult(entry); // page-local cache second
  303. }
  304.  
  305. async function deleteResult(taskId) {
  306. deleteGMResult(taskId);
  307. await deleteIndexedResult(taskId);
  308. }
  309.  
  310. async function clearAllResults() {
  311. clearGMResults();
  312. await clearIndexedResults();
  313. }
  314.  
  315. /******************************************************************
  316. * BOOT / TAB INSTALLATION
  317. ******************************************************************/
  318.  
  319. async function start() {
  320. ensureStyles();
  321. ensureInstalled();
  322. installNativeNavigationWatcher();
  323.  
  324. await loadSavedResults();
  325. renderRows();
  326. updateProgress(loadState());
  327.  
  328. // Important: childList only. Watching style/class caused the previous freeze.
  329. new MutationObserver(ensureInstalled).observe(document.documentElement, {
  330. subtree: true,
  331. childList: true
  332. });
  333.  
  334. setInterval(ensureInstalled, 750);
  335. console.log('[Mystic Open+] v1.3.0 started with durable Tampermonkey persistence.');
  336. }
  337.  
  338. function ensureInstalled() {
  339. if (!document.body) return;
  340.  
  341. ensureStyles();
  342. const context = findMysticContext();
  343.  
  344. if (!context) {
  345. removeTab();
  346. hidePanel();
  347. return;
  348. }
  349.  
  350. let tab = document.getElementById(TAB_ID);
  351. if (!tab) tab = createTab();
  352.  
  353. if (
  354. tab.parentElement !== context.openLogsLi.parentElement ||
  355. tab.previousElementSibling !== context.openLogsLi
  356. ) {
  357. context.openLogsLi.parentElement.insertBefore(tab, context.openLogsLi.nextSibling);
  358. }
  359.  
  360. ensurePanel(context.panel);
  361. }
  362.  
  363. function findMysticContext() {
  364. const panels = Array.from(
  365. document.querySelectorAll('#slPanel, [id*="slPanel"], .slPanel')
  366. );
  367.  
  368. for (const panel of panels) {
  369. if (!isVisible(panel)) continue;
  370.  
  371. const text = normalizeText(panel.textContent);
  372. if (!text.includes("Scouts' Log") || !text.includes('Mystic:')) continue;
  373.  
  374. for (const list of panel.querySelectorAll('ul.tabs')) {
  375. const openLogsLi = Array.from(list.children).find(li => {
  376. const t = normalizeText(li.textContent);
  377. return t === 'Open Logs' || /^Open Logs\s+\d+$/.test(t);
  378. });
  379.  
  380. if (openLogsLi) return { panel, openLogsLi };
  381. }
  382. }
  383.  
  384. return null;
  385. }
  386.  
  387. function createTab() {
  388. const li = document.createElement('li');
  389. li.id = TAB_ID;
  390.  
  391. const link = document.createElement('a');
  392. link.href = '#';
  393. link.textContent = 'Mystic Open+';
  394. link.title = 'Scan registry cells for unresolved Mystic Scout’s Log entries';
  395.  
  396. link.addEventListener('mousedown', event => event.stopPropagation());
  397. link.addEventListener('click', event => {
  398. event.preventDefault();
  399. event.stopPropagation();
  400. openPanel();
  401. });
  402.  
  403. li.appendChild(link);
  404. return li;
  405. }
  406.  
  407. function removeTab() {
  408. document.getElementById(TAB_ID)?.remove();
  409. }
  410.  
  411. /******************************************************************
  412. * NATIVE EYEWIRE JUMP
  413. ******************************************************************/
  414.  
  415. function nativeEyeWireJump(taskId) {
  416. const task = String(taskId || '').trim();
  417. if (!task) return;
  418.  
  419. clearError();
  420.  
  421. const injected = document.createElement('script');
  422. injected.textContent = `
  423. (() => {
  424. const task = ${JSON.stringify(task)};
  425. try {
  426. if (!window.tomni || typeof window.tomni.jumpToTaskID !== 'function') {
  427. console.error('[Mystic Open+] window.tomni.jumpToTaskID is unavailable');
  428. return;
  429. }
  430.  
  431. const scouts = window.scoutsLog && window.scoutsLog.S
  432. ? window.scoutsLog.S
  433. : null;
  434.  
  435. const slVisible = window.jQuery
  436. ? window.jQuery('#slPanel').is(':visible')
  437. : false;
  438.  
  439. if (slVisible && scouts && typeof scouts.hide === 'function') {
  440. scouts.hide();
  441. }
  442.  
  443. if (
  444. window.tomni.gameMode &&
  445. typeof Attention !== 'undefined' &&
  446. Attention.Confirmation
  447. ) {
  448. const confirmation = new Attention.Confirmation({
  449. situation: 'information calm',
  450. title: typeof _ === 'function'
  451. ? _('Jump to Task #{0}?', task)
  452. : 'Jump to Task #' + task + '?',
  453. message: typeof _ === 'function'
  454. ? _('You will lose your progress on this cube.')
  455. : 'You will lose your progress on this cube.',
  456. ok: {
  457. label: typeof _ === 'function' ? _('Jump to Task') : 'Jump to Task',
  458. klass: 'flat'
  459. },
  460. cancel: {
  461. label: typeof _ === 'function' ? _('Stay Here') : 'Stay Here',
  462. klass: 'flat'
  463. }
  464. });
  465.  
  466. confirmation
  467. .on('ok', () => window.tomni.jumpToTaskID(task))
  468. .on('cancel', () => {
  469. if (slVisible && scouts && typeof scouts.show === 'function') scouts.show();
  470. })
  471. .show();
  472. } else {
  473. window.tomni.jumpToTaskID(task);
  474. }
  475. } catch (error) {
  476. console.error('[Mystic Open+] jump failed:', error);
  477. }
  478. })();
  479. `;
  480.  
  481. (document.head || document.documentElement).appendChild(injected);
  482. injected.remove();
  483. }
  484.  
  485. /******************************************************************
  486. * REGISTRY / EYEWIRE HTTP
  487. ******************************************************************/
  488.  
  489. function fetchRegistry() {
  490. return new Promise((resolve, reject) => {
  491. GM_xmlhttpRequest({
  492. method: 'GET',
  493. url: REGISTRY_EXEC_URL,
  494. timeout: 60000,
  495. onload: response => {
  496. try {
  497. const data = JSON.parse(response.responseText);
  498. if (!data.ok) throw new Error(data.error || 'Registry returned ok:false');
  499. const cells = Array.isArray(data.cells) ? data.cells : [];
  500. resolve({
  501. cells,
  502. count: Number(data.count) || cells.length,
  503. generatedAt: String(data.generatedAt || '')
  504. });
  505. } catch (error) {
  506. reject(error);
  507. }
  508. },
  509. onerror: () => reject(new Error('Could not reach Apps Script registry.')),
  510. ontimeout: () => reject(new Error('Apps Script registry request timed out.'))
  511. });
  512. });
  513. }
  514.  
  515. async function requestJson(url) {
  516. const response = await fetch(url, {
  517. credentials: 'include',
  518. cache: 'no-store',
  519. headers: { Accept: 'application/json, text/plain, */*' }
  520. });
  521.  
  522. if (!response.ok) throw new Error(`HTTP ${response.status}: ${url}`);
  523. return response.json();
  524. }
  525.  
  526. function cellTasksUrl(cellId) {
  527. return 'https://eyewire.org/1.0/cell/' + encodeURIComponent(cellId) + '/tasks';
  528. }
  529.  
  530. function taskActionsUrl(taskId) {
  531. return 'https://scoutslog2.eyewire.org/1.1/task/' +
  532. encodeURIComponent(taskId) + '/actions';
  533. }
  534.  
  535. function hashRegistry(cells) {
  536. let hash = 2166136261;
  537.  
  538. for (const cell of cells) {
  539. const id = String(cell.id || '');
  540. for (let i = 0; i < id.length; i++) {
  541. hash ^= id.charCodeAt(i);
  542. hash = Math.imul(hash, 16777619);
  543. }
  544. hash ^= 44;
  545. hash = Math.imul(hash, 16777619);
  546. }
  547.  
  548. return (hash >>> 0).toString(16);
  549. }
  550.  
  551. /******************************************************************
  552. * SCANNING / DURABLE RESUME
  553. ******************************************************************/
  554.  
  555. async function startResumeScan() {
  556. if (running) return;
  557.  
  558. running = true;
  559. pauseRequested = false;
  560. updateButtons();
  561. clearError();
  562.  
  563. try {
  564. if (!resultsLoaded) await loadSavedResults();
  565.  
  566. setStatus('Loading Zfish cell registry…');
  567. const registry = await fetchRegistry();
  568. registryCells = registry.cells;
  569.  
  570. if (!registryCells.length) {
  571. throw new Error('The registry returned zero marked cells.');
  572. }
  573.  
  574. let state = loadState();
  575.  
  576. // Migration from old numeric-only progress: convert the already-passed
  577. // registry rows into exact remembered cell IDs.
  578. if (!state.scannedCellIds.length && state.nextCellIndex > 0) {
  579. state.scannedCellIds = registryCells
  580. .slice(0, Math.min(state.nextCellIndex, registryCells.length))
  581. .map(cell => String(cell.id || '').trim())
  582. .filter(Boolean);
  583. }
  584.  
  585. const registryIds = registryCells
  586. .map(cell => String(cell.id || '').trim())
  587. .filter(Boolean);
  588.  
  589. const registryIdSet = new Set(registryIds);
  590.  
  591. // Keep only remembered IDs that are still in the marked registry.
  592. state.scannedCellIds = Array.from(
  593. new Set(
  594. state.scannedCellIds
  595. .map(id => String(id || '').trim())
  596. .filter(id => id && registryIdSet.has(id))
  597. )
  598. );
  599.  
  600. const scanned = new Set(state.scannedCellIds);
  601. const currentHash = hashRegistry(registryCells);
  602.  
  603. state.registryHash = currentHash;
  604. state.registryCount = registryCells.length;
  605. if (!state.startedAt) state.startedAt = new Date().toISOString();
  606.  
  607. const firstUnscanned = registryCells.findIndex(
  608. cell => !scanned.has(String(cell.id || '').trim())
  609. );
  610.  
  611. state.nextCellIndex = firstUnscanned < 0 ? registryCells.length : firstUnscanned;
  612. state.cellsCompleted = scanned.size;
  613. state.completed = firstUnscanned < 0;
  614. saveState(state);
  615.  
  616. if (state.completed) {
  617. setStatus(
  618. `All ${registryCells.length.toLocaleString()} marked cells are already remembered as scanned.`
  619. );
  620. updateProgress(state);
  621. return;
  622. }
  623.  
  624. setStatus(
  625. `Resuming with ${scanned.size.toLocaleString()} remembered scanned cells — ` +
  626. `next unscanned row ${state.nextCellIndex + 1} of ${registryCells.length.toLocaleString()}…`
  627. );
  628.  
  629. await runRegistryBatches(state);
  630.  
  631. } catch (error) {
  632. console.error('[Mystic Open+]', error);
  633. showError(error.message);
  634. } finally {
  635. running = false;
  636. updateButtons();
  637. }
  638. }
  639.  
  640. async function runRegistryBatches(state) {
  641. const scanned = new Set(
  642. (state.scannedCellIds || []).map(id => String(id || '').trim()).filter(Boolean)
  643. );
  644.  
  645. let cursor = Math.max(0, Number(state.nextCellIndex || 0));
  646.  
  647. while (cursor < registryCells.length) {
  648. if (pauseRequested) break;
  649.  
  650. const batch = [];
  651.  
  652. while (cursor < registryCells.length && batch.length < CELL_BATCH_SIZE) {
  653. const cell = registryCells[cursor++];
  654. const id = String(cell && cell.id || '').trim();
  655. if (!id || scanned.has(id)) continue;
  656. batch.push(cell);
  657. }
  658.  
  659. if (!batch.length) break;
  660.  
  661. const results = await Promise.allSettled(
  662. batch.map(cell => scanCell(cell, state))
  663. );
  664.  
  665. for (let i = 0; i < results.length; i++) {
  666. const id = String(batch[i] && batch[i].id || '').trim();
  667.  
  668. if (results[i].status === 'rejected') {
  669. state.errors++;
  670. console.warn('[Mystic Open+] Cell failed:', id, results[i].reason);
  671. }
  672.  
  673. // Matches previous behavior: once a registry cell has been processed,
  674. // remember it so a reload/browser restart does not scan it again.
  675. if (id) scanned.add(id);
  676. }
  677.  
  678. state.scannedCellIds = Array.from(scanned);
  679. state.cellsCompleted = scanned.size;
  680.  
  681. let next = registryCells.length;
  682. for (let i = cursor; i < registryCells.length; i++) {
  683. const id = String(registryCells[i] && registryCells[i].id || '').trim();
  684. if (id && !scanned.has(id)) {
  685. next = i;
  686. break;
  687. }
  688. }
  689.  
  690. state.nextCellIndex = next;
  691. saveState(state);
  692. updateProgress(state);
  693. scheduleRender();
  694.  
  695. if (pauseRequested) break;
  696. cursor = next;
  697. await sleep(BETWEEN_BATCH_DELAY_MS);
  698. }
  699.  
  700. let remaining = -1;
  701. for (let i = 0; i < registryCells.length; i++) {
  702. const id = String(registryCells[i] && registryCells[i].id || '').trim();
  703. if (id && !scanned.has(id)) {
  704. remaining = i;
  705. break;
  706. }
  707. }
  708.  
  709. state.scannedCellIds = Array.from(scanned);
  710. state.cellsCompleted = scanned.size;
  711.  
  712. if (!pauseRequested && remaining < 0) {
  713. state.completed = true;
  714. state.nextCellIndex = registryCells.length;
  715. saveState(state);
  716.  
  717. setStatus(
  718. `Finished — remembered ${scanned.size.toLocaleString()} scanned cells; ` +
  719. `${countEntries().toLocaleString()} unresolved entries across ` +
  720. `${groupedResults.length.toLocaleString()} cells.`
  721. );
  722. } else {
  723. state.completed = false;
  724. if (remaining >= 0) state.nextCellIndex = remaining;
  725. saveState(state);
  726.  
  727. setStatus(
  728. `Paused — ${scanned.size.toLocaleString()} scanned cells safely remembered; ` +
  729. `next unscanned row ${Math.min(state.nextCellIndex + 1, registryCells.length).toLocaleString()} / ` +
  730. `${registryCells.length.toLocaleString()}.`
  731. );
  732. }
  733.  
  734. updateProgress(state);
  735. }
  736.  
  737. async function scanCell(registryCell, state) {
  738. const cellId = String(registryCell.id || '').trim();
  739. if (!cellId) return;
  740.  
  741. const data = await requestJson(cellTasksUrl(cellId));
  742. const tasks = Array.isArray(data.tasks) ? data.tasks : [];
  743. let nextTaskIndex = 0;
  744.  
  745. async function worker() {
  746. while (true) {
  747. if (pauseRequested) return;
  748.  
  749. const index = nextTaskIndex++;
  750. if (index >= tasks.length) return;
  751.  
  752. const task = tasks[index];
  753. if (!task || task.id === undefined || task.id === null) continue;
  754.  
  755. const taskId = String(task.id);
  756.  
  757. try {
  758. const log = await requestJson(taskActionsUrl(taskId));
  759. state.cubesChecked++;
  760.  
  761. if (isCurrentlyUnresolved(log)) {
  762. const entry = makeResultEntry(log, registryCell);
  763. if (entry) {
  764. addResultToMemory(entry);
  765. await saveResult(entry);
  766. }
  767. } else {
  768. removeResultFromMemory(taskId);
  769. await deleteResult(taskId);
  770. }
  771. } catch (error) {
  772. state.errors++;
  773. console.warn('[Mystic Open+] Task failed:', taskId, error);
  774. }
  775.  
  776. await sleep(BETWEEN_ACTION_DELAY_MS);
  777. }
  778. }
  779.  
  780. await Promise.all(
  781. Array.from(
  782. { length: ACTION_CONCURRENCY },
  783. () => worker()
  784. )
  785. );
  786. }
  787.  
  788. function isCurrentlyUnresolved(log) {
  789. if (!log) return false;
  790. if (!Array.isArray(log.actions) || !log.actions.length) return false;
  791.  
  792. const cell = String(log.cell || '').trim();
  793. if (!cell || cell === '0') return false;
  794.  
  795. const status = normalizeStatus(log.status);
  796. if (!status || status === 'n/a') return false;
  797. if (RESOLVED_STATUSES.has(status)) return false;
  798.  
  799. return true;
  800. }
  801.  
  802. function makeResultEntry(log, registryCell) {
  803. const taskId = String(log.task || '').trim();
  804. const cellId = String(log.cell || registryCell.id || '').trim();
  805. if (!taskId || !cellId) return null;
  806.  
  807. return {
  808. taskId,
  809. cellId,
  810. cellName: String(
  811. log.cellName ||
  812. log.cellNameKO ||
  813. registryCell.name ||
  814. ''
  815. ).trim(),
  816. status: String(log.status || ''),
  817. statusText: String(log.statusText || ''),
  818. issue: String(log.issue || ''),
  819. lastUser: String(log.lastUser || ''),
  820. lastUpdated: String(log.lastUpdated || '')
  821. };
  822. }
  823.  
  824. /******************************************************************
  825. * RESULTS / GROUPING
  826. ******************************************************************/
  827.  
  828. function addResultToMemory(entry) {
  829. let group = groupedResults.find(item => item.cellId === entry.cellId);
  830.  
  831. if (!group) {
  832. group = {
  833. cellId: entry.cellId,
  834. cellName: entry.cellName,
  835. entries: []
  836. };
  837. groupedResults.push(group);
  838. }
  839.  
  840. if (entry.cellName) group.cellName = entry.cellName;
  841.  
  842. const existing = group.entries.find(item => item.taskId === entry.taskId);
  843. if (existing) Object.assign(existing, entry);
  844. else group.entries.push(entry);
  845.  
  846. group.entries.sort((a, b) => parseDate(b.lastUpdated) - parseDate(a.lastUpdated));
  847. }
  848.  
  849. function removeResultFromMemory(taskId) {
  850. const id = String(taskId);
  851.  
  852. for (let i = groupedResults.length - 1; i >= 0; i--) {
  853. const group = groupedResults[i];
  854. group.entries = group.entries.filter(entry => entry.taskId !== id);
  855. if (!group.entries.length) groupedResults.splice(i, 1);
  856. }
  857. }
  858.  
  859. function sortGroupedResults() {
  860. for (const group of groupedResults) {
  861. group.entries.sort((a, b) => parseDate(b.lastUpdated) - parseDate(a.lastUpdated));
  862. }
  863.  
  864. groupedResults.sort((a, b) => {
  865. const aDate = a.entries[0] ? parseDate(a.entries[0].lastUpdated) : 0;
  866. const bDate = b.entries[0] ? parseDate(b.entries[0].lastUpdated) : 0;
  867. return bDate - aDate;
  868. });
  869. }
  870.  
  871. function countEntries() {
  872. return groupedResults.reduce((total, group) => total + group.entries.length, 0);
  873. }
  874.  
  875. /******************************************************************
  876. * RESET / FULL RESCAN
  877. ******************************************************************/
  878.  
  879. async function resetProgress() {
  880. if (running) return;
  881.  
  882. if (!confirm('Reset Mystic Open+ progress and all cached results?')) return;
  883.  
  884. clearPersistentState();
  885. await clearAllResults();
  886.  
  887. groupedResults = [];
  888. registryCells = [];
  889. resultsLoaded = true;
  890.  
  891. renderRows();
  892. updateProgress(defaultState());
  893. setStatus('Progress and all remembered results cleared.');
  894. }
  895.  
  896. async function fullRescan() {
  897. if (running) return;
  898.  
  899. clearPersistentState();
  900. await clearAllResults();
  901.  
  902. groupedResults = [];
  903. registryCells = [];
  904. resultsLoaded = true;
  905.  
  906. renderRows();
  907. await startResumeScan();
  908. }
  909.  
  910. /******************************************************************
  911. * EMBEDDED SCOUT'S LOG PANEL
  912. ******************************************************************/
  913.  
  914. function getScoutLogContainers(panelHint) {
  915. const slPanel = panelHint || document.querySelector('#slPanel');
  916. if (!slPanel) return null;
  917.  
  918. const slContent =
  919. slPanel.querySelector('.slPanelContent, #slPanelContent') ||
  920. document.querySelector('#slPanel .slPanelContent, #slPanelContent');
  921.  
  922. if (!slContent) return null;
  923.  
  924. return {
  925. slPanel,
  926. slContent,
  927. nativeOptions: slContent.querySelector('.slOptions, #slOptions'),
  928. nativeMain: slContent.querySelector('#sl-main-table')
  929. };
  930. }
  931.  
  932. function ensurePanel(panelHint) {
  933. const containers = getScoutLogContainers(panelHint);
  934. if (!containers) return null;
  935.  
  936. const { slContent } = containers;
  937. let panel = document.getElementById(PANEL_ID);
  938.  
  939. if (panel) {
  940. if (panel.parentElement !== slContent) slContent.appendChild(panel);
  941. return panel;
  942. }
  943.  
  944. panel = document.createElement('div');
  945. panel.id = PANEL_ID;
  946. panel.style.display = 'none';
  947.  
  948. panel.innerHTML = `
  949. <div class="mop-toolbar">
  950. <div class="mop-search-wrap">
  951. <input
  952. id="mop-search"
  953. type="text"
  954. autocomplete="off"
  955. placeholder="Search cube, cell, issue, status or player…"
  956. >
  957. </div>
  958.  
  959. <div class="mop-toolbar-buttons">
  960. <button id="mop-start" type="button">Start / Resume</button>
  961. <button id="mop-pause" type="button">Pause</button>
  962. <button id="mop-full-rescan" type="button">Full Rescan</button>
  963. <button id="mop-reset" type="button" class="danger">Reset progress</button>
  964. </div>
  965. </div>
  966.  
  967. <div class="mop-status-row">
  968. <span>
  969. <strong>Mystic Open+</strong>
  970. <span id="mop-result-count"></span>
  971. </span>
  972. <span id="mop-status">Ready.</span>
  973. <span id="mop-progress-text"></span>
  974. </div>
  975.  
  976. <div class="mop-progress-track">
  977. <div id="mop-progress-bar"></div>
  978. </div>
  979.  
  980. <div id="mop-error" class="mop-error" style="display:none"></div>
  981.  
  982. <div class="mop-table-wrap">
  983. <table class="sl-table mop-table">
  984. <thead>
  985. <tr>
  986. <th>Cube</th>
  987. <th>Cell</th>
  988. <th>Status</th>
  989. <th>Issue</th>
  990. <th>Last User</th>
  991. <th>Last Updated (UTC)</th>
  992. </tr>
  993. </thead>
  994. <tbody id="mop-table-body"></tbody>
  995. </table>
  996. </div>
  997. `;
  998.  
  999. slContent.appendChild(panel);
  1000.  
  1001. panel.querySelector('#mop-start').addEventListener('click', startResumeScan);
  1002.  
  1003. panel.querySelector('#mop-pause').addEventListener('click', () => {
  1004. if (!running) return;
  1005. pauseRequested = true;
  1006. setStatus('Pausing after the current batch finishes…');
  1007. });
  1008.  
  1009. panel.querySelector('#mop-full-rescan').addEventListener('click', fullRescan);
  1010. panel.querySelector('#mop-reset').addEventListener('click', resetProgress);
  1011. panel.querySelector('#mop-search').addEventListener('input', renderRows);
  1012.  
  1013. panel.addEventListener('click', event => {
  1014. const jump = event.target.closest('[data-mop-jump]');
  1015. if (!jump) return;
  1016.  
  1017. event.preventDefault();
  1018. event.stopPropagation();
  1019. nativeEyeWireJump(jump.getAttribute('data-mop-jump'));
  1020. });
  1021.  
  1022. renderRows();
  1023. updateProgress(loadState());
  1024. return panel;
  1025. }
  1026.  
  1027. function openPanel() {
  1028. const context = findMysticContext();
  1029. if (!context) return;
  1030.  
  1031. const panel = ensurePanel(context.panel);
  1032. const containers = getScoutLogContainers(context.panel);
  1033. if (!panel || !containers) return;
  1034.  
  1035. if (containers.nativeMain) {
  1036. containers.nativeMain.style.setProperty('display', 'none', 'important');
  1037. }
  1038.  
  1039. containers.slContent.classList.add('mop-view-active');
  1040. panel.style.setProperty('display', 'flex', 'important');
  1041.  
  1042. const tab = document.getElementById(TAB_ID);
  1043. if (tab) {
  1044. for (const sibling of Array.from(tab.parentElement?.children || [])) {
  1045. sibling.classList.remove('active');
  1046. }
  1047. tab.classList.add('active');
  1048. }
  1049.  
  1050. renderRows();
  1051. updateProgress(loadState());
  1052. }
  1053.  
  1054. function hidePanel() {
  1055. const panel = document.getElementById(PANEL_ID);
  1056. if (panel) panel.style.setProperty('display', 'none', 'important');
  1057.  
  1058. const containers = getScoutLogContainers();
  1059. if (containers) {
  1060. containers.slContent.classList.remove('mop-view-active');
  1061. containers.nativeMain?.style.removeProperty('display');
  1062. }
  1063.  
  1064. document.getElementById(TAB_ID)?.classList.remove('active');
  1065. }
  1066.  
  1067. function installNativeNavigationWatcher() {
  1068. if (document.documentElement.dataset.mopNativeNavigationWatcher === '1') return;
  1069. document.documentElement.dataset.mopNativeNavigationWatcher = '1';
  1070.  
  1071. document.addEventListener('click', event => {
  1072. const panel = document.getElementById(PANEL_ID);
  1073. if (!panel || getComputedStyle(panel).display === 'none') return;
  1074.  
  1075. if (
  1076. event.target.closest(`#${PANEL_ID}`) ||
  1077. event.target.closest(`#${TAB_ID}`)
  1078. ) return;
  1079.  
  1080. const nativeTab = event.target.closest(
  1081. '.slOptions ul.tabs > li, ' +
  1082. '.slOptions .tabs > li, ' +
  1083. '#slOptions ul.tabs > li, ' +
  1084. '#slOptions .tabs > li'
  1085. );
  1086.  
  1087. if (nativeTab) hidePanel();
  1088. }, true);
  1089. }
  1090.  
  1091. /******************************************************************
  1092. * TABLE RENDERING
  1093. ******************************************************************/
  1094.  
  1095. function scheduleRender() {
  1096. const now = Date.now();
  1097. if (now - lastRenderTime < 400) return;
  1098.  
  1099. lastRenderTime = now;
  1100. sortGroupedResults();
  1101. renderRows();
  1102. }
  1103.  
  1104. function renderRows() {
  1105. const panel = document.getElementById(PANEL_ID);
  1106. if (!panel) return;
  1107.  
  1108. sortGroupedResults();
  1109.  
  1110. const tbody = panel.querySelector('#mop-table-body');
  1111. const searchInput = panel.querySelector('#mop-search');
  1112. if (!tbody || !searchInput) return;
  1113.  
  1114. const query = String(searchInput.value || '').trim().toLowerCase();
  1115. tbody.innerHTML = '';
  1116.  
  1117. let visibleCells = 0;
  1118. let visibleEntries = 0;
  1119.  
  1120. for (const group of groupedResults) {
  1121. const matching = group.entries.filter(entry => {
  1122. if (!query) return true;
  1123.  
  1124. return [
  1125. entry.taskId,
  1126. group.cellId,
  1127. group.cellName,
  1128. entry.status,
  1129. entry.statusText,
  1130. entry.issue,
  1131. entry.lastUser,
  1132. entry.lastUpdated
  1133. ].join(' ').toLowerCase().includes(query);
  1134. });
  1135.  
  1136. if (!matching.length) continue;
  1137.  
  1138. visibleCells++;
  1139. visibleEntries += matching.length;
  1140.  
  1141. const row = document.createElement('tr');
  1142.  
  1143. row.innerHTML = `
  1144. <td>
  1145. ${matching.map(entry => `
  1146. <div class="entry-line mop-cube-line">
  1147. <a
  1148. href="#"
  1149. class="mop-cube-link"
  1150. data-mop-jump="${escapeHtml(entry.taskId)}"
  1151. title="Jump to cube ${escapeHtml(entry.taskId)} in EyeWire"
  1152. >${escapeHtml(entry.taskId)}</a>
  1153. <span class="mop-jump-separator">|</span>
  1154. <a
  1155. href="#"
  1156. class="mop-jump-link"
  1157. data-mop-jump="${escapeHtml(entry.taskId)}"
  1158. title="Jump to cube ${escapeHtml(entry.taskId)} in EyeWire"
  1159. >Jump</a>
  1160. </div>
  1161. `).join('')}
  1162. </td>
  1163.  
  1164. <td>
  1165. <strong>${escapeHtml(group.cellName || ('Cell ' + group.cellId))}</strong>
  1166. <div class="secondary">${escapeHtml(group.cellId)}</div>
  1167. </td>
  1168.  
  1169. <td>
  1170. ${matching.map(entry => `
  1171. <div class="entry-line status">
  1172. ${escapeHtml(entry.statusText || titleCase(entry.status))}
  1173. </div>
  1174. `).join('')}
  1175. </td>
  1176.  
  1177. <td>
  1178. ${matching.map(entry => `
  1179. <div class="entry-line">${escapeHtml(titleCase(entry.issue))}</div>
  1180. `).join('')}
  1181. </td>
  1182.  
  1183. <td>
  1184. ${matching.map(entry => `
  1185. <div class="entry-line">${escapeHtml(entry.lastUser)}</div>
  1186. `).join('')}
  1187. </td>
  1188.  
  1189. <td>
  1190. ${matching.map(entry => `
  1191. <div class="entry-line">${escapeHtml(entry.lastUpdated)}</div>
  1192. `).join('')}
  1193. </td>
  1194. `;
  1195.  
  1196. tbody.appendChild(row);
  1197. }
  1198.  
  1199. const counter = panel.querySelector('#mop-result-count');
  1200. if (counter) {
  1201. counter.textContent =
  1202. ` ${visibleCells.toLocaleString()} cells / ${visibleEntries.toLocaleString()} entries`;
  1203. }
  1204. }
  1205.  
  1206. /******************************************************************
  1207. * PROGRESS / HELPERS
  1208. ******************************************************************/
  1209.  
  1210. function updateProgress(state) {
  1211. const panel = document.getElementById(PANEL_ID);
  1212. if (!panel) return;
  1213.  
  1214. const total = registryCells.length || Number(state.registryCount || 0);
  1215. const done = Math.min(
  1216. total || Number.MAX_SAFE_INTEGER,
  1217. Number(state.cellsCompleted || state.scannedCellIds?.length || 0)
  1218. );
  1219.  
  1220. const percent = total > 0 ? Math.min(100, (done / total) * 100) : 0;
  1221.  
  1222. const text = panel.querySelector('#mop-progress-text');
  1223. if (text) {
  1224. text.textContent = total
  1225. ? `${done.toLocaleString()} / ${total.toLocaleString()} cells — ` +
  1226. `${Number(state.cubesChecked || 0).toLocaleString()} cubes checked — ` +
  1227. `${countEntries().toLocaleString()} unresolved — ` +
  1228. `${Number(state.errors || 0).toLocaleString()} errors`
  1229. : '';
  1230. }
  1231.  
  1232. const bar = panel.querySelector('#mop-progress-bar');
  1233. if (bar) bar.style.width = `${percent}%`;
  1234.  
  1235. updateButtons();
  1236. }
  1237.  
  1238. function updateButtons() {
  1239. const panel = document.getElementById(PANEL_ID);
  1240. if (!panel) return;
  1241.  
  1242. panel.querySelector('#mop-start').disabled = running;
  1243. panel.querySelector('#mop-pause').disabled = !running;
  1244. panel.querySelector('#mop-full-rescan').disabled = running;
  1245. panel.querySelector('#mop-reset').disabled = running;
  1246. }
  1247.  
  1248. function normalizeStatus(value) {
  1249. return String(value || '').trim().toLowerCase().replace(/\s+/g, '-');
  1250. }
  1251.  
  1252. function normalizeText(value) {
  1253. return String(value || '').replace(/\s+/g, ' ').trim();
  1254. }
  1255.  
  1256. function titleCase(value) {
  1257. return String(value || '')
  1258. .trim()
  1259. .replace(/[-_]+/g, ' ')
  1260. .replace(/\b\w/g, char => char.toUpperCase());
  1261. }
  1262.  
  1263. function escapeHtml(value) {
  1264. return String(value || '')
  1265. .replace(/&/g, '&amp;')
  1266. .replace(/</g, '&lt;')
  1267. .replace(/>/g, '&gt;')
  1268. .replace(/"/g, '&quot;')
  1269. .replace(/'/g, '&#039;');
  1270. }
  1271.  
  1272. function parseDate(value) {
  1273. if (!value) return 0;
  1274.  
  1275. const raw = String(value).trim();
  1276. let parsed = Date.parse(raw);
  1277.  
  1278. if (!Number.isFinite(parsed)) {
  1279. parsed = Date.parse(raw.replace(' ', 'T') + 'Z');
  1280. }
  1281.  
  1282. return Number.isFinite(parsed) ? parsed : 0;
  1283. }
  1284.  
  1285. function sleep(ms) {
  1286. return new Promise(resolve => setTimeout(resolve, ms));
  1287. }
  1288.  
  1289. function setStatus(text) {
  1290. const element = document.querySelector(`#${PANEL_ID} #mop-status`);
  1291. if (element) element.textContent = text;
  1292. console.log('[Mystic Open+] ' + text);
  1293. }
  1294.  
  1295. function clearError() {
  1296. const element = document.querySelector(`#${PANEL_ID} #mop-error`);
  1297. if (!element) return;
  1298. element.style.display = 'none';
  1299. element.textContent = '';
  1300. }
  1301.  
  1302. function showError(text) {
  1303. const element = document.querySelector(`#${PANEL_ID} #mop-error`);
  1304. if (!element) return;
  1305. element.style.display = 'block';
  1306. element.textContent = String(text || 'Unknown error');
  1307. }
  1308.  
  1309. function isVisible(element) {
  1310. if (!element) return false;
  1311.  
  1312. const rect = element.getBoundingClientRect();
  1313. if (!rect.width || !rect.height) return false;
  1314.  
  1315. const style = getComputedStyle(element);
  1316. return style.display !== 'none' && style.visibility !== 'hidden';
  1317. }
  1318.  
  1319. /******************************************************************
  1320. * CSS
  1321. ******************************************************************/
  1322.  
  1323. function ensureStyles() {
  1324. if (document.getElementById(STYLE_ID)) return;
  1325.  
  1326. const style = document.createElement('style');
  1327. style.id = STYLE_ID;
  1328.  
  1329. style.textContent = `
  1330. #${TAB_ID} > a {
  1331. background: #245f49 !important;
  1332. border-color: #62cf96 !important;
  1333. color: #fff !important;
  1334. }
  1335.  
  1336. #${TAB_ID} > a:hover,
  1337. #${TAB_ID}.active > a {
  1338. background: #327b5e !important;
  1339. border-color: #74dfa9 !important;
  1340. color: #fff !important;
  1341. }
  1342.  
  1343. .slPanelContent.mop-view-active,
  1344. #slPanelContent.mop-view-active {
  1345. display: flex !important;
  1346. flex-direction: column !important;
  1347. min-height: 0 !important;
  1348. overflow-x: hidden !important;
  1349. overflow-y: hidden !important;
  1350. }
  1351.  
  1352. .slPanelContent.mop-view-active .slOptions,
  1353. #slPanelContent.mop-view-active #slOptions {
  1354. flex: 0 0 auto !important;
  1355. }
  1356.  
  1357. .slPanelContent.mop-view-active #${PANEL_ID},
  1358. #slPanelContent.mop-view-active #${PANEL_ID} {
  1359. flex: 1 1 auto !important;
  1360. display: flex !important;
  1361. flex-direction: column !important;
  1362. min-height: 0 !important;
  1363. height: auto !important;
  1364. overflow: hidden !important;
  1365. }
  1366.  
  1367. #${PANEL_ID} {
  1368. position: static !important;
  1369. left: auto !important;
  1370. right: auto !important;
  1371. top: auto !important;
  1372. bottom: auto !important;
  1373. width: 100% !important;
  1374. height: auto !important;
  1375. min-width: 0 !important;
  1376. min-height: 0 !important;
  1377. max-width: none !important;
  1378. margin: 0 !important;
  1379. padding: 0 !important;
  1380. box-sizing: border-box !important;
  1381. overflow: visible !important;
  1382. background: transparent !important;
  1383. border: 0 !important;
  1384. border-radius: 0 !important;
  1385. box-shadow: none !important;
  1386. color: #eee;
  1387. font: 13px Arial, sans-serif;
  1388. }
  1389.  
  1390. #${PANEL_ID} .mop-toolbar {
  1391. display: flex;
  1392. align-items: center;
  1393. gap: 8px;
  1394. box-sizing: border-box;
  1395. padding: 8px 8px 5px;
  1396. flex: 0 0 auto !important;
  1397. }
  1398.  
  1399. #${PANEL_ID} .mop-search-wrap {
  1400. flex: 1 1 auto;
  1401. min-width: 120px;
  1402. }
  1403.  
  1404. #${PANEL_ID} #mop-search {
  1405. display: block;
  1406. width: 100%;
  1407. height: 28px;
  1408. box-sizing: border-box;
  1409. padding: 4px 7px;
  1410. color: white;
  1411. background: #101215;
  1412. border: 1px solid #555;
  1413. border-radius: 3px;
  1414. }
  1415.  
  1416. #${PANEL_ID} .mop-toolbar-buttons {
  1417. display: flex;
  1418. flex: 0 0 auto;
  1419. align-items: center;
  1420. gap: 5px;
  1421. }
  1422.  
  1423. #${PANEL_ID} button {
  1424. display: inline-block;
  1425. width: auto !important;
  1426. min-width: 0 !important;
  1427. height: 28px !important;
  1428. margin: 0 !important;
  1429. padding: 4px 8px !important;
  1430. color: white !important;
  1431. background: #25282d !important;
  1432. border: 1px solid #555 !important;
  1433. border-radius: 3px !important;
  1434. font: 11px Arial, sans-serif !important;
  1435. cursor: pointer !important;
  1436. }
  1437.  
  1438. #${PANEL_ID} button:hover {
  1439. background: #33373c !important;
  1440. }
  1441.  
  1442. #${PANEL_ID} button.danger {
  1443. background: #783c4e !important;
  1444. }
  1445.  
  1446. #${PANEL_ID} button:disabled {
  1447. opacity: .45 !important;
  1448. cursor: default !important;
  1449. }
  1450.  
  1451. #${PANEL_ID} .mop-status-row {
  1452. display: grid;
  1453. grid-template-columns: auto 1fr auto;
  1454. align-items: center;
  1455. gap: 15px;
  1456. padding: 3px 8px 5px;
  1457. color: #aab1b7;
  1458. font-size: 11px;
  1459. flex: 0 0 auto !important;
  1460. }
  1461.  
  1462. #${PANEL_ID} #mop-status {
  1463. overflow: hidden;
  1464. text-overflow: ellipsis;
  1465. white-space: nowrap;
  1466. }
  1467.  
  1468. #${PANEL_ID} #mop-progress-text {
  1469. white-space: nowrap;
  1470. text-align: right;
  1471. }
  1472.  
  1473. #${PANEL_ID} .mop-progress-track {
  1474. height: 2px;
  1475. margin: 0 8px 4px;
  1476. background: #292d32;
  1477. flex: 0 0 auto !important;
  1478. }
  1479.  
  1480. #${PANEL_ID} #mop-progress-bar {
  1481. width: 0%;
  1482. height: 100%;
  1483. background: #50b982;
  1484. transition: width 100ms linear;
  1485. }
  1486.  
  1487. #${PANEL_ID} .mop-error {
  1488. margin: 5px 8px;
  1489. padding: 6px;
  1490. color: #ffaaaa;
  1491. background: #351d1d;
  1492. border: 1px solid #864b4b;
  1493. flex: 0 0 auto !important;
  1494. }
  1495.  
  1496. #${PANEL_ID} .mop-table-wrap {
  1497. flex: 1 1 auto !important;
  1498. width: 100%;
  1499. height: auto !important;
  1500. min-height: 0 !important;
  1501. max-height: none !important;
  1502. overflow-x: hidden !important;
  1503. overflow-y: auto !important;
  1504. overscroll-behavior: contain;
  1505. scrollbar-gutter: stable;
  1506. box-sizing: border-box !important;
  1507. border-top: 1px solid #292d32;
  1508. }
  1509.  
  1510. #${PANEL_ID} table {
  1511. width: 100%;
  1512. border-collapse: collapse;
  1513. table-layout: auto;
  1514. }
  1515.  
  1516. #${PANEL_ID} thead {
  1517. position: sticky;
  1518. top: 0;
  1519. z-index: 2;
  1520. background: #171a1e;
  1521. }
  1522.  
  1523. #${PANEL_ID} th,
  1524. #${PANEL_ID} td {
  1525. padding: 5px 8px;
  1526. text-align: left;
  1527. vertical-align: top;
  1528. border-bottom: 1px solid #292d32;
  1529. }
  1530.  
  1531. #${PANEL_ID} tbody tr:nth-child(even) {
  1532. background: rgba(255,255,255,.035);
  1533. }
  1534.  
  1535. #${PANEL_ID} tbody tr:hover {
  1536. background: rgba(65,130,100,.16);
  1537. }
  1538.  
  1539. #${PANEL_ID} .entry-line {
  1540. min-height: 18px;
  1541. white-space: nowrap;
  1542. }
  1543.  
  1544. #${PANEL_ID} .mop-cube-link,
  1545. #${PANEL_ID} .mop-jump-link {
  1546. color: #55d9ff !important;
  1547. text-decoration: none !important;
  1548. cursor: pointer !important;
  1549. font-weight: bold;
  1550. }
  1551.  
  1552. #${PANEL_ID} .mop-cube-link:hover,
  1553. #${PANEL_ID} .mop-jump-link:hover {
  1554. text-decoration: underline !important;
  1555. }
  1556.  
  1557. #${PANEL_ID} .mop-jump-separator {
  1558. color: #777;
  1559. margin: 0 4px;
  1560. }
  1561.  
  1562. #${PANEL_ID} .status {
  1563. color: #ffff00;
  1564. }
  1565.  
  1566. #${PANEL_ID} .secondary {
  1567. color: #828b94;
  1568. font-size: 11px;
  1569. margin-top: 2px;
  1570. }
  1571. `;
  1572.  
  1573. (document.head || document.documentElement).appendChild(style);
  1574. }
  1575.  
  1576. if (document.readyState === 'loading') {
  1577. document.addEventListener('DOMContentLoaded', start, { once: true });
  1578. } else {
  1579. start();
  1580. }
  1581. })();
Advertisement
Add Comment
Please, Sign In to add comment