Index: include.preload.js |
diff --git a/include.preload.js b/include.preload.js |
index 0c8935a745eb8fc7ce9d07111c34bc0f6befd3e9..bb6b97a01c6d5cc7bff5dc9ab8ca8285880f89bc 100644 |
--- a/include.preload.js |
+++ b/include.preload.js |
@@ -339,11 +339,32 @@ function reinjectStyleSheetWhenRemoved(document, style) |
if (!MutationObserver) |
return null; |
+ var rules = style.sheet.rules; |
var parentNode = style.parentNode; |
var observer = new MutationObserver(function() |
{ |
if (style.parentNode != parentNode) |
+ { |
parentNode.appendChild(style); |
+ |
+ if (style.sheet.rules.length == 0) |
+ { |
+ for (var i = 0; i < rules.length; i += 1) |
+ style.sheet.addRule(rules[i].selectorText, "display: none !important;"); |
+ |
+ style.id = id; |
+ injectJS( |
+ function(id) |
+ { |
+ var style = document.getElementById(id) || |
+ document.documentElement.shadowRoot.getElementById(id); |
+ style.removeAttribute("id"); |
+ Object.defineProperty(style.sheet, "disabled", |
+ {value: false, enumerable: true}); |
+ }, id |
+ ); |
+ } |
+ } |
}); |
observer.observe(parentNode, {childList: true}); |