-
Notifications
You must be signed in to change notification settings - Fork 1
/
migrator.js
23 lines (19 loc) · 1.01 KB
/
migrator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const renderer = new DashRenderer();
(function(){
const url = document.URL;
const modules = {
swiper: ["https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js"],
eCharts: ["https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"],
userView: ["/MLA/assets/view_dashboard.js", "/MLA/assets/view_dashboard_plots.js"]}
// Maintain the scripts based on the order
const allowed_extensions = ["https://unpkg.com/dash.nprogress@latest/dist/dash.nprogress.js"];
const MLA_Prefixed = (page) => new RegExp(`^https?:\/\/.*\/MLA\/${page}`);
if(MLA_Prefixed("view").test(url) || MLA_Prefixed("_test").test(url))
allowed_extensions.push(...modules.swiper, ...modules.eCharts, ...modules.userView);
const head = document.getElementsByTagName('head')[0];
allowed_extensions.forEach(function(scriptPath){
const script = document.createElement('script');
script.type = 'text/javascript'; script.src = scriptPath;
head.appendChild(script);
});
})()