split path to folders

pull/72/head
qkqpttgf 2020-05-22 16:07:52 +08:00 committed by GitHub
parent c8a9540d03
commit 47014d73e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 33 deletions

View File

@ -11,7 +11,9 @@
<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>
<title><!--Title--></title>
<link rel="icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="<!--base_path-->favicon.ico" type="image/x-icon">
<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}
@ -46,7 +48,7 @@
@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>*{display:none}*/
.mdui-toolbar>a:last-child,.mdui-toolbar>.mdui-typo-headline,.mdui-toolbar>i:first-child{display:block}
}
@ -57,7 +59,22 @@
<div class="mdui-container">
<div class="mdui-container-fluid">
<div class="mdui-toolbar nexmoe-item" id="toolbar">
<!--Path-->
<a href="<!--base_path-->"><!--Sitename--></a>
<!--MultiDiskAreaStart-->
<i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>
<div class="more-disk">
<span><!--DiskNameNow--></span>
<div>
<!--MultiDisksStart-->
<li><a href="<!--MultiDisksUrl-->" <!--MultiDisksNow-->><!--MultiDisksName--></a></li>
<!--MultiDisksEnd-->
</div>
</div>
<!--MultiDiskAreaEnd-->
<!--PathArrayStart-->
<i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>
<a href="<!--PathArrayLink-->"><!--PathArrayName--></a>
<!--PathArrayEnd-->
</div>
</div>
@ -210,7 +227,6 @@
</li>
<!--BackArrowEnd-->
<!--IsFolderStart-->
<!--FolderListStart-->
<li class="mdui-list-item mdui-ripple">
<a href="<!--FileEncodeReplaceUrl-->/">
@ -255,35 +271,9 @@
<!--FootomfEnd-->
</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-->
<!--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>';
e.innerHTML = '<a href="<!--base_path-->"><!--Sitename--></a><i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>';
<!--MultiDiskAreaStart-->
e.innerHTML += '<div class="more-disk"><span><!--DiskNameNow--></span><div><!--MultiDisksStart--><li><a href="<!--MultiDisksUrl-->" <!--MultiDisksNow-->><!--MultiDisksName--></a></li><!--MultiDisksEnd--></div></div><i class="mdui-icon material-icons mdui-icon-dark" style="margin:0;">chevron_right</i>';
<!--MultiDiskAreaEnd-->
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({