Skip to content

Commit 678bfb2

Browse files
committed
Infrastructure Preparation 24
1 parent e656c2b commit 678bfb2

File tree

3 files changed

+72
-2
lines changed

3 files changed

+72
-2
lines changed

demo/Taiizor.Essentials.Maui.Conforyon/Usage/Initialize/Initialize.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555

5656
<ItemGroup>
5757
<PackageReference Include="Taiizor.Essentials.Maui" Version="22.11.23.1515" />
58-
<PackageReference Include="Taiizor.Essentials.Blazor" Version="22.11.27.145" />
59-
<PackageReference Include="Taiizor.Essentials.Blazor.Conforyon" Version="22.11.25.1514" />
58+
<PackageReference Include="Taiizor.Essentials.Blazor" Version="22.12.4.1759" />
59+
<PackageReference Include="Taiizor.Essentials.Blazor.Conforyon" Version="22.12.3.310" />
6060
</ItemGroup>
6161

6262
<!--<ItemGroup>

src/Taiizor.Essentials.Blazor/Extension/Include.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ public static async Task FontProtected(string Path, string Rel, string Pathname)
2424
await Font(Path, Rel);
2525
}
2626
}
27+
public static async Task FontElement(string Identify, string Path)
28+
{
29+
await FontElement(Identify, Path, "stylesheet");
30+
}
31+
32+
public static async Task FontElementProtected(string Identify, string Path, string Pathname)
33+
{
34+
await FontElementProtected(Identify, Path, "stylesheet", Pathname);
35+
}
36+
37+
public static async Task FontElement(string Identify, string Path, string Rel)
38+
{
39+
await Interop.Call("Taiizor.Include.Font.Element", Identify, Path, Rel);
40+
}
41+
42+
public static async Task FontElementProtected(string Identify, string Path, string Rel, string Pathname)
43+
{
44+
if (await Location.GetPathname() == Pathname)
45+
{
46+
await FontElement(Identify, Path, Rel);
47+
}
48+
}
2749

2850
public static async Task Script(string Path)
2951
{
@@ -83,5 +105,38 @@ public static async Task StylesheetProtected(string Path, string Rel, string Typ
83105
await Stylesheet(Path, Rel, Type);
84106
}
85107
}
108+
109+
public static async Task StylesheetElement(string Identify, string Path)
110+
{
111+
await StylesheetElement(Identify, Path, "stylesheet");
112+
}
113+
114+
public static async Task StylesheetElementProtected(string Identify, string Path, string Pathname)
115+
{
116+
await StylesheetElementProtected(Identify, Path, "stylesheet", Pathname);
117+
}
118+
119+
public static async Task StylesheetElement(string Identify, string Path, string Rel)
120+
{
121+
await StylesheetElement(Identify, Path, Rel, "text/css");
122+
}
123+
124+
public static async Task StylesheetElementProtected(string Identify, string Path, string Rel, string Pathname)
125+
{
126+
await StylesheetElementProtected(Identify, Path, Rel, "text/css", Pathname);
127+
}
128+
129+
public static async Task StylesheetElement(string Identify, string Path, string Rel, string Type)
130+
{
131+
await Interop.Call("Taiizor.Include.Css.Element", Identify, Path, Rel, Type);
132+
}
133+
134+
public static async Task StylesheetElementProtected(string Identify, string Path, string Rel, string Type, string Pathname)
135+
{
136+
if (await Location.GetPathname() == Pathname)
137+
{
138+
await StylesheetElement(Identify, Path, Rel, Type);
139+
}
140+
}
86141
}
87142
}

src/Taiizor.Essentials.Blazor/Resources/Raw/Taiizor.Blazor.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,13 @@ Taiizor.Include.Font = function (path, rel) {
883883
document.head.appendChild(customFont);
884884
}
885885

886+
Taiizor.Include.Font.Element = function (elementId, path, rel) {
887+
var customFont = document.createElement('link');
888+
customFont.setAttribute('href', path);
889+
customFont.setAttribute('rel', rel);
890+
document.getElementById(elementId).appendChild(customFont);
891+
}
892+
886893
Taiizor.Include.Js = function (path) {
887894
var customScript = document.createElement('script');
888895
customScript.setAttribute('src', path);
@@ -903,6 +910,14 @@ Taiizor.Include.Css = function (path, rel, type) {
903910
document.head.appendChild(customStylesheet);
904911
}
905912

913+
Taiizor.Include.Css.Element = function (elementId, path, rel, type) {
914+
var customStylesheet = document.createElement('link');
915+
customStylesheet.setAttribute('href', path);
916+
customStylesheet.setAttribute('rel', rel);
917+
customStylesheet.setAttribute('type', type);
918+
document.getElementById(elementId).appendChild(customStylesheet);
919+
}
920+
906921

907922

908923
Taiizor.Invoke.MethodAsync = function (assemblyName, methodName, ...args) {

0 commit comments

Comments
 (0)