mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
switch to module.exports = style in tabs.coffee
This commit is contained in:
@@ -8,43 +8,38 @@ File = require 'fs'
|
||||
|
||||
# click tab
|
||||
$(document).delegate '#tabs ul li:not(.add) a', 'click', ->
|
||||
switchToTab this
|
||||
tabs.switchToTab this
|
||||
false
|
||||
|
||||
# click 'add' tab
|
||||
$(document).delegate '#tabs .add a', 'click', ->
|
||||
addTab()
|
||||
tabs.addTab()
|
||||
false
|
||||
|
||||
# toggle
|
||||
bindKey 'toggleTabs', 'Command-Ctrl-T', (env) ->
|
||||
if $('#tabs').length
|
||||
hideTabs()
|
||||
tabs.hideTabs()
|
||||
else
|
||||
showTabs()
|
||||
tabs.showTabs()
|
||||
|
||||
|
||||
showTabs = ->
|
||||
Chrome.addPane 'top', require('tabs/tabs.html')
|
||||
$('#tabs').parents('.pane').css height: 'inherit'
|
||||
css = $('<style id="tabs-style"></style>').html require 'tabs/tabs.css'
|
||||
$('head').append css
|
||||
module.exports = tabs =
|
||||
showTabs: ->
|
||||
Chrome.addPane 'top', require 'tabs/tabs.html'
|
||||
$('#tabs').parents('.pane').css height: 'inherit'
|
||||
css = $('<style id="tabs-style"></style>').html require 'tabs/tabs.css'
|
||||
$('head').append css
|
||||
|
||||
hideTabs = ->
|
||||
$('#tabs').parents('.pane').remove()
|
||||
$('#tabs-style').remove()
|
||||
hideTabs: ->
|
||||
$('#tabs').parents('.pane').remove()
|
||||
$('#tabs-style').remove()
|
||||
|
||||
addTab = ->
|
||||
$('#tabs ul .add').before '<li><a href="#">untitled</a></li>'
|
||||
$('#tabs ul .active').removeClass()
|
||||
$('#tabs ul .add').prev().addClass 'active'
|
||||
addTab: ->
|
||||
$('#tabs ul .add').before '<li><a href="#">untitled</a></li>'
|
||||
$('#tabs ul .active').removeClass()
|
||||
$('#tabs ul .add').prev().addClass 'active'
|
||||
|
||||
switchToTab = (tab) ->
|
||||
$('#tabs ul .active').removeClass()
|
||||
$(tab).parents('li').addClass 'active'
|
||||
|
||||
|
||||
exports.show = exports.showTabs = showTabs
|
||||
exports.hideTabs = hideTabs
|
||||
exports.addTab = addTab
|
||||
exports.switchToTab = switchToTab
|
||||
switchToTab: (tab) ->
|
||||
$('#tabs ul .active').removeClass()
|
||||
$(tab).parents('li').addClass 'active'
|
||||
Reference in New Issue
Block a user