diff --git a/extensions/tabs/tabs-pane.coffee b/extensions/tabs/tabs-pane.coffee
index a4e8d3b13..1f17df8bf 100644
--- a/extensions/tabs/tabs-pane.coffee
+++ b/extensions/tabs/tabs-pane.coffee
@@ -2,6 +2,7 @@ $ = require 'jquery'
_ = require 'underscore'
Pane = require 'pane'
+Browser = require 'browser'
module.exports =
class TabsPane extends Pane
@@ -30,19 +31,24 @@ class TabsPane extends Pane
switchToTab: (tab) ->
tab = $("#tabs ul li").get(tab - 1) if _.isNumber tab
return if tab.length is 0
- return if $(tab).is "#tabs ul .active"
+ return if $(tab).is ".active"
path = $(tab).data 'path'
$("#tabs ul .active").removeClass("active")
$(tab).addClass 'active'
- window.editor.focusBuffer path
+ window.open path
addTab: (path) ->
existing = $("#tabs [data-path='#{path}']")
- if existing.length
- return @switchToTab existing
+ return @switchToTab existing if existing.length
+
+ name = if not path
+ "untitled"
+ else if Browser.isPathUrl path
+ path.match(/(\w+:\/\/)([^\/]+)?/)[2]
+ else
+ _.last path.split '/'
- name = if path then _.last path.split '/' else "untitled"
$("#tabs ul .active").removeClass()
$("#tabs ul").append """
"
- el.addClass "pane " + @position
- el.append @html
+ @pane = $ "
"
+ @pane.addClass "pane " + @position
+ @pane.append @html
switch @position
when 'main'
- $('.main').replaceWith el
+ # ICK: There can be multiple 'main' panes, but only one can be active
+ # at at time.
+ $('#main-container').children().css 'display', 'none !important'
+ $('#main-container').append @pane
when 'top'
- verticalDiv.prepend el
+ verticalDiv.prepend @pane
when 'left'
- horizontalDiv.prepend el
+ horizontalDiv.prepend @pane
when 'bottom'
- verticalDiv.append el
+ verticalDiv.append @pane
when 'right'
- horizontalDiv.append el
+ horizontalDiv.append @pane
else
throw "I DON'T KNOW HOW TO DEAL WITH #{@position}"
+ showing: ->
+ @pane and not @pane.css('display').match /none/
+
show: ->
- @add this
- @showing = true
+ if @position == 'main'
+ $('#main-container').children().css 'display', 'none !important'
+
+ if not @pane then @add() else @pane.css 'display', '-webkit-box !important'
hide: ->
- @html.parent().detach()
- @showing = false
+ @pane.css 'display', 'none !important'
toggle: ->
- if @showing
+ if @showing()
@hide()
else
@show()
diff --git a/src/window.coffee b/src/window.coffee
index 5a2cde64b..078c380c9 100644
--- a/src/window.coffee
+++ b/src/window.coffee
@@ -1,3 +1,4 @@
+Browser = require 'browser'
Editor = require 'editor'
Extension = require 'extension'
Event = require 'event'
@@ -13,6 +14,8 @@ _ = require 'underscore'
windowAdditions =
editor: null
+ browser: null
+
extensions: {}
appRoot: OSX.NSBundle.mainBundle.resourcePath
@@ -23,10 +26,8 @@ windowAdditions =
@path = atomController.path
@setTitle _.last @path.split '/'
- @editor = if fs.isFile @path
- new Editor @path
- else
- new Editor
+ @editor = new Editor
+ @browser = new Browser
@loadExtensions()
@loadKeyBindings()