diff --git a/Web/Models/Entities/Audio.php b/Web/Models/Entities/Audio.php index 05022b8c..c6e6838f 100644 --- a/Web/Models/Entities/Audio.php +++ b/Web/Models/Entities/Audio.php @@ -465,4 +465,4 @@ class Audio extends Media parent::delete($softly); } -} \ No newline at end of file +} diff --git a/Web/Models/Entities/Playlist.php b/Web/Models/Entities/Playlist.php index 89b4155b..c027a038 100644 --- a/Web/Models/Entities/Playlist.php +++ b/Web/Models/Entities/Playlist.php @@ -253,4 +253,4 @@ class Playlist extends MediaCollection return implode(" • ", $props); } -} \ No newline at end of file +} diff --git a/Web/Models/Entities/Traits/TAudioStatuses.php b/Web/Models/Entities/Traits/TAudioStatuses.php index 0d687b68..f957a104 100644 --- a/Web/Models/Entities/Traits/TAudioStatuses.php +++ b/Web/Models/Entities/Traits/TAudioStatuses.php @@ -35,4 +35,4 @@ trait TAudioStatuses return NULL; } -} \ No newline at end of file +} diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 9152e64e..f72a0978 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -464,7 +464,6 @@ class User extends RowModel "links", "poster", "apps", - "audios", ], ])->get($id); } diff --git a/Web/Models/shell/processAudio.ps1 b/Web/Models/shell/processAudio.ps1 index 5404857a..206e11e1 100644 --- a/Web/Models/shell/processAudio.ps1 +++ b/Web/Models/shell/processAudio.ps1 @@ -36,4 +36,4 @@ Move-Item -Path ("$fileHash.mpd") -Destination "$storageDir/$hashPart" cd .. Remove-Item -Recurse $temp -Remove-Item $audioFile \ No newline at end of file +Remove-Item $audioFile diff --git a/Web/Presenters/AudioPresenter.php b/Web/Presenters/AudioPresenter.php index 9b9b20c8..3bae710c 100644 --- a/Web/Presenters/AudioPresenter.php +++ b/Web/Presenters/AudioPresenter.php @@ -693,4 +693,4 @@ final class AudioPresenter extends OpenVKPresenter $this->returnJson($resultArr); } -} \ No newline at end of file +} diff --git a/Web/Presenters/templates/Admin/@layout.xml b/Web/Presenters/templates/Admin/@layout.xml index c5a9a22a..055bd0a0 100644 --- a/Web/Presenters/templates/Admin/@layout.xml +++ b/Web/Presenters/templates/Admin/@layout.xml @@ -98,7 +98,7 @@ <a href="/admin/bannedLinks">{_admin_banned_links}</a> </li> <li> - <a href="/admin/music">Музыка</a> + <a href="/admin/music">{_admin_music}</a> </li> </ul> <div class="aui-nav-heading"> diff --git a/Web/Presenters/templates/Admin/EditPlaylist.xml b/Web/Presenters/templates/Admin/EditPlaylist.xml index 7c6e21cd..b0bd823f 100644 --- a/Web/Presenters/templates/Admin/EditPlaylist.xml +++ b/Web/Presenters/templates/Admin/EditPlaylist.xml @@ -16,15 +16,15 @@ <input class="text medium-field" type="number" id="id" disabled value="{$playlist->getId()}" /> </div> <div class="field-group"> - <label for="name">Название</label> + <label for="name">{_name}</label> <input class="text medium-field" type="text" id="name" name="name" value="{$playlist->getName()}" /> </div> <div class="field-group"> - <label for="ext">Описание</label> + <label for="ext">{_description}</label> <textarea class="text medium-field" type="text" id="description" name="description" style="resize: vertical;">{$playlist->getDescription()}</textarea> </div> <div class="field-group"> - <label for="ext">Обложка (ID фото)</label> + <label for="ext">{_admin_cover_id}</label> <span id="avatar" class="aui-avatar aui-avatar-project aui-avatar-xlarge"> <span class="aui-avatar-inner"> <img src="{$playlist->getCoverUrl()}" style="object-fit: cover;"></img> @@ -35,11 +35,11 @@ </div> <hr /> <div class="field-group"> - <label for="owner">Владелец</label> + <label for="owner">{_owner}</label> <input class="text medium-field" type="number" id="owner_id" name="owner" value="{$playlist->getOwner()->getId()}" /> </div> <div class="field-group"> - <label for="deleted">Удален</label> + <label for="deleted">{_deleted}</label> <input class="toggle-large" type="checkbox" id="deleted" name="deleted" value="1" {if $playlist->isDeleted()} checked {/if} /> </div> <hr /> diff --git a/Web/Presenters/templates/Admin/Music.xml b/Web/Presenters/templates/Admin/Music.xml index cf96b1ad..448ee54d 100644 --- a/Web/Presenters/templates/Admin/Music.xml +++ b/Web/Presenters/templates/Admin/Music.xml @@ -37,7 +37,7 @@ <tr> <th>ID</th> <th>{_admin_author}</th> - <th>Исполнитель</th> + <th>{_peformer}</th> <th>{_admin_title}</th> <th>{_genre}</th> <th>Explicit</th> @@ -88,8 +88,8 @@ <th>ID</th> <th>{_admin_author}</th> <th>{_name}</th> - <th>Создан</th> - <th>Действия</th> + <th>{_created_playlist}</th> + <th>{_actions}</th> </tr> </thead> <tbody> @@ -113,12 +113,12 @@ <img src="{$playlist->getCoverURL()}" alt="{$owner->getCanonicalName()}" style="object-fit: cover;" role="presentation" /> </span> </span> - {$playlist->getName()} + {ovk_proc_strtr($playlist->getName(), 30)} </td> <td>{$playlist->getCreationTime()}</td> <td> <a class="aui-button aui-button-primary" href="/admin/playlist/{$playlist->getId()}/edit"> - <span class="aui-icon aui-icon-small aui-iconfont-new-edit">Редактировать</span> + <span class="aui-icon aui-icon-small aui-iconfont-new-edit">{_edit}</span> </a> </td> </tr> diff --git a/Web/Presenters/templates/Audio/EditPlaylist.xml b/Web/Presenters/templates/Audio/EditPlaylist.xml index 32690d50..32d43d92 100644 --- a/Web/Presenters/templates/Audio/EditPlaylist.xml +++ b/Web/Presenters/templates/Audio/EditPlaylist.xml @@ -37,12 +37,12 @@ <div style="margin-top: 19px;"> <input id="playlist_query" type="text" style="height: 26px;" placeholder="{_header_search}"> - <div class="playlistAudiosContainer" style="display:table;clear:both;width:100%;margin-top: 10px;"> + <div class="playlistAudiosContainer editContainer"> <div id="newPlaylistAudios" n:foreach="$audios as $audio"> - <div style="width: 78%;float: left;"> + <div class="playerContainer"> {include "player.xml", audio => $audio, hideButtons => true} </div> - <div class="attachAudio addToPlaylist" data-id="{$audio->getId()}" style="width: 22%;"> + <div class="attachAudio addToPlaylist" data-id="{$audio->getId()}"> <span>{_remove_from_playlist}</span> </div> </div> diff --git a/Web/Presenters/templates/Audio/Embed.xml b/Web/Presenters/templates/Audio/Embed.xml index 7f9e8714..b7540358 100644 --- a/Web/Presenters/templates/Audio/Embed.xml +++ b/Web/Presenters/templates/Audio/Embed.xml @@ -3,92 +3,18 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <link rel="icon"> <title>{$audio->getName()}</title> - {css "css/style.css"} + {css "css/main.css"} + {css "css/audios.css"} + {script "js/node_modules/dashjs/dist/dash.all.min.js"} + {script "js/node_modules/jquery/dist/jquery.min.js"} + {script "js/node_modules/umbrellajs/umbrella.min.js"} </head> <body id="audioEmbed"> - <audio id="audio" /> - - <div id="miniplayer" class="audioEntry"> - <div class="playerButton"> - <img src="/assets/packages/static/openvk/img/play.jpg" /> - </div> - - <div class="status"> - <div class="mediaInfo"> - <strong> - {$audio->getPerformer()} - </strong> - - - <span class="nobold"> - {$audio->getTitle()} - </span> - </div> - - <div class="track"> - <div class="selectableTrack"> - <div> <!-- actual track --></div> - </div> - </div> - </div> - - <div class="volume"> - <span class="nobold"> - {$audio->getFormattedLength()} - </span> - </div> - </div> - - {script "js/node_modules/umbrellajs/umbrella.min.js"} - {script "js/node_modules/dashjs/dist/dash.all.min.js"} - <script> - function fmtTime(time) { - mins = Math.floor(time / 60).toString().padStart(2, 0); - secs = (time - (Math.floor(time / 60) * 60)).toString().padStart(2, 0); - - return mins + ":" + secs; - } - - const protData = { - "org.w3.clearkey": { - "clearkeys": {$audio->getKeys()} - } - }; - - const play = u(".playerButton > img"); - const audio = document.querySelector("#audio"); - const player = dashjs.MediaPlayer().create(); - player.initialize(audio, {$audio->getURL()}, true); - player.setProtectionData(protData); - - play.on("click", function() { - audio.paused ? audio.play() : audio.pause(); - }); - - u(audio).on("timeupdate", function() { - let time = audio.currentTime; - let ps = Math.ceil((time * 100) / {$audio->getLength()}); - - u(".volume span").html(fmtTime(Math.floor(time))); - u(".track > div > div").nodes[0].style.width = ps + "%"; - }); - - u(audio).on("play", function() { - play.attr("src", "/assets/packages/static/openvk/img/pause.jpg"); - }); - - u(audio).on(["pause", "ended", "suspended"], function() { - play.attr("src", "/assets/packages/static/openvk/img/play.jpg"); - }); - - u(".track > div").on("click", function(e) { - let rect = document.querySelector(".selectableTrack").getBoundingClientRect(); - let width = e.clientX - rect.left; - let time = Math.ceil((width * {$audio->getLength()}) / (rect.right - rect.left)); - - audio.currentTime = time; - }); - </script> + {include "player.xml", audio => $audio} + + {script "js/al_music.js"} </body> </html> diff --git a/Web/Presenters/templates/Audio/List.xml b/Web/Presenters/templates/Audio/List.xml index 7ab978b3..f270bdf6 100644 --- a/Web/Presenters/templates/Audio/List.xml +++ b/Web/Presenters/templates/Audio/List.xml @@ -123,4 +123,4 @@ </div> {include "tabs.xml"} </div> -{/block} \ No newline at end of file +{/block} diff --git a/Web/Presenters/templates/Audio/NewPlaylist.xml b/Web/Presenters/templates/Audio/NewPlaylist.xml index a55267c7..b7546749 100644 --- a/Web/Presenters/templates/Audio/NewPlaylist.xml +++ b/Web/Presenters/templates/Audio/NewPlaylist.xml @@ -49,12 +49,12 @@ <div style="margin-top: 19px;"> <input id="playlist_query" type="text" style="height: 26px;" placeholder="{_header_search}"> - <div class="playlistAudiosContainer" style="display:table;clear:both;width:100%;margin-top: 10px;"> + <div class="playlistAudiosContainer editContainer"> <div id="newPlaylistAudios" n:foreach="$audios as $audio"> <div style="width: 78%;float: left;"> {include "player.xml", audio => $audio, hideButtons => true} </div> - <div class="attachAudio addToPlaylist" data-id="{$audio->getId()}" style="width: 22%;"> + <div class="attachAudio addToPlaylist" data-id="{$audio->getId()}"> <span>{_add_to_playlist}</span> </div> </div> @@ -66,9 +66,9 @@ </div> <form method="post" id="newPlaylistForm" enctype="multipart/form-data"> - <input type="hidden" name="title" maxlength="128" /> + <input type="hidden" name="title" maxlength="125" /> <input type="hidden" name="hash" value="{$csrfToken}" /> - <textarea style="display:none;" name="description" maxlength="2048" /> + <textarea style="display:none;" name="description" maxlength="2045" /> <input type="hidden" name="audios"> <input type="file" style="display:none;" name="cover" accept=".jpg,.png"> diff --git a/Web/Presenters/templates/Audio/player.xml b/Web/Presenters/templates/Audio/player.xml index 17ba003a..a8c9bec9 100644 --- a/Web/Presenters/templates/Audio/player.xml +++ b/Web/Presenters/templates/Audio/player.xml @@ -14,10 +14,10 @@ <div class="mediaInfo" style="margin-bottom: -8px; cursor: pointer;display:flex;width: 85%;"> <div class="info noOverflow"> <strong class="performer"> - <a href="/search?query=&type=audios&sort=id&only_performers=on&query={$audio->getPerformer()}">{$audio->getPerformer()}</a> + <a href="/search?query=&type=audios&sort=id&only_performers=on&query={$audio->getPerformer()}">{ovk_proc_strtr($audio->getPerformer(), 30)}</a> </strong> — - <span class="title {if !empty($audio->getLyrics())}withLyrics{/if}">{$audio->getTitle()}</span> + <span class="title {if !empty($audio->getLyrics())}withLyrics{/if}">{ovk_proc_strtr($audio->getTitle(), 30)}</span> </div> <div class="explicitMark" n:if="$audio->isExplicit()"></div> @@ -25,7 +25,7 @@ </div> <div class="volume" style="display: flex; flex-direction: column;width:14%;"> - <span class="nobold" data-unformatted="{$audio->getLength()}" style="text-align: center;margin-top: 12px;">{$audio->getFormattedLength()}</span> + <span class="nobold {if !$hideButtons}hideOnHover{/if}" data-unformatted="{$audio->getLength()}" style="text-align: center;margin-top: 12px;">{$audio->getFormattedLength()}</span> <div class="buttons" style="margin-top: 8px;"> {php $hasAudio = isset($thisUser) && $audio->isInLibraryOf($thisUser)} @@ -66,4 +66,4 @@ <div class="lyrics" n:if="!empty($audio->getLyrics())"> {nl2br($audio->getLyrics())|noescape} </div> -</div> \ No newline at end of file +</div> diff --git a/Web/Presenters/templates/Audio/tabs.xml b/Web/Presenters/templates/Audio/tabs.xml index df631b8b..ed74ca86 100644 --- a/Web/Presenters/templates/Audio/tabs.xml +++ b/Web/Presenters/templates/Audio/tabs.xml @@ -37,4 +37,4 @@ </div> {/if} </div> -</div> \ No newline at end of file +</div> diff --git a/Web/static/css/audios.css b/Web/static/css/audios.css index e998f856..5decbb89 100644 --- a/Web/static/css/audios.css +++ b/Web/static/css/audios.css @@ -312,7 +312,7 @@ display: block; } -.audioEntry:hover .volume span { +.audioEntry:hover .volume .hideOnHover { display: none; } @@ -640,4 +640,22 @@ .friendsAudiosList #used .elem:hover { background: #787878; cursor: pointer; -} \ No newline at end of file +} + +.editContainer { + display:table; + clear:both; + width:100%; + margin-top: 10px; +} + +.editContainer .playerContainer { + width: 78%; + float: left; + max-width: 78%; + min-width: 68%; +} + +.addToPlaylist { + width: 22%; +} diff --git a/Web/static/css/main.css b/Web/static/css/main.css index 5d02b17d..4dd38356 100644 --- a/Web/static/css/main.css +++ b/Web/static/css/main.css @@ -2999,4 +2999,4 @@ hr { background-repeat: repeat !important; background-repeat: no-repeat !important; background-position: 50% !important; -} \ No newline at end of file +} diff --git a/Web/static/img/common.png b/Web/static/img/common.png deleted file mode 100644 index 0c54bf0f..00000000 Binary files a/Web/static/img/common.png and /dev/null differ diff --git a/Web/static/js/al_playlists.js b/Web/static/js/al_playlists.js index 443e6f30..cf61c45d 100644 --- a/Web/static/js/al_playlists.js +++ b/Web/static/js/al_playlists.js @@ -25,10 +25,10 @@ searcher.successCallback = (response, thisc) => { document.querySelector(".playlistAudiosContainer").insertAdjacentHTML("beforeend", ` <div id="newPlaylistAudios"> - <div style="width: 78%;float: left;"> + <div class="playerContainer"> ${el.outerHTML} </div> - <div class="attachAudio addToPlaylist" data-id="${id}" style="width: 22%;"> + <div class="attachAudio addToPlaylist" data-id="${id}"> <span>${isAttached ? tr("remove_from_playlist") : tr("add_to_playlist")}</span> </div> </div> @@ -110,4 +110,4 @@ $(document).on("change", "input#playlist_query", async (e) => { searcher.movePage(1) return; } -}) \ No newline at end of file +}) diff --git a/locales/en.strings b/locales/en.strings index e3615fd6..be6ec594 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -347,6 +347,7 @@ "albums" = "Albums"; "album" = "Album"; "photos" = "photos"; +"photo" = "Photo"; "create_album" = "Create album"; "edit_album" = "Edit album"; "edit_photo" = "Edit photo"; @@ -1530,6 +1531,8 @@ "admin_gift_moved_to_recycle" = "This gift will now be in <b>Recycle Bin</b>."; "admin_original_file" = "Original file"; "admin_audio_length" = "Length"; +"admin_cover_id" = "Cover (photo ID)"; +"admin_music" = "Music"; "logs" = "Logs"; "logs_anything" = "Anything"; diff --git a/locales/ru.strings b/locales/ru.strings index 282d8d3f..4a9d13c0 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -1415,6 +1415,8 @@ "admin_gift_moved_to_recycle" = "Теперь подарок находится в <b>корзине</b>."; "admin_original_file" = "Оригинальный файл"; "admin_audio_length" = "Длина"; +"admin_cover_id" = "Обложка (ID фото)"; +"admin_music" = "Музыка"; "logs" = "Логи"; "logs_anything" = "Любое";