From b884628a5a7396d18d9eb4ebe194ae4529090a97 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 15 Jul 2021 16:59:17 -0400 Subject: [PATCH] pad_editbar: Use arrow functions for callbacks, IIFEs --- src/static/js/pad_editbar.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 530a83326..856f96275 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -78,7 +78,7 @@ ToolbarItem.prototype.bind = function (callback) { }; -const padeditbar = (function () { +const padeditbar = (() => { const syncAnimationFn = () => { const SYNCING = -100; const DONE = 100; @@ -166,8 +166,8 @@ const padeditbar = (function () { } // When editor is scrolled, we add a class to style the editbar differently - $('iframe[name="ace_outer"]').contents().scroll(function () { - $('#editbar').toggleClass('editor-scrolled', $(this).scrollTop() > 2); + $('iframe[name="ace_outer"]').contents().scroll((ev) => { + $('#editbar').toggleClass('editor-scrolled', $(ev.currentTarget).scrollTop() > 2); }); }, isEnabled: () => true, @@ -489,6 +489,6 @@ const padeditbar = (function () { }; return self; -}()); +})(); exports.padeditbar = padeditbar;