Skip to content

Commit 6c2da80

Browse files
committed
Relase 2.13
Fix advanced pages not working
1 parent 98c6ad4 commit 6c2da80

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

content.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@
1414

1515
void function() {
1616
//TODO It would be preferable to deduplicate this code
17-
let clonedDocument = document.documentElement.cloneNode(true);
17+
let clonedDocument = new DOMParser().parseFromString(document.documentElement.outerHTML, "text/html");
1818

1919
//Remove script/style nodes
2020
let excludedNodes = clonedDocument.querySelectorAll("script, style, object, video, audio, img, source");
2121
for(let i = 0; i < excludedNodes.length; i++) {
2222
let thisNode = excludedNodes[i];
2323
thisNode.remove();
24-
// Browser does not unload video after removal from DOM
25-
// We have to unload it ourselves :(
26-
try { thisNode.pause(); } catch(e) {}
27-
try { thisNode.src = ""; } catch(e) {}
2824
}
2925

3026
chrome.runtime.sendMessage({

dynamicdetection.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ void function() {
22
//Do not inject twice
33
if(window._DynamicHistory_observer != null) return;
44

5-
var config = {
5+
let config = {
66
attributes: true,
77
childList: true,
88
characterData: true,
@@ -25,19 +25,17 @@ void function() {
2525
postChange();
2626
});
2727

28+
let parser = new DOMParser();
29+
2830
let postChange = function() {
2931
//TODO It would be preferable to deduplicate this code
30-
let clonedDocument = document.documentElement.cloneNode(true);
32+
let clonedDocument = parser.parseFromString(document.documentElement.outerHTML, "text/html");
3133

3234
//Remove script/style nodes
3335
let excludedNodes = clonedDocument.querySelectorAll("script, style, object, video, audio, img, source");
3436
for(let i = 0; i < excludedNodes.length; i++) {
3537
let thisNode = excludedNodes[i];
3638
thisNode.remove();
37-
// Browser does not unload video after removal from DOM
38-
// We have to unload it ourselves :(
39-
try { thisNode.pause(); } catch(e) {}
40-
try { thisNode.src = ""; } catch(e) {}
4139
}
4240

4341
chrome.runtime.sendMessage({

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"short_name": "DynamicHistory",
1010
"author": "nulldev",
1111
"description": "Automagically delete history based on the keywords on the page!",
12-
"version": "2.12",
12+
"version": "2.13",
1313
"options_ui": {
1414
"page": "options.html",
1515
"chrome_style": true,

0 commit comments

Comments
 (0)