biliob/Web/js/CommonConfig.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-10-30 18:27:37 +08:00
var headerModel=0;
function createUi(html){
return fetch(html)
.then(response=>response.text())
.then(htmlText=>{
return htmlText;
})
2024-10-31 18:23:39 +08:00
}
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);
// 可以在这里设置一个默认图片或者显示错误信息
});
2024-11-01 00:15:12 +08:00
}
function showTmpImage(url, imgElement) {
getHttpTmpImage(url)
.then(blob => {
imgElement.src ="data:image/jpeg;base64,"+blob;
})
.catch(error => {
console.log("Error loading image:", error);
// 可以在这里设置一个默认图片或者显示错误信息
});
2024-11-18 18:27:49 +08:00
}
function hasString(text){
return !!text;
2024-10-30 18:27:37 +08:00
}