fix: no global bootbox (#9879)

* fix: require bootbox (easy ones)

* fix: require bootbox (ugly ones)

* fix(eslint): a lengthy line
isekai-main
gasoved 4 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 "maxerr" : 50, // {int} Maximum error before stopping
"esversion": 6, "esversion": 9,
// Enforcing // Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)

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

@ -20,6 +20,7 @@
} }
logoutTimer = setTimeout(function () { logoutTimer = setTimeout(function () {
require(['bootbox'], function (bootbox) {
bootbox.alert({ bootbox.alert({
closeButton: false, closeButton: false,
message: logoutMessage, message: logoutMessage,
@ -27,6 +28,7 @@
window.location.reload(); window.location.reload();
}, },
}); });
});
}, 3600000); }, 3600000);
} }
@ -141,6 +143,7 @@
function setupRestartLinks() { function setupRestartLinks() {
$('.rebuild-and-restart').off('click').on('click', function () { $('.rebuild-and-restart').off('click').on('click', function () {
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) { bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) {
if (confirm) { if (confirm) {
require(['admin/modules/instance'], function (instance) { require(['admin/modules/instance'], function (instance) {
@ -149,8 +152,10 @@
} }
}); });
}); });
});
$('.restart').off('click').on('click', function () { $('.restart').off('click').on('click', function () {
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) { bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) {
if (confirm) { if (confirm) {
require(['admin/modules/instance'], function (instance) { require(['admin/modules/instance'], function (instance) {
@ -159,6 +164,7 @@
} }
}); });
}); });
});
} }
function configureSlidemenu() { function configureSlidemenu() {

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

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

@ -1,7 +1,7 @@
'use strict'; '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 Admin = {};
var intervals = { var intervals = {
rooms: false, rooms: false,

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

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

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

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

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

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

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

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

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

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

@ -217,6 +217,7 @@ app.cacheBuster = null;
app.handleInvalidSession = function () { app.handleInvalidSession = function () {
socket.disconnect(); socket.disconnect();
app.logout(false); app.logout(false);
require(['bootbox'], function (bootbox) {
bootbox.alert({ bootbox.alert({
title: '[[error:invalid-session]]', title: '[[error:invalid-session]]',
message: '[[error:invalid-session-text]]', message: '[[error:invalid-session-text]]',
@ -225,6 +226,7 @@ app.cacheBuster = null;
window.location.reload(); window.location.reload();
}, },
}); });
});
}; };
app.handleSessionMismatch = () => { app.handleSessionMismatch = () => {
@ -233,6 +235,7 @@ app.cacheBuster = null;
} }
socket.disconnect(); socket.disconnect();
require(['bootbox'], function (bootbox) {
bootbox.alert({ bootbox.alert({
title: '[[error:session-mismatch]]', title: '[[error:session-mismatch]]',
message: '[[error:session-mismatch-text]]', message: '[[error:session-mismatch-text]]',
@ -241,6 +244,7 @@ app.cacheBuster = null;
window.location.reload(); window.location.reload();
}, },
}); });
});
}; };
app.enterRoom = function (room, callback) { app.enterRoom = function (room, callback) {
@ -434,12 +438,14 @@ app.cacheBuster = null;
if (!isDnD) { if (!isDnD) {
return createChat(); return createChat();
} }
require(['bootbox'], function (bootbox) {
bootbox.confirm('[[modules:chat.confirm-chat-with-dnd-user]]', function (ok) { bootbox.confirm('[[modules:chat.confirm-chat-with-dnd-user]]', function (ok) {
if (ok) { if (ok) {
createChat(); createChat();
} }
}); });
}); });
});
}; };
app.toggleNavbar = function (state) { app.toggleNavbar = function (state) {

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

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

@ -11,7 +11,12 @@ define('forum/chats', [
'benchpress', 'benchpress',
'composer/autocomplete', 'composer/autocomplete',
'hooks', '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 = { var Chats = {
initialised: false, initialised: false,
}; };

@ -1,7 +1,7 @@
'use strict'; '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 = {}; var messages = {};
messages.sendMessage = function (roomId, inputEl) { messages.sendMessage = function (roomId, inputEl) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save