-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathimport_net8_resources.js
117 lines (110 loc) · 4.09 KB
/
import_net8_resources.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import {data} from './version.js';
if (data.version == "net8.0") {
var path = "_content/Blazor_Server_Common_NET8";
}
else {
var path = "_content/Blazor_Server_Common_NET9";
}
const homepagepath = ["/demos/", "/net9/demos/", "/staging/server/demos/", "/server/demos/" ,"/net8/demos/", "/development/net8/demos/", "/development/net9/demos/", "/release/net8/demos/", "/release/net9/demos/", "/hotfix/net8/demos/", "/hotfix/net9/demos/","/cloudtesting/net8-server/","/"];
function dynamicResources() {
if (window.location.href.indexOf('pdf-viewer-2') != -1 || window.location.href.indexOf('powerpoint') != -1) {
let newScript = document.createElement('script');
newScript.setAttribute('src', "_content/Syncfusion.Blazor.SfPdfViewer/scripts/syncfusion-blazor-sfpdfviewer.min.js");
document.getElementsByClassName('dynamic-resources')[0].appendChild(newScript);
}
if (window.location.href.indexOf('document-editor') != -1) {
let newScript = document.createElement('script');
newScript.setAttribute('src', "_content/Syncfusion.Blazor.WordProcessor/scripts/syncfusion-blazor-documenteditor.min.js");
document.getElementsByClassName('dynamic-resources')[0].appendChild(newScript);
}
}
function loadAssets(file) {
if (file.indexOf(".css") >= 0) {
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href', file);
if (file.indexOf("device") >= 0) {
link.setAttribute('media', "(max-width: 1024px)");
}
document.head.appendChild(link);
}
else if (file.indexOf(".js") >= 0) {
const script = document.createElement('script');
script.setAttribute('src', file);
document.body.appendChild(script);
}
else {
const link = document.createElement('link');
link.setAttribute('rel', 'shortcut icon');
link.setAttribute('type', 'image/x-icon');
link.setAttribute('href', file);
document.head.appendChild(link);
}
}
function homePageAssets() {
var assetFiles;
if (data.configuration == "Release") {
assetFiles = [
'/styles/bootstrap.min.css',
'/favicon.ico',
'/styles/site.css',
'/styles/common/home.min.css',
'/styles/common/devices.min.css',
'/scripts/common/index.min.js'
];
} else {
assetFiles = [
'/styles/bootstrap.min.css',
'/favicon.ico',
'/styles/site.css',
'/styles/common/home.css',
'/styles/common/devices.css',
'/scripts/common/index.js'
];
}
assetFiles.forEach((file) => {
loadAssets(path + file);
});
}
function samplePageAssets() {
var assetFiles;
if (data.configuration == "Release") {
assetFiles = [
'/favicon.ico',
'/styles/bootstrap.min.css',
'/styles/common/demos.min.css',
'/styles/common/devices.min.css',
'/scripts/common/highlight.min.js',
'/scripts/common/index.min.js',
'/scripts/image-editor.min.js',
'/scripts/richtexteditor.min.js',
'/styles/common/dark-theme.min.css',
];
} else {
assetFiles = [
'/styles/common/highcontrast.css',
'/favicon.ico',
'/styles/common/roboto.css',
'/styles/bootstrap.min.css',
'/styles/common/highlight.css',
'/styles/common/demos.css',
'/styles/common/devices.css',
'/scripts/common/highlight.min.js',
'/scripts/common/index.js',
'/scripts/image-editor.js',
'/scripts/richtexteditor.js',
'/styles/common/dark-theme.css',
]; }
assetFiles.forEach((file) => {
loadAssets(path + file);
});
}
if (homepagepath.indexOf(window.location.pathname) !== -1) {
homePageAssets();
loadAssets('_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js');
}
else {
samplePageAssets();
}
dynamicResources();