The argument for preventing downloading

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2023-10-06 19:16:58 +07:00
parent d3c0ab1e72
commit c788e7939d

View File

@ -23,7 +23,7 @@ if (typeof window.reinitializer !== "function") {
/**
* Instance of the observer
*/
observer = new MutationObserver(() => this.handle(this.root));
observer = new MutationObserver(() => this.handle());
/**
* Construct
@ -38,9 +38,11 @@ if (typeof window.reinitializer !== "function") {
/**
* Reinitialize <link> and <script> elements
*
* @param {bool} download Reinitialize elements with downloading or just move
*
* @return {bool} Processing status
*/
handle() {
handle(download = true) {
// Check for a dublicate execute launch
if (this.started) return false;
@ -56,8 +58,8 @@ if (typeof window.reinitializer !== "function") {
// Initialization of the <link> element
const link = links[0];
if (link.getAttribute("data-reinitializer-ignore") === "true") {
// Marked as ignored
if (download !== true || link.getAttribute("data-reinitializer-ignore") === "true") {
// Download is disabled or marked as ignored
// Move element
this.css.appendChild(link);
@ -124,8 +126,11 @@ if (typeof window.reinitializer !== "function") {
// Initialization of the <script> element
const script = scripts[0];
if (script.getAttribute("data-reinitializer-ignore") === "true") {
// Marked as ignored
console.log(download);
if (download !== true || script.getAttribute("data-reinitializer-ignore") === "true") {
// Download is disabled or marked as ignored
// Move element
this.js.appendChild(script);