diff --git a/resources/assets/src/scripts/admin.js b/resources/assets/src/scripts/admin.js index c6335c86..4509ee34 100644 --- a/resources/assets/src/scripts/admin.js +++ b/resources/assets/src/scripts/admin.js @@ -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] = ``; } else { html[textureType] = ` - - + + `; } }); @@ -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 = ` - ${trans('admin.configurePlugin')}`; + ${trans('admin.configurePlugin')}`; } else { configViewButton = ` ${trans('admin.configurePlugin')}`; diff --git a/resources/assets/src/scripts/user.js b/resources/assets/src/scripts/user.js index 770e39b9..bd4d9eeb 100644 --- a/resources/assets/src/scripts/user.js +++ b/resources/assets/src/scripts/user.js @@ -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 `
- +
`); } else { container.html(`
${trans('general.noResult')}
`); } } 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,