Fixed issue with loading resources

This commit is contained in:
Shaun Walker 2020-05-16 22:11:58 -04:00
parent c426302242
commit f8ab886750
3 changed files with 9 additions and 19 deletions

View File

@ -37,10 +37,4 @@
return resources; return resources;
} }
} }
protected override async Task OnParametersSetAsync()
{
//await IncludeCSS("Theme.css");
}
} }

View File

@ -25,16 +25,8 @@
{ {
List<Resource> resources = new List<Resource>(); List<Resource> resources = new List<Resource>();
resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css", Integrity = "sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM", CrossOrigin = "anonymous" }); resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css", Integrity = "sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM", CrossOrigin = "anonymous" });
resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "Themes/" + GetType().Namespace + "/Theme.css" }); resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "Themes/" + GetType().Namespace + "/Theme.css", Integrity = "", CrossOrigin = "" });
return resources; return resources;
} }
} }
protected override async Task OnParametersSetAsync()
{
// go to https://www.bootstrapcdn.com/bootswatch/ and take your favorite theme
//<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css" rel="stylesheet" integrity="sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM" crossorigin="anonymous">
//await LoadBootstrapTheme("https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css","sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM");
//await IncludeCSS("Theme.css");
}
} }

View File

@ -62,10 +62,10 @@ window.interop = {
link.id = id; link.id = id;
} }
link.rel = rel; link.rel = rel;
link.href = url;
if (type !== "") { if (type !== "") {
link.type = type; link.type = type;
} }
link.href = url;
if (integrity !== "") { if (integrity !== "") {
link.integrity = integrity; link.integrity = integrity;
} }
@ -78,9 +78,6 @@ window.interop = {
if (link.rel !== rel) { if (link.rel !== rel) {
link.setAttribute('rel', rel); link.setAttribute('rel', rel);
} }
if (link.href !== url) {
link.setAttribute('href', url);
}
if (type !== "") { if (type !== "") {
if (link.type !== type) { if (link.type !== type) {
link.setAttribute('type', type); link.setAttribute('type', type);
@ -88,6 +85,11 @@ window.interop = {
} else { } else {
link.removeAttribute('type'); link.removeAttribute('type');
} }
if (link.href !== url) {
link.removeAttribute('integrity');
link.removeAttribute('crossorigin');
link.setAttribute('href', url);
}
if (integrity !== "") { if (integrity !== "") {
if (link.integrity !== integrity) { if (link.integrity !== integrity) {
link.setAttribute('integrity', integrity); link.setAttribute('integrity', integrity);
@ -136,6 +138,8 @@ window.interop = {
else { else {
if (src !== "") { if (src !== "") {
if (script.src !== src) { if (script.src !== src) {
script.removeAttribute('integrity');
script.removeAttribute('crossorigin');
script.src = src; script.src = src;
} }
if (integrity !== "") { if (integrity !== "") {