Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
✨ 自定义脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Dec 31, 2020
1 parent 0fdf133 commit a8d784f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/assets/css/global.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
html,body,#app{
height: 100vh;
margin: 0;
padding: 0;
}
Expand All @@ -18,4 +19,20 @@ html,body,#app{
.ant-table-body{
overflow: -moz-scrollbars-none;
-ms-overflow-style: none;
}

.ant-table-fixed>.ant-table-thead>tr>th{
background-color: rgba(0, 0, 0, 0);
}

.readme>.ant-card{
background-color: rgba(0, 0, 0, 0);
}

.ant-card-body div{
background-color: rgba(0, 0, 0, 0);
}

.markdown-preview{
background-color: rgba(0, 0, 0, 0) !important;
}
21 changes: 21 additions & 0 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ export default {
if(!this.info.logo){
this.info.logo=require('../assets/alist.png')
}
if(this.info.script){
this.loadJS(this.info.script)
}
}else{
this.$msg.error(res.meta.msg)
}
Expand Down Expand Up @@ -411,6 +414,24 @@ export default {
let content=this.info.backend_url+"/d/"+this.file_id
copyToClip(content)
this.$msg.success('链接已复制到剪贴板.');
},
loadJS(content){
return new Promise((resolve,reject)=>{
let script = document.createElement('script')
script.type = "text/javascript"
script.onload = ()=>{
resolve()
}
script.onerror = ()=>{
reject()
}
if(/^(http|https):\/\/([\w.]+\/?)\S*/.test(content)){
script.src=content
}else{
script.text= content
}
document.querySelector('body').appendChild(script)
})
}
},
mounted(){
Expand Down

0 comments on commit a8d784f

Please sign in to comment.