diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-06-30 16:27:31 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-07-06 10:10:01 -0500 |
commit | 3b32313cceee02c084cdf7fcde2ea4ad0a416512 (patch) | |
tree | fa5f4479da62e2b58942a33ed6929aac4a2f4326 /app/assets/javascripts/zen_mode.js | |
parent | c2255c5779b9f7247c08772a5514f28b3a7931cf (diff) | |
download | gitlab-ce-3b32313cceee02c084cdf7fcde2ea4ad0a416512.tar.gz |
refactor zen_mode.js to use ES class syntax
Diffstat (limited to 'app/assets/javascripts/zen_mode.js')
-rw-r--r-- | app/assets/javascripts/zen_mode.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index 08f80735e93..039bef0bd8a 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, no-unused-vars, consistent-return, camelcase, comma-dangle, max-len */ +/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, no-unused-vars, consistent-return, camelcase, comma-dangle, max-len, class-methods-use-this */ /* global Mousetrap */ // Zen Mode (full screen) textarea @@ -35,8 +35,8 @@ window.Dropzone = Dropzone; // **Target** a.js-zen-leave // -window.ZenMode = (function() { - function ZenMode() { +class ZenMode { + constructor() { this.active_backdrop = null; this.active_textarea = null; $(document).on('click', '.js-zen-enter', function(e) { @@ -66,7 +66,7 @@ window.ZenMode = (function() { }); } - ZenMode.prototype.enter = function(backdrop) { + enter(backdrop) { Mousetrap.pause(); this.active_backdrop = $(backdrop); this.active_backdrop.addClass('fullscreen'); @@ -74,9 +74,9 @@ window.ZenMode = (function() { // Prevent a user-resized textarea from persisting to fullscreen this.active_textarea.removeAttr('style'); return this.active_textarea.focus(); - }; + } - ZenMode.prototype.exit = function() { + exit() { if (this.active_textarea) { Mousetrap.unpause(); this.active_textarea.closest('.zen-backdrop').removeClass('fullscreen'); @@ -85,13 +85,13 @@ window.ZenMode = (function() { this.active_backdrop = null; return Dropzone.forElement('.div-dropzone').enable(); } - }; + } - ZenMode.prototype.scrollTo = function(zen_area) { + scrollTo(zen_area) { return $.scrollTo(zen_area, 0, { offset: -150 }); - }; + } +} - return ZenMode; -})(); +window.ZenMode = ZenMode; |