Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3b32313c
Commit
3b32313c
authored
Jun 30, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor zen_mode.js to use ES class syntax
parent
c2255c57
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
app/assets/javascripts/zen_mode.js
app/assets/javascripts/zen_mode.js
+11
-11
No files found.
app/assets/javascripts/zen_mode.js
View file @
3b32313c
/* 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 */
/* global Mousetrap */
// Zen Mode (full screen) textarea
// Zen Mode (full screen) textarea
...
@@ -35,8 +35,8 @@ window.Dropzone = Dropzone;
...
@@ -35,8 +35,8 @@ window.Dropzone = Dropzone;
// **Target** a.js-zen-leave
// **Target** a.js-zen-leave
//
//
window
.
ZenMode
=
(
function
()
{
class
ZenMode
{
function
ZenMode
()
{
constructor
()
{
this
.
active_backdrop
=
null
;
this
.
active_backdrop
=
null
;
this
.
active_textarea
=
null
;
this
.
active_textarea
=
null
;
$
(
document
).
on
(
'
click
'
,
'
.js-zen-enter
'
,
function
(
e
)
{
$
(
document
).
on
(
'
click
'
,
'
.js-zen-enter
'
,
function
(
e
)
{
...
@@ -66,7 +66,7 @@ window.ZenMode = (function() {
...
@@ -66,7 +66,7 @@ window.ZenMode = (function() {
});
});
}
}
ZenMode
.
prototype
.
enter
=
function
(
backdrop
)
{
enter
(
backdrop
)
{
Mousetrap
.
pause
();
Mousetrap
.
pause
();
this
.
active_backdrop
=
$
(
backdrop
);
this
.
active_backdrop
=
$
(
backdrop
);
this
.
active_backdrop
.
addClass
(
'
fullscreen
'
);
this
.
active_backdrop
.
addClass
(
'
fullscreen
'
);
...
@@ -74,9 +74,9 @@ window.ZenMode = (function() {
...
@@ -74,9 +74,9 @@ window.ZenMode = (function() {
// Prevent a user-resized textarea from persisting to fullscreen
// Prevent a user-resized textarea from persisting to fullscreen
this
.
active_textarea
.
removeAttr
(
'
style
'
);
this
.
active_textarea
.
removeAttr
(
'
style
'
);
return
this
.
active_textarea
.
focus
();
return
this
.
active_textarea
.
focus
();
}
;
}
ZenMode
.
prototype
.
exit
=
function
()
{
exit
()
{
if
(
this
.
active_textarea
)
{
if
(
this
.
active_textarea
)
{
Mousetrap
.
unpause
();
Mousetrap
.
unpause
();
this
.
active_textarea
.
closest
(
'
.zen-backdrop
'
).
removeClass
(
'
fullscreen
'
);
this
.
active_textarea
.
closest
(
'
.zen-backdrop
'
).
removeClass
(
'
fullscreen
'
);
...
@@ -85,13 +85,13 @@ window.ZenMode = (function() {
...
@@ -85,13 +85,13 @@ window.ZenMode = (function() {
this
.
active_backdrop
=
null
;
this
.
active_backdrop
=
null
;
return
Dropzone
.
forElement
(
'
.div-dropzone
'
).
enable
();
return
Dropzone
.
forElement
(
'
.div-dropzone
'
).
enable
();
}
}
}
;
}
ZenMode
.
prototype
.
scrollTo
=
function
(
zen_area
)
{
scrollTo
(
zen_area
)
{
return
$
.
scrollTo
(
zen_area
,
0
,
{
return
$
.
scrollTo
(
zen_area
,
0
,
{
offset
:
-
150
offset
:
-
150
});
});
};
}
}
return
ZenMode
;
window
.
ZenMode
=
ZenMode
;
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment