Skip to content

Commit

Permalink
add URLSechma button
Browse files Browse the repository at this point in the history
  • Loading branch information
donwa authored Feb 13, 2020
1 parent 5a6ad15 commit 6f6e506
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions themes/material/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ document.write('<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/d
// markdown支持
document.write('<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/markdown-it.min.js"></script>');
document.write('<style>.mdui-appbar .mdui-toolbar{height:56px;font-size:1pc}.mdui-toolbar>*{padding:0 6px;margin:0 2px}.mdui-toolbar>i{opacity:.5}.mdui-toolbar>.mdui-typo-headline{padding:0 1pc 0 0}.mdui-toolbar>i{padding:0}.mdui-toolbar>a:hover,a.active,a.mdui-typo-headline{opacity:1}.mdui-container{max-width:980px}.mdui-list-item{transition:none}.mdui-list>.th{background-color:initial}.mdui-list-item>a{width:100%;line-height:3pc}.mdui-list-item{margin:2px 0;padding:0}.mdui-toolbar>a:last-child{opacity:1}@media screen and (max-width:980px){.mdui-list-item .mdui-text-right{display:none}.mdui-container{width:100%!important;margin:0}.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>a:last-child,.mdui-toolbar>i:first-child{display:block}}</style>');

// 初始化页面,并载入必要资源
function init(){
document.siteName = $('title').html();
Expand Down Expand Up @@ -144,7 +145,7 @@ function list_files(path,files){
});
}
var ext = p.split('.').pop();
if("|html|php|css|go|java|js|json|txt|sh|md|mp4|bmp|jpg|jpeg|png|gif|m4a|mp3|wav|ogg|webm|avi|".indexOf(`|${ext}|`) >= 0){
if("|html|php|css|go|java|js|json|txt|sh|md|mp4|webm|avi|bmp|jpg|jpeg|png|gif|m4a|mp3|wav|ogg|mpg|mpeg|mkv|rm|rmvb|mov|wmv|asf|ts|flv|".indexOf(`|${ext}|`) >= 0){
p += "?a=view";
c += " view";
}
Expand Down Expand Up @@ -189,6 +190,10 @@ function file(path){
if("|mp4|webm|avi|".indexOf(`|${ext}|`) >= 0){
return file_video(path);
}

if("|mpg|mpeg|mkv|rm|rmvb|mov|wmv|asf|ts|flv|".indexOf(`|${ext}|`) >= 0){
return file_video(path);
}

if("|mp3|wav|ogg|m4a|".indexOf(`|${ext}|`) >= 0){
return file_audio(path);
Expand Down Expand Up @@ -255,13 +260,17 @@ function file_code(path){
// 文件展示 视频 |mp4|webm|avi|
function file_video(path){
var url = window.location.origin + path;
var playBtn = `<a class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent" href="potplayer://${url}"><i class="mdui-icon material-icons">&#xe038;</i>在 potplayer 中播放</a>`;
if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) { //移动端
playBtn = ` <a class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent" href="intent:${url}#Intent;package=com.mxtech.videoplayer.ad;S.title=${path};end"><i class="mdui-icon material-icons">&#xe039;</i>在mxplayer中播放</a>`;
}
var content = `
<div class="mdui-container-fluid">
<br>
<video class="mdui-video-fluid mdui-center" preload controls>
<source src="${url}" type="video/mp4">
</video>
<br>
<br>${playBtn}
<!-- 固定标签 -->
<div class="mdui-textfield">
<label class="mdui-textfield-label">下载地址</label>
Expand Down

0 comments on commit 6f6e506

Please sign in to comment.