diff --git a/images/expand.svg b/images/expand.svg
new file mode 100644
index 0000000..78c13d0
--- /dev/null
+++ b/images/expand.svg
@@ -0,0 +1,160 @@
+
+
+
+
diff --git a/images/sort.svg b/images/sort.svg
new file mode 100644
index 0000000..b1071cd
--- /dev/null
+++ b/images/sort.svg
@@ -0,0 +1,556 @@
+
+
+
+
diff --git a/inc/content.php b/inc/content.php
index 874e2b5..a53091c 100644
--- a/inc/content.php
+++ b/inc/content.php
@@ -103,6 +103,14 @@ if (empty($ci['bc'])) {
$listCurrentDir = listCurrentDir($path);
$listCurrentFile = listVideo($path);
+if(!empty($listCurrentFile) && count($listCurrentFile) > 1 && $ci['ac'] !== 'view'){
+ echo '
';
+
+
if (!empty($listCurrentDir) && $ci['ac'] !== 'view') {
$listCurrentDir = sortDir($listCurrentDir,$fullListDir);
foreach ($listCurrentDir as $key => $value) {
@@ -130,21 +140,22 @@ if (!empty($listCurrentDir) && $ci['ac'] !== 'view') {
}
}
if (!empty($listCurrentFile) && $ci['ac'] !== 'view') {
- $listCurrentFile = sortFile($listCurrentFile, $fullListFile);
+ $listCurrentFile = sortFile($listCurrentFile, $fullListFile,$ci['sort']);
foreach ($listCurrentFile as $key => $value) {
if ($key == 'thumb') {
continue;
}
- echo '
', $value, '';
+ echo '
', $value['title'], '';
}
}
echo '
';
if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
$_SESSION['video'] = $videoInfo['hash'];
if (!empty($videoInfo)) {
- if (empty($videoInfo['title'])) {
+ if (empty($videoInfo['title']) || empty($videoInfo['uploadDateSort'])) {
$fullTitle = $videoInfo['originalTitle'];
- updateFileTitle($videoInfo['hash'], $fullTitle);
+ $uploadDate = $videoInfo['uploadDate'];
+ updateFileInfo($videoInfo['hash'], $fullTitle, $uploadDate);
} else {
$fullTitle = $videoInfo['title'].' ('.$videoInfo['originalTitle'].')';
}
@@ -194,7 +205,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
Duration |
@@ -207,7 +218,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
Via |
';
if (!empty($videoInfo['via'])) {
- echo '', $videoInfo['via'], '';
+ echo '', $videoInfo['via'], '';
} else {
echo '';
}
diff --git a/index.php b/index.php
index 0f67774..c39ddf4 100644
--- a/index.php
+++ b/index.php
@@ -186,9 +186,9 @@ function n_print($data, $name = '') {
';
@@ -264,9 +264,10 @@ function deleteVideo($bc, $file) {
}
}
-function updateFileTitle($hash, $title) {
+function updateFileInfo($hash, $title, $uploadDate) {
global $fullListFile;
$fullListFile[$hash]['title'] = $title;
+ $fullListFile[$hash]['uploadDateSort'] = $uploadDate;
chdir($_SERVER['DOCUMENT_ROOT']);
file_put_contents($GLOBALS['config']['LISTFILE'], "");
}
@@ -284,11 +285,25 @@ function sortDir($listCurrentDir, $fullListDir) {
return $rows;
}
-function sortFile($listCurrentFile, $fullListFile) {
+function sortFile($listCurrentFile, $fullListFile, $sort = 'name') {
foreach ($listCurrentFile as $value) {
- $rows[str_replace('.jpg', '', $value)] = $fullListFile[str_replace('.jpg', '', $value)]['title'];
+ $hash = str_replace('.jpg', '', $value);
+ $rows[$hash] = array(
+ 'uploadDateSort' => $fullListFile[$hash]['uploadDateSort'],
+ 'title' => $fullListFile[$hash]['title']
+ );
}
- asort($rows);
+ $tmp = Array();
+ if ($sort === 'date') {
+ foreach ($rows as &$ma) {
+ $tmp[] = &$ma["uploadDateSort"];
+ }
+ } else {
+ foreach ($rows as &$ma) {
+ $tmp[] = &$ma["title"];
+ }
+ }
+ array_multisort($tmp, $rows);
return $rows;
}
@@ -335,6 +350,7 @@ function getVideoInfo($file, $dir, $fullListFile) {
'url' => $postInfo['url'],
'desc' => $postInfo['desc'],
'originalDesc' => htmlentities($jsonInfo -> description),
+ 'uploadDateSort' => $postInfo['uploadDateSort'],
'uploadDate' => htmlentities($jsonInfo -> upload_date),
'format' => htmlentities($jsonInfo -> format),
'ext' => htmlentities($jsonInfo -> ext),
diff --git a/style.css b/style.css
index 407c446..12e260b 100644
--- a/style.css
+++ b/style.css
@@ -78,7 +78,7 @@ body {
vertical-align: middle;
max-height: 170px;
height: 100%;
- max-width : 260px;
+ max-width: 260px;
}
.dir, .video {
@@ -105,6 +105,43 @@ body {
height: 170px;
width: 270px;
}
+
+#sort {
+ padding: 0 0 0 32px;
+ position: fixed;
+ top: 48%;
+ right: 0;
+ background-image: url("images/expand.svg");
+ background-position: left center;
+ background-repeat: no-repeat;
+ background-size: auto 32px;
+ width: 32px;
+ z-index: 10;
+}
+
+#sort:hover {
+ width: auto;
+}
+
+#sort ul {
+ margin: 0;
+ padding: 0.2em;
+ border: 2px solid #dfdfdf;
+ border-radius: 0.2em;
+ border-right: none;
+ background-color: #262626;
+}
+
+#sort li {
+ list-style: none;
+ margin: 0.4em;
+}
+
+#sort a {
+ padding: 0.4em;
+ text-decoration: none;
+}
+
#time {
clear: both;
}
|