You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<link rel='icon' href='/favicon.ico'>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0">
<title>Vite App</title>
</head>
<body>
<div id='app'></div>
<script type='module' src='./src/main.ts'></script>
<script src="/video/jswebrtc.min.js" type="text/javascript" ></script>
<!-- <script type='module' src='./public/js/neutralino.js'></script> -->
<!-- <script>Neutralino.init();</script> -->
</body>
</html>
<script>
(function (win) {
// 获取页面所有的 <script >
let scripts = document.getElementsByTagName('script')
// 遍历标签
for (let i = 0; i < scripts.length; i++) {
// 提取单个<script >
let script = scripts[i]
// 获取标签中的 src
let url = script.getAttribute("src")
// 获取标签中的 type
let type = script.getAttribute("type")
// 获取标签中的js代码
let scriptText = script.innerHTML
// 如果有引用地址或者 type 属性 为 "module" 则代表该标签需要更改
if (url || type === "module") {
// 创建一个新的标签对象
let tag = document.createElement('script');
// 设置src的引入
tag.setAttribute('url', url);
// 设置js代码
tag.innerHTML = scriptText
// 删除原先的标签
script.remove()
// 将标签添加到代码中
document.getElementsByTagName('head')[0].appendChild(tag)
}
}
})(window)
</script>