added scafolding and seporated the jquery code...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-06-18 19:29:22 +04:00
parent 94d7438822
commit f6b62ad114
3 changed files with 99 additions and 52 deletions

View File

@ -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(<message-name>, <arguments> ...)
// - too singleton-ish
// - use a constructor and native methods...
// var ui = $(...).ImageGridUI(<options>)
// ui.method(<arguments>)
// - 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 **/

52
ui/jquery.ImageGrid.js Executable file
View File

@ -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(<message-name>, <arguments> ...)
// - too singleton-ish
// - use a constructor and native methods...
// var ui = $(...).ImageGridUI(<options>)
// ui.method(<arguments>)
// - 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 :

47
ui/jquery.ImageGrid.scafold.js Executable file
View File

@ -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 :