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
|
* @Author: printempw
|
||||||
* @Date: 2016-07-22 14:02:44
|
* @Date: 2016-07-22 14:02:44
|
||||||
* @Last Modified by: g-plane
|
* @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';
|
'use strict';
|
||||||
@ -25,11 +25,11 @@ $(document).ready(function() {
|
|||||||
serverSide: true
|
serverSide: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.location.pathname.includes('admin/users')) {
|
if (window.location.href == url('admin/users')) {
|
||||||
initUsersTable();
|
initUsersTable();
|
||||||
} else if (window.location.pathname.includes('admin/players')) {
|
} else if (window.location.href == url('admin/players')) {
|
||||||
initPlayersTable();
|
initPlayersTable();
|
||||||
} else if (window.location.pathname.includes('admin/plugins/manage')) {
|
} else if (window.location.href == url('admin/plugins/manage')) {
|
||||||
initPluginsTable();
|
initPluginsTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -520,9 +520,8 @@ function downloadUpdates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initUsersTable() {
|
function initUsersTable() {
|
||||||
const rootPath = /(^https?:.*)\/admin\/users/.exec(window.location.href)[1];
|
|
||||||
$('#user-table').DataTable({
|
$('#user-table').DataTable({
|
||||||
ajax: `${rootPath}/admin/user-data`,
|
ajax: url('admin/user-data'),
|
||||||
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
||||||
rowCallback: (row, data) => {
|
rowCallback: (row, data) => {
|
||||||
$(row).attr('id', `user-${data.uid}`);
|
$(row).attr('id', `user-${data.uid}`);
|
||||||
@ -631,9 +630,8 @@ function initUsersTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initPlayersTable() {
|
function initPlayersTable() {
|
||||||
const rootPath = /(^https?:.*)\/admin\/players/.exec(window.location.href)[1];
|
|
||||||
$('#player-table').DataTable({
|
$('#player-table').DataTable({
|
||||||
ajax: `${rootPath}/admin/player-data`,
|
ajax: url('admin/player-data'),
|
||||||
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
@ -671,8 +669,8 @@ function initPlayersTable() {
|
|||||||
html[textureType] = `<img id="${row.pid}-${row['tid_' + textureType]}" width="64" />`;
|
html[textureType] = `<img id="${row.pid}-${row['tid_' + textureType]}" width="64" />`;
|
||||||
} else {
|
} else {
|
||||||
html[textureType] = `
|
html[textureType] = `
|
||||||
<a href="${rootPath}/skinlib/show/${row['tid_' + textureType]}">
|
<a href="${url('/')}skinlib/show/${row['tid_' + textureType]}">
|
||||||
<img id="${row.pid}-${row['tid_' + textureType]}" width="64" src="${rootPath}/preview/64/${row['tid_' + textureType]}.png" />
|
<img id="${row.pid}-${row['tid_' + textureType]}" width="64" src="${url('/')}preview/64/${row['tid_' + textureType]}.png" />
|
||||||
</a>`;
|
</a>`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -705,9 +703,8 @@ function initPlayersTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initPluginsTable() {
|
function initPluginsTable() {
|
||||||
const rootPath = /(^https?:.*)\/admin\/plugins\/manage/.exec(window.location.href)[1];
|
|
||||||
$('#plugin-table').DataTable({
|
$('#plugin-table').DataTable({
|
||||||
ajax: `${rootPath}/admin/plugins/data`,
|
ajax: url('admin/plugins/data'),
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
targets: 0,
|
targets: 0,
|
||||||
@ -753,7 +750,7 @@ function initPluginsTable() {
|
|||||||
}
|
}
|
||||||
if (data.enabled && data.hasConfigView) {
|
if (data.enabled && data.hasConfigView) {
|
||||||
configViewButton = `
|
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 {
|
} else {
|
||||||
configViewButton = `
|
configViewButton = `
|
||||||
<a class="btn btn-default btn-sm" disabled="disabled" title="${trans('admin.noPluginConfigNotice')}" data-toggle="tooltip" data-placement="top">${trans('admin.configurePlugin')}</a>`;
|
<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
|
* @Author: printempw
|
||||||
* @Date: 2016-07-16 10:02:24
|
* @Date: 2016-07-16 10:02:24
|
||||||
* @Last Modified by: g-plane
|
* @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';
|
'use strict';
|
||||||
@ -57,18 +57,18 @@ $('body').on('click', '.category-switch', () => {
|
|||||||
reloadCloset(category, page, search);
|
reloadCloset(category, page, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
function renderClosetItemComponent(item, rootPath) {
|
function renderClosetItemComponent(item) {
|
||||||
return `
|
return `
|
||||||
<div class="item" tid="${item.tid}">
|
<div class="item" tid="${item.tid}">
|
||||||
<div class="item-body">
|
<div class="item-body">
|
||||||
<img src="${rootPath}/preview/${item.tid}.png">
|
<img src="${url('/')}preview/${item.tid}.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="item-footer">
|
<div class="item-footer">
|
||||||
<p class="texture-name">
|
<p class="texture-name">
|
||||||
<span title="${item.name}">${item.name} <small>(${item.type})</small></span>
|
<span title="${item.name}">${item.name} <small>(${item.type})</small></span>
|
||||||
</p>
|
</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>
|
<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">
|
<ul class="dropup dropdown-menu" aria-labelledby="more-button">
|
||||||
@ -81,7 +81,6 @@ function renderClosetItemComponent(item, rootPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderCloset(items, category) {
|
function renderCloset(items, category) {
|
||||||
const rootPath = /(^https?.*)\/user\/closet/.exec(window.location.href)[1];
|
|
||||||
const search = $('input[name=q]').val();
|
const search = $('input[name=q]').val();
|
||||||
let container = $(`#${category}-category`);
|
let container = $(`#${category}-category`);
|
||||||
container.html('');
|
container.html('');
|
||||||
@ -89,14 +88,14 @@ function renderCloset(items, category) {
|
|||||||
$('#closet-paginator').hide();
|
$('#closet-paginator').hide();
|
||||||
if (search === '') {
|
if (search === '') {
|
||||||
container.html(`<div class="empty-msg">
|
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 {
|
} else {
|
||||||
container.html(`<div class="empty-msg">${trans('general.noResult')}</div>`);
|
container.html(`<div class="empty-msg">${trans('general.noResult')}</div>`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#closet-paginator').show();
|
$('#closet-paginator').show();
|
||||||
for (const item of items) {
|
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) {
|
function reloadCloset(category, page, search) {
|
||||||
Promise.resolve($.ajax({
|
Promise.resolve($.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: /(^https?.*)\/user\/closet/.exec(window.location.href)[1] + '/user/closet-data',
|
url: url('user/closet-data'),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
category: category,
|
category: category,
|
||||||
|
Loading…
Reference in New Issue
Block a user