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: { clientUpdated: {
files: [ files: [
// 'public/src/modules/**/*.js',
// 'public/vendor/**/*.js',
...clientUpdated, ...clientUpdated,
'node_modules/benchpressjs/build/benchpress.js', 'node_modules/benchpressjs/build/benchpress.js',
], ],

View File

@@ -1,7 +1,7 @@
'use strict'; '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 = {}; const Errors = {};
Errors.init = function () { Errors.init = function () {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
'use strict'; '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 = { const Graph = {
_current: null, _current: null,
}; };

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
'use strict'; '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 = {}; const Blacklist = {};
Blacklist.init = function () { Blacklist.init = function () {

View File

@@ -45,7 +45,7 @@ define('pictureCropper', ['alerts'], function (alerts) {
const cropBoxHeight = parseInt($(window).height() / 2, 10); const cropBoxHeight = parseInt($(window).height() / 2, 10);
const img = document.getElementById('cropped-image'); const img = document.getElementById('cropped-image');
$(img).css('max-height', cropBoxHeight); $(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, { let cropperTool = new Cropper(img, {
aspectRatio: data.aspectRatio, 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'); $(this).addClass('disabled');
cropperTool.destroy(); cropperTool.destroy();
const Cropper = (await import(/* webpackChunkName: "cropperjs" */ 'cropperjs')).default;
cropperTool = new Cropper(img, { cropperTool = new Cropper(img, {
viewMode: 1, viewMode: 1,
autoCropArea: 1, autoCropArea: 1,

View File

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

View File

@@ -1,7 +1,7 @@
'use strict'; 'use strict';
define('topicThumbs', [ 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) { ], function (api, bootbox, alerts, uploader, Benchpress, translator) {
const Thumbs = {}; const Thumbs = {};

View File

@@ -51,6 +51,9 @@ module.exports = {
admin: path.resolve(__dirname, 'public/src/admin'), admin: path.resolve(__dirname, 'public/src/admin'),
vendor: path.resolve(__dirname, 'public/vendor'), vendor: path.resolve(__dirname, 'public/vendor'),
benchpress: path.resolve(__dirname, 'node_modules/benchpressjs'), 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'),
}, },
}, },
}; };