mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-30 14:09:58 +08:00
Use "url()" function
This commit is contained in:
parent
8abed82899
commit
8a6ef9e437
@ -2,7 +2,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-07-22 14:02:44
|
||||
* @Last Modified by: g-plane
|
||||
* @Last Modified time: 2017-04-26 16:29:33
|
||||
* @Last Modified time: 2017-04-26 17:30:40
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -25,11 +25,11 @@ $(document).ready(function() {
|
||||
serverSide: true
|
||||
});
|
||||
|
||||
if (window.location.pathname.includes('admin/users')) {
|
||||
if (window.location.href == url('admin/users')) {
|
||||
initUsersTable();
|
||||
} else if (window.location.pathname.includes('admin/players')) {
|
||||
} else if (window.location.href == url('admin/players')) {
|
||||
initPlayersTable();
|
||||
} else if (window.location.pathname.includes('admin/plugins/manage')) {
|
||||
} else if (window.location.href == url('admin/plugins/manage')) {
|
||||
initPluginsTable();
|
||||
}
|
||||
});
|
||||
@ -520,9 +520,8 @@ function downloadUpdates() {
|
||||
}
|
||||
|
||||
function initUsersTable() {
|
||||
const rootPath = /(^https?:.*)\/admin\/users/.exec(window.location.href)[1];
|
||||
$('#user-table').DataTable({
|
||||
ajax: `${rootPath}/admin/user-data`,
|
||||
ajax: url('admin/user-data'),
|
||||
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
||||
rowCallback: (row, data) => {
|
||||
$(row).attr('id', `user-${data.uid}`);
|
||||
@ -631,9 +630,8 @@ function initUsersTable() {
|
||||
}
|
||||
|
||||
function initPlayersTable() {
|
||||
const rootPath = /(^https?:.*)\/admin\/players/.exec(window.location.href)[1];
|
||||
$('#player-table').DataTable({
|
||||
ajax: `${rootPath}/admin/player-data`,
|
||||
ajax: url('admin/player-data'),
|
||||
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
||||
columnDefs: [
|
||||
{
|
||||
@ -671,8 +669,8 @@ function initPlayersTable() {
|
||||
html[textureType] = `<img id="${row.pid}-${row['tid_' + textureType]}" width="64" />`;
|
||||
} else {
|
||||
html[textureType] = `
|
||||
<a href="${rootPath}/skinlib/show/${row['tid_' + textureType]}">
|
||||
<img id="${row.pid}-${row['tid_' + textureType]}" width="64" src="${rootPath}/preview/64/${row['tid_' + textureType]}.png" />
|
||||
<a href="${url('/')}skinlib/show/${row['tid_' + textureType]}">
|
||||
<img id="${row.pid}-${row['tid_' + textureType]}" width="64" src="${url('/')}preview/64/${row['tid_' + textureType]}.png" />
|
||||
</a>`;
|
||||
}
|
||||
});
|
||||
@ -705,9 +703,8 @@ function initPlayersTable() {
|
||||
}
|
||||
|
||||
function initPluginsTable() {
|
||||
const rootPath = /(^https?:.*)\/admin\/plugins\/manage/.exec(window.location.href)[1];
|
||||
$('#plugin-table').DataTable({
|
||||
ajax: `${rootPath}/admin/plugins/data`,
|
||||
ajax: url('admin/plugins/data'),
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
@ -753,7 +750,7 @@ function initPluginsTable() {
|
||||
}
|
||||
if (data.enabled && data.hasConfigView) {
|
||||
configViewButton = `
|
||||
<a class="btn btn-default btn-sm" href="${rootPath}/admin/plugins/config/${row.name}">${trans('admin.configurePlugin')}</a>`;
|
||||
<a class="btn btn-default btn-sm" href="${url('/')}admin/plugins/config/${row.name}">${trans('admin.configurePlugin')}</a>`;
|
||||
} else {
|
||||
configViewButton = `
|
||||
<a class="btn btn-default btn-sm" disabled="disabled" title="${trans('admin.noPluginConfigNotice')}" data-toggle="tooltip" data-placement="top">${trans('admin.configurePlugin')}</a>`;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-07-16 10:02:24
|
||||
* @Last Modified by: g-plane
|
||||
* @Last Modified time: 2017-04-26 17:02:57
|
||||
* @Last Modified time: 2017-04-26 17:32:38
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -57,18 +57,18 @@ $('body').on('click', '.category-switch', () => {
|
||||
reloadCloset(category, page, search);
|
||||
});
|
||||
|
||||
function renderClosetItemComponent(item, rootPath) {
|
||||
function renderClosetItemComponent(item) {
|
||||
return `
|
||||
<div class="item" tid="${item.tid}">
|
||||
<div class="item-body">
|
||||
<img src="${rootPath}/preview/${item.tid}.png">
|
||||
<img src="${url('/')}preview/${item.tid}.png">
|
||||
</div>
|
||||
<div class="item-footer">
|
||||
<p class="texture-name">
|
||||
<span title="${item.name}">${item.name} <small>(${item.type})</small></span>
|
||||
</p>
|
||||
|
||||
<a href="${rootPath}/skinlib/show/${item.tid}" title="${trans('user.viewInSkinlib')}" class="more" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-share"></i></a>
|
||||
<a href="${url('/')}skinlib/show/${item.tid}" title="${trans('user.viewInSkinlib')}" class="more" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-share"></i></a>
|
||||
<span title="${trans('general.more')}" class="more" data-toggle="dropdown" aria-haspopup="true" id="more-button"><i class="fa fa-cog"></i></span>
|
||||
|
||||
<ul class="dropup dropdown-menu" aria-labelledby="more-button">
|
||||
@ -81,7 +81,6 @@ function renderClosetItemComponent(item, rootPath) {
|
||||
}
|
||||
|
||||
function renderCloset(items, category) {
|
||||
const rootPath = /(^https?.*)\/user\/closet/.exec(window.location.href)[1];
|
||||
const search = $('input[name=q]').val();
|
||||
let container = $(`#${category}-category`);
|
||||
container.html('');
|
||||
@ -89,14 +88,14 @@ function renderCloset(items, category) {
|
||||
$('#closet-paginator').hide();
|
||||
if (search === '') {
|
||||
container.html(`<div class="empty-msg">
|
||||
${trans('user.emptyClosetMsg', { url: rootPath + '/skinlib?filter=' + category })}</div>`);
|
||||
${trans('user.emptyClosetMsg', { url: url('skinlib?filter=' + category) })}</div>`);
|
||||
} else {
|
||||
container.html(`<div class="empty-msg">${trans('general.noResult')}</div>`);
|
||||
}
|
||||
} else {
|
||||
$('#closet-paginator').show();
|
||||
for (const item of items) {
|
||||
container.append(renderClosetItemComponent(item, rootPath));
|
||||
container.append(renderClosetItemComponent(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,7 +103,7 @@ function renderCloset(items, category) {
|
||||
function reloadCloset(category, page, search) {
|
||||
Promise.resolve($.ajax({
|
||||
type: 'GET',
|
||||
url: /(^https?.*)\/user\/closet/.exec(window.location.href)[1] + '/user/closet-data',
|
||||
url: url('user/closet-data'),
|
||||
dataType: 'json',
|
||||
data: {
|
||||
category: category,
|
||||
|
Loading…
Reference in New Issue
Block a user