Skip to content

Commit

Permalink
слегка проебался
Browse files Browse the repository at this point in the history
  • Loading branch information
mrilyew committed Oct 24, 2024
1 parent 3aafae1 commit 9c92fe4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 40 deletions.
15 changes: 1 addition & 14 deletions VKAPI/Handlers/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,20 +587,7 @@ function searchAlbums(string $query = '', int $offset = 0, int $limit = 25, int

$playlists = [];
$params = [];
$order_str = 'id';
switch($order) {
default:
case 0:
$order_str = 'id';
break;
case 1:
$order_str = 'length';
break;
case 2:
$order_str = 'listens';
break;
}

$order_str = (['id', 'length', 'listens'][$order] ?? 'id');
if($from_me === 1)
$params['from_me'] = $this->getUser()->getId();

Expand Down
16 changes: 2 additions & 14 deletions Web/Models/Repositories/Audios.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,7 @@ function find(string $query, array $params = [], array $order = ['type' => 'id',
"unlisted" => 0,
"deleted" => 0,
]);
$order_str = 'id';

switch($order['type']) {
case 'id':
$order_str = 'id ' . ($order['invert'] ? 'ASC' : 'DESC');
break;
case 'length':
$order_str = 'length ' . ($order['invert'] ? 'ASC' : 'DESC');
break;
case 'listens':
$order_str = 'listens ' . ($order['invert'] ? 'ASC' : 'DESC');
break;
}
$order_str = (in_array($order['type'], ['id', 'length', 'listens']) ? $order['type'] : 'id') . ' ' . ($order['invert'] ? 'ASC' : 'DESC');;

if($params["only_performers"] == "1") {
$result->where("performer LIKE ?", $query);
Expand Down Expand Up @@ -304,7 +292,7 @@ function findPlaylists(string $query, array $params = [], array $order = ['type'
$result = $this->playlists->where([
"deleted" => 0,
])->where("CONCAT_WS(' ', name, description) LIKE ?", $query);
$order_str = (['id', 'length', 'listens'][$order['type']] ?? 'id') . ' ' . ($order['invert'] ? 'ASC' : 'DESC');
$order_str = (in_array($order['type'], ['id', 'length', 'listens']) ? $order['type'] : 'id') . ' ' . ($order['invert'] ? 'ASC' : 'DESC');

if(is_null($params['from_me']) || empty($params['from_me']))
$result->where(["unlisted" => 0]);
Expand Down
4 changes: 2 additions & 2 deletions Web/Presenters/AudioPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ function renderList(?int $owner = NULL, ?string $mode = "list"): void

$this->template->mode = $mode;
$this->template->page = $page;

if(in_array($mode, ["list", "new", "popular"]) && $this->user->identity)
if(in_array($mode, ["list", "new", "popular"]) && $this->user->identity && $page < 2)
$this->template->friendsAudios = $this->user->identity->getBroadcastList("all", true);
}

Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/templates/Audio/bigplayer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="trackPanel">
<div class="trackInfo">
<div class="trackName">
<b>{_track_unknown}</b> —
<a>{_track_unknown}</a> —
<span>{_track_noname}</span>
</div>

Expand Down
9 changes: 4 additions & 5 deletions Web/Presenters/templates/Audio/tabs.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<div class='verticalGrayTabsWrapper'>
<div class="verticalGrayTabs">
<div class='with_padding'>
<a n:attr="id => $mode === 'list' && $isMy ? 'used' : 'ki'" href="/audios{$thisUser->getId()}" n:if="isset($thisUser)">{_my_music}</a>
<a href="/player/upload{if $isMyClub}?gid={abs($ownerId)}{/if}" n:if="isset($thisUser)">{_upload_audio}</a>
<a n:attr="id => $mode === 'new' ? 'used' : 'ki'" href="/audios/new">{_audio_new}</a>
<a n:attr="id => $mode === 'popular' ? 'used' : 'ki'" href="/audios/popular">{_audio_popular}</a>
<a href="/search?section=audios" n:if="isset($thisUser)">{_audio_search}</a>
<a n:if="isset($thisUser)" n:attr="id => $mode === 'list' && $isMy ? 'used' : 'ki'" href="/audios{$thisUser->getId()}">{_my_music}</a>
<a n:if="isset($thisUser)" href="/player/upload{if $isMyClub}?gid={abs($ownerId)}{/if}">{_upload_audio}</a>
<a n:if="isset($thisUser)" n:attr="id => $mode === 'new' ? 'used' : 'ki'" href="/search?section=audios">{_audio_new}</a>
<a n:if="isset($thisUser)" n:attr="id => $mode === 'popular' ? 'used' : 'ki'" href="/search?section=audios&order=listens">{_audio_popular}</a>

<hr n:if="isset($thisUser)">

Expand Down
9 changes: 7 additions & 2 deletions Web/static/css/audios.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@
font-size: 10px;
}

.bigPlayer .paddingLayer .trackInfo b:hover {
.bigPlayer .paddingLayer .trackInfo a {
font-weight: bold;
color: black;
}

.bigPlayer .paddingLayer .trackInfo a:hover {
text-decoration: underline;
cursor: pointer;
}
Expand Down Expand Up @@ -346,7 +351,7 @@
.overflowedName {
position: absolute;
z-index: 99;
width: 85% !important;
width: 80% !important;
}

.audioEntry .status strong {
Expand Down
2 changes: 1 addition & 1 deletion Web/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@ a.poll-retract-vote {
}

.verticalGrayTabsWrapper {
width: 25.5%;
width: 158px;
border-top: 1px solid #E5E7E6;
border-left: 1px solid #d8d8d8;
scrollbar-width: none;
Expand Down
3 changes: 2 additions & 1 deletion Web/static/js/al_music.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ class bigPlayer {
}

this.nodes["thisPlayer"].querySelector(".trackInfo span").innerHTML = escapeHtml(obj.name)
this.nodes["thisPlayer"].querySelector(".trackInfo b").innerHTML = escapeHtml(obj.performer)
this.nodes["thisPlayer"].querySelector(".trackInfo a").innerHTML = escapeHtml(obj.performer)
this.nodes["thisPlayer"].querySelector(".trackInfo a").href = `/search?query=&section=audios&order=listens&only_performers=on&q=${encodeURIComponent(obj.performer.escapeHtml())}`
this.nodes["thisPlayer"].querySelector(".trackInfo .time").innerHTML = fmtTime(obj.length)
this.tracks["currentTrack"] = obj

Expand Down

0 comments on commit 9c92fe4

Please sign in to comment.