biliob/Web/js/CommonConfig.js
zlzw b15d1c917f add 视频页面
update 用户管理
2024-11-18 18:27:49 +08:00

41 lines
1.1 KiB
JavaScript

var headerModel=0;
function createUi(html){
return fetch(html)
.then(response=>response.text())
.then(htmlText=>{
return htmlText;
})
}
function getParam(name){
console.log(window.location.href)
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
return null;
} else {
return decodeURI(results[1]) || 0;
}
}
function showImage(url, imgElement) {
getHttpImage(url)
.then(imageUrl => {
imgElement.src = imageUrl;
})
.catch(error => {
console.log("Error loading image:", error);
// 可以在这里设置一个默认图片或者显示错误信息
});
}
function showTmpImage(url, imgElement) {
getHttpTmpImage(url)
.then(blob => {
imgElement.src ="data:image/jpeg;base64,"+blob;
})
.catch(error => {
console.log("Error loading image:", error);
// 可以在这里设置一个默认图片或者显示错误信息
});
}
function hasString(text){
return !!text;
}