diff --git a/ui/gallery-prototype.js b/ui/gallery-prototype.js index d359742a..6f3eceef 100755 --- a/ui/gallery-prototype.js +++ b/ui/gallery-prototype.js @@ -6,58 +6,6 @@ $(document).ready(setup); -/**************************************************** jQuery Plugin **/ -/* TODO: - * - basic functionality - * - setup / options - * - navigation - * - events - * - onPromote - * - onDemote - * - * This will do the folowing: - * - build the basic elemnt tree needed for the viewer - * we will need a seporate component to: - * - init the visual controls - * ImageGridUIButtons - * - init the keyboard controls - * ImageGridUIKeyboard - * - init the touch/swipe controls - * ImageGridUITouch - * - * the other components must be usable independently - * - * - * see: ImageGridUI.js for a generated scafold example... - */ -(function($){$.fn.ImageGridUI = function(options) { - // NOTE: this refers to the element this was ivoked on... - - var options = $.extend({ - // default options... - }, options) - - // XXX chose the method architecture... - // possible options: - // - use jQuery style message passing... - // $.ImageGridUI(, ...) - // - too singleton-ish - // - use a constructor and native methods... - // var ui = $(...).ImageGridUI() - // ui.method() - // - ui may be a collection... - // - need to query by ImageGridUI to get the objects again - // instead of re-constructing... - - - - // jQuery chainability... - // XXX do we use this or return construct and an ImageGridUI object instead? - return this -}})(jQuery) - - - /************************************************************ Setup **/ diff --git a/ui/jquery.ImageGrid.js b/ui/jquery.ImageGrid.js new file mode 100755 index 00000000..ab7d26ff --- /dev/null +++ b/ui/jquery.ImageGrid.js @@ -0,0 +1,52 @@ +/**************************************************** jQuery Plugin **/ +/* TODO: + * - basic functionality + * - setup / options + * - navigation + * - events + * - onPromote + * - onDemote + * + * This will do the folowing: + * - build the basic elemnt tree needed for the viewer + * we will need a seporate component to: + * - init the visual controls + * ImageGridUIButtons + * - init the keyboard controls + * ImageGridUIKeyboard + * - init the touch/swipe controls + * ImageGridUITouch + * + * the other components must be usable independently + * + * + * see: jquery.ImageGrid.scafold.js for a generated scafold example... + */ +(function($){$.fn.ImageGridUI = function(options) { + // NOTE: this refers to the element this was ivoked on... + + var options = $.extend({ + // default options... + }, options) + + // XXX chose the method architecture... + // possible options: + // - use jQuery style message passing... + // $.ImageGridUI(, ...) + // - too singleton-ish + // - use a constructor and native methods... + // var ui = $(...).ImageGridUI() + // ui.method() + // - ui may be a collection... + // - need to query by ImageGridUI to get the objects again + // instead of re-constructing... + + + + // jQuery chainability... + // XXX do we use this or return construct and an ImageGridUI object instead? + return this +}})(jQuery) + + +// vim:set ts=4 sw=4 nowrap : diff --git a/ui/jquery.ImageGrid.scafold.js b/ui/jquery.ImageGrid.scafold.js new file mode 100755 index 00000000..246caa55 --- /dev/null +++ b/ui/jquery.ImageGrid.scafold.js @@ -0,0 +1,47 @@ +(function($){ + $.ImageGridUI = function(el, options, options){ + // To avoid scope issues, use 'base' instead of 'this' + // to reference this class from internal events and functions. + var base = this; + + // Access to jQuery and DOM versions of element + base.$el = $(el); + base.el = el; + + // Add a reverse reference to the DOM object + base.$el.data("ImageGridUI", base); + + base.init = function(){ + + base.options = $.extend({},$.ImageGridUI.defaultOptions, options); + + // Put your initialization code here + }; + + // Sample Function, Uncomment to use + // base.functionName = function(paramaters){ + // + // }; + + // Run initializer + base.init(); + }; + + $.ImageGridUI.defaultOptions = { + }; + + $.fn.imageGridUI = function(options, options){ + return this.each(function(){ + (new $.ImageGridUI(this, options, options)); + }); + }; + + // This function breaks the chain, but returns + // the ImageGridUI if it has been attached to the object. + $.fn.getImageGridUI = function(){ + this.data("ImageGridUI"); + }; + +})(jQuery); + +// vim:set ts=4 sw=4 nowrap :