| Author | Dave Jarvis <email> |
|---|---|
| Date | 2014-12-31 19:05:02 GMT-0800 |
| Commit | c7ff679f2915fb1a956582a3da184d520d1a071a |
| Parent | b99bf5d |
| $.fn.millerColumns = function( options ) { | ||
| var defaults = { | ||
| - selection: function( $item ) {}, | ||
| + current: function( $item ) {}, | ||
| breadcrumb: breadcrumb, | ||
| animation: animation, | ||
| settings.animation.call( this, $columns, $(this) ); | ||
| settings.breadcrumb.call( this ); | ||
| - settings.selection.call( this, $(this) ); | ||
| + settings.current.call( this, $(this) ); | ||
| // Don't allow the underlying DIV to receive the click event. | ||
| $(".column > .selected").removeClass( "selected" ); | ||
| breadcrumb(); | ||
| + settings.current( undefined ); | ||
| } | ||
| keypress = function( event ) { | ||
| + // Was an attempt made to move the currently selected item (the cursor)? | ||
| var moved = false; | ||
| var $child = current().data( "child" ); | ||
| - if( $child !== undefined ) { | ||
| - $child.children().first().click(); | ||
| - } | ||
| - else { | ||
| - moveD(); | ||
| - } | ||
| + ($child === undefined) ? moveD() : $child.children().first().click(); | ||
| } | ||
| })(jQuery); | ||
| $(document).ready( function() { | ||
| $.getScript( "js/columns.js", function() { | ||
| + var $current; | ||
| + | ||
| $("div.columns").millerColumns({ | ||
| - selection: function( $item ) { | ||
| - console.log( $item.attr( "id" ) ); | ||
| + current: function( $item ) { | ||
| + $current = $item; | ||
| + } | ||
| + }); | ||
| + | ||
| + $("#new").on( "click", function( event ) { | ||
| + event.preventDefault(); | ||
| + | ||
| + if( $current !== undefined ) { | ||
| + console.log( "new child of: " + $current.attr( "id" ) ); | ||
| + } | ||
| + else { | ||
| + console.log( "new root sibling" ); | ||
| + } | ||
| + | ||
| + return false; | ||
| + }); | ||
| + | ||
| + $("#edit").on( "click", function( event ) { | ||
| + event.preventDefault(); | ||
| + | ||
| + if( $current !== undefined ) { | ||
| + console.log( "edit: " + $current.attr( "id" ) ); | ||
| + } | ||
| + | ||
| + return false; | ||
| + }); | ||
| + | ||
| + $("#del").on( "click", function( event ) { | ||
| + event.preventDefault(); | ||
| + | ||
| + if( $current !== undefined ) { | ||
| + console.log( "delete: " + $current.attr( "id" ) ); | ||
| + } | ||
| + | ||
| + return false; | ||
| + }); | ||
| + | ||
| + $("#flag").on( "click", function( event ) { | ||
| + event.preventDefault(); | ||
| + | ||
| + if( $current !== undefined ) { | ||
| + console.log( "flag: " + $current.attr( "id" ) ); | ||
| } | ||
| + | ||
| + return false; | ||
| }); | ||
| }); |
| </div> | ||
| <div class="toolbar"> | ||
| - <a href="do.xhtml?action=tag&command=new">new</a> | | ||
| - <a href="do.xhtml?action=tag&command=edit">edit</a> | | ||
| - <a href="do.xhtml?action=tag&command=delete">delete</a> | | ||
| - <a href="do.xhtml?action=tag&command=flag">flag</a> | ||
| + <a id="new" href="do.xhtml?action=tag&command=new">new</a> | | ||
| + <a id="edit" href="do.xhtml?action=tag&command=edit">edit</a> | | ||
| + <a id="del" href="do.xhtml?action=tag&command=delete">delete</a> | | ||
| + <a id="flag" href="do.xhtml?action=tag&command=flag">flag</a> | ||
| </div> | ||
| </div> |
| Delta | 56 lines added, 14 lines removed, 42-line increase |
|---|