Skip to content

Commit

Permalink
Loading "src" or "inner script"
Browse files Browse the repository at this point in the history
- Fixed the script for reloading eighter the src or the inner script
- Fixed "SameSite=lax" with removing it from cookie initialisation
- Fixed init() funktion where case support called the wrong funktion
  • Loading branch information
Jersyfi authored May 6, 2021
1 parent b9d5557 commit 959bb71
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cookify.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Cookify {
break;

case 'support':
this.initExpire(element, type);
this.initSupport(element, type);
break;

case 'view':
Expand Down Expand Up @@ -811,7 +811,7 @@ export class Cookify {

var expires = "expires=" + d.toUTCString();

document.cookie = this._name + "=" + btoa(JSON.stringify(cookieValue)) + ";" + expires + ";path=/" + ";SameSite=Lax";
document.cookie = this._name + "=" + btoa(JSON.stringify(cookieValue)) + ";" + expires + ";path=/";
}

/**
Expand Down Expand Up @@ -942,9 +942,11 @@ export class Cookify {
if (element.hasAttribute("type")) {
if (type == "js") {
element.setAttribute("type", "text/javascript");
var attr = element.getAttribute("src");
element.removeAttribute("src");
element.setAttribute("src", attr);
if (element.hasAttribute("src")) {
element.setAttribute("src", element.getAttribute("src"));
} else {
element.innerHTML = element.innerHTML;
}
} else {
element.setAttribute("type", "text/plain");
}
Expand Down Expand Up @@ -992,4 +994,4 @@ export class Cookify {
ucfirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
}
}

0 comments on commit 959bb71

Please sign in to comment.