Merge pull request #74 from qkqpttgf/master

pull
pull/98/head
Mr.Lin 2020-05-15 22:50:15 +08:00 committed by GitHub
commit 4d5da0f231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 393 additions and 28 deletions

View File

@ -153,6 +153,8 @@ function main($path)
global $exts;
global $constStr;
$_SERVER['php_starttime'] = microtime(true);
$path = path_format($path);
if (in_array($_SERVER['firstacceptlanguage'], array_keys($constStr['languages']))) {
$constStr['language'] = $_SERVER['firstacceptlanguage'];
} else {
@ -216,10 +218,14 @@ function main($path)
// echo 'count$disk:'.count($disktags);
if (count($disktags)>1) {
if ($path=='/'||$path=='') return output('', 302, [ 'Location' => path_format($_SERVER['base_path'].'/'.$disktags[0].'/') ]);
$_SERVER['disktag'] = $path;
$pos = strpos($path, '/');
if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
if (!in_array($_SERVER['disktag'], $disktags)) return message('<meta http-equiv="refresh" content="2;URL='.$_SERVER['base_path'].'">Please visit from <a href="'.$_SERVER['base_path'].'">Home Page</a>.', 'Error', 404);
$_SERVER['disktag'] = splitfirst( substr(path_format($path), 1), '/' )[0];
//$pos = strpos($path, '/');
//if ($pos>1) $_SERVER['disktag'] = substr($path, 0, $pos);
if (!in_array($_SERVER['disktag'], $disktags)) {
$tmp = path_format($_SERVER['base_path'].'/'.$disktags[0].'/'.$path);
return output('Please visit <a href="'.$tmp.'">'.$tmp.'</a>.', 302, [ 'Location' => $tmp ]);
//return message('<meta http-equiv="refresh" content="2;URL='.$_SERVER['base_path'].'">Please visit from <a href="'.$_SERVER['base_path'].'">Home Page</a>.', 'Error', 404);
}
$path = substr($path, strlen('/'.$_SERVER['disktag']));
if ($_SERVER['disktag']!='') $_SERVER['base_disk_path'] = path_format($_SERVER['base_disk_path']. '/' . $_SERVER['disktag'] . '/');
} else $_SERVER['disktag'] = $disktags[0];
@ -1372,10 +1378,17 @@ function get_refresh_token()
$tmp['Drive_custom'] = $_POST['Drive_custom'];
$tmp['client_id'] = $_POST['client_id'];
$tmp['client_secret'] = $_POST['client_secret'];
} else {
$tmp['Drive_custom'] = '';
$tmp['client_id'] = '';
$tmp['client_secret'] = '';
}
if ($_POST['usesharepoint']=='on') {
$tmp['usesharepoint'] = $_POST['usesharepoint'];
$tmp['sharepointSiteAddress'] = $_POST['sharepointSiteAddress'];
} else {
$tmp['usesharepoint'] = '';
$tmp['sharepointSiteAddress'] = '';
}
}
$response = setConfigResponse( setConfig($tmp, $_COOKIE['disktag']) );
@ -1732,7 +1745,7 @@ function render_list($path = '', $files = '')
date_default_timezone_set(get_timezone($_SERVER['timezone']));
$authinfo = '<!--
OneManager: An index & manager of Onedrive auth by ysun.
Github https://github.com/qkqpttgf/OneManager-php
Github: https://github.com/qkqpttgf/OneManager-php
-->';
$theme = getConfig('theme');
@ -1874,7 +1887,7 @@ function render_list($path = '', $files = '')
$html = str_replace('<!--GuestUploadEnd-->', '', $html);
}
}
if ($_SERVER['is_guestup_path']||$_SERVER['admin']) {
if ($_SERVER['is_guestup_path']||( $_SERVER['admin']&&isset($files['folder'])&&$_SERVER['ishidden']<4 )) {
while (strpos($html, '<!--UploadJsStart-->')) {
$html = str_replace('<!--UploadJsStart-->', '', $html);
$html = str_replace('<!--UploadJsEnd-->', '', $html);
@ -1921,10 +1934,13 @@ function render_list($path = '', $files = '')
$html = str_replace('<!--EncryptedStart-->', '', $html);
$html = str_replace('<!--EncryptedEnd-->', '', $html);
}
/*while (strpos($html, '<!--IsFolderStart-->')) {
$html = str_replace('<!--IsFolderStart-->', '', $html);
$html = str_replace('<!--IsFolderEnd-->', '', $html);
}*/
$tmp[1] = 'a';
while ($tmp[1]!='') {
$tmp = splitfirst($html, '<!--GuestUploadStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--GuestUploadEnd-->');
$html .= $tmp[1];
}
}
if (isset($files['children'])) {
@ -1997,8 +2013,10 @@ function render_list($path = '', $files = '')
if ($ext==$key1) {
$FolderListStr = str_replace('<!--IconValue-->', $value1, $FolderListStr);
}
//error_log('file:'.$file['name'].':'.$key1);
if (!strpos($FolderListStr, '<!--IconValue-->')) break;
}
$FolderListStr = str_replace('<!--IconValue-->', $IconValues['default'], $FolderListStr);
if (strpos($FolderListStr, '<!--IconValue-->')) $FolderListStr = str_replace('<!--IconValue-->', $IconValues['default'], $FolderListStr);
while (strpos($FolderListStr, '<!--filenum-->')) $FolderListStr = str_replace('<!--filenum-->', $filenum, $FolderListStr);
$html .= $FolderListStr;
}
@ -2120,6 +2138,7 @@ function render_list($path = '', $files = '')
$html = str_replace('<!--Is'.$ext.'FileEnd-->', '', $html);
}
while (strpos($html, '<!--FileDownUrl-->')) $html = str_replace('<!--FileDownUrl-->', $files[$_SERVER['DownurlStrName']], $html);
while (strpos($html, '<!--FileEncodeReplaceUrl-->')) $html = str_replace('<!--FileEncodeReplaceUrl-->', path_format($_SERVER['base_disk_path'] . '/' . $path), $html);
while (strpos($html, '<!--FileName-->')) $html = str_replace('<!--FileName-->', $files['name'], $html);
$html = str_replace('<!--FileEncodeDownUrl-->', urlencode($files[$_SERVER['DownurlStrName']]), $html);
$html = str_replace('<!--constStr@ClicktoEdit-->', getconstStr('ClicktoEdit'), $html);
@ -2144,22 +2163,24 @@ function render_list($path = '', $files = '')
$html = str_replace('<!--Title-->', $title, $html);
$keywords = $n_path;
if ($p_path!='') $keywords .= ',' . $p_path;
$keywords .= ',' . $_SERVER['sitename'] . ',OneManager';
if ($p_path!='') $keywords .= ', ' . $p_path;
if ($_SERVER['sitename']!='OneManager') $keywords .= ', ' . $_SERVER['sitename'] . ', OneManager';
else $keywords .= ', OneManager';
$html = str_replace('<!--Keywords-->', $keywords, $html);
if ($_GET['preview']) $description = 'Preview of '.$n_path.'. ';
elseif (isset($files['folder'])) $description = 'List of '.$n_path.'. ';
$description .= 'In '.$_SERVER['sitename'];
if ($_GET['preview']) {
$description = $n_path.', '.getconstStr('Preview');//'Preview of '.
} elseif (isset($files['folder'])) {
$description = $n_path.', '.getconstStr('List');//'List of '.$n_path.'. ';
}
//$description .= 'In '.$_SERVER['sitename'];
$html = str_replace('<!--Description-->', $description, $html);
while (strpos($html, '<!--base_disk_path-->')) $html = str_replace('<!--base_disk_path-->', $_SERVER['base_disk_path'], $html);
while (strpos($html, '<!--base_path-->')) $html = str_replace('<!--base_path-->', $_SERVER['base_path'], $html);
while (strpos($html, '<!--Path-->')) $html = str_replace('<!--Path-->', str_replace('%23', '#', str_replace('&','&amp;', $path)), $html);
while (strpos($html, '<!--constStr@Home-->')) $html = str_replace('<!--constStr@Home-->', getconstStr('Home'), $html);
while (strpos($html, '<!--timezone-->')) $html = str_replace('<!--timezone-->', $_SERVER['timezone'], $html);
$html = str_replace('<!--customCss-->', getConfig('customCss'), $html);
$html = str_replace('<!--customScript-->', getConfig('customScript'), $html);
@ -2190,9 +2211,6 @@ function render_list($path = '', $files = '')
while (strpos($html, '<!--constStr@UploadFile-->')) $html = str_replace('<!--constStr@UploadFile-->', getconstStr('UploadFile'), $html);
while (strpos($html, '<!--constStr@UploadFolder-->')) $html = str_replace('<!--constStr@UploadFolder-->', getconstStr('UploadFolder'), $html);
while (strpos($html, '<!--IsPreview?-->')) $html = str_replace('<!--IsPreview?-->', (isset($_GET['preview'])?'?preview&':'?'), $html);
$html = str_replace('<!--FootStr-->', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'], $html);
$tmp = splitfirst($html, '<!--BackgroundStart-->');
$html = $tmp[0];
@ -2245,7 +2263,7 @@ function render_list($path = '', $files = '')
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--ShowThumbnailsEnd-->');
if (!(isset($_SERVER['USER'])&&$_SERVER['USER']=='qcloud')) {
$html .= $tmp[0] . $tmp[1];
$html .= str_replace('<!--constStr@OriginalPic-->', getconstStr('OriginalPic'), $tmp[0]) . $tmp[1];
} else $html .= $tmp[1];
}
$imgextstr = '';
@ -2399,13 +2417,21 @@ function render_list($path = '', $files = '')
}
$html .= $tmp[1];
$tmp = splitfirst($html, '<!--WriteTimezoneStart-->');
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--WriteTimezoneEnd-->');
if (!isset($_COOKIE['timezone'])) $html .= str_replace('<!--timezone-->', $_SERVER['timezone'], $tmp[0]);
$html .= $tmp[1];
while (strpos($html, '<!--timezone-->')) $html = str_replace('<!--timezone-->', $_SERVER['timezone'], $html);
// 最后清除换行
while (strpos($html, "\r\n\r\n")) $html = str_replace("\r\n\r\n", "\r\n", $html);
//while (strpos($html, PHP_EOL.PHP_EOL)) $html = str_replace(PHP_EOL.PHP_EOL, PHP_EOL, $html);
$exetime = round(microtime(true)-$_SERVER['php_starttime'],3);
$html = str_replace('<!--FootStr-->', date("Y-m-d H:i:s")." ".getconstStr('Week')[date("w")]." ".$_SERVER['REMOTE_ADDR'].' Runtime:'.$exetime.'s Mem:'.size_format(memory_get_usage()), $html);
}
$html = $authinfo . $html;
if (isset($_SERVER['Set-Cookie'])) return output($html, $statusCode, [ 'Set-Cookie' => $_SERVER['Set-Cookie'], 'Content-Type' => 'text/html' ]);
return output($html,$statusCode);

View File

@ -4,7 +4,7 @@ $exts['img'] = ['ico', 'bmp', 'gif', 'jpg', 'jpeg', 'jpe', 'jfif', 'tif', 'tiff'
$exts['music'] = ['mp3', 'wma', 'flac', 'wav', 'ogg', 'm4a'];
$exts['office'] = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];
$exts['txt'] = ['txt', 'bat', 'sh', 'php', 'asp', 'js', 'json', 'html', 'c', 'md', 'py', 'omf'];
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8'];
$exts['video'] = ['mp4', 'webm', 'mkv', 'mov', 'flv', 'blv', 'avi', 'wmv', 'm3u8', 'rm', 'rmvb'];
$exts['zip'] = ['zip', 'rar', '7z', 'gz', 'tar'];
$constStr = [
@ -259,6 +259,14 @@ $constStr = [
'ko-kr' => '홈',
'fa' => 'خانه',
],
'Preview' => [
'en-us' => 'Preview',
'zh-cn' => '预览',
],
'List' => [
'en-us' => 'List',
'zh-cn' => '列表',
],
'NeedUpdate' => [
'en-us' => 'Program can update<br>Click setup in Operate at top.',
'zh-cn' => '可以升级程序<br>在上方管理菜单中<br>进入设置页面升级',
@ -329,6 +337,10 @@ $constStr = [
'ko-kr' => '사진 섬네일',
'fa' => 'تصویر بندانگشتی',
],
'OriginalPic' => [
'en-us' => 'OriginalPic',
'zh-cn' => '原图',
],
'CopyAllDownloadUrl' => [
'en-us' => 'CopyAllDownloadUrl',
'zh-cn' => '复制所有下载链接',
@ -658,8 +670,8 @@ $constStr = [
'zh-cn' => '对一个Onedrive文件夹共享允许所有人编辑然后将共享链接填在下方',
],
'CustomIdSecret' => [
'en-us' => 'Use custom client id & secret',
'zh-cn' => '自己申请应用ID与机密',
'en-us' => 'Use custom client id & secret instead of OneManager default',
'zh-cn' => '自己申请应用ID与机密不用OneManager默认的',
'ja' => 'アプリケーションIDとシークレットを自分で申請する',
'ko-kr' => '응용 프로그램 ID 및 비밀 신청',
'fa' => 'به طور پیش فرض اما از شناسه برنامه و سکرت استفاده کنید',

View File

@ -3,6 +3,7 @@
function getpath()
{
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
$_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
$p = strpos($_SERVER['REQUEST_URI'],'?');
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);

326
theme/nexmoe.html Normal file
View File

@ -0,0 +1,326 @@
<!--IconValuesStart-->
{
"music":"audiotrack",
"video":"ondemand_video",
"img":"image",
"default":"insert_drive_file"
}
<!--IconValuesEnd-->
<!DOCTYPE html>
<html lang="<!--constStr@language-->">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<title><!--Title--></title>
<link rel="stylesheet" href="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/css/mdui.css">
<style>
body{background-color:#f2f5fa;padding-bottom:60px;background-position:center bottom;background-repeat:no-repeat;background-attachment:fixed}.nexmoe-item{margin:20px -8px 0!important;padding:15px!important;border-radius:5px;background-color:#fff;-webkit-box-shadow:0 .5em 3em rgba(161,177,204,.4);box-shadow:0 .5em 3em rgba(161,177,204,.4);background-color:#fff}.mdui-img-fluid,.mdui-video-fluid{border-radius:5px;border:1px solid #eee}.mdui-list{padding:0}.mdui-list-item{margin:0!important;border-radius:5px;padding:0 10px 0 5px!important;border:1px solid #eee;margin-bottom:10px!important}.mdui-list-item:last-child{margin-bottom:0!important}.mdui-list-item:first-child{border:none}.mdui-toolbar{width:auto;margin-top:60px!important}.mdui-appbar .mdui-toolbar{height:56px;font-size:16px}.mdui-toolbar>*{padding:0 6px;margin:0 2px;opacity:.5}.mdui-toolbar>.mdui-typo-headline{padding:0 16px 0 0}.mdui-toolbar>i{padding:0}.mdui-toolbar>a:hover,a.mdui-typo-headline,a.active{opacity:1}.mdui-container{max-width:980px}.mdui-list>.th{background-color:initial}.mdui-list-item>a{width:100%;line-height:48px}.mdui-toolbar>a{padding:0 16px;line-height:30px;border-radius:30px;border:1px solid #eee}.mdui-toolbar>a:last-child{opacity:1;background-color:#1e89f2;color:#ffff}@media screen and (max-width:980px){.mdui-list-item .mdui-text-right{display:none}.mdui-container{width:100%!important;margin:0}.mdui-toolbar>*{display:none}.mdui-toolbar>a:last-child,.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>i:first-child{display:block}}
</style>
<script src="//cdnjs.loli.net/ajax/libs/mdui/0.4.1/js/mdui.min.js"></script>
</head>
<body class="mdui-theme-primary-blue-grey mdui-theme-accent-blue">
<div class="mdui-container">
<div class="mdui-container-fluid">
<div class="mdui-toolbar nexmoe-item" id="toolbar">
<!--Path-->
</div>
</div>
<!--ListStart-->
<div class="mdui-container-fluid">
<!--EncryptedStart-->
<div class="mdui-col-md-6 mdui-col-offset-md-3">
<!--<center><h1 class="mdui-typo-display-2-opacity">这是一个受保护的文件夹,您需要提供访问密码才能查看。</h1></center>-->
<form action="" method="post">
<div class="mdui-textfield mdui-textfield-floating-label">
<i class="mdui-icon material-icons">https</i>
<label class="mdui-textfield-label"><!--constStr@InputPassword--></label>
<input name="password1" class="mdui-textfield-input" type="password"/>
</div>
<br>
<button type="submit" class="mdui-center mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme">
<i class="mdui-icon material-icons">fingerprint</i>
<!--constStr@Submit-->
</button>
</form>
</div>
<!--EncryptedEnd-->
<!--GuestUploadStart-->
<!--
<div class="nexmoe-item" style="padding: 100px!important;">
<div class="mdui-typo-display-3-opacity" style="text-align:center;">OneImages</div>
<form action="" method="post" enctype="multipart/form-data">
<input class="mdui-center" type="file" style="margin: 50px 0;" name="file" />
<div class="mdui-row-xs-3">
<div class="mdui-col"></div>
<div class="mdui-col">
<button class="mdui-btn mdui-btn-block mdui-color-theme-accent mdui-ripple"><!--constStr@Upload--></button>
</div>
</div>
</form>
</div>
-->
<!--GuestUploadEnd-->
<!--HeadmdStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">face</i></span>
<span class="mdui-chip-title">HEAD.md</span>
</div>-->
<!--HeadmdContent-->
</div>
<!--HeadmdEnd-->
<!--IsFileStart-->
<!--IsimgFileStart-->
<div class="nexmoe-item">
<img class="mdui-img-fluid mdui-center" src="<!--FileDownUrl-->"/>
</div>
<!--IsimgFileEnd-->
<!--IstxtFileStart-->
<div class="nexmoe-item">
<pre id="editor" ><!--TxtContent--></pre>
</div>
<!--IstxtFileEnd-->
<!--IsmusicFileStart-->
<div class="nexmoe-item">
<audio class="mdui-center" src="<!--FileDownUrl-->" controls autoplay style="width: 100%;" ></audio>
</div>
<!--IsmusicFileEnd-->
<!--IsofficeFileStart-->
<div class="nexmoe-item">
<iframe id="office-a" src="https://view.officeapps.live.com/op/view.aspx?src=<!--FileEncodeDownUrl-->" style="width: 100%;height: 800px" frameborder="0"></iframe>
</div>
<!--IsofficeFileEnd-->
<!--IsvideoFileStart-->
<link class="dplayer-css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<div class="nexmoe-item">
<div class="mdui-center" id="dplayer"></div>
</div>
<script>
const dp = new DPlayer({
container: document.getElementById('dplayer'),
lang:'zh-cn',
video: {
url: '<!--FileDownUrl-->',
type: 'auto'
}
});
</script>
<!--IsvideoFileEnd-->
<!--IsOtherFileStart-->
<div class="nexmoe-item"><!--constStr@FileNotSupport--></div>
<!--IsOtherFileEnd-->
<a href="<!--FileEncodeReplaceUrl-->" class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i class="mdui-icon material-icons">file_download</i></a>
<!--IsFileEnd-->
<!--IsFolderStart-->
<style>
.thumb .th{
display: none;
}
.thumb .mdui-text-right{
display: none;
}
.thumb .mdui-list-item a ,.thumb .mdui-list-item {
width:217px;
height: 230px;
float: left;
margin: 10px 10px !important;
}
.thumb .mdui-col-xs-12,.thumb .mdui-col-sm-7{
width:100% !important;
height:230px;
}
.thumb .mdui-list-item .mdui-icon{
font-size:100px;
display: block;
margin-top: 40px;
color: #7ab5ef;
}
.thumb .mdui-list-item span{
float: left;
display: block;
text-align: center;
width:100%;
position: absolute;
top: 180px;
}
</style>
<div class="nexmoe-item">
<div class="mdui-row">
<ul class="mdui-list">
<li class="mdui-list-item th">
<div class="mdui-col-xs-12 mdui-col-sm-7"><!--constStr@File--> <i class="mdui-icon material-icons icon-sort" data-sort="name" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-3 mdui-text-right"><!--constStr@EditTime--> <i class="mdui-icon material-icons icon-sort" data-sort="date" data-order="downward">expand_more</i></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--constStr@Size--> <i class="mdui-icon material-icons icon-sort" data-sort="size" data-order="downward">expand_more</i></div>
</li>
<!--BackArrowStart-->
<li class="mdui-list-item mdui-ripple">
<a href="<!--BackArrowUrl-->">
<div class="mdui-col-xs-12 mdui-col-sm-7">
<i class="mdui-icon material-icons">arrow_upward</i>
..
</div>
<div class="mdui-col-sm-3 mdui-text-right"></div>
<div class="mdui-col-sm-2 mdui-text-right"></div>
</a>
</li>
<!--BackArrowEnd-->
<!--IsFolderStart-->
<!--FolderListStart-->
<li class="mdui-list-item mdui-ripple">
<a href="<!--FileEncodeReplaceUrl-->/">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons">folder_open</i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
</li>
<!--FolderListEnd-->
<!--FileListStart-->
<li class="mdui-list-item file mdui-ripple">
<a href="<!--FileEncodeReplaceUrl-->?preview" target="_blank">
<div class="mdui-col-xs-12 mdui-col-sm-7 mdui-text-truncate">
<i class="mdui-icon material-icons"><!--IconValue--></i>
<span><!--FileEncodeReplaceName--></span>
</div>
<div class="mdui-col-sm-3 mdui-text-right"><!--lastModifiedDateTime--></div>
<div class="mdui-col-sm-2 mdui-text-right"><!--size--></div>
</a>
</li>
<!--FileListEnd-->
</ul>
</div>
</div>
<!--ReadmemdStart-->
<div class="mdui-typo mdui-shadow-3" style="padding: 20px;margin: 20px 0">
<!--<div class="mdui-chip">
<span class="mdui-chip-icon"><i class="mdui-icon material-icons">face</i></span>
<span class="mdui-chip-title">README.md</span>
</div>-->
<!--ReadmemdContent-->
</div>
<!--ReadmemdEnd-->
</div>
<a href="javascript:thumb();" class="mdui-fab mdui-fab-fixed mdui-ripple mdui-color-theme-accent"><i class="mdui-icon material-icons">format_list_bulleted</i></a>
<!--IsFolderEnd-->
<!--ListEnd-->
<script>
var root = '<!--base_disk_path-->';
function path_format(path) {
path = '/' + path + '/';
while (path.indexOf('//') !== -1) {
path = path.replace('//', '/')
}
return path
}
document.querySelectorAll('#toolbar').forEach(function (e) {
var path = e.innerText;
if (path.substr(path.length-1)=='/') path = path.substr(0, path.length-1);
var paths = path.split('/');
e.innerHTML = '<a href="<!--base_path-->"><!--Sitename--></a><i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>';
if (paths <= 2) return;
for (var i = 1; i < paths.length - 1; i++) {
var to = path_format(root + paths.slice(0, i + 1).join('/'));
e.innerHTML += '<a href="' + to + '">' + paths[i] + '</a> <i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>'
}
e.innerHTML += paths[paths.length - 1];
e.innerHTML = e.innerHTML.replace(/\s\/\s$/, '')
});
$ = mdui.JQ;
$.fn.extend({
sortElements: function (comparator, getSortable) {
getSortable = getSortable || function () { return this; };
var placements = this.map(function () {
var sortElement = getSortable.call(this),
parentNode = sortElement.parentNode,
nextSibling = parentNode.insertBefore(
document.createTextNode(''),
sortElement.nextSibling
);
return function () {
parentNode.insertBefore(this, nextSibling);
parentNode.removeChild(nextSibling);
};
});
return [].sort.call(this, comparator).each(function (i) {
placements[i].call(getSortable.call(this));
});
}
});
function downall() {
let dl_link_list = Array.from(document.querySelectorAll("li a"))
.map(x => x.href) // 所有list中的链接
.filter(x => x.slice(-1) != "/"); // 筛选出非文件夹的文件下载链接
let blob = new Blob([dl_link_list.join("\r\n")], {
type: 'text/plain'
}); // 构造Blog对象
let a = document.createElement('a'); // 伪造一个a对象
a.href = window.URL.createObjectURL(blob); // 构造href属性为Blob对象生成的链接
a.download = "folder_download_link.txt"; // 文件名称,你可以根据你的需要构造
a.click() // 模拟点击
a.remove();
}
function thumb(){
if($('.mdui-fab i').text() == "apps"){
$('.mdui-fab i').text("format_list_bulleted");
$('.nexmoe-item').removeClass('thumb');
$('.nexmoe-item .mdui-icon').show();
$('.nexmoe-item .mdui-list-item').css("background","");
}else{
$('.mdui-fab i').text("apps");
$('.nexmoe-item').addClass('thumb');
$('.mdui-col-xs-12 i.mdui-icon').each(function(){
if($(this).text() == "image" || $(this).text() == "ondemand_video"){
var href = $(this).parent().parent().attr('href');
var thumb =(href.indexOf('?') == -1)?'?t=220':'&t=220';
$(this).hide();
$(this).parent().parent().parent().css("background","url("+href+thumb+") no-repeat center top");
}
});
}
}
$(function(){
$('.file a').each(function(){
$(this).on('click', function () {
var form = $('<form target=_blank method=post></form>').attr('action', $(this).attr('href')).get(0);
$(document.body).append(form);
form.submit();
$(form).remove();
return false;
});
});
$('.icon-sort').on('click', function () {
let sort_type = $(this).attr("data-sort"), sort_order = $(this).attr("data-order");
let sort_order_to = (sort_order === "less") ? "more" : "less";
$('li[data-sort]').sortElements(function (a, b) {
let data_a = $(a).attr("data-sort-" + sort_type), data_b = $(b).attr("data-sort-" + sort_type);
let rt = data_a.localeCompare(data_b, undefined, {numeric: true});
return (sort_order === "more") ? 0-rt : rt;
});
$(this).attr("data-order", sort_order_to).text("expand_" + sort_order_to);
});
});
</script>
</body>
</html>