switch to module.exports = style in tabs.coffee

This commit is contained in:
Chris Wanstrath
2011-09-04 00:29:06 -07:00
parent b0c09aab18
commit befc802ea1

View File

@@ -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'