mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-21 18:46:10 +10:00
Merge pull request #7797 from cirosantilli/zen-style
Improve zen mode internals.
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
class @ZenMode
|
||||
@fullscreen_prefix = 'fullscreen_'
|
||||
@ESC = 27
|
||||
|
||||
constructor: ->
|
||||
@active_zen_area = null
|
||||
@active_checkbox = null
|
||||
|
||||
$('body').on 'change', '.zennable input[type=checkbox]', (e) =>
|
||||
checkbox = e.currentTarget;
|
||||
checkbox = e.currentTarget
|
||||
if checkbox.checked
|
||||
Mousetrap.pause()
|
||||
@udpateActiveZenArea(checkbox)
|
||||
@@ -15,8 +14,7 @@ class @ZenMode
|
||||
@exitZenMode()
|
||||
|
||||
$(document).on 'keydown', (e) =>
|
||||
console.log("esc")
|
||||
if e.keyCode is ZenMode.ESC
|
||||
if e.keyCode is $.ui.keyCode.ESCAPE
|
||||
@exitZenMode()
|
||||
|
||||
$(window).on 'hashchange', @updateZenModeFromLocationHash
|
||||
@@ -27,7 +25,7 @@ class @ZenMode
|
||||
@active_zen_area = @active_checkbox.parent().find('textarea')
|
||||
@active_zen_area.focus()
|
||||
window.location.hash = ZenMode.fullscreen_prefix + @active_checkbox.prop('id')
|
||||
|
||||
|
||||
exitZenMode: =>
|
||||
if @active_zen_area isnt null
|
||||
Mousetrap.unpause()
|
||||
@@ -48,4 +46,4 @@ class @ZenMode
|
||||
if checkbox
|
||||
@udpateActiveZenArea(checkbox)
|
||||
else
|
||||
@exitZenMode()
|
||||
@exitZenMode()
|
||||
|
||||
Reference in New Issue
Block a user