fix: no global bootbox (#9879)

* fix: require bootbox (easy ones)

* fix: require bootbox (ugly ones)

* fix(eslint): a lengthy line
isekai-main
gasoved 3 years ago committed by GitHub
parent 94c4f87b2f
commit 227456fb17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,7 @@
"maxerr" : 50, // {int} Maximum error before stopping
"esversion": 6,
"esversion": 9,
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)

@ -1,6 +1,8 @@
{
"maxerr" : 50, // {int} Maximum error before stopping
"esversion": 9,
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
@ -42,7 +44,7 @@
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope" : false, // true: Tolerate defining variables inside control statements"
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
"globalstrict" : true, // true: Allow global "use strict" (also enables 'strict')
"iterator" : false, // true: Tolerate using the `__iterator__` property
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
@ -66,7 +68,6 @@
"utils": true,
"overrides": true,
"componentHandler": true,
"bootbox": true,
"templates": true,
"Visibility": true,
"Tinycon": true,

@ -20,12 +20,14 @@
}
logoutTimer = setTimeout(function () {
bootbox.alert({
closeButton: false,
message: logoutMessage,
callback: function () {
window.location.reload();
},
require(['bootbox'], function (bootbox) {
bootbox.alert({
closeButton: false,
message: logoutMessage,
callback: function () {
window.location.reload();
},
});
});
}, 3600000);
}
@ -141,22 +143,26 @@
function setupRestartLinks() {
$('.rebuild-and-restart').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) {
if (confirm) {
require(['admin/modules/instance'], function (instance) {
instance.rebuildAndRestart();
});
}
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) {
if (confirm) {
require(['admin/modules/instance'], function (instance) {
instance.rebuildAndRestart();
});
}
});
});
});
$('.restart').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) {
if (confirm) {
require(['admin/modules/instance'], function (instance) {
instance.restart();
});
}
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) {
if (confirm) {
require(['admin/modules/instance'], function (instance) {
instance.restart();
});
}
});
});
});
}

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

@ -1,7 +1,7 @@
'use strict';
define('admin/appearance/themes', ['translator'], function (translator) {
define('admin/appearance/themes', ['bootbox', 'translator'], function (bootbox, translator) {
var Themes = {};
Themes.init = function () {

@ -1,7 +1,7 @@
'use strict';
define('admin/dashboard', ['Chart', 'translator', 'benchpress'], function (Chart, translator, Benchpress) {
define('admin/dashboard', ['Chart', 'translator', 'benchpress', 'bootbox'], function (Chart, translator, Benchpress, bootbox) {
var Admin = {};
var intervals = {
rooms: false,

@ -4,8 +4,9 @@
define('admin/extend/plugins', [
'translator',
'benchpress',
'bootbox',
'jquery-ui/widgets/sortable',
], function (translator, Benchpress) {
], function (translator, Benchpress, bootbox) {
var Plugins = {};
Plugins.init = function () {
var pluginsList = $('.plugins');

@ -2,11 +2,12 @@
define('admin/extend/widgets', [
'bootbox',
'jquery-ui/widgets/sortable',
'jquery-ui/widgets/draggable',
'jquery-ui/widgets/droppable',
'jquery-ui/widgets/datepicker',
], function () {
], function (bootbox) {
var Widgets = {};
Widgets.init = function () {

@ -6,7 +6,8 @@ define('admin/manage/category', [
'categorySelector',
'benchpress',
'api',
], function (uploader, iconSelect, categorySelector, Benchpress, api) {
'bootbox',
], function (uploader, iconSelect, categorySelector, Benchpress, api, bootbox) {
var Category = {};
var updateHash = {};

@ -1,7 +1,7 @@
'use strict';
define('admin/manage/digest', function () {
define('admin/manage/digest', ['bootbox'], function (bootbox) {
var Digest = {};
Digest.init = function () {

@ -8,7 +8,8 @@ define('admin/manage/group', [
'groupSearch',
'slugify',
'api',
], function (memberList, iconSelect, translator, categorySelector, groupSearch, slugify, api) {
'bootbox',
], function (memberList, iconSelect, translator, categorySelector, groupSearch, slugify, api, bootbox) {
var Groups = {};
Groups.init = function () {

@ -4,7 +4,8 @@ define('admin/manage/groups', [
'categorySelector',
'slugify',
'api',
], function (categorySelector, slugify, api) {
'bootbox',
], function (categorySelector, slugify, api, bootbox) {
var Groups = {};
Groups.init = function () {

@ -1,7 +1,7 @@
'use strict';
define('admin/manage/registration', function () {
define('admin/manage/registration', ['bootbox'], function (bootbox) {
var Registration = {};
Registration.init = function () {

@ -2,9 +2,10 @@
define('admin/manage/tags', [
'bootbox',
'forum/infinitescroll',
'admin/modules/selectable',
], function (infinitescroll, selectable) {
], function (bootbox, infinitescroll, selectable) {
var Tags = {};
Tags.init = function () {

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

@ -545,11 +545,13 @@ $(document).ready(function () {
return;
}
bootbox.confirm('[[global:unsaved-changes]]', function (navigate) {
if (navigate) {
app.flags._unsaved = false;
process.call(_self);
}
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[global:unsaved-changes]]', function (navigate) {
if (navigate) {
app.flags._unsaved = false;
process.call(_self);
}
});
});
return e.preventDefault();
}

@ -217,13 +217,15 @@ app.cacheBuster = null;
app.handleInvalidSession = function () {
socket.disconnect();
app.logout(false);
bootbox.alert({
title: '[[error:invalid-session]]',
message: '[[error:invalid-session-text]]',
closeButton: false,
callback: function () {
window.location.reload();
},
require(['bootbox'], function (bootbox) {
bootbox.alert({
title: '[[error:invalid-session]]',
message: '[[error:invalid-session-text]]',
closeButton: false,
callback: function () {
window.location.reload();
},
});
});
};
@ -233,13 +235,15 @@ app.cacheBuster = null;
}
socket.disconnect();
bootbox.alert({
title: '[[error:session-mismatch]]',
message: '[[error:session-mismatch-text]]',
closeButton: false,
callback: function () {
window.location.reload();
},
require(['bootbox'], function (bootbox) {
bootbox.alert({
title: '[[error:session-mismatch]]',
message: '[[error:session-mismatch-text]]',
closeButton: false,
callback: function () {
window.location.reload();
},
});
});
};
@ -434,10 +438,12 @@ app.cacheBuster = null;
if (!isDnD) {
return createChat();
}
bootbox.confirm('[[modules:chat.confirm-chat-with-dnd-user]]', function (ok) {
if (ok) {
createChat();
}
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[modules:chat.confirm-chat-with-dnd-user]]', function (ok) {
if (ok) {
createChat();
}
});
});
});
};

@ -6,7 +6,8 @@ define('forum/account/edit', [
'translator',
'api',
'hooks',
], function (header, picture, translator, api, hooks) {
'bootbox',
], function (header, picture, translator, api, hooks, bootbox) {
var AccountEdit = {};
AccountEdit.init = function () {

@ -9,7 +9,8 @@ define('forum/account/header', [
'benchpress',
'accounts/delete',
'api',
], function (coverPhoto, pictureCropper, components, translator, Benchpress, AccountsDelete, api) {
'bootbox',
], function (coverPhoto, pictureCropper, components, translator, Benchpress, AccountsDelete, api, bootbox) {
var AccountHeader = {};
var isAdminOrSelfOrGlobalMod;

@ -11,7 +11,12 @@ define('forum/chats', [
'benchpress',
'composer/autocomplete',
'hooks',
], function (components, translator, mousetrap, recentChats, search, messages, Benchpress, autocomplete, hooks) {
'bootbox',
], function (
components, translator, mousetrap,
recentChats, search, messages, Benchpress,
autocomplete, hooks, bootbox
) {
var Chats = {
initialised: false,
};

@ -1,7 +1,7 @@
'use strict';
define('forum/chats/messages', ['components', 'translator', 'benchpress', 'hooks'], function (components, translator, Benchpress, hooks) {
define('forum/chats/messages', ['components', 'translator', 'benchpress', 'hooks', 'bootbox'], function (components, translator, Benchpress, hooks, bootbox) {
var messages = {};
messages.sendMessage = function (roomId, inputEl) {

@ -1,6 +1,6 @@
'use strict';
define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'benchpress', 'forum/account/header', 'accounts/delete', 'api'], function (FlagsList, components, translator, Benchpress, AccountHeader, AccountsDelete, api) {
define('forum/flags/detail', ['forum/flags/list', 'components', 'translator', 'benchpress', 'forum/account/header', 'accounts/delete', 'api', 'bootbox'], function (FlagsList, components, translator, Benchpress, AccountHeader, AccountsDelete, api, bootbox) {
var Detail = {};
Detail.init = function () {

@ -10,6 +10,7 @@ define('forum/groups/details', [
'api',
'slugify',
'categorySelector',
'bootbox',
], function (
memberList,
iconSelect,
@ -19,7 +20,8 @@ define('forum/groups/details', [
translator,
api,
slugify,
categorySelector
categorySelector,
bootbox
) {
var Details = {};
var groupName;

@ -1,8 +1,8 @@
'use strict';
define('forum/groups/list', [
'forum/infinitescroll', 'benchpress', 'api',
], function (infinitescroll, Benchpress, api) {
'forum/infinitescroll', 'benchpress', 'api', 'bootbox',
], function (infinitescroll, Benchpress, api, bootbox) {
var Groups = {};
Groups.init = function () {

@ -1,6 +1,6 @@
'use strict';
define('forum/groups/memberlist', ['api'], function (api) {
define('forum/groups/memberlist', ['api', 'bootbox'], function (api, bootbox) {
var MemberList = {};
var searchInterval;
var groupName;

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

@ -1,7 +1,7 @@
'use strict';
define('forum/pagination', function () {
define('forum/pagination', ['bootbox'], function (bootbox) {
var pagination = {};
pagination.init = function () {

@ -2,8 +2,8 @@
define('forum/register', [
'translator', 'zxcvbn', 'slugify', 'api', 'forum/login', 'jquery-form',
], function (translator, zxcvbn, slugify, api, Login) {
'translator', 'zxcvbn', 'slugify', 'api', 'bootbox', 'forum/login', 'jquery-form',
], function (translator, zxcvbn, slugify, api, bootbox, Login) {
var Register = {};
var validationError = false;
var successIcon = '';

@ -8,7 +8,8 @@ define('forum/topic/threadTools', [
'forum/topic/posts',
'api',
'hooks',
], function (components, translator, handleBack, posts, api, hooks) {
'bootbox',
], function (components, translator, handleBack, posts, api, hooks, bootbox) {
var ThreadTools = {};
ThreadTools.init = function (tid, topicContainer) {

@ -2,8 +2,8 @@
define('forum/topic/votes', [
'components', 'translator', 'benchpress', 'api', 'hooks',
], function (components, translator, Benchpress, api, hooks) {
'components', 'translator', 'benchpress', 'api', 'hooks', 'bootbox',
], function (components, translator, Benchpress, api, hooks, bootbox) {
var Votes = {};
Votes.addVoteHandler = function () {

@ -1,6 +1,6 @@
'use strict';
define('accounts/delete', ['api', 'bootbox'], function (api) {
define('accounts/delete', ['api', 'bootbox'], function (api, bootbox) {
var Delete = {};
Delete.account = function (uid, callback) {

@ -3,7 +3,8 @@
define('accounts/picture', [
'pictureCropper',
'api',
], (pictureCropper, api) => {
'bootbox',
], (pictureCropper, api, bootbox) => {
const Picture = {};
Picture.openChangeModal = () => {

@ -1,7 +1,7 @@
'use strict';
define('iconSelect', ['benchpress'], function (Benchpress) {
define('iconSelect', ['benchpress', 'bootbox'], function (Benchpress, bootbox) {
var iconSelect = {};
iconSelect.init = function (el, onModified) {

@ -2,9 +2,10 @@
define('settings/sorted-list', [
'benchpress',
'bootbox',
'hooks',
'jquery-ui/widgets/sortable',
], function (benchpress, hooks) {
], function (benchpress, bootbox, hooks) {
var SortedList;
var Settings;

@ -212,7 +212,7 @@ socket = window.socket;
}
function onEventBanned(data) {
require(['translator'], function (translator) {
require(['bootbox', 'translator'], function (bootbox, translator) {
var message = data.until ?
translator.compile('error:user-banned-reason-until', (new Date(data.until).toLocaleString()), data.reason) :
'[[error:user-banned-reason, ' + data.reason + ']]';

Loading…
Cancel
Save