r2379 - /branches/dev/toolbar: added Jason Iles toolbar from http://daersystems.com/jquery/toolbars/
Author: rdworth
Date: Wed Mar 25 05:12:20 2009
New Revision: 2379
Added:
branches/dev/toolbar/demos/toolbar/
branches/dev/toolbar/demos/toolbar/default.html (contents, props
changed)
branches/dev/toolbar/demos/toolbar/index.html (contents, props changed)
branches/dev/toolbar/tests/static/toolbar/
branches/dev/toolbar/tests/static/toolbar/default.html (contents,
props changed)
branches/dev/toolbar/tests/unit/toolbar/
branches/dev/toolbar/tests/unit/toolbar/toolbar.html (contents, props
changed)
branches/dev/toolbar/tests/unit/toolbar/toolbar_core.js (contents,
props changed)
branches/dev/toolbar/tests/unit/toolbar/toolbar_defaults.js (contents,
props changed)
branches/dev/toolbar/tests/unit/toolbar/toolbar_events.js (contents,
props changed)
branches/dev/toolbar/tests/unit/toolbar/toolbar_methods.js (contents,
props changed)
branches/dev/toolbar/tests/unit/toolbar/toolbar_options.js (contents,
props changed)
branches/dev/toolbar/tests/unit/toolbar/toolbar_tickets.js (contents,
props changed)
branches/dev/toolbar/tests/visual/toolbar/
branches/dev/toolbar/tests/visual/toolbar/default.html (contents,
props changed)
branches/dev/toolbar/themes/base/ui.toolbar.css (contents, props
changed)
branches/dev/toolbar/ui/ui.toolbar.js
Modified:
branches/dev/toolbar/AUTHORS.txt
branches/dev/toolbar/build/build.xml
branches/dev/toolbar/demos/index.html
branches/dev/toolbar/themes/base/ui.base.css
Log:
/branches/dev/toolbar: added Jason Iles toolbar from
http://daersystems.com/jquery/toolbars/
Modified: branches/dev/toolbar/AUTHORS.txt
==============================================================================
--- branches/dev/toolbar/AUTHORS.txt (original)
+++ branches/dev/toolbar/AUTHORS.txt Wed Mar 25 05:12:20 2009
@@ -17,6 +17,7 @@
Scott González
Marc Grabanski (m@marcgrabanski.com)
Klaus Hartl (stilbuero.de)
+Jason Iles
Scott Jehl
Cody Lindley
Eduardo Lundgren (eduardolundgren@gmail.com)
Modified: branches/dev/toolbar/build/build.xml
==============================================================================
--- branches/dev/toolbar/build/build.xml (original)
+++ branches/dev/toolbar/build/build.xml Wed Mar 25 05:12:20 2009
@@ -204,6 +204,7 @@
<get src="${url}Progressbar" dest="${docs.dir}progressbar.html" />
<get src="${url}Slider" dest="${docs.dir}slider.html" />
<get src="${url}Tabs" dest="${docs.dir}tabs.html" />
+ <get src="${url}Toolbar" dest="${docs.dir}toolbar.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/animate"
dest="${docs.dir}animate.html" />
<get src="http://docs.jquery.com/action/render/UI/Effects/addClass"
dest="${docs.dir}addClass.html" />
Modified: branches/dev/toolbar/demos/index.html
==============================================================================
--- branches/dev/toolbar/demos/index.html (original)
+++ branches/dev/toolbar/demos/index.html Wed Mar 25 05:12:20 2009
@@ -19,6 +19,7 @@
<script type="text/javascript" src="../ui/ui.slider.js"></script>
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
+ <script type="text/javascript" src="../ui/ui.toolbar.js"></script>
<script type="text/javascript" src="../ui/effects.core.js"></script>
<script type="text/javascript" src="../ui/effects.blind.js"></script>
<script type="text/javascript" src="../ui/effects.bounce.js"></script>
@@ -249,6 +250,7 @@
<dd><a href="progressbar/index.html">Progressbar</a></dd>
<dd><a href="slider/index.html">Slider</a></dd>
<dd><a href="tabs/index.html">Tabs</a></dd>
+ <dd><a href="toolbar/index.html">Toolbar</a></dd>
<dt>Effects</dt>
<dd><a href="addClass/index.html">Add Class</a></dd>
<dd><a href="removeClass/index.html">Remove Class</a></dd>
Added: branches/dev/toolbar/demos/toolbar/default.html
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/demos/toolbar/default.html Wed Mar 25 05:12:20 2009
@@ -0,0 +1,32 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Toolbar - Default functionality</title>
+ <link type="text/css" href="../../themes/base/ui.all.css"
rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.3.2.js"></script>
+ <script type="text/javascript" src="../../ui/ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/ui.toolbar.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $("#toolbar").toolbar();
+ });
+ </script>
+</head>
+<body>
+
+<div class="demo">
+
+<div id="toolbar">
+</div>
+
+</div><!-- End demo -->
+
+<div class="demo-description">
+
+( ... demo description ... )
+
+</div><!-- End demo-description -->
+
+</body>
+</html>
Added: branches/dev/toolbar/demos/toolbar/index.html
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/demos/toolbar/index.html Wed Mar 25 05:12:20 2009
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Toolbar Demos</title>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+</head>
+<body>
+ <div class="demos-nav">
+ <h4>Examples</h4>
+ <ul>
+ <li class="demo-config-on"><a href="default.html">Default
functionality</a></li>
+ </ul>
+ </div>
+</body>
+</html>
Added: branches/dev/toolbar/tests/static/toolbar/default.html
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/static/toolbar/default.html Wed Mar 25
05:12:20 2009
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+<head>
+ <title>Toolbar Static Test : Default</title>
+ <link rel="stylesheet" href="../static.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/ui.base.css"
type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/ui.theme.css"
type="text/css" title="ui-theme" />
+ <script type="text/javascript" src="../../../jquery-1.3.2.js"></script>
+ <script type="text/javascript" src="../static.js"></script>
+</head>
+<body>
+
+<div class="ui-toolbar">
+</div>
+
+</body>
+</html>
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar.html
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar.html Wed Mar 25
05:12:20 2009
@@ -0,0 +1,29 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>jQuery UI Toolbar Test Suite</title>
+
+ <script type="text/javascript" src="../../../jquery-1.3.2.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.toolbar.js"></script>
+
+ <link type="text/css" href="../testsuite.css" rel="stylesheet" />
+ <script type="text/javascript" src="../testsuite.js"></script>
+ <script type="text/javascript"
src="../../../external/qunit/testrunner.js"></script>
+ <script type="text/javascript"
src="../../../external/simulate/jquery.simulate.js"></script>
+
+ <script type="text/javascript" src="toolbar_core.js"></script>
+ <script type="text/javascript" src="toolbar_defaults.js"></script>
+ <script type="text/javascript" src="toolbar_events.js"></script>
+ <script type="text/javascript" src="toolbar_methods.js"></script>
+ <script type="text/javascript" src="toolbar_options.js"></script>
+ <script type="text/javascript" src="toolbar_tickets.js"></script>
+</head>
+<body>
+
+<div id="main">
+ <div id="toolbar"></div>
+</div>
+
+</body>
+</html>
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar_core.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar_core.js Wed Mar 25
05:12:20 2009
@@ -0,0 +1,13 @@
+/*
+ * toolbar_core.js
+ */
+
+var el;
+
+(function($) {
+
+module("toolbar: core");
+
+
+
+})(jQuery);
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar_defaults.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar_defaults.js Wed Mar 25
05:12:20 2009
@@ -0,0 +1,9 @@
+/*
+ * toolbar_defaults.js
+ */
+
+var toolbar_defaults = {
+ disabled: false
+};
+
+commonWidgetTests('toolbar', { defaults: toolbar_defaults });
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar_events.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar_events.js Wed Mar 25
05:12:20 2009
@@ -0,0 +1,10 @@
+/*
+ * toolbar_events.js
+ */
+(function($) {
+
+module("toolbar: events");
+
+
+
+})(jQuery);
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar_methods.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar_methods.js Wed Mar 25
05:12:20 2009
@@ -0,0 +1,24 @@
+/*
+ * toolbar_methods.js
+ */
+(function($) {
+
+module("toolbar: methods");
+
+test("init", function() {
+ expect(1);
+
+ $("<div></div>").appendTo('body').toolbar().remove();
+ ok(true, '.toolbar() called on element');
+
+});
+
+test("destroy", function() {
+ expect(1);
+
+ $("<div></div>").appendTo('body').toolbar().toolbar("destroy").remove();
+ ok(true, '.toolbar("destroy") called on element');
+
+});
+
+})(jQuery);
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar_options.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar_options.js Wed Mar 25
05:12:20 2009
@@ -0,0 +1,10 @@
+/*
+ * toolbar_options.js
+ */
+(function($) {
+
+module("toolbar: options");
+
+
+
+})(jQuery);
Added: branches/dev/toolbar/tests/unit/toolbar/toolbar_tickets.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/unit/toolbar/toolbar_tickets.js Wed Mar 25
05:12:20 2009
@@ -0,0 +1,10 @@
+/*
+ * toolbar_tickets.js
+ */
+(function($) {
+
+module("toolbar: tickets");
+
+
+
+})(jQuery);
Added: branches/dev/toolbar/tests/visual/toolbar/default.html
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/tests/visual/toolbar/default.html Wed Mar 25
05:12:20 2009
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <title>Accordion Toolbar Test : Default</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/ui.all.css"
type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.3.2.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/ui.toolbar.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $("#toolbar").toolbar();
+ })
+ </script>
+</head>
+<body>
+
+<div id="toolbar">
+</div>
+
+</body>
+</html>
Modified: branches/dev/toolbar/themes/base/ui.base.css
==============================================================================
--- branches/dev/toolbar/themes/base/ui.base.css (original)
+++ branches/dev/toolbar/themes/base/ui.base.css Wed Mar 25 05:12:20 2009
@@ -7,3 +7,4 @@
@import url("ui.resizable.css");
@import url("ui.slider.css");
@import url("ui.tabs.css");
+@import url("ui.toolbar.css");
Added: branches/dev/toolbar/themes/base/ui.toolbar.css
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/themes/base/ui.toolbar.css Wed Mar 25 05:12:20 2009
@@ -0,0 +1,49 @@
+/* Toolbar
+----------------------------------*/
+.ui-toolbars {
+ padding : .2em;
+}
+
+.ui-toolbar, .ui-toolbar-rtl {
+ margin : 0 .2em .2em 0;
+ padding : .2em;
+ list-style : none;
+}
+
+.ui-toolbar-item {
+ margin : 0 .1em;
+ padding : .2em;
+ cursor : pointer;
+}
+
+.ui-toolbar-divider {
+ margin : 0 .3em;
+}
+
+.ui-toolbar-item {
+
+}
+
+.ui-toolbar-icon {
+
+}
+
+.ui-toolbar-draggable {
+ cursor : move;
+}
+
+.ui-toolbar-draggable-disabled {
+ cursor : auto;
+}
+
+.ui-toolbar, .ui-toolbar-item, .ui-toolbar-icon, .ui-toolbar-draggable, .ui-toolbar-divider, .ui-toolbar .ui-state-highlight
{
+ float : left;
+}
+
+.ui-toolbar-icon-rt {
+ float : right;
+}
+
+.ui-toolbar-rtl, .ui-toolbar-rtl .ui-toolbar-item, .ui-toolbar-rtl .ui-toolbar-icon, .ui-toolbar-rtl .ui-toolbar-draggable, .ui-toolbar-rtl .ui-toolbar-divider, .ui-toolbar-rtl .ui-state-highlight
{
+ float : right;
+}
Added: branches/dev/toolbar/ui/ui.toolbar.js
==============================================================================
--- (empty file)
+++ branches/dev/toolbar/ui/ui.toolbar.js Wed Mar 25 05:12:20 2009
@@ -0,0 +1,685 @@
+/*
+ * jQuery UI Toolbar @VERSION
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://wiki.jqueryui.com/Toolbar
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function($) {
+
+$.widget("ui.tabs", {
+
+ _init: function() {
+ if (this.options.deselectable !== undefined) {
+ this.options.collapsible = this.options.deselectable;
+ }
+ this._tabify(true);
+ },
+
+ _setData: function(key, value) {
+ if (key == 'selected') {
+ if (this.options.collapsible && value == this.options.selected) {
+ return;
+ }
+ this.select(value);
+ }
+ else {
+ this.options[key] = value;
+ if (key == 'deselectable') {
+ this.options.collapsible = value;
+ }
+ this._tabify();
+ }
+ },
+
+ _tabId: function(a) {
+ return a.title &&
a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
+ this.options.idPrefix + $.data(a);
+ },
+
+ _sanitizeSelector: function(hash) {
+ return hash.replace(/:/g, '\\:'); // we need this because an id may
contain a ":"
+ },
+
+ _cookie: function() {
+ var cookie = this.cookie || (this.cookie = this.options.cookie.name |
| 'ui-tabs-' + $.data(this.list[0]));
+ return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
+ },
+
+ _ui: function(tab, panel) {
+ return {
+ tab: tab,
+ panel: panel,
+ index: this.anchors.index(tab)
+ };
+ },
+
+ _cleanup: function() {
+ // restore all former loading tabs labels
+
this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
+ .find('span:data(label.tabs)')
+ .each(function() {
+ var el = $(this);
+ el.html(el.data('label.tabs')).removeData('label.tabs');
+ });
+ },
+
+ _tabify: function(init) {
+
+ this.list = this.element.children('ul:first');
+ this.lis = $('li:has(a[href])', this.list);
+ this.anchors = this.lis.map(function() { return $('a', this)[0]; });
+ this.panels = $([]);
+
+ var self = this, o = this.options;
+
+ var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
+ this.anchors.each(function(i, a) {
+ var href = $(a).attr('href');
+
+ // For dynamically created HTML that contains a hash as href IE < 8
expands
+ // such href to the full page url with hash and then misinterprets tab
as ajax.
+ // Same consideration applies for an added tab with a fragment
identifier
+ // since a[href=#fragment-identifier] does unexpectedly not match.
+ // Thus normalize href attribute...
+ var hrefBase = href.split('#')[0], baseEl;
+ if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
+ (baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
+ href = a.hash;
+ a.href = href;
+ }
+
+ // inline tab
+ if (fragmentId.test(href)) {
+ self.panels = self.panels.add(self._sanitizeSelector(href));
+ }
+
+ // remote tab
+ else if (href != '#') { // prevent loading the page itself if href is
just "#"
+ $.data(a, 'href.tabs', href); // required for restore on destroy
+
+ // TODO until #3808 is fixed strip fragment identifier from url
+ // (IE fails to load from such url)
+ $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data
+
+ var id = self._tabId(a);
+ a.href = '#' + id;
+ var $panel = $('#' + id);
+ if (!$panel.length) {
+ $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel
ui-widget-content ui-corner-bottom')
+ .insertAfter(self.panels[i - 1] || self.list);
+ $panel.data('destroy.tabs', true);
+ }
+ self.panels = self.panels.add($panel);
+ }
+
+ // invalid tab href
+ else {
+ o.disabled.push(i);
+ }
+ });
+
+ // initialization from scratch
+ if (init) {
+
+ // attach necessary classes for styling
+ this.element.addClass('ui-tabs ui-widget ui-widget-content
ui-corner-all');
+ this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix
ui-widget-header ui-corner-all');
+ this.lis.addClass('ui-state-default ui-corner-top');
+ this.panels.addClass('ui-tabs-panel ui-widget-content
ui-corner-bottom');
+
+ // Selected tab
+ // use "selected" option or try to retrieve:
+ // 1. from fragment identifier in url
+ // 2. from cookie
+ // 3. from selected class attribute on <li>
+ if (o.selected === undefined) {
+ if (location.hash) {
+ this.anchors.each(function(i, a) {
+ if (a.hash == location.hash) {
+ o.selected = i;
+ return false; // break
+ }
+ });
+ }
+ if (typeof o.selected != 'number' && o.cookie) {
+ o.selected = parseInt(self._cookie(), 10);
+ }
+ if (typeof o.selected != 'number' &&
this.lis.filter('.ui-tabs-selected').length) {
+ o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
+ }
+ o.selected = o.selected || 0;
+ }
+ else if (o.selected === null) { // usage of null is deprecated, TODO
remove in next release
+ o.selected = -1;
+ }
+
+ // sanity check - default to first tab...
+ o.selected = ((o.selected >= 0 && this.anchors[o.selected]) ||
o.selected < 0) ? o.selected : 0;
+
+ // Take disabling tabs via class attribute from HTML
+ // into account and update option properly.
+ // A selected tab cannot become disabled.
+ o.disabled = $.unique(o.disabled.concat(
+ $.map(this.lis.filter('.ui-state-disabled'),
+ function(n, i) { return self.lis.index(n); } )
+ )).sort();
+
+ if ($.inArray(o.selected, o.disabled) != -1) {
+ o.disabled.splice($.inArray(o.selected, o.disabled), 1);
+ }
+
+ // highlight selected tab
+ this.panels.addClass('ui-tabs-hide');
+ this.lis.removeClass('ui-tabs-selected ui-state-active');
+ if (o.selected >= 0 && this.anchors.length) { // check for length
avoids error when initializing empty list
+ this.panels.eq(o.selected).removeClass('ui-tabs-hide');
+ this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');
+
+ // seems to be expected behavior that the show callback is fired
+ self.element.queue("tabs", function() {
+ self._trigger('show', null, self._ui(self.anchors[o.selected],
self.panels[o.selected]));
+ });
+
+ this.load(o.selected);
+ }
+
+ // clean up to avoid memory leaks in certain versions of IE 6
+ $(window).bind('unload', function() {
+ self.lis.add(self.anchors).unbind('.tabs');
+ self.lis = self.anchors = self.panels = null;
+ });
+
+ }
+ // update selected after add/remove
+ else {
+ o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
+ }
+
+ // update collapsible
+
this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');
+
+ // set or update cookie after init and add/remove respectively
+ if (o.cookie) {
+ this._cookie(o.selected, o.cookie);
+ }
+
+ &n