mirror of
https://github.com/openvk/openvk
synced 2024-12-25 10:01:05 +03:00
upload page changes, add playlist add menu
This commit is contained in:
parent
933c4ee45a
commit
d165307993
13 changed files with 431 additions and 72 deletions
|
@ -581,13 +581,31 @@ final class Audio extends VKAPIRequestHandler
|
|||
];
|
||||
}
|
||||
|
||||
function searchAlbums(string $query, int $offset = 0, int $limit = 25, int $drop_private = 0): object
|
||||
function searchAlbums(string $query = '', int $offset = 0, int $limit = 25, int $drop_private = 0, int $order = 0, int $from_me = 0): object
|
||||
{
|
||||
$this->requireUser();
|
||||
|
||||
$playlists = [];
|
||||
$search = (new Audios)->searchPlaylists($query)->offsetLimit($offset, $limit);
|
||||
foreach($search as $playlist) {
|
||||
$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;
|
||||
}
|
||||
|
||||
if($from_me === 1)
|
||||
$params['from_me'] = $this->getUser()->getId();
|
||||
|
||||
$search = (new Audios)->findPlaylists($query, $params, ['type' => $order_str, 'invert' => false]);
|
||||
foreach($search->offsetLimit($offset, $limit) as $playlist) {
|
||||
if(!$playlist->canBeViewedBy($this->getUser())) {
|
||||
if($drop_private == 0)
|
||||
$playlists[] = NULL;
|
||||
|
@ -599,7 +617,7 @@ final class Audio extends VKAPIRequestHandler
|
|||
}
|
||||
|
||||
return (object) [
|
||||
"count" => sizeof($playlists),
|
||||
"count" => $search->size(),
|
||||
"items" => $playlists,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -300,11 +300,13 @@ class Audios
|
|||
function findPlaylists(string $query, array $params = [], array $order = ['type' => 'id', 'invert' => false]): \Traversable
|
||||
{
|
||||
$result = $this->playlists->where([
|
||||
"unlisted" => 0,
|
||||
"deleted" => 0,
|
||||
])->where("CONCAT_WS(' ', name, description) LIKE ?", "%$query%");
|
||||
$order_str = 'id';
|
||||
|
||||
if(is_null($params['from_me']) || empty($params['from_me']))
|
||||
$result->where(["unlisted" => 0]);
|
||||
|
||||
switch($order['type']) {
|
||||
case 'id':
|
||||
$order_str = 'id ' . ($order['invert'] ? 'ASC' : 'DESC');
|
||||
|
@ -317,6 +319,17 @@ class Audios
|
|||
break;
|
||||
}
|
||||
|
||||
foreach($params as $paramName => $paramValue) {
|
||||
if(is_null($paramValue) || $paramValue == '') continue;
|
||||
|
||||
switch($paramName) {
|
||||
# БУДЬ МАКСИМАЛЬНО АККУРАТЕН С ДАННЫМ ПАРАМЕТРОМ
|
||||
case "from_me":
|
||||
$result->where("owner", $paramValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($order_str)
|
||||
$result->order($order_str);
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ class Posts
|
|||
case 'ads':
|
||||
$result->where("ad", 1);
|
||||
break;*/
|
||||
# БУДЬ МАКСИМАЛЬНО АККУРАТЕН С ДАННЫМ ПАРАМЕТРОМ
|
||||
case 'from_me':
|
||||
$result->where("owner", $paramValue);
|
||||
break;
|
||||
|
|
|
@ -567,16 +567,65 @@ final class AudioPresenter extends OpenVKPresenter
|
|||
|
||||
break;
|
||||
case "add_to_club":
|
||||
$club = (new Clubs)->get((int)$this->postParam("club"));
|
||||
|
||||
if(!$club || !$club->canBeModifiedBy($this->user->identity))
|
||||
$this->flashFail("err", "error", tr("access_denied"), null, true);
|
||||
|
||||
if(!$audio->isInLibraryOf($club))
|
||||
$audio->add($club);
|
||||
else
|
||||
$this->flashFail("err", "error", tr("group_has_audio"), null, true);
|
||||
|
||||
$detailed = [];
|
||||
if($audio->isWithdrawn())
|
||||
$this->flashFail("err", "error", tr("invalid_audio"), null, true);
|
||||
|
||||
if(empty($this->postParam("clubs")))
|
||||
$this->flashFail("err", "error", 'clubs not passed', null, true);
|
||||
|
||||
$clubs_arr = explode(',', $this->postParam("clubs"));
|
||||
$count = sizeof($clubs_arr);
|
||||
if($count < 1 || $count > 10) {
|
||||
$this->flashFail("err", "error", tr('too_many_or_to_lack'), null, true);
|
||||
}
|
||||
|
||||
foreach($clubs_arr as $club_id) {
|
||||
$club = (new Clubs)->get((int)$club_id);
|
||||
if(!$club || !$club->canBeModifiedBy($this->user->identity))
|
||||
continue;
|
||||
|
||||
if(!$audio->isInLibraryOf($club)) {
|
||||
$detailed[$club_id] = true;
|
||||
$audio->add($club);
|
||||
} else {
|
||||
$detailed[$club_id] = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->returnJson(["success" => true, 'detailed' => $detailed]);
|
||||
break;
|
||||
case "add_to_playlist":
|
||||
$detailed = [];
|
||||
if($audio->isWithdrawn())
|
||||
$this->flashFail("err", "error", tr("invalid_audio"), null, true);
|
||||
|
||||
if(empty($this->postParam("playlists")))
|
||||
$this->flashFail("err", "error", 'playlists not passed', null, true);
|
||||
|
||||
$playlists_arr = explode(',', $this->postParam("playlists"));
|
||||
$count = sizeof($playlists_arr);
|
||||
if($count < 1 || $count > 10) {
|
||||
$this->flashFail("err", "error", tr('too_many_or_to_lack'), null, true);
|
||||
}
|
||||
|
||||
foreach($playlists_arr as $playlist_id) {
|
||||
$pid = explode('_', $playlist_id);
|
||||
$playlist = (new Audios)->getPlaylistByOwnerAndVID((int)$pid[0], (int)$pid[1]);
|
||||
if(!$playlist || !$playlist->canBeModifiedBy($this->user->identity))
|
||||
continue;
|
||||
|
||||
if(!$playlist->hasAudio($audio)) {
|
||||
$playlist->add($audio);
|
||||
$detailed[$playlist_id] = true;
|
||||
} else {
|
||||
$detailed[$playlist_id] = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->returnJson(["success" => true, 'detailed' => $detailed]);
|
||||
break;
|
||||
case "delete":
|
||||
if($audio->canBeModifiedBy($this->user->identity))
|
||||
|
|
|
@ -83,6 +83,7 @@ final class SearchPresenter extends OpenVKPresenter
|
|||
$parameters['with_lyrics'] = true;
|
||||
|
||||
break;
|
||||
# дай бог работал этот case
|
||||
case 'from_me':
|
||||
if((int) $param_value != 1) continue;
|
||||
$parameters['from_me'] = $this->user->id;
|
||||
|
|
|
@ -110,8 +110,24 @@
|
|||
|
||||
document.querySelector("#firstStep").style.display = "none"
|
||||
document.querySelector("#lastStep").style.display = "block"
|
||||
|
||||
function fallback() {
|
||||
console.info('Tags not found, setting default values.')
|
||||
|
||||
document.querySelector("#lastStep input[name=name]").value = files[0].name
|
||||
document.querySelector("#lastStep select[name=genre]").value = "Other"
|
||||
document.querySelector("#lastStep input[name=performer]").value = tr("track_unknown");
|
||||
}
|
||||
|
||||
const tags = await id3.fromFile(files[0]);
|
||||
let tags = null
|
||||
|
||||
try {
|
||||
tags = await id3.fromFile(files[0]);
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
console.log(tags)
|
||||
if(tags != null) {
|
||||
console.log("ID" + tags.kind + " detected, setting values...");
|
||||
|
||||
|
@ -126,11 +142,22 @@
|
|||
document.querySelector("#lastStep input[name=performer]").value = tr("track_unknown");
|
||||
|
||||
if(tags.genre != null) {
|
||||
if(document.querySelector("#lastStep select[name=genre] > option[value='" + tags.genre + "']") != null) {
|
||||
document.querySelector("#lastStep select[name=genre]").value = tags.genre;
|
||||
// if there are more than one genre
|
||||
if(tags.genre.split(', ').length > 1) {
|
||||
const genres = tags.genre.split(', ')
|
||||
|
||||
genres.forEach(genre => {
|
||||
if(document.querySelector("#lastStep select[name=genre] > option[value='" + genre + "']") != null) {
|
||||
document.querySelector("#lastStep select[name=genre]").value = genre;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.warn("Unknown genre: " + tags.genre);
|
||||
document.querySelector("#lastStep select[name=genre]").value = "Other"
|
||||
if(document.querySelector("#lastStep select[name=genre] > option[value='" + tags.genre + "']") != null) {
|
||||
document.querySelector("#lastStep select[name=genre]").value = tags.genre;
|
||||
} else {
|
||||
console.warn("Unknown genre: " + tags.genre);
|
||||
document.querySelector("#lastStep select[name=genre]").value = "Other"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document.querySelector("#lastStep select[name=genre]").value = "Other"
|
||||
|
@ -139,9 +166,7 @@
|
|||
if(tags.comments != null)
|
||||
document.querySelector("#lastStep textarea[name=lyrics]").value = tags.comments
|
||||
} else {
|
||||
document.querySelector("#lastStep input[name=name]").value = files[0].name
|
||||
document.querySelector("#lastStep select[name=genre]").value = "Other"
|
||||
document.querySelector("#lastStep input[name=performer]").value = tr("track_unknown");
|
||||
fallback()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{php $id = $audio->getId() . rand(0, 1000)}
|
||||
{php $isWithdrawn = $audio->isWithdrawn()}
|
||||
{php $isAvailable = $audio->isAvailable()}
|
||||
{php $editable = isset($thisUser) && $audio->canBeModifiedBy($thisUser)}
|
||||
<div id="audioEmbed-{$id}" data-realid="{$audio->getId()}" {if $hideButtons}data-prettyid="{$audio->getPrettyId()}" data-name="{$audio->getName()}"{/if} data-genre="{$audio->getGenre()}" class="audioEmbed {if !$audio->isAvailable()}processed{/if} {if $isWithdrawn}withdrawn{/if}" data-length="{$audio->getLength()}" data-keys="{json_encode($audio->getKeys())}" data-url="{$audio->getURL()}">
|
||||
<div id="audioEmbed-{$id}" data-realid="{$audio->getId()}" {if $hideButtons}data-prettyid="{$audio->getPrettyId()}" data-name="{$audio->getName()}"{/if} data-genre="{$audio->getGenre()}" class="audioEmbed {if !$isAvailable}processed{/if} {if $isWithdrawn}withdrawn{/if}" data-length="{$audio->getLength()}" data-keys="{json_encode($audio->getKeys())}" data-url="{$audio->getURL()}">
|
||||
<audio class="audio" />
|
||||
|
||||
<div id="miniplayer" class="audioEntry" style="min-height: 39px;">
|
||||
|
@ -36,7 +37,7 @@
|
|||
<div class="add-icon musicIcon hovermeicon" data-id="{$audio->getId()}" n:if="isset($thisUser) && !$hasAudio && !$isWithdrawn" ></div>
|
||||
<div class="remove-icon-group musicIcon" data-id="{$audio->getId()}" data-club="{$club->getId()}" n:if="isset($thisUser) && isset($club) && $club->canBeModifiedBy($thisUser)" ></div>
|
||||
<div class="add-icon-group musicIcon hidden" data-id="{$audio->getId()}" n:if="isset($thisUser) && !$isWithdrawn" ></div>
|
||||
<a class="download-icon musicIcon" n:if='isset($thisUser) && !$isWithdrawn && OPENVK_ROOT_CONF["openvk"]["preferences"]["music"]["exposeOriginalURLs"]' href="{$audio->getOriginalURL()}" download="{$audio->getDownloadName()}"></a>
|
||||
<a class="download-icon musicIcon" n:if='isset($thisUser) && !$isWithdrawn && $isAvailable && OPENVK_ROOT_CONF["openvk"]["preferences"]["music"]["exposeOriginalURLs"]' href="{$audio->getOriginalURL()}" download="{$audio->getDownloadName()}"></a>
|
||||
<div class="edit-icon musicIcon" data-lyrics="{$audio->getLyrics()}" data-title="{$audio->getTitle()}" data-performer="{$audio->getPerformer()}" data-explicit="{(int)$audio->isExplicit()}" data-searchable="{(int)!$audio->isUnlisted()}" n:if="isset($thisUser) && $editable && !$isWithdrawn" ></div>
|
||||
<div class="report-icon musicIcon" data-id="{$audio->getId()}" n:if="isset($thisUser) && !$editable && !$isWithdrawn" ></div>
|
||||
{/if}
|
||||
|
|
|
@ -213,7 +213,6 @@
|
|||
highlightText({$query}, '.page_wrap_content_main', ['text', "span[data-highlight='_appDesc']"])
|
||||
</script>
|
||||
{elseif $section === 'posts'}
|
||||
{* шмалим дурь курим шмаль дуем коку пиво пьём *}
|
||||
<div class='search_content' n:foreach="$data as $dat">
|
||||
{if !$dat || $dat->getWallOwner()->isHideFromGlobalFeedEnabled()}
|
||||
{_closed_group_post}.
|
||||
|
|
|
@ -764,3 +764,27 @@
|
|||
.addToPlaylist {
|
||||
width: 22%;
|
||||
}
|
||||
|
||||
#_addAudioAdditional {
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
#_addAudioAdditional #_tabs {
|
||||
margin: 0px -6px;
|
||||
}
|
||||
|
||||
#_addAudioAdditional #_tabs .mb_tabs {
|
||||
background-color: unset;
|
||||
border-bottom: unset;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
#_addAudioAdditional #_tip {
|
||||
margin: 5px 0px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#_addAudioAdditional #_content {
|
||||
margin-top: 6px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
|
|
@ -2102,12 +2102,13 @@ table td[width="120"] {
|
|||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.mb_tab div {
|
||||
.mb_tab div, .mb_tab > a {
|
||||
padding: 5px 9px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mb_tab#active {
|
||||
background-color: #898989;
|
||||
background-color: #606060;
|
||||
}
|
||||
|
||||
.mb_tab#active a {
|
||||
|
@ -2584,7 +2585,7 @@ a.poll-retract-vote {
|
|||
.page_header.search_expanded .header_navigation #search_box #searchBoxFastTips.shown {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.page_header.search_expanded .link {
|
||||
|
@ -3211,3 +3212,53 @@ hr {
|
|||
background-position: 50% !important;
|
||||
}
|
||||
|
||||
.entity_vertical_list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
height: 197px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item .first_column {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item .avatar {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item .info {
|
||||
width: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.entity_vertical_list.mini .entity_vertical_list_item img {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
#gif_loader {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
background-image: url('/assets/packages/static/openvk/img/loading_mini.gif');
|
||||
width: 30px;
|
||||
height: 7px;
|
||||
}
|
||||
|
|
|
@ -993,7 +993,7 @@ $(document).on("click", ".musicIcon.remove-icon", (e) => {
|
|||
e.stopImmediatePropagation()
|
||||
|
||||
const id = e.currentTarget.dataset.id
|
||||
if(e.altKey) {
|
||||
if(e.detail > 1 || e.altKey) {
|
||||
const player = e.target.closest('.audioEmbed')
|
||||
player.querySelector('.add-icon-group').click()
|
||||
return
|
||||
|
@ -1061,60 +1061,214 @@ $(document).on("click", ".musicIcon.remove-icon-group", (e) => {
|
|||
})
|
||||
|
||||
$(document).on("click", ".musicIcon.add-icon-group", async (ev) => {
|
||||
let body = `
|
||||
${tr("what_club_add")}
|
||||
<div style="margin-top: 4px;">
|
||||
<select id="addIconsWindow" style="width: 59%;"></select>
|
||||
<input name="addButton" type="button" class="button" value="${tr("add")}">
|
||||
let current_tab = 'club';
|
||||
const id = Number(ev.target.dataset.id)
|
||||
const body = `
|
||||
<div id='_addAudioAdditional'>
|
||||
<div id='_tabs'>
|
||||
<div class="mb_tabs">
|
||||
<div class="mb_tab" data-name='club'>
|
||||
<a>
|
||||
${tr('to_club')}
|
||||
</a>
|
||||
</div>
|
||||
<div class="mb_tab" data-name='playlist'>
|
||||
<a>
|
||||
${tr('to_playlist')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span id='_tip'>${tr('add_audio_limitations')}</span>
|
||||
<div id='_content'></div>
|
||||
</div>
|
||||
<span class="errorPlace"></span>
|
||||
`
|
||||
MessageBox(tr("add_audio_to_club"), body, [tr("close")], [Function.noop])
|
||||
|
||||
document.querySelector(".ovk-diag-body").style.padding = "11px"
|
||||
|
||||
if(window.openvk.writeableClubs == null) {
|
||||
try {
|
||||
window.openvk.writeableClubs = await API.Groups.getWriteableClubs()
|
||||
} catch (e) {
|
||||
document.querySelector(".errorPlace").innerHTML = tr("no_access_clubs")
|
||||
document.querySelector(".ovk-diag-body input[name='addButton']").classList.add("lagged")
|
||||
MessageBox(tr("add_audio"), body, [tr("cancel"), tr("add")], [Function.noop, () => {
|
||||
const ids = []
|
||||
u('#_content .entity_vertical_list_item').nodes.forEach(item => {
|
||||
const _checkbox = item.querySelector(`input[type='checkbox'][name='add_to']`)
|
||||
if(_checkbox.checked) {
|
||||
ids.push(item.dataset.id)
|
||||
}
|
||||
})
|
||||
|
||||
if(ids.length < 1 || ids.length > 10) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log(ids)
|
||||
|
||||
switch(current_tab) {
|
||||
case 'club':
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: `/audio${id}/action?act=add_to_club`,
|
||||
data: {
|
||||
hash: u("meta[name=csrf]").attr("value"),
|
||||
clubs: ids.join(',')
|
||||
},
|
||||
success: (response) => {
|
||||
if(!response.success)
|
||||
fastError(response.flash.message)
|
||||
else
|
||||
NewNotification(tr("audio_was_successfully_added"), '')
|
||||
}
|
||||
})
|
||||
|
||||
break
|
||||
case 'playlist':
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: `/audio${id}/action?act=add_to_playlist`,
|
||||
data: {
|
||||
hash: u("meta[name=csrf]").attr("value"),
|
||||
playlists: ids.join(',')
|
||||
},
|
||||
success: (response) => {
|
||||
if(!response.success)
|
||||
fastError(response.flash.message)
|
||||
else
|
||||
NewNotification(tr("audio_was_successfully_added"), '')
|
||||
}
|
||||
})
|
||||
|
||||
break
|
||||
}
|
||||
}])
|
||||
|
||||
u(".ovk-diag-body").attr('style', 'padding:0px;height: 260px;')
|
||||
|
||||
async function switchTab(tab = 'club') {
|
||||
current_tab = tab
|
||||
u(`#_addAudioAdditional .mb_tab`).attr('id', 'ki')
|
||||
u(`#_addAudioAdditional .mb_tab[data-name='${tab}']`).attr('id', 'active')
|
||||
|
||||
switch(tab) {
|
||||
case 'club':
|
||||
u("#_content").html(`<div class='entity_vertical_list mini'></div>`)
|
||||
if(window.openvk.writeableClubs == null) {
|
||||
u('.entity_vertical_list').append(`<div id='gif_loader'></div>`)
|
||||
|
||||
try {
|
||||
window.openvk.writeableClubs = await API.Groups.getWriteableClubs()
|
||||
} catch (e) {
|
||||
u("#_content").html(tr("no_access_clubs"))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
u('.entity_vertical_list #gif_loader').remove()
|
||||
}
|
||||
|
||||
window.openvk.writeableClubs.forEach(el => {
|
||||
u("#_content .entity_vertical_list").append(`
|
||||
<label class='entity_vertical_list_item with_third_column' data-id='${el.id}'>
|
||||
<div class='first_column'>
|
||||
<a href='/club${el.id}' class='avatar'>
|
||||
<img src='${el.avatar}' alt='avatar'>
|
||||
</a>
|
||||
|
||||
<div class='info'>
|
||||
<b class='noOverflow' value="${el.id}">${ovk_proc_strtr(escapeHtml(el.name), 100)}</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='third_column'>
|
||||
<input type='checkbox' name='add_to'>
|
||||
</div>
|
||||
</label>
|
||||
`)
|
||||
})
|
||||
break
|
||||
case 'playlist':
|
||||
const per_page = 10
|
||||
let page = 0
|
||||
u("#_content").html(`<div class='entity_vertical_list mini'></div>`)
|
||||
|
||||
async function recievePlaylists(s_page) {
|
||||
res = await fetch(`/method/audio.searchAlbums?auth_mechanism=roaming&query=&limit=10&offset=${s_page * per_page}&from_me=1`)
|
||||
res = await res.json()
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
function appendPlaylists(response) {
|
||||
response.items.forEach(el => {
|
||||
u("#_content .entity_vertical_list").append(`
|
||||
<label class='entity_vertical_list_item with_third_column' data-id='${el.owner_id}_${el.id}'>
|
||||
<div class='first_column'>
|
||||
<a href='/playlist${el.owner_id}_${el.id}' class='avatar'>
|
||||
<img src='${el.cover_url}' alt='cover'>
|
||||
</a>
|
||||
|
||||
<div class='info'>
|
||||
<b class='noOverflow' value="${el.owner_id}_${el.id}">${ovk_proc_strtr(escapeHtml(el.title), 100)}</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='third_column'>
|
||||
<input type='checkbox' name='add_to'>
|
||||
</div>
|
||||
</label>
|
||||
`)
|
||||
})
|
||||
|
||||
if(response.count > per_page * page) {
|
||||
u("#_content .entity_vertical_list").append(`<a id='_pladdwinshowmore'>${tr('show_more')}</a>`)
|
||||
}
|
||||
}
|
||||
|
||||
if(window.openvk.writeablePlaylists == null) {
|
||||
u('.entity_vertical_list').append(`<div id='gif_loader'></div>`)
|
||||
|
||||
try {
|
||||
res = await recievePlaylists(page)
|
||||
page += 1
|
||||
window.openvk.writeablePlaylists = res.response
|
||||
|
||||
if(!window.openvk.writeablePlaylists || window.openvk.writeablePlaylists.count < 1) {
|
||||
throw new Error
|
||||
}
|
||||
} catch (e) {
|
||||
u("#_content").html(tr("no_access_playlists"))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
u('.entity_vertical_list #gif_loader').remove()
|
||||
}
|
||||
|
||||
appendPlaylists(window.openvk.writeablePlaylists)
|
||||
|
||||
u('#_addAudioAdditional').on('click', '#_pladdwinshowmore', async (e) => {
|
||||
e.target.outerHTML = ''
|
||||
|
||||
res = await recievePlaylists(page)
|
||||
page += 1
|
||||
|
||||
appendPlaylists(res.response)
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
window.openvk.writeableClubs.forEach(el => {
|
||||
document.querySelector("#addIconsWindow").insertAdjacentHTML("beforeend", `
|
||||
<option value="${el.id}">${ovk_proc_strtr(escapeHtml(el.name), 50)}</option>
|
||||
`)
|
||||
switchTab(current_tab)
|
||||
|
||||
u("#_addAudioAdditional").on("click", ".mb_tab a", async (e) => {
|
||||
await switchTab(u(e.target).closest('.mb_tab').attr('data-name'))
|
||||
})
|
||||
|
||||
$(".ovk-diag-body").on("click", "input[name='addButton']", (e) => {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: `/audio${ev.target.dataset.id}/action?act=add_to_club`,
|
||||
data: {
|
||||
hash: u("meta[name=csrf]").attr("value"),
|
||||
club: document.querySelector("#addIconsWindow").value
|
||||
},
|
||||
beforeSend: () => {
|
||||
e.target.classList.add("lagged")
|
||||
document.querySelector(".errorPlace").innerHTML = ""
|
||||
},
|
||||
success: (response) => {
|
||||
if(!response.success)
|
||||
document.querySelector(".errorPlace").innerHTML = response.flash.message
|
||||
|
||||
e.currentTarget.classList.remove("lagged")
|
||||
}
|
||||
})
|
||||
|
||||
u("#_addAudioAdditional").on("click", "input[name='add_to']", async (e) => {
|
||||
if(u(`input[name='add_to']:checked`).length > 10) {
|
||||
e.preventDefault()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on("click", ".musicIcon.add-icon", (e) => {
|
||||
const id = e.currentTarget.dataset.id
|
||||
if(e.altKey) {
|
||||
if(e.detail > 1 || e.altKey) {
|
||||
const player = e.target.closest('.audioEmbed')
|
||||
player.querySelector('.add-icon-group').click()
|
||||
return
|
||||
|
|
|
@ -250,6 +250,8 @@
|
|||
"clubs_posts" = "Group's posts";
|
||||
"others_posts" = "Others posts";
|
||||
|
||||
"show_more" = "Show more";
|
||||
|
||||
/* Friends */
|
||||
|
||||
"friends" = "Friends";
|
||||
|
@ -878,6 +880,7 @@
|
|||
"my_playlists" = "My playlists";
|
||||
"playlists" = "Playlists";
|
||||
"audios_explicit" = "Contains obscene language";
|
||||
"audios_unlisted" = "Unlisted";
|
||||
"withdrawn" = "Withdrawn";
|
||||
"deleted" = "Deleted";
|
||||
"owner" = "Owner";
|
||||
|
@ -901,7 +904,7 @@
|
|||
"edit_playlist" = "Edit playlist";
|
||||
"unable_to_load_queue" = "Error when loading queue.";
|
||||
|
||||
"fully_delete_audio" = "Fully delete audio";
|
||||
"fully_delete_audio" = "Delete audio";
|
||||
"attach_audio" = "Attach audio";
|
||||
"detach_audio" = "Detach audio";
|
||||
|
||||
|
@ -929,6 +932,12 @@
|
|||
"listens_count_other" = "$1 listens";
|
||||
|
||||
"add_audio_to_club" = "Add audio to group";
|
||||
"add_audio" = "Adding audio";
|
||||
"add_audio_limitations" = "You can select up to 10 groups/playlists.";
|
||||
"to_club" = "To club";
|
||||
"to_playlist" = "To playlist";
|
||||
|
||||
"audio_was_successfully_added" = "Audios was successfully added.";
|
||||
"what_club_add" = "Which group do you want to add the song to?";
|
||||
"group_has_audio" = "This group already has this song.";
|
||||
"group_hasnt_audio" = "This group doesn't have this song.";
|
||||
|
@ -936,6 +945,7 @@
|
|||
"by_name" = "by name";
|
||||
"by_performer" = "by performer";
|
||||
"no_access_clubs" = "There are no groups where you are an administrator.";
|
||||
"no_access_playlists" = "You haven't created any playlists.";
|
||||
"audio_successfully_uploaded" = "Audio has been successfully uploaded and is currently being processed.";
|
||||
|
||||
"broadcast_audio" = "Broadcast audio to status";
|
||||
|
@ -948,6 +958,8 @@
|
|||
"repeat_tip" = "Repeat";
|
||||
"shuffle_tip" = "Shuffle";
|
||||
"mute_tip" = "Mute";
|
||||
"playlist_hide_from_search" = "Unlisted";
|
||||
"confirm_deleting_audio" = "Do you sure want to delete this audio?";
|
||||
|
||||
/* Notifications */
|
||||
|
||||
|
@ -1539,6 +1551,7 @@
|
|||
"error_code" = "Error code: $1.";
|
||||
"ffmpeg_timeout" = "Timed out waiting ffmpeg. Try to upload file again.";
|
||||
"ffmpeg_not_installed" = "Failed to proccess the file. It looks like ffmpeg is not installed on this server.";
|
||||
"too_many_or_to_lack" = "Too few or too many sources.";
|
||||
|
||||
/* Admin actions */
|
||||
|
||||
|
@ -2009,7 +2022,7 @@
|
|||
"s_order_invert" = "Invert";
|
||||
"s_order_by_reg_date" = "By reg date";
|
||||
"s_order_by_creation_date" = "By creation date";
|
||||
"s_order_by_publishing_date" = "By publication date;
|
||||
"s_order_by_publishing_date" = "By publication date";
|
||||
"s_order_by_upload_date" = "By upload date";
|
||||
|
||||
"s_by_date" = "By date";
|
||||
|
|
|
@ -229,6 +229,7 @@
|
|||
"users_posts" = "Записи $1";
|
||||
"clubs_posts" = "Записи сообщества";
|
||||
"others_posts" = "Чужие записи";
|
||||
"show_more" = "Показать больше";
|
||||
|
||||
/* Friends */
|
||||
|
||||
|
@ -887,6 +888,13 @@
|
|||
"listens_count_other" = "$1 прослушиваний";
|
||||
|
||||
"add_audio_to_club" = "Добавить аудио в группу";
|
||||
"add_audio" = "Добавление аудио";
|
||||
"add_audio_limitations" = "Можно выбрать до 10 групп/плейлистов.";
|
||||
"to_club" = "В группу";
|
||||
"to_playlist" = "В плейлист";
|
||||
|
||||
"audio_was_successfully_added" = "Аудио были успешно добавлены.";
|
||||
|
||||
"what_club_add" = "В какую группу вы хотите добавить песню?";
|
||||
"group_has_audio" = "У группы уже есть эта песня.";
|
||||
"group_hasnt_audio" = "У группы нет этой песни.";
|
||||
|
@ -894,6 +902,7 @@
|
|||
"by_name" = "по композициям";
|
||||
"by_performer" = "по исполнителю";
|
||||
"no_access_clubs" = "Нет групп, где вы являетесь администратором.";
|
||||
"no_access_playlists" = "Вы ещё не создавали плейлистов.";
|
||||
"audio_successfully_uploaded" = "Аудио успешно загружено и на данный момент обрабатывается.";
|
||||
|
||||
"broadcast_audio" = "Транслировать аудио в статус";
|
||||
|
@ -1444,6 +1453,7 @@
|
|||
"error_code" = "Код ошибки: $1.";
|
||||
"ffmpeg_timeout" = "Превышено время ожидания обработки ffmpeg. Попробуйте загрузить файл снова.";
|
||||
"ffmpeg_not_installed" = "Не удалось обработать файл. Похоже, на сервере не установлен ffmpeg.";
|
||||
"too_many_or_to_lack" = "Слишком мало либо слишком много источников.";
|
||||
|
||||
/* Admin actions */
|
||||
|
||||
|
|
Loading…
Reference in a new issue