mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added scafolding and seporated the jquery code...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
94d7438822
commit
f6b62ad114
@ -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
52
ui/jquery.ImageGrid.js
Executable 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
47
ui/jquery.ImageGrid.scafold.js
Executable 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 :
|
||||
Loading…
x
Reference in New Issue
Block a user