domopt: add config option

pull/142/head
CanadaHonk 1 year ago
parent d3e8a4f341
commit 6b576adba5

1
src/bootstrap.js vendored

@ -42,6 +42,7 @@ const startCore = () => {
bw.webContents.executeJavaScript(readFileSync(join(__dirname, 'mainWindow.js'), 'utf8')
.replaceAll('<hash>', hash).replaceAll('<channel>', channel)
.replaceAll('<notrack>', oaConfig.noTrack !== false)
.replaceAll('<domopt>', oaConfig.domOptimizer !== false)
.replace('<css>', (oaConfig.css ?? '').replaceAll('\\', '\\\\').replaceAll('`', '\\`')));
if (oaConfig.js) bw.webContents.executeJavaScript(oaConfig.js);

@ -79,5 +79,7 @@ const optimize = orig => function(...args) {
return orig.apply(this, args);
};
Element.prototype.removeChild = optimize(Element.prototype.removeChild);
// Element.prototype.appendChild = optimize(Element.prototype.appendChild);
if ('<domopt>' === 'true') {
Element.prototype.removeChild = optimize(Element.prototype.removeChild);
// Element.prototype.appendChild = optimize(Element.prototype.appendChild);
}
Loading…
Cancel
Save