Browse Source

fix-remark-existing-dom-on-chat-change-and-fail-log-detail

master
Serge Shutov 2 weeks ago
parent
commit
988d006905
  1. 8
      content/content.js

8
content/content.js

@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
var queue = [];
var pumping = false;
var timer = null;
var pending = new Set(); var lastPath = location.pathname; function __onPathChange() { var p = location.pathname; if (p === lastPath) return; lastPath = p; queue.length = 0; pending.clear(); seenHashes.clear(); seenCallsHashes.clear(); pumping = false; if (UI) { UI.setPhase('idle'); if (UI.log) UI.log('chat changed ' + p); } try { window.dispatchEvent(new CustomEvent('dshmem:chat-change', { detail: p })); } catch (e) {} } window.addEventListener('popstate', __onPathChange); try { var __ps = history.pushState; var __rs = history.replaceState; history.pushState = function () { var r = __ps.apply(this, arguments); setTimeout(__onPathChange, 0); return r; }; history.replaceState = function () { var r = __rs.apply(this, arguments); setTimeout(__onPathChange, 0); return r; }; } catch (e) {} setInterval(__onPathChange, 1000);
var pending = new Set(); var lastPath = location.pathname; function __onPathChange() { var p = location.pathname; if (p === lastPath) return; lastPath = p; queue.length = 0; pending.clear(); seenHashes.clear(); seenCallsHashes.clear(); pumping = false; setTimeout(function () { try { markExistingAsProcessed(); } catch (e) { } }, 200); setTimeout(function () { try { markExistingAsProcessed(); } catch (e) { } }, 1200); if (UI) { UI.setPhase('idle'); if (UI.log) UI.log('chat changed ' + p); } try { window.dispatchEvent(new CustomEvent('dshmem:chat-change', { detail: p })); } catch (e) {} } window.addEventListener('popstate', __onPathChange); try { var __ps = history.pushState; var __rs = history.replaceState; history.pushState = function () { var r = __ps.apply(this, arguments); setTimeout(__onPathChange, 0); return r; }; history.replaceState = function () { var r = __rs.apply(this, arguments); setTimeout(__onPathChange, 0); return r; }; } catch (e) {} setInterval(__onPathChange, 1000);
function hashText(s) {
var h = 5381;
@ -227,12 +227,12 @@ @@ -227,12 +227,12 @@
console.log('[dsh-memory] call ok', call.tool, res.durationMs);
if (UI) UI.log('ok ' + call.tool);
} else {
console.warn('[dsh-memory] call failed', call.tool, JSON.stringify(res.error));
if (UI) UI.log('fail ' + call.tool);
try { console.warn('[dsh-memory] call failed', call.tool, JSON.stringify(res.error)); } catch (e) { }
if (UI) UI.log('fail ' + call.tool + ' ' + JSON.stringify((res && res.error) || 'nores'));
}
} else {
console.warn('[dsh-memory] call failed (no res)', call.tool);
if (UI) UI.log('fail ' + call.tool);
if (UI) UI.log('fail ' + call.tool + ' ' + JSON.stringify((res && res.error) || 'nores'));
}
}).catch(function (err) { console.warn('[dsh-memory] call throw', call.tool, String(err)); }).then(step);
};

Loading…
Cancel
Save