plugins/ (not working yet)

This commit is contained in:
Chris Wanstrath
2011-08-27 15:13:08 -07:00
parent cfdce83925
commit 9af38c8c53
11 changed files with 125 additions and 128 deletions

View File

@@ -0,0 +1,13 @@
$ = require 'jquery'
$ ->
dir = OSX.NSFileManager.defaultManager.currentDirectoryPath
$('#cwd').text(dir)
files = Dir.list(dir)
files = _.map files, (file) ->
listItems = _.map files, (file) ->
file = file.replace(dir, "")
"<li>#{file}</li>"
$('#files').append(listItems.join('\n'))

View File

@@ -0,0 +1,12 @@
ul {
margin: 0;
padding: 0;
}
li {
list-style-type: none;
}
li:hover {
background-color: grey;
}

View File

@@ -0,0 +1,2 @@
<div id='cwd'></div>
<ul id='files'></ul>

View File

@@ -0,0 +1 @@
require('./tabs').show()

32
plugins/tabs/tabs.coffee Normal file
View File

@@ -0,0 +1,32 @@
$ = require 'jquery'
{Chrome, File, Dir, Process} = require 'osx'
exports.show = ->
root = OSX.NSBundle.mainBundle.resourcePath + '/plugins/tabs'
tabs = OSX.NSString.stringWithContentsOfFile "#{root}/tabs.html"
console.log tabs
# edit = OSX.NSString.stringWithContentsOfFile "#{root}/editor.html"
Chrome.addPane 'main', 'derp'
# events
$('#tabs ul li:not(.add) a').live 'click', ->
$('#tabs ul .active').removeClass()
$(this).parents('li').addClass 'active'
idx = $('#tabs ul a').index this
$('.content iframe').hide().eq(idx).show().focus()
false
$('#tabs .add a').click ->
$('#tabs ul .active').removeClass()
$('#tabs ul .add').before '<li><a href="#">untitled</a></li>'
$('.content iframe').hide()
$('.content').append '<iframe src="editor.html" width="100%" height="100%"></iframe>'
$('#tabs ul .add').prev().addClass 'active'
false

86
plugins/tabs/tabs.css Normal file
View File

@@ -0,0 +1,86 @@
* { margin: 0; padding: 0; }
body {
font: 12px "Lucida Grande", Helvetica, Arial, serif;
overflow: hidden;
}
iframe { border: 0; }
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
#tabs {
background: -webkit-gradient(linear, left top, left bottom, from(#EEEEEE), to(#D8D7D8));
padding: 3px 0 0 0;
}
#tabs .add a {
width: 12px;
height: 12px;
margin-top: 2px;
margin-left: 10px;
padding: 2px;
font-size: 15px;
font-weight: bold;
color: #fff;
text-shadow: #000 1px 1px 0;
background: #d8d7d8;
border: 1px solid #a0a0a0;
border-bottom: none;
-webkit-border-top-right-radius: 10px 5px;
-webkit-border-top-left-radius: 10px 5px;
-webkit-box-shadow: inset 0 1px 0 white;
}
#tabs .add span {
display: block;
margin-top: -4px;
}
#tabs ul {
list-style: none;
border-bottom: 1px solid #a0a0a0;
}
#tabs ul li { display: inline; }
#tabs ul li.active a {
position: relative;
z-index: 1;
height: 8px;
background: #eee;
padding-top: 4px;
}
#tabs ul li a {
display: block;
float: left;
text-decoration: none;
position: relative;
height: 8px;
padding: 3px 50px 7px;
margin: 0 -5px 0 0;
color: #222;
background: #d8d7d8;
-webkit-border-top-right-radius: 10px 20px;
-webkit-border-top-left-radius: 10px 20px;
-webkit-box-shadow: inset 1px 1px 0 white;
border: 1px solid #a0a0a0;
border-bottom: 0;
}
.content {
-webkit-box-shadow: inset 0 1px 0 white;
-moz-box-shadow: inset 0 1px 0 white;
height: 97%;
}

9
plugins/tabs/tabs.html Normal file
View File

@@ -0,0 +1,9 @@
<div id="tabs">
<ul class="clearfix">
<li class="active"><a href="#">untitled</a></li>
<li class="add"><a href="#"><span>+</span></a></li>
</ul>
</div>
<div class="content">
</div>