Skip to content

Commit

Permalink
Remove closePopup function from window object (#8221)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchamp authored Oct 2, 2023
1 parent 24cad47 commit 73dcb68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion openlibrary/plugins/openlibrary/js/covers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import 'jquery-ui/ui/widgets/sortable';
import 'jquery-ui-touch-punch'; // this makes drag-to-reorder work on touch devices

import { closePopup } from './utils';

//cover/change.html
export function initCoversChange() {
// Pull data from data-config of class "manageCovers" in covers/manage.html
Expand Down Expand Up @@ -107,7 +109,7 @@ export function initCoversSaved() {
const image = $('.imageSaved').data('imageId');
var cover_url;

$('.formButtons button').on('click', parent.closePopup);
$('.formButtons button').on('click', closePopup);

// Update the image for the cover
if (['/type/edition', '/type/work', '/edit'].includes(doc_type_key)) {
Expand Down
4 changes: 1 addition & 3 deletions openlibrary/plugins/openlibrary/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { commify } from './python';
import { Subject, urlencode, slice } from './subjects';
import Template from './template.js';
// Add $.fn.focusNextInputField
import { closePopup, truncate, cond } from './utils';
import { truncate, cond } from './utils';
import initValidate from './validate';
import '../../../../static/css/js-all.less';
// polyfill Promise support for IE11
Expand All @@ -28,8 +28,6 @@ import { confirmDialog, initDialogs } from './dialog';

// Eventually we will export all these to a single global ol, but in the mean time
// we add them to the window object for backwards compatibility.
// closePopup used in openlibrary/templates/covers/saved.html
window.closePopup = closePopup;
window.commify = commify;
window.cond = cond;
window.enumerate = enumerate;
Expand Down
1 change: 0 additions & 1 deletion openlibrary/plugins/openlibrary/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ $.fn.focusNextInputField = function() {
};

// closes active popup
// used in templates/covers/saved.html
export function closePopup() {
parent.jQuery.fn.colorbox.close();
}
Expand Down

0 comments on commit 73dcb68

Please sign in to comment.