Skip to content

Commit 6b576ad

Browse files
committed
domopt: add config option
1 parent d3e8a4f commit 6b576ad

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/bootstrap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const startCore = () => {
4242
bw.webContents.executeJavaScript(readFileSync(join(__dirname, 'mainWindow.js'), 'utf8')
4343
.replaceAll('<hash>', hash).replaceAll('<channel>', channel)
4444
.replaceAll('<notrack>', oaConfig.noTrack !== false)
45+
.replaceAll('<domopt>', oaConfig.domOptimizer !== false)
4546
.replace('<css>', (oaConfig.css ?? '').replaceAll('\\', '\\\\').replaceAll('`', '\\`')));
4647

4748
if (oaConfig.js) bw.webContents.executeJavaScript(oaConfig.js);

src/mainWindow.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,7 @@ const optimize = orig => function(...args) {
7979
return orig.apply(this, args);
8080
};
8181

82-
Element.prototype.removeChild = optimize(Element.prototype.removeChild);
83-
// Element.prototype.appendChild = optimize(Element.prototype.appendChild);
82+
if ('<domopt>' === 'true') {
83+
Element.prototype.removeChild = optimize(Element.prototype.removeChild);
84+
// Element.prototype.appendChild = optimize(Element.prototype.appendChild);
85+
}

0 commit comments

Comments
 (0)