mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: no global bootbox (#9879)
* fix: require bootbox (easy ones) * fix: require bootbox (ugly ones) * fix(eslint): a lengthy line
This commit is contained in:
		| @@ -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,6 +20,7 @@ | ||||
| 		} | ||||
|  | ||||
| 		logoutTimer = setTimeout(function () { | ||||
| 			require(['bootbox'], function (bootbox) { | ||||
| 				bootbox.alert({ | ||||
| 					closeButton: false, | ||||
| 					message: logoutMessage, | ||||
| @@ -27,6 +28,7 @@ | ||||
| 						window.location.reload(); | ||||
| 					}, | ||||
| 				}); | ||||
| 			}); | ||||
| 		}, 3600000); | ||||
| 	} | ||||
|  | ||||
| @@ -141,6 +143,7 @@ | ||||
|  | ||||
| 	function setupRestartLinks() { | ||||
| 		$('.rebuild-and-restart').off('click').on('click', function () { | ||||
| 			require(['bootbox'], function (bootbox) { | ||||
| 				bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) { | ||||
| 					if (confirm) { | ||||
| 						require(['admin/modules/instance'], function (instance) { | ||||
| @@ -149,8 +152,10 @@ | ||||
| 					} | ||||
| 				}); | ||||
| 			}); | ||||
| 		}); | ||||
|  | ||||
| 		$('.restart').off('click').on('click', function () { | ||||
| 			require(['bootbox'], function (bootbox) { | ||||
| 				bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) { | ||||
| 					if (confirm) { | ||||
| 						require(['admin/modules/instance'], function (instance) { | ||||
| @@ -159,6 +164,7 @@ | ||||
| 					} | ||||
| 				}); | ||||
| 			}); | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	function configureSlidemenu() { | ||||
|   | ||||
| @@ -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,12 +545,14 @@ $(document).ready(function () { | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| 				require(['bootbox'], function (bootbox) { | ||||
| 					bootbox.confirm('[[global:unsaved-changes]]', function (navigate) { | ||||
| 						if (navigate) { | ||||
| 							app.flags._unsaved = false; | ||||
| 							process.call(_self); | ||||
| 						} | ||||
| 					}); | ||||
| 				}); | ||||
| 				return e.preventDefault(); | ||||
| 			} | ||||
|  | ||||
|   | ||||
| @@ -217,6 +217,7 @@ app.cacheBuster = null; | ||||
| 	app.handleInvalidSession = function () { | ||||
| 		socket.disconnect(); | ||||
| 		app.logout(false); | ||||
| 		require(['bootbox'], function (bootbox) { | ||||
| 			bootbox.alert({ | ||||
| 				title: '[[error:invalid-session]]', | ||||
| 				message: '[[error:invalid-session-text]]', | ||||
| @@ -225,6 +226,7 @@ app.cacheBuster = null; | ||||
| 					window.location.reload(); | ||||
| 				}, | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	app.handleSessionMismatch = () => { | ||||
| @@ -233,6 +235,7 @@ app.cacheBuster = null; | ||||
| 		} | ||||
|  | ||||
| 		socket.disconnect(); | ||||
| 		require(['bootbox'], function (bootbox) { | ||||
| 			bootbox.alert({ | ||||
| 				title: '[[error:session-mismatch]]', | ||||
| 				message: '[[error:session-mismatch-text]]', | ||||
| @@ -241,6 +244,7 @@ app.cacheBuster = null; | ||||
| 					window.location.reload(); | ||||
| 				}, | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	app.enterRoom = function (room, callback) { | ||||
| @@ -434,12 +438,14 @@ app.cacheBuster = null; | ||||
| 			if (!isDnD) { | ||||
| 				return createChat(); | ||||
| 			} | ||||
| 			require(['bootbox'], function (bootbox) { | ||||
| 				bootbox.confirm('[[modules:chat.confirm-chat-with-dnd-user]]', function (ok) { | ||||
| 					if (ok) { | ||||
| 						createChat(); | ||||
| 					} | ||||
| 				}); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	app.toggleNavbar = function (state) { | ||||
|   | ||||
| @@ -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 + ']]'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user