From c447cb91ddcb955d6470881ca64f91d02ea093d4 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Fri, 26 Aug 2011 17:05:35 -0700 Subject: [PATCH] Tabs --- HTML/css/tabs.css | 86 -------------------------------- HTML/lib/tabs.coffee | 59 ++++++++++++---------- HTML/tabs.html | 115 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 127 insertions(+), 133 deletions(-) delete mode 100644 HTML/css/tabs.css diff --git a/HTML/css/tabs.css b/HTML/css/tabs.css deleted file mode 100644 index b27102e4e..000000000 --- a/HTML/css/tabs.css +++ /dev/null @@ -1,86 +0,0 @@ -* { 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%; -} \ No newline at end of file diff --git a/HTML/lib/tabs.coffee b/HTML/lib/tabs.coffee index 7c046cda5..f71c433ec 100644 --- a/HTML/lib/tabs.coffee +++ b/HTML/lib/tabs.coffee @@ -1,38 +1,43 @@ -# {$} = require 'jQuery' -# {Chrome} = require 'lib/osx' +{Chrome, File, Dir, Process} = require 'lib/osx' -# awesome hover effect -if false - $('#tabs ul li:not(".active") a').mousemove (e) -> - originalBG = $(this).css("background-color") - x = e.pageX - @offsetLeft - y = e.pageY - @offsetTop - xy = x + " " + y +exports.show = -> + root = OSX.NSBundle.mainBundle.resourcePath + '/HTML/' + html = OSX.NSString.stringWithContentsOfFile "#{root}/tabs.html" - bgWebKit = "-webkit-gradient(radial, #{xy}, 0, #{xy}, 100, from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0.0))), #{originalBG}" + Chrome.addPane('main', html) - $(this).css background: bgWebKit + # awesome hover effect + if false + $('#tabs ul li:not(".active") a').mousemove (e) -> + originalBG = $(this).css("background-color") + x = e.pageX - @offsetLeft + y = e.pageY - @offsetTop + xy = x + " " + y - $('#tabs ul li:not(".active") a').mouseleave (e) -> - $(this).removeAttr 'style' + bgWebKit = "-webkit-gradient(radial, #{xy}, 0, #{xy}, 100, from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0.0))), #{originalBG}" -# events -$('#tabs ul li:not(.add) a').live 'click', -> - $('#tabs ul .active').removeClass() - $(this).parents('li').addClass 'active' + $(this).css background: bgWebKit - idx = $('#tabs ul a').index this - $('.content iframe').hide().eq(idx).show().focus() + $('#tabs ul li:not(".active") a').mouseleave (e) -> + $(this).removeAttr 'style' - false + # events + $('#tabs ul li:not(.add) a').live 'click', -> + $('#tabs ul .active').removeClass() + $(this).parents('li').addClass 'active' -$('#tabs .add a').click -> - $('#tabs ul .active').removeClass() - $('#tabs ul .add').before '
  • untitled
  • ' + idx = $('#tabs ul a').index this + $('.content iframe').hide().eq(idx).show().focus() - $('.content iframe').hide() - $('.content').append '' + false - $('#tabs ul .add').prev().addClass 'active' + $('#tabs .add a').click -> + $('#tabs ul .active').removeClass() + $('#tabs ul .add').before '
  • untitled
  • ' - false \ No newline at end of file + $('.content iframe').hide() + $('.content').append '' + + $('#tabs ul .add').prev().addClass 'active' + + false diff --git a/HTML/tabs.html b/HTML/tabs.html index de99ea5f3..14fa2de42 100644 --- a/HTML/tabs.html +++ b/HTML/tabs.html @@ -1,24 +1,99 @@ - - - - - + + +
    + +
    + +
    + +