summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/zen_mode.js
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-07-07 17:52:51 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2017-07-07 17:52:51 +0000
commite36daa0fd95c93967708447b3b8f615c2a81e3b5 (patch)
tree4725efc3c18bc321da6941dcf274b4396c2782c6 /app/assets/javascripts/zen_mode.js
parent2719b2f0a1ed03170abeca7e78d99a36afb0b65d (diff)
parent7c35ecf7e44e5b44643b41719a67e89f99f10053 (diff)
downloadgitlab-ce-e36daa0fd95c93967708447b3b8f615c2a81e3b5.tar.gz
Merge branch 'master' into 'fix/gb/stage-id-reference-background-migration'
# Conflicts: # app/models/concerns/each_batch.rb # spec/models/concerns/each_batch_spec.rb
Diffstat (limited to 'app/assets/javascripts/zen_mode.js')
-rw-r--r--app/assets/javascripts/zen_mode.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js
index 08f80735e93..99c7644e4d9 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() {
+export default 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,11 @@ 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;
-})();
+ }
+}