Add quick-apply button to skinlib.show page
This commit is contained in:
parent
193fb75ec7
commit
d30b2cb4c6
|
|
@ -181,16 +181,17 @@ async function changeTextureModel(tid, oldModel) {
|
|||
*/
|
||||
function updateTextureStatus(tid, action) {
|
||||
const likes = parseInt($('#likes').html()) + (action === 'add' ? 1 : -1);
|
||||
action = (action === 'add') ? 'removeFromCloset' : 'addToCloset';
|
||||
const buttonAction = (action === 'add') ? 'removeFromCloset' : 'addToCloset';
|
||||
|
||||
$(`a[tid=${tid}]`)
|
||||
.attr('onclick', `${action}(${tid});`)
|
||||
.attr('title', trans(`skinlib.${action}`))
|
||||
.attr('onclick', `${buttonAction}(${tid});`)
|
||||
.attr('title', trans(`skinlib.${buttonAction}`))
|
||||
.toggleClass('liked');
|
||||
$(`#${tid}`)
|
||||
.attr('onclick', `${action}(${tid});`)
|
||||
.html(trans(`skinlib.${action}`));
|
||||
.attr('onclick', `${buttonAction}(${tid});`)
|
||||
.html(trans(`skinlib.${buttonAction}`));
|
||||
$('#likes').html(likes);
|
||||
$('#quick-apply').toggle(action === 'add');
|
||||
}
|
||||
|
||||
$(document).on('click', '.private-label', async function () {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
$(document).ready(initCloset);
|
||||
$(document).ready(async () => {
|
||||
await initCloset();
|
||||
|
||||
const tid = getQueryString('tid');
|
||||
|
||||
// Select closet item if texture id is specified by query string
|
||||
if (tid !== undefined) {
|
||||
$(`[tid=${tid}]`).children('.item-body').click();
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.item-body', async function () {
|
||||
$('.item-selected').parent().removeClass('item-selected');
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ item:
|
|||
steve: (Steve)
|
||||
alex: (Alex)
|
||||
cape: (Cape)
|
||||
apply: Quick Apply
|
||||
remove-from-closet: Remove from closet
|
||||
add-to-closet: Add to closet
|
||||
anonymous: Please login first
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ item:
|
|||
steve: (Steve)
|
||||
alex: (Alex)
|
||||
cape: (披风)
|
||||
apply: 立即使用
|
||||
remove-from-closet: 从衣柜中移除
|
||||
add-to-closet: 添加至衣柜
|
||||
anonymous: 请先登录
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@
|
|||
<button disabled="disabled" title="{{ trans('skinlib.show.anonymous') }}" class="btn btn-primary pull-right">{{ trans('skinlib.item.add-to-closet') }}</button>
|
||||
@else
|
||||
|
||||
<a id="quick-apply"
|
||||
href="{{ url('user/closet?tid=').$texture->tid }}"
|
||||
class="btn btn-success pull-right"
|
||||
style="margin-left:12px; {{ $user->getCloset()->has($texture->tid) ? '' : 'display:none;' }}"
|
||||
>{{ trans('skinlib.item.apply') }}</a>
|
||||
|
||||
@if ($user->getCloset()->has($texture->tid))
|
||||
<a onclick="removeFromCloset({{ $texture->tid }});" id="{{ $texture->tid }}" class="btn btn-primary pull-right">{{ trans('skinlib.item.remove-from-closet') }}</a>
|
||||
@else
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user