refactor: add aliases

This commit is contained in:
Barış Soner Uşaklı
2022-02-17 16:35:42 -05:00
parent 862381008a
commit d60cb6c6e5
17 changed files with 32 additions and 26 deletions

View File

@@ -91,6 +91,8 @@ module.exports = function (grunt) {
},
clientUpdated: {
files: [
// 'public/src/modules/**/*.js',
// 'public/vendor/**/*.js',
...clientUpdated,
'node_modules/benchpressjs/build/benchpress.js',
],

View File

@@ -1,7 +1,7 @@
'use strict';
define('admin/advanced/errors', ['bootbox', 'alerts', 'chart.js'], function (bootbox, alerts, Chart) {
define('admin/advanced/errors', ['bootbox', 'alerts', 'Chart'], function (bootbox, alerts, Chart) {
const Errors = {};
Errors.init = function () {

View File

@@ -2,7 +2,7 @@
define('admin/dashboard', [
'chart.js', 'translator', 'benchpress', 'bootbox', 'alerts',
'Chart', 'translator', 'benchpress', 'bootbox', 'alerts',
], function (Chart, translator, Benchpress, bootbox, alerts) {
const Admin = {};
const intervals = {

View File

@@ -6,7 +6,7 @@ define('admin/extend/plugins', [
'benchpress',
'bootbox',
'alerts',
'jquery-ui/ui/widgets/sortable',
'jquery-ui/widgets/sortable',
], function (translator, Benchpress, bootbox, alerts) {
const Plugins = {};
Plugins.init = function () {

View File

@@ -4,10 +4,10 @@
define('admin/extend/widgets', [
'bootbox',
'alerts',
'jquery-ui/ui/widgets/sortable',
'jquery-ui/ui/widgets/draggable',
'jquery-ui/ui/widgets/droppable',
'jquery-ui/ui/widgets/datepicker',
'jquery-ui/widgets/sortable',
'jquery-ui/widgets/draggable',
'jquery-ui/widgets/droppable',
'jquery-ui/widgets/datepicker',
], function (bootbox, alerts) {
const Widgets = {};

View File

@@ -5,7 +5,7 @@ define('admin/manage/categories', [
'benchpress',
'categorySelector',
'api',
'sortablejs',
'Sortable',
'bootbox',
'alerts',
], function (translator, Benchpress, categorySelector, api, Sortable, bootbox, alerts) {

View File

@@ -1,7 +1,7 @@
'use strict';
define('admin/manage/category-analytics', ['chart.js'], function (Chart) {
define('admin/manage/category-analytics', ['Chart'], function (Chart) {
const CategoryAnalytics = {};
CategoryAnalytics.init = function () {

View File

@@ -1,6 +1,6 @@
'use strict';
define('admin/modules/dashboard-line-graph', ['chart.js', 'translator', 'benchpress', 'api', 'hooks', 'bootbox'], function (Chart, translator, Benchpress, api, hooks, bootbox) {
define('admin/modules/dashboard-line-graph', ['Chart', 'translator', 'benchpress', 'api', 'hooks', 'bootbox'], function (Chart, translator, Benchpress, api, hooks, bootbox) {
const Graph = {
_current: null,
};

View File

@@ -2,7 +2,7 @@
define('admin/modules/selectable', [
'jquery-ui/ui/widgets/selectable',
'jquery-ui/widgets/selectable',
], function () {
const selectable = {};

View File

@@ -6,9 +6,9 @@ define('admin/settings/navigation', [
'iconSelect',
'benchpress',
'alerts',
'jquery-ui/ui/widgets/draggable',
'jquery-ui/ui/widgets/droppable',
'jquery-ui/ui/widgets/sortable',
'jquery-ui/widgets/draggable',
'jquery-ui/widgets/droppable',
'jquery-ui/widgets/sortable',
], function (translator, iconSelect, Benchpress, alerts) {
const navigation = {};
let available;

View File

@@ -352,11 +352,11 @@ app.flags = {};
return callback();
}
require([
'jquery-ui/ui/widgets/datepicker',
'jquery-ui/ui/widgets/autocomplete',
'jquery-ui/ui/widgets/sortable',
'jquery-ui/ui/widgets/resizable',
'jquery-ui/ui/widgets/draggable',
'jquery-ui/widgets/datepicker',
'jquery-ui/widgets/autocomplete',
'jquery-ui/widgets/sortable',
'jquery-ui/widgets/resizable',
'jquery-ui/widgets/draggable',
], function () {
callback();
});

View File

@@ -1,7 +1,7 @@
'use strict';
define('forum/flags/list', [
'components', 'chart.js', 'categoryFilter', 'autocomplete', 'api', 'alerts',
'components', 'Chart', 'categoryFilter', 'autocomplete', 'api', 'alerts',
], function (components, Chart, categoryFilter, autocomplete, api, alerts) {
const Flags = {};

View File

@@ -1,7 +1,7 @@
'use strict';
define('forum/ip-blacklist', ['chart.js', 'benchpress', 'bootbox', 'alerts'], function (Chart, Benchpress, bootbox, alerts) {
define('forum/ip-blacklist', ['Chart', 'benchpress', 'bootbox', 'alerts'], function (Chart, Benchpress, bootbox, alerts) {
const Blacklist = {};
Blacklist.init = function () {

View File

@@ -45,7 +45,7 @@ define('pictureCropper', ['alerts'], function (alerts) {
const cropBoxHeight = parseInt($(window).height() / 2, 10);
const img = document.getElementById('cropped-image');
$(img).css('max-height', cropBoxHeight);
const Cropper = await import(/* webpackChunkName: "cropperjs" */ 'cropperjs');
const Cropper = (await import(/* webpackChunkName: "cropperjs" */ 'cropperjs')).default;
let cropperTool = new Cropper(img, {
aspectRatio: data.aspectRatio,
@@ -127,10 +127,11 @@ define('pictureCropper', ['alerts'], function (alerts) {
});
});
cropperModal.find('.upload-btn').on('click', function () {
cropperModal.find('.upload-btn').on('click', async function () {
$(this).addClass('disabled');
cropperTool.destroy();
const Cropper = (await import(/* webpackChunkName: "cropperjs" */ 'cropperjs')).default;
cropperTool = new Cropper(img, {
viewMode: 1,
autoCropArea: 1,

View File

@@ -4,7 +4,7 @@ define('settings/sorted-list', [
'benchpress',
'bootbox',
'hooks',
'jquery-ui/ui/widgets/sortable',
'jquery-ui/widgets/sortable',
], function (benchpress, bootbox, hooks) {
let Settings;

View File

@@ -1,7 +1,7 @@
'use strict';
define('topicThumbs', [
'api', 'bootbox', 'alerts', 'uploader', 'benchpress', 'translator', 'jquery-ui/ui/widgets/sortable',
'api', 'bootbox', 'alerts', 'uploader', 'benchpress', 'translator', 'jquery-ui/widgets/sortable',
], function (api, bootbox, alerts, uploader, Benchpress, translator) {
const Thumbs = {};

View File

@@ -51,6 +51,9 @@ module.exports = {
admin: path.resolve(__dirname, 'public/src/admin'),
vendor: path.resolve(__dirname, 'public/vendor'),
benchpress: path.resolve(__dirname, 'node_modules/benchpressjs'),
Chart: path.resolve(__dirname, 'node_modules/chart.js'),
Sortable: path.resolve(__dirname, 'node_modules/sortablejs'),
'jquery-ui/widgets': path.resolve(__dirname, 'node_modules/jquery-ui/ui/widgets'),
},
},
};