Permalink
Browse files

Source Clean-up

  • Loading branch information...
1 parent 08d8e1e commit 0456aae385487872adfd3ea7f9cdf443d825a771 @threedubmedia committed Jun 8, 2010
View
82 Blackbox/jquery.Blackbox.css
@@ -1,82 +0,0 @@
-.blkbx_wrap {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 999;
- }
-.blkbx_bg {
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- z-index: 1000;
- }
-.blkbx_cont {
- position: absolute;
- z-index: 1001;
- }
-/*** BG CLASSES ***/
-.blackBg {
- background: #000;
- filter:alpha(opacity=60);
- -moz-opacity: 0.6;
- opacity: 0.6;
- }
-.blueBg {
- background: #006;
- filter:alpha(opacity=60);
- -moz-opacity: 0.6;
- opacity: 0.6;
- }
-.redBg {
- background: #F00;
- filter:alpha(opacity=20);
- -moz-opacity: 0.2;
- opacity: 0.2;
- }
-.clearBg {
- background: #FFF;
- filter:alpha(opacity=0);
- -moz-opacity: 0;
- opacity: 0;
- }
-.patternBg {
- background: #000;
- filter:alpha(opacity=20);
- -moz-opacity: 0.2;
- opacity: 0.2;
- }
-/*** BOX CLASSES ***/
-.whiteBox {
- border: 4px solid #333;
- background: #FFF;
- text-align: center;
- padding: 10px;
- margin: 20px 0;
- }
-.photoFrame {
- border: 4px solid #FFF;
- background: #000;
- padding: 0;
- margin: 0;
- text-align: center;
- }
- .photoFrame div.lnks {
- background: #FFF;
- text-align: right;
- }
-/*** OTHER CLASSES ***/
-.bbxActive {font-weight: bold;}
-.bbxLoader {
- position: absolute;
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- background: #000 url("loading.gif") no-repeat center center;
- }
-.loading {
- height: 200px;
- width: 300px;
- }
View
252 Blackbox/jquery.Blackbox.js
@@ -1,252 +0,0 @@
-(function($){ // secure the $ jQuery alias
-/*******************************************************************************************/
-// jQuery.Blackbox.js - rev 42
-// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
-// Liscensed under the MIT License (MIT-LICENSE.txt)
-// http://www.opensource.org/licenses/mit-license.php
-// Created: 2007-03-22 | Updated: 2008-05-19
-/*******************************************************************************************/
-// REQUIRES: jquery 1.2.3+, utils.js, jquery.Register.js (rev 16+)
-/*******************************************************************************************/
-var PLUGIN = "Blackbox", // Register the PLUGIN... and public methods...
-$reg = new $.Register( PLUGIN, "enable,disable,destroy,show,hide,size,align".split(',') );
-/*******************************************************************************************/
-// the jquery extension
-$.fn[ PLUGIN ] = function( arg ){
- if ( is.String( arg ) ){ // call a single public method
- var args = Slice( arguments, 1 );
- return this.each(function(){ $reg.call( this, arg, args ); });
- }
- // inherit default options
- var opts = $.extend( {}, $[ PLUGIN ].defaults, arg||{} );
- // convert some option values from a percentage to a decimal
- $.each(['width','height','opacity'],function(x,v){
- if (x=(/^(\d+)%$/i).exec(opts[v])) opts[v] = parseInt(x[1])/100;
- });
- // initialize the feature
- return this.each(function(){ new $[ PLUGIN ].create( this, opts ); });
- };
-/*******************************************************************************************/
-// default settings
-$[ PLUGIN ].defaults = {
- html: '<h1>Please wait...</h1>', // (string|function|element|jquery) box content to be appended
- onOpen: null, // (null|function) optional fn, return false to prevent, scope: source element, arg: box element
- onClose: null, // (null|function) optional fn, return false to prevent, scope: source element, arg: box element
- opacity: null, // (string|number) overrides the opacity in bgCss
- background: null, // (string|number) overrides the background in bgCss
- wrapClass: '', // (string) optional "wrapper" classname
- wrapCss: {}, // (object) optional "wrapper" css
- bgClass: '', // (string) optional "background" classname
- bgCss: {}, // (object) optional "background" css
- boxClass: '', // (string) optional "display box" classname
- boxCss: {}, // (object) optional "display box" css
- height: 'auto', // (string|number) overrides the height in boxCss
- width: 'auto', // (string|number) overrides the width in boxCss
- top: 'center', // (string|number) overrides the top in boxCss
- left: 'center', // (string|number) overrides the left in boxCss
- isolate: false, // (boolean) true: only this one overlay visible at a time
- keepHtml: true, // (boolean) false: re-create the box content on every "show"
- emptyBox: true, // (boolean) remove all box content before (re)filling
- autoZindex: true, // (boolean) true: automatically manage the z-index
- showEvent: "click", // (string|false) which event on the element triggers "show", false to prevent
- bgClose: "click" // (string|false) which event on the bg div triggers "hide", false to prevent
- };
-var base_z_index = 999; // @private var // but customize as needed
-/*******************************************************************************************/
-// constructor
-$[ PLUGIN ].create = function( el, opts ){
- var self = $reg.add( el, this, { el:el, opts:opts }); // register the instance, store args
- self.size( opts.width, opts.height ); // store size
- self.align( opts.left, opts.top ); // store alignment
- if ( opts.showEvent ) // bind the element show event
- $( el ).bind( opts.showEvent+self.NS, function(){
- var html = self.ready && self.opts.keepHtml ? null : self.opts.html;
- if (!self.disabled) return self.show( html );
- });
- this.Publish( "create" ); // "create.PLUGIN"
- };
-/*******************************************************************************************/
-// methods
-$[ PLUGIN ].create.prototype = {
- init: function(){ var self = this;
- // create the overlay markup
- self.$bg = $(dv).addClass(self.opts.bgClass)
- .css( $.extend({position:'absolute',width:'100%',height:'100%',top:0,left:0}, self.opts.bgCss||{}) );
- self.$bx = $(dv).addClass(self.opts.boxClass)
- .css( $.extend({position:'absolute'},self.opts.boxCss||{}) );
- self.$wrap = $(dv).addClass(self.opts.wrapClass)
- .css( $.extend({position:'absolute',top:0,left:0},self.opts.wrapCss||{}) )
- .append( self.$bg ).append( self.$bx ).hide();
- try { self.$wrap.bgiframe() } catch(err){ } // try "bgiframe"
- // optional opacity and background overrides
- if (!is.empty(self.opts.opacity)) self.$bg.css('opacity',self.opts.opacity);
- if (!is.empty(self.opts.background)) self.$bg.css('background',self.opts.background);
- // bind the bg close event
- if ( self.opts.bgClose ) self.$bg.bind( self.opts.bgClose+self.NS , function(){ self.hide(); });
- self.html = self.opts.html; // set the default html
- self.ready = true;
- },
- allow: function(fn){
- if (this.disabled) return false;
- if (is.Function(fn)) return (fn.call( this.el, this.$bx[0] )!==false);
- return true;
- },
- "show": function( html ){
- var self = this;
- if (!self.ready) self.init();
- html = html || self.html;
- if ( !bbx.isolate && self.allow(self.opts.onOpen) ){
- if ( html ){ // fill box content
- if ( self.opts.emptyBox ) self.$bx.empty();
- if ( is.Function(html) ) html = html.call( self.el, self.$bx[0] );
- if ( html===false ) return false;
- self.$bx.append( html ); // insert any html
- if (self.opts.keepHtml) self.html = false; // clear the html
- }
- if (self.opts.isolate) { // isolate this overlay
- $[ PLUGIN ]('hide'); // close everything
- if (bbx.opened.length==0) bbx.isolate = true; // everything is closed
- else return false; // something else is still open
- }
- var z = bbx.open( self );
- if (self.opts.autoZindex){ // manage z-index
- self.$wrap.css('z-index',z);
- self.$bg.css('z-index',z+1);
- self.$bx.css('z-index',z+2);
- }
- else bbx.z = parseInt($wrap.css('zIndex'))||base_z_index; // store this Z
- this.Publish( "show" ); // "show.PLUGIN"
- $(document.body).append( self.$wrap );
- self.$wrap.show();
- $(window).trigger( "resize." + PLUGIN );
- self.isOpen = true;
- self.size();
- }
- return false;
- },
- "hide": function(){ var self = this;
- if ( self.isOpen && self.allow(self.opts.onClose) ){
- bbx.close( self );
- if ( self.opts.isolate ) bbx.isolate = false;
- self.$wrap.hide();
- bbx.page();
- self.isOpen = false;
- this.Publish( "hide" ); // "hide.PLUGIN"
- }
- },
- "align": function( x, y ){ //console.log('align',x,y)
- this.x = is.defined(x) ? x : this.x;
- this.y = is.defined(y) ? y : this.y;
- if ( this.isOpen ){
- var self = this, xx = self.x, yy = self.y, tt, ll, scr,
- hh = self.$bx.outerHeight({margin:true}),
- ww = self.$bx.outerWidth({margin:true});
- bbx.page( ww, hh ); // adjusts page size
- self.$wrap.css({ // cover the page
- height: Math.max( WIN.h, BOD.h ), width: Math.max( BOD.w, WIN.w )
- });
- if ( xx=='center' ){ // horizontal center
- if ( ww > WIN.x ){ // box content overflow
- ll = self.$bx.offset()['left']; // current position
- scr = SCR.x - lastSCR.x; // scroll difference: right[+] / left[-]
- ll = ( scr>0 && ll+ww<SCR.x+WIN.w ) ? SCR.x+WIN.w-ww : // right edge
- ( scr<0 && ll>SCR.x ) ? SCR.x : Math.min( ll, SCR.x ); // left edge
- }
- else ll = Math.round( (WIN.w-ww)/2 )+SCR.x; // viewport center
- xx = Math.min( Math.max( ll, 0 ), BOD.w-ww ); // page limited position
- }
- if ( yy=='center' ){ // vertical center
- if ( hh > WIN.h ){ // box content overflow
- tt = self.$bx.offset()['top']; // current position
- scr = SCR.y-lastSCR.y; // scroll difference: down[+] / up[-]
- tt = ( scr>0 && tt+hh<SCR.y+WIN.h ) ? SCR.y+WIN.h-hh : // bottom edge
- ( scr<0 && tt>SCR.y ) ? SCR.y : Math.min( tt, SCR.y ); // top edge
- }
- else tt = Math.round( (WIN.h-hh)/2 )+SCR.y; // viewport center
- yy = Math.min( Math.max( tt, 0 ), BOD.h-hh ); // page limited position
- }
- self.$bx.css({ top: yy, left: xx }); // pos box
- }
- },
- "size": function( w, h ){ //console.log("size",w,h);
- this.w = is.defined(w) ? w : this.w;
- this.h = is.defined(h) ? h : this.h;
- if ( this.isOpen ){
- var self = this, ww, hh;
- self.$wrap.css({ // cover the page, gives content box layout
- height: Math.max( WIN.h, BOD.h ), width: Math.max( BOD.w, WIN.w )
- });
- // figure out box width
- ww = w || self.w || self.opts.boxCss.width;
- if (!ww || ww=='auto') ww = self.$bx.width('').width();
- self.$bx.width( ww<1 ? Math.round(WIN.w*ww) : ww );
- // figure out box height
- hh = h || self.h || self.opts.boxCss.height;
- if (!hh || hh=='auto') hh = self.$bx.height('').height();
- self.$bx.height( hh<1 ? Math.round(WIN.h*hh) : hh );
- self.align();
- }
- },
- "enable": function(){
- this.disabled = false;
- this.Publish( "enable" ); // "enable.PLUGIN"
- },
- "disable": function(){
- this.disabled = true;
- this.Publish( "disable" ); // "disable.PLUGIN"
- },
- "destroy": function(){
- $(window).unbind( this.NS ); // window events
- bbx.hide( this.el ); // unreg bbx
- $( this.el ).unbind( this.NS ); // remove "show" event
- this.$wrap.remove().empty(); // remove the markup
- this.Publish( "destroy" ); // "destroy.PLUGIN"
- $reg.drop( this ); // unregister
- }
- };
-/*******************************************************************************************/
-// store and update window props seperately
-var WIN = {}, SCR = {x:0,y:0}, lastSCR = {x:0,y:0}, BOD = {w:0,h:0}, trueBOD = {}, $bod;
-$(function(){ // doc.ready
- $bod = $(document.body);
- $(window)
- .bind( "resize."+PLUGIN, function(){ //console.log('WINDOW.SIZE',WIN)
- WIN = { w: $(this).width(), h: $(this).height() };
- bbx.page(); // recalculate the total page size
- bbx.each('size'); // "size" all open instances
- })
- .bind( "scroll."+PLUGIN, function(event){ //console.log('SCROLL.SIZE',SCR)
- lastSCR = SCR; // to compare scroll direction
- SCR = { x: $(this).scrollLeft(), y: $(this).scrollTop() };
- bbx.each('align'); // "align" all open instances
- });
- }); // doc.ready
-/*******************************************************************************************/
-// private helpers - manage open-ness and z-index and such
-var bbx = {
- z: base_z_index, opened: [],
- open: function( obj ){
- bbx.close( obj );
- bbx.opened.push( obj );
- return ( bbx.z+=3 );
- },
- close: function( obj ){
- bbx.opened = $.grep( bbx.opened, function(val){ return val.el!==obj.el; });
- if (bbx.opened.length==0) bbx.z = base_z_index;
- },
- each: function( meth ){
- $.each( bbx.opened, function(){ this[ meth ](); });
- },
- page: function( ww, hh ){
- if ( is.Number( ww, hh ) ){
- BOD = { w: Math.max( trueBOD.w, ww ), h: Math.max( trueBOD.h, hh ) };
- if ( BOD.w!=trueBOD.w ) $bod.width( BOD.w );
- if ( BOD.h!=trueBOD.h ) $bod.height( BOD.h );
- }
- else trueBOD = { w: $bod.width("").width(), h: $bod.height("").height() }; // to compare page sizes
- },
- isolate: false
- },
-dv = '<div></div>';
-/*******************************************************************************************/
-})(jQuery) // secure the $ jQuery alias
View
BIN Blackbox/loading.gif
Deleted file not rendered
View
BIN ColorPicker/bg_transparent.gif
Deleted file not rendered
View
BIN ColorPicker/colorArea.png
Deleted file not rendered
View
BIN ColorPicker/colorAreaMarker-b.gif
Deleted file not rendered
View
BIN ColorPicker/colorAreaMarker-w.gif
Deleted file not rendered
View
BIN ColorPicker/colorDisplay.png
Deleted file not rendered
View
BIN ColorPicker/colorPickerButtons.gif
Deleted file not rendered
View
BIN ColorPicker/colorWheel.png
Deleted file not rendered
View
BIN ColorPicker/colorWheelMarker.png
Deleted file not rendered
View
205 ColorPicker/jquery.ColorPicker.css
@@ -1,205 +0,0 @@
-/*** COLORPICKER STYLES ******************************************/
-
-.cpk_input {width: 100px;} /* hex */
-.cpk_span {
- margin: 0 0 0 1px;
- background: #FFF url("bg_transparent.gif") repeat 0px 0px;
- padding: 4px 0;
- }
-.cpk_swatch {
- padding: 1px 10px;
- border: 1px solid #808080;
- margin: 0;
- cursor: pointer;
- text-decoration: none;
- }
-.cpk_swatch:hover,
-.cpk_swatch:focus {
- border-color: #FFF;
- }
-.cpk_active {}
- .cpk_active .cpk_swatch {
- border-color: #FFF;
- }
-/*** THE COLOR PICKER MARKUP ********************************************************
-<div id="cpk_div">
- <div class="cpk_bg"></div>
- <div class="cpk_wheel">
- <div class="cpk_hue">
- <div class="cpk_hueBg"></div>
- <div class="cpk_hueFg"></div>
- </div>
- </div>
- <div class="cpk_orig">
- <div class="cpk_origBg"></div>
- <div class="cpk_origFg"></div>
- </div>
- <div class="cpk_curr">
- <div class="cpk_currBg"></div>
- <div class="cpk_currFg"></div>
- </div>
- <div class="cpk_lum"></div>
- <div class="cpk_sat"></div>
- <div class="cpk_area">
- <div class="cpk_bMarker"></div>
- </div>
- <a href="#AcceptColor" class="cpk_accept"> </a>
- <a href="#RejectColor" class="cpk_reject"> </a>
- </div>
-************************************************************************************/
-.cpk_div {
- display: block;
- position: absolute;
- z-index: 999;
- top: 0;
- left: 0;
- }
- .cpk_bg {
- height: 180px;
- width: 180px;
- position: absolute;
- background: url('colorWheel.png') no-repeat 0px 0px;
- z-index: 1000;
- }
- .cpk_wheel {
- height: 152px; /* hue circle inner diameter */
- width: 152px; /* diameter = 2 * Radius */
- padding: 14px; /* hue circle thickness (clickable range) */
- top: 0;
- left: 0;
- z-index: 1001;
- cursor: pointer;
- }
- .cpk_hue {
- position: absolute;
- height: 20px;
- width: 20px;
- top: 0; /* Set position at "12 O'Clock" : radius to follow is calculated from center of the wheel */
- left: 90px;
- z-index: 1004;
- }
- .cpk_hueBg {
- position: absolute;
- height: 14px;
- width: 14px;
- top: 3px;
- left: 3px;
- background: #F00;
- z-index: 1004;
- }
- .cpk_hueFg {
- position: absolute;
- height: 20px;
- width: 20px;
- top: 0;
- left: 0;
- background: url('colorWheelMarker.png') no-repeat 0px 0px;
- z-index: 1005;
- }
- .cpk_orig {
- position: absolute;
- width: 27px;
- height: 27px;
- top: 13px;
- left: 13px;
- z-index: 1002;
- }
- .cpk_origBg {
- position: absolute;
- width: 12px;
- height: 27px;
- left: 15px;
- top: 0;
- z-index: 1003;
- }
- .cpk_origFg {
- position: absolute;
- width: 27px;
- height: 27px;
- top: 0;
- left: 0;
- background: url('colorDisplay.png') no-repeat 0px 0px;
- z-index: 1003;
- }
- .cpk_curr {}
- .cpk_currBg {
- position: absolute;
- width: 15px;
- height: 27px;
- top: 0;
- left: 0;
- z-index: 1002;
- }
- .cpk_currFg {}
- .cpk_lum {
- position: absolute;
- width: 40px;
- height: 140px;
- top: 20px;
- left: 70px;
- cursor: n-resize;
- z-index: 1004;
- }
- .cpk_sat {
- position: absolute;
- width: 140px;
- height: 40px;
- top: 70px;
- left: 20px;
- cursor: e-resize;
- z-index: 1004;
- }
- .cpk_area {
- position: absolute;
- height: 100px;
- width: 100px;
- top: 40px;
- left: 40px;
- background: #F00 url('colorArea.png') no-repeat 0px 0px;
- cursor: crosshair;
- overflow: hidden;
- z-index: 1006;
- }
- .cpk_bMarker,
- .cpk_wMarker {
- position: absolute;
- height: 8px;
- width: 8px;
- top: 50px;
- left: 0;
- margin: -4px 0 0 -4px;
- background: url() no-repeat 0px 0px;
- z-index: 1007;
- }
- .cpk_bMarker {background-image: url('colorAreaMarker-b.gif');}
- .cpk_wMarker {background-image: url('colorAreaMarker-w.gif');} /* << Should take precedence in the cascade */
- .cpk_accept{
- display: block;
- position: absolute;
- width: 14px;
- height: 14px;
- top: 152px;
- left: 152px;
- background: url('colorPickerButtons.gif') no-repeat -14px 0px;
- z-index: 1002;
- cursor: pointer;
- }
- .cpk_accept:hover,
- .cpk_accept:focus{
- background-position: -14px -14px;
- }
- .cpk_reject{
- display:block;
- position: absolute;
- width: 14px;
- height: 14px;
- top: 152px;
- left: 14px;
- background: url('colorPickerButtons.gif') no-repeat 0px 0px;
- z-index: 1002;
- cursor: pointer;
- }
- .cpk_reject:hover,
- .cpk_reject:focus{
- background-position: 0 -14px;
- }
View
318 ColorPicker/jquery.ColorPicker.js
@@ -1,318 +0,0 @@
-(function($){ // confine scope
-/*******************************************************************************************/
-// jQuery.ColorPicker.js - rev 48
-// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
-// Liscensed under the MIT License (MIT-LICENSE.txt)
-// http://www.opensource.org/licenses/mit-license.php
-// Created: 2007-02-14 | Updated: 2008-05-19
-/*******************************************************************************************/
-// REQUIRES: jquery 1.2.3+, utils.js, jquery.Register.js (rev 16+), Color.js, jquery.alignTo.js
-/*******************************************************************************************/
-var PLUGIN = "ColorPicker", // Register the PLUGIN... and public methods...
-$reg = $.Register( PLUGIN, "enable,disable,destroy,value,show,hide".split(',') );
-/*******************************************************************************************/
-// jquery extension
-$.fn[ PLUGIN ] = function( opts ){
- if ( is.String( opts ) ){ // call a single public method
- var args = Slice( arguments, 1 );
- return this.each(function(){ $reg.call( this, opts, args ); });
- }
- // inherit defaults...
- opts = $.extend( {}, $[ PLUGIN ].defaults, opts||{} );
-
- // initialize the feature
- return this.each(function(){
- var type = $(this).is(':'+PLUGIN) || !$(this).is('input') ? false : $(this).attr('type');
- if ( type=='text' || type=='hidden' || type=='button' ){
- // try any metadata options...
- new $[ PLUGIN ].create( this, opts );
- }
- });
- };
-/*******************************************************************************************/
-// plugin defaults
-$[ PLUGIN ].defaults = {
- format: 'hex',
- color: '#000',
-// speed: null,
- insert: "after", // String "before" or "after"
- inputClass: "cpk_input",
- swatchClass: "cpk_swatch",
- spanClass: "cpk_span",
- activeClass: "cpk_active",
- onOpen: false, // optional function (position the picker) // false to prevent // scope: cpk_div
- onColor: false, // optional function // return a value to modify, false to prevent // scope: input, arg: Color Object
- // classnames used in the color picker mark-up
- pickerClass: "cpk_div",
- bgClass: "cpk_bg",
- wheelClass: "cpk_wheel",
- hueClass: "cpk_hue",
- hueBgClass: "cpk_hueBg",
- hueFgClass: "cpk_hueFg",
- origClass: "cpk_orig",
- origBgClass: "cpk_origBg",
- origFgClass: "cpk_origFg",
- currClass: "cpk_curr",
- currBgClass: "cpk_currBg",
- currFgClass: "cpk_currFg",
- lumClass: "cpk_lum",
- satClass: "cpk_sat",
- areaClass: "cpk_area",
- wMarkerClass: "cpk_wMarker",
- bMarkerClass: "cpk_bMarker",
- acceptClass: "cpk_accept",
- rejectClass: "cpk_reject"
- };
-/*******************************************************************************************/
-// plugin constructor
-$[ PLUGIN ].create = function( input, opts ){
- var self = $reg.add( input, this, { input:input, opts:opts }); // register the instance, store args
- // adjust some options...
- opts.format = (/rgb/i).test(opts.format) ? "rgb" : (/hsl/i).test(opts.format) ? "hsl" : "hex";
- // init some elements
- self.$input = $(input).addClass(opts.inputClass)
- .bind( "blur"+self.NS, function(){ self.value(this.value); });
- //.bond( "blur", self, 'value' );
- //self.$span = $('<span></span>').css("position","relative").addClass(opts.spanClass)
- self.$swatch = $('<input type="button" />').addClass(opts.swatchClass)//.appendTo( self.$span )
- [ (/after/i).test(opts.insert) ? "insertAfter" : "insertBefore" ]( self.$input )
- //.bind( "click"+self.NS, function(){ self.show(); });
- .bond( "click", self, 'show' );
- self.$bgs = $( self.$swatch );
- self.value( opts.color );
- };
-/*******************************************************************************************/
-// plugin methods
-$[ PLUGIN ].create.prototype = {
- init: function(){
- var o = this;
- // create the colorpicker mark-up and references
- o.$picker = $(div).addClass(o.opts.pickerClass).appendTo(document.body);
- o.$bg = $(div).addClass(o.opts.bgClass).appendTo(o.$picker);
- o.$wheel = $(div).addClass(o.opts.wheelClass).appendTo(o.$picker);
- o.$hue = $(div).addClass(o.opts.hueClass).appendTo(o.$wheel);
- o.$hueBG = $(div).addClass(o.opts.hueBgClass).appendTo(o.$hue);
- o.$hueFG = $(div).addClass(o.opts.hueFgClass).appendTo(o.$hue);
- o.$reset = $(div).addClass(o.opts.origClass).appendTo(o.$picker);
- o.$resetBG = $(div).addClass(o.opts.origBgClass).appendTo(o.$reset);
- o.$resetFG = $(div).addClass(o.opts.origFgClass).appendTo(o.$reset);
- o.$curr = $(div).addClass(o.opts.currClass).appendTo(o.$reset);
- o.$currBG = $(div).addClass(o.opts.currBgClass).appendTo(o.$reset);
- o.$currFG = $(div).addClass(o.opts.currFgClass).appendTo(o.$reset);
- o.$lum = $(div).addClass(o.opts.lumClass).appendTo(o.$picker);
- o.$sat = $(div).addClass(o.opts.satClass).appendTo(o.$picker);
- o.$area = $(div).addClass(o.opts.areaClass).appendTo(o.$picker);
- o.$xy = $(div).addClass(o.opts.bMarkerClass).appendTo(o.$area);
- o.$accept = $(div).addClass(o.opts.acceptClass).appendTo(o.$picker);
- o.$reject = $(div).addClass(o.opts.rejectClass).appendTo(o.$picker);
- o.$bgs = o.$bgs.add( o.$currBG ); // the background colors to update
- o.$bgHue = $( o.$area ).add( o.$hueBG ); // the background hues to update
- // make IE6 and lower happy, if possible
- try{ $('*',o.$picker).png(); } catch(ex){}
- try{ o.$picker.bgiframe(); } catch(ex){}
- // calculate/store the dimensions to do the math
- o.innerRadius = parseInt(o.$wheel.css('width'))/2;
- o.outerRadius = o.innerRadius+parseInt(o.$wheel.css('padding-top'));
- o.hueAdj = { x: o.$hue.width()/2, y: o.$hue.height()/2 };
- var x = o.$hue[0].offsetLeft - o.outerRadius + o.hueAdj.x;
- var y = o.$hue[0].offsetTop - o.outerRadius + o.hueAdj.y;
- o.radius = Math.sqrt( Math.pow(x,2) + Math.pow(y,2) ); // radius to follow
- o.areaScale = { x: o.$area.width()/100, y: o.$area.height()/100 };
- o.ready = true;
- //o.hide();
- },
- "value": function(c){
- var o = this, fmt = this.opts.format;
- if (!o.disabled){
- o.clr = Color( c || o.clr );
- var color = (is.Function(o.opts.onColor)) ? o.opts.onColor.call(o.$input[0],o.clr[fmt]) : null;
- if (color!==false){
- //clr = Color(color||clr); // makes picker choppy
- o.$input.val( color || o.clr[fmt] );
- o.$bgs.css('background-color',o.clr.html());
- if (o.ready && o.isOpen){
- o.$bgHue.css('background-color',o.clr.sat(100).lum(50).html());
- var angle = (o.clr.H/360)*2*Math.PI;
- o.$hue.css({ // hue marker
- left: Math.round(Math.sin(angle)*o.radius+o.outerRadius)-o.hueAdj.x,
- top: Math.round(-Math.cos(angle)*o.radius+o.outerRadius)-o.hueAdj.y
- });
- o.$xy.css({ // sat/lum marker
- left: Math.round(o.areaScale.x*(100-o.clr.S)),
- top: Math.round(o.areaScale.y*(100-o.clr.L))
- });
- var lim = (o.clr.H>45&&o.clr.H<75)?(33):(o.clr.H>210&&o.clr.H<280)?(66):(50);
- o.$xy[( o.clr.L<lim ? 'addClass' : 'removeClass' )](o.opts.wMarkerClass);
- }
- }
- }
- else o.$input.val( o.clr[fmt] ); // disabled, restore last color value
- },
- "show": function(){
- Hide(); var o = this;
- if (!o.disabled){
- if (!o.ready) o.init();
- var chk = is.Function(o.opts.onOpen) ? o.opts.onOpen.call( o.$picker[0] ) : true;
- if (chk!==false){
- Hide = o.hide;
- o.$picker.appendTo(document.body)
- .alignTo(o.$swatch,{auto:"point"}).show(); // opts.speed
- o.isOpen = true;
- //$(document).bind("mousedown"+o.NS,function(e){ o.start(e); });
- $(document).bond('mousedown',o,'start');
- //$(window).bind("keypress"+o.NS,function(e){ o.key(e); });
- $(window).bond('keypress',o,'key');
- o.original( o.clr );
- o.value();
- }
- else o.hide();
- }
- },
- "hide": function(){
- var o = this;
- if (o.isOpen){
- o.$picker.hide();
- //$(document).unbind("mousedown"+o.NS);
- $(document).unbond('mousedown',o,'start');
- //$(window).unbind("keypress"+o.NS);
- $(window).unbond('keypress',o,'key');
- o.isOpen = false;
- }
- },
- original: function(c){
- if (is.empty(c)){ // use orig color
- this.value(this.orig.hex);
- if (c===null) this.hide();
- }
- else { // set orig color
- this.orig = is.String(c) ? Color(c) : Color(this.clr);
- this.$reset.css('background-color', this.orig.html() );
- }
- },
- start: function(event){
- var o = this;
- if (o.isOpen && !o.inDrag){
- var xy = relPos(event,o.$wheel), el = event.target,
- ctr = Math.sqrt(Math.pow(xy.x-o.outerRadius,2)+Math.pow(xy.y-o.outerRadius,2));
- if (ctr>o.innerRadius && ctr<o.outerRadius) o.act = 'dragHue';
- else xy = relPos(event,o.$xy);
- while ( el ){
- if (el==o.$area[0]) o.act = 'dragArea';
- if (el==o.$hue[0]) o.act = 'dragHue';
- if (el==o.$sat[0]) o.act = 'dragSat';
- if (el==o.$lum[0]) o.act = 'dragLum';
- if (el==o.$reject[0]) return o.original(null);
- if (el==o.$reset[0]) return o.original();
- if (el==o.$accept[0]||el==document.body) return o.hide();
- if (el==o.$picker[0]) return;
- if (o.act!=null) {
- o.inDrag = true;
- o.off = xy;
- o.tmr = event.timeStamp;
- o.move(event);
- $(document).bind('mousemove'+o.NS,function(e){ o.move(e); })
- .bind("mouseup"+o.NS,function(e){ o.stop(e); });
- break;
- }
- else el = el.parentNode;
- }
- }
- },
- move: function(event){
- var o = this, xy, time = event.timeStamp - o.tmr;
- switch (o.act){
- case 'dragArea':
- xy = relPos(event,o.$area);
- o.value(o.clr.sat(100-(xy.x/o.areaScale.x)).lum(100-(xy.y/o.areaScale.y)));
- break;
- case 'dragHue':
- xy = relPos(event,o.$wheel);
- o.value(o.clr.hue(360*((Math.PI+Math.atan2(-(xy.x-o.outerRadius),xy.y-o.outerRadius))/(2*Math.PI)))); // 0 <-> 360
- break;
- case 'dragSat':
- xy = relPos(event,o.$area).x + o.$xy.width()/2;
- o.value(o.clr.sat(100-((xy - o.off.x)/o.areaScale.x)));
- break;
- case 'dragLum':
- xy = relPos(event,o.$area).y + o.$xy.height()/2;
- o.value(o.clr.lum(100-((xy - o.off.y)/o.areaScale.y)));
- break;
- default: return;
- }
- },
- stop: function(event){
- var o = this;
- if (o.isOpen && o.inDrag){
- var xy, time = event.timeStamp - o.tmr;
- switch (o.act){ // just a click?
- case time<200 && 'dragSat':
- xy = relPos(event,o.$sat);
- o.value(o.clr.sat( o.clr.S+( xy.x < o.$sat.width()/2 ? 1 : -1 ) ));
- break;
- case time<200 && 'dragLum':
- xy = relPos(event,o.$lum);
- o.value(o.clr.lum( o.clr.L+( xy.y < o.$lum.height()/2 ? 1 : -1 ) ));
- break;
- default: break;
- }
- $(document).unbind('mousemove'+o.NS+' mouseup'+o.NS);
- o.act = null;
- o.inDrag = false;
- o.tmr = 0;
- o.off = null;
- }
- },
- key: function(ev){
- var o = this;
- if (o.isOpen){
- switch (ev.keyCode){
- case 38: o.value( o.clr.lum('+1') ); break; // UP: lum++
- case 40: o.value( o.clr.lum('-1') ); break; // DOWN: lum--
- case 37: o.value( o.clr.sat('+1') ); break; // LEFT: sat++
- case 39: o.value( o.clr.sat('-1') ); break; // RIGHT: sat--
- case 33: o.value( o.clr.hue('+1') ); break; // PAGEUP: hue++
- case 34: o.value( o.clr.hue('-1') ); break; // PAGEDOWN: hue--
- case 36: o.value( o.clr.sat(100).lum(50) ); break; // HOME: pure hue
- case 35: o.value( o.clr.gray() ); break; // END: grayscale
- case 46: o.original(); break; // DELETE: use original color
- case 45: o.original( o.clr ); break; // INSERT: update orig color
- case 27: o.original( null ); break; // ESC: reject/close
- case 13: o.hide(); break; // ENTER: accept/close
- case 9: o.hide(); // TAB: accept/close
- default: return true;
- }
- ev.preventDefault();
- return false;
- }
- },
- "enable": function(){
- this.disabled = false;
- this.$input.attr('disabled',false);
- this.Publish( "enable" ); // "enable.PLUGIN"
- },
- "disable": function(){
- this.hide();
- this.disabled = true;
- this.$input.attr('disabled',true);
- this.Publish( "disable" ); // "disable.PLUGIN"
- },
- "destroy": function(){
- var self = this;
- self.$picker.remove().empty();
- self.$input.unbind( "blur"+self.NS );
- $.each("input $swatch $picker".split(' '),
- function(i,attr){ delete self[ attr ]; });
- this.Publish( "destroy" ); // "destroy.PLUGIN"
- $reg.drop( this ); // unregister
- }
- };
-/*******************************************************************************************/
-var // private helpers
-Hide = function(){},
-div = "<div></div>",
-relPos = function( event, elem ){
- var offset = $(elem).offset();
- return { x: event.pageX-offset.left, y: event.pageY-offset.top };
- };
-/*******************************************************************************************/
-})(jQuery) // secure the $ jQuery alias
View
BIN DateSelect/calendarIcon.gif
Deleted file not rendered
View
165 DateSelect/jquery.DateSelect.css
@@ -1,165 +0,0 @@
-
-/*
-input.invalid {
- background: #FCC;
- border: 0;
- }*/
-.calendarButton {
- background: #7799bb url(calendarIcon.gif) no-repeat 0px 0px;
- height: 18px;
- width: 18px;
- border: 0;
- padding: 0;
- margin: 0;
- text-indent: -2000px;
- }
-
-.calendarPop {
- position: absolute;
- top: 0;
- right: -18.3em;
- width: 18.3em;
- border: .1em solid #A2BBDD;
- padding: .3em .5em;
- font: 10px/2em Verdana, Arial, Helvetica, sans-serif;
- text-align: center;
- background: #C3D9FF;
- z-index: 9999;
- }
- .bgDiv{
- height: 100%;
- width: 100%;
- position: absolute;
- background: #003;
- top: .3em;
- left: .3em;
- z-index: -1;
- padding: 0 0 0 .1em;
- filter:alpha(opacity=40);
- -moz-opacity: 0.4;
- opacity: 0.4;
- }
- .fgDiv{
- z-index: 9999;
- }
- /*
- .month0 {background: #CAC2FF;}
- .month1 {background: #C2D9FF;}
- .month2 {background: #C2F7FF;}
- .month3 {background: #C2FFE9;}
- .month4 {background: #C2FFCA;}
- .month5 {background: #D9FFC2;}
- .month6 {background: #F7FFC2;}
- .month7 {background: #FFE9C2;}
- .month8 {background: #FFCAC2;}
- .month9 {background: #FFC2D9;}
- .month10 {background: #FFC2F7;}
- .month11 {background: #E9C2FF;}
- */
- .bottomButtons {
- position: relative;
- padding: .2em 0 0 0;
- }
- .calendarPop div.closeCalendar,
- .calendarPop div.cancelCalendar {
- position: absolute;
- bottom: 0;
- line-height: 1.2em;
- text-decoration: none;
- color: #112ABB;
- cursor: pointer;
- }
- .calendarPop div.closeCalendar {right: 0;}
- .calendarPop div.cancelCalendar {left: 0;}
- .calendarPop div.selectToday {
- line-height: 1.2em;
- text-decoration: none;
- margin: 0;
- padding: 0;
- color: #112ABB;
- cursor: pointer;
- }
- .calendarPop div.prevMonth,
- .calendarPop div.nextMonth {
- position: absolute;
- top: 0;
- text-decoration: none;
- padding: 0 .6em;
- line-height: 2em;
- color: #112ABB;
- cursor: pointer;
- }
- .calendarPop div.prevMonth {left:0;}
- .calendarPop div.nextMonth {right:0;}
- .calendarPop .monthDisplay {
- font: bold 1.4em/1.4em Arial, Helvetica, sans-serif;
- color: #112ABB;
- }
- .calendarPop table {
- width: 18.3em;
- table-layout: fixed;
- border: .1em solid #7799bb;
- }
- .calendarPop thead td {
- background: #A2BBDD;
- color: #FFF;
- line-height: 1.4em;
- border: 0;
- border-bottom: .1em solid #7799bb;
- }
- .calendarPop thead td.day6,
- .calendarPop thead td.day0 {
- color: #E8EEF7;
- }
- .calendarPop table td {
- padding: 0;
- width: 2.5em;
- cursor: pointer;
- text-align: center;
- }
-
- .calendarPop td div {
- display: block;
- text-decoration: none;
- background: #FFF;
- line-height: 2em;
- height: 2em;
- color: #112ABB;
- /*color: #000;*/
- }
- .calendarPop td div span {display: block;}
- .calendarPop .currentMonth div {
- background: #FFF;
- }
- .calendarPop div.day0,
- .calendarPop div.day6 {
- background: #E8EEF7;
- }
- .calendarPop .prevMonth div,
- .calendarPop .nextMonth div {
- color: #AAA;
- }
-
- .calendarPop td.valid div.active {
- background: #ACC3E7;
- color: #16246F;
- }
- .calendarPop td.invalid div {
- display: block;
- }
- .calendarPop td.invalid div span {
- text-decoration: line-through;
- }
-
- .calendarPop td.invalid div.active {
- background: #C2C8D2;
- cursor: not-allowed;
- color: #900;
- }
-
- .calendarPop td.selected div,
- .calendarPop td.selected div.active {
- background-color: #316AC5;
- color: #FFF;
- font-weight: bold;
- }
View
392 DateSelect/jquery.DateSelect.js
@@ -1,392 +0,0 @@
-(function($){ // confine scope
-/*******************************************************************************************/
-// jQuery.DateSelect.js - rev 27
-// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
-// Liscensed under the MIT License (MIT-LICENSE.txt)
-// http://www.opensource.org/licenses/mit-license.php
-// Created: 2007-02-14 | Updated: 2008-08-06
-/*******************************************************************************************/
-// REQUIRES: jquery 1.2.3+, utils.js, jquery.Register.js, Parse.js, jquery.alignTo.js
-/*******************************************************************************************/
-var PLUGIN = "DateSelect", // Register the PLUGIN... and public methods...
-$reg = $.Register( PLUGIN, "enable,disable,destroy,value,show,hide".split(',') );
-/*******************************************************************************************/
-// jquery extension
-$.fn[ PLUGIN ] = function( opts ){
- if ( is.String( opts ) ){ // call a single public method
- var args = Slice( arguments, 1 );
- return this.each(function(){ $reg.call( this, opts, args ); });
- }
- // inherit default values
- opts = $.extend( {}, $[ PLUGIN ].defaults, opts||{} );
- // calculate max, min, and date...
- var mn = $.trim(opts.min), mx = $.trim(opts.max);
- opts = $.extend( opts, {
- min: getYMD( (/^\d{4}$/).test(mn) ? mn+'0101' : mn ) || '01000101',
- max: getYMD( (/^\d{4}$/).test(mx) ? mx+'1231' : mx ) || '99991231',
- date: Parse(opts.date,'date') || Parse('today '+opts.date,'date')
- });
- // initialize the feature ( text/hidden/button inputs only )
- return this.each(function(){
- var type = $(this).is(':'+PLUGIN) ? false : $(this).attr('type');
- if ( type=='text' || type=='hidden' || type=='button' )
- new $[ PLUGIN ].create( this, opts );
- });
- };
-/*******************************************************************************************/
-// plugin defaults
-$[ PLUGIN ].defaults = {
- date: 'today',
- min: null, // year or date obj or date string
- max: null, // year or date obj or date string
- insert: "after", // string "after" or "before"
- order: "MDY", // select order
- delta: 50, // +/- years
- start: 0, // week start index [ 0=sun, 1=mon... ]
- months: 'January February March April May June July August September October November December'.split(" "),
- days: '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31'.split(" "),
- weeks: 'Su Mo Tu We Th Fr Sa'.split(" "),
- overMaxTitle: "Invalid: After Maximum Date",
- underMinTitle: "Invalid: Before Minimum Date",
- closeLinkText: "Close",
- cancelLinkText: "Cancel",
- todayLinkText: "Today",
- nextMonthText: "&raquo;",
- prevMonthText: "&laquo;",
- buttonTitle: "Select Date From Calendar",
- buttonValue: "...",
- buttonClass: "calendarButton",
- inputClass: "",
- spanClass: "",
- monthClass: "",
- dayClass: "",
- yearClass: "",
- value: function(y,m,d){ // scope: input
- return Pad(y,-4)+Pad(m+1,-2)+Pad(d,-2);
- },
- title: function(y,m,d){ // scope: options object
- return this.months[m]+' '+this.days[d-1]+', '+Pad(y,-4);
- }
- };
-/*******************************************************************************************/
-// plugin constructor
-$[ PLUGIN ].create = function( input, opts ){
- var self = $reg.add( input, this, { input:input, opts:opts, // register the instance, store args
- ready: false, isOpen: false, active: null, isActive: false, // store initial properties
- cal: { m:null, y:null }, last: { x:0, y:0, t:0 }
- });
- // try to use the input value, else the options value
- opts.date = Parse( input.value, 'date' ) || opts.date;
- self.$input = $(input).addClass( opts.inputClass )
- .bind( "blur"+self.NS, function(){ self.value( Parse(this.value,'date') ); });
- self.$span = $(sp).addClass( opts.spanClass )
- [ (/after/i).test(opts.insert) ? "insertAfter" : "insertBefore" ](self.$input);
- self.$button = $('<input type="button" title="'+opts.buttonTitle+'" />')
- .addClass(opts.buttonClass).val(opts.buttonValue).appendTo(self.$span)
- .bind( "click"+self.NS, function(){ self.show(); });
- // THE DATE SELECTS
- // figure out the years array from max/min/theDate...
- var years = [], yMin = opts.min.substr(0,4), yMax = opts.max.substr(0,4);
- if (yMin==yMax) years = [ yMin ]; // only one year
- else if (yMin!='0100' && yMax!='9999') // max and min are both defined
- for (var i=0; i<=parseInt(yMax,10)-parseInt(yMin,10); i++)
- years[i] = Pad(parseInt(yMin,10)+i,-4);
- self.adjustYrs = is.empty(years); // fixed year range
- var sel = [], ord = String(opts.order||"").toLowerCase();
- self.$yr = newSelect(years).addClass(opts.yearClass);
- self.$mth = newSelect(opts.months).addClass(opts.monthClass);
- self.$dy = newSelect(opts.days).addClass(opts.dayClass);
- sel[ ord.indexOf("y") ] = self.$yr[0];
- sel[ ord.indexOf("m") ] = self.$mth[0];
- sel[ ord.indexOf("d") ] = self.$dy[0];
- self.$sel = $(sel).bind( "change"+self.NS, function(){ self.changeSelects(); });
- self.$span.prepend( self.$sel );
- this.Publish( "create" ); // "create.PLUGIN"
- self.value( opts.date );
- };
-/*******************************************************************************************/
-// plugin methods
-$[ PLUGIN ].create.prototype = {
- init: function(){
- var self = this;
- // create calendar mark-up and references
- self.$cal = $(dv).addClass("calendarPop").appendTo(document.body);//.append( $bg ).append( $fg );
- self.$bg = $(dv).addClass("bgDiv").appendTo(self.$cal);
- self.$fg = $(dv).addClass("fgDiv").appendTo(self.$cal);
- self.$prev = $(dv).addClass("prevMonth").html(self.opts.prevMonthText).appendTo(self.$fg);
- self.$next = $(dv).addClass("nextMonth").html(self.opts.nextMonthText).appendTo(self.$fg);
- self.$head = $(dv).addClass("monthDisplay").text('Month Year').appendTo(self.$fg);
- self.$table = $('<table cellpadding="0" cellspacing="0" border="0"></table>').appendTo(self.$fg);
- self.$thead = $('<thead><tr></tr></thead>').appendTo(self.$table);
- $.each(Array(7),function(i){ // weekday thead cells
- var w = (self.opts.start+i)%7, // the day index
- t = $('<td></td>').addClass( "day"+w ), // the cell
- s = $(sp).text( self.opts.weeks[w] ); // span/text
- $('tr',self.$thead).append( t.append(s) );
- });
- self.$tbody = $('<tbody></tbody>').appendTo(self.$table);
- self.$foot = $(dv).addClass("bottomButtons").appendTo(self.$fg);
- self.$close = $(dv).addClass("closeCalendar").html(self.opts.closeLinkText).appendTo(self.$foot);
- self.$cancel = $(dv).addClass("cancelCalendar").html(self.opts.cancelLinkText).appendTo(self.$foot);
- self.$today = $(dv).addClass("selectToday").html(self.opts.todayLinkText).appendTo(self.$foot);
- // set todays title...
- self.$today.attr('title',self.opts.title.apply(self.opts,Parse('today','ymd')));
- // bind events....
- self.$cal
- .bind( "mouseover"+self.NS, function(ev){
- var el = ev.target;
- while (el!=this){
- if ($(el).is('td'))
- return self.move($('td',self.$tbody).index(el));
- el = el.parentNode;
- }
- self.move();
- })
- .bind( "mousedown"+self.NS, function(ev){
- var el = ev.target, u = null,
- clk = { t:ev.timeStamp, x:ev.pageX, y:ev.pageY };
- while (el!=this && u==null){
- if ($(el).is('td.valid')){
- if (clk.t-self.last.t<333 && Math.abs(clk.x-self.last.x)<3 && Math.abs(clk.y-self.last.y)<3) self.hide();
- else u = $('div',el).attr('title');
- }
- if (el==self.$cancel[0]){ self.hide(); u = self.$cancel[0].title; }
- if (el==self.$close[0]){ self.hide(); u = true; }
- if (el==self.$today[0]) u = self.$today[0].title;
- if (el==self.$next[0]) u = +1;
- if (el==self.$prev[0]) u = -1;
- if (u==null) el = el.parentNode;
- }
- if (is.String(u)) self.value( u );
- else if (is.Number(u)) self.changeMonth( u );
- self.$button[0].focus();
- self.last = clk;
- ev.stopPropagation();
- });
- // try to use these extensions if available
- try{ $('*',self.$cal).png(); } catch(ex){}
- try{ self.$cal.bgiframe(); } catch(ex){}
- try{ self.$cal.bind( "mousewheel"+self.NS, function(ev,d){
- var el = ev.target, f = 1;
- while (el!=this){
- if (el==self.$head[0]) f = 12;
- el = el.parentNode;
- }
- self.changeMonth( -(d*f) );
- ev.preventDefault();
- });
- } catch(ex){}
- self.$cal.hide();
- self.ready = true;
- },
- move: function(n){
- var $divs = $('div',this.$tbody).removeClass('active');
- if (is.Number(n)) this.active = n;
- if (is.String(n)) this.active += parseInt(n) || 0;
- if (is.defined(n) && is.Number(this.active)){
- this.active += this.active<0 ? 42 : this.active>=42 ? -42 : 0;
- $divs.eq(this.active).addClass('active');
- this.isActive = true;
- }
- else this.isActive = false;
- },
- keyPress: function(ev){
- if (this.isOpen && !this.disabled) {
- switch (ev.keyCode){
- case ev.shiftKey && 33: // SHIFT + PAGEUP
- this.changeMonth(-12); break;
- case 33: // PAGEUP
- this.changeMonth(-1); break;
- case ev.shiftKey && 34: // SHIFT + PAGEDOWN
- this.changeMonth(+12);; break;
- case 34: // PAGEDOWN
- this.changeMonth(+1);; break;
- case 38: // UP
- this.move('-7'); break;
- case 40: // DOWN
- this.move('+7'); break;
- case 37: // LEFT
- this.move('-1'); break;
- case 39: // RIGHT
- this.move('+1'); break;
- case 36: // HOME
- this.value(this.$today[0].title); break;
- case 46: // DELETE
- this.value(this.$cancel[0].title); break;
- case 27: // ESC
- this.value(this.$cancel[0].title);
- this.hide();
- break;
- case 13: // ENTER
- var $act = $('div.active',this.$tbody);
- if (is.not.defined($act[0])) this.hide();
- else this.value( $act[0].title );
- break;
- case 9: // TAB
- this.hide();
- default: return;
- }
- ev.preventDefault();
- }
- },
- "value": function(d){
- if (!this.disabled){
- var ymd = getYMD(d); d = Parse(ymd,'ymd');
- if (is.Array(d) && ymd>=this.opts.min && ymd<=this.opts.max){
- this.date = Parse(ymd,'date');
- this.changeSelects( d[0], d[1], d[2] );
- if (this.isOpen) this.newMonth( d[0], d[1] );
- }
- }
- },
- changeMonth: function(x){
- if (!this.disabled){
- var d = new Date(this.cal.y,this.cal.m+x,1), yy = d.getFullYear(), mm = d.getMonth();
- if (yy>99 && this.opts.min<getYMD([yy,mm,monthSize(yy,mm)]) && this.opts.max>getYMD([yy,mm,1])){
- this.newMonth(yy,mm);
- if (this.isActive) this.move(this.active);
- }
- }
- },
- newMonth: function(y,m){
- var self = this;
- if (!is.Number(y)) y = self.cal.y;
- if (!is.Number(m)) m = self.cal.m;
- self.$close.attr('title',self.opts.title.apply(self.opts,Parse(self.date,'ymd')));
- if (y!=self.cal.y || m!=self.cal.m){ // change the visible data
- self.cal = { y:y, m:m }; // what the calendar shows
- self.$prev.show(); self.$next.show();
- var sel = getYMD(self.date); // ymd of current selection
- self.$cal.removeClass('month0 month1 month2 month3 month4 month5 month6 month7 month8 month9 month10 month11').addClass('month'+m);
- // set month/year titles
- self.$prev.attr('title',self.opts.months[(m-1<0?11:m-1)]+' '+(m-1<0?y-1:y) );
- self.$next.attr('title',self.opts.months[(m+1>11?0:m+1)]+' '+(m+1>11?y+1:y) );
- self.$head.html(self.opts.months[m]+' '+y); // main calendar title
- var str = '<tr>', d=1, e, s = new Date(y,m,1).getDay(); // beginning day of the month
- if (s<=self.opts.start) s = s+7; e = monthSize(y,m)+s; // ending day of the month
- for (var i=self.opts.start; i<(42+self.opts.start); i++) {
- if (i>self.opts.start && i%7==self.opts.start && i<41+self.opts.start) str += '</tr><tr>'; // new row
- var x = new Date(y,m,( i<s ? -(s-i-1) : i>=e ? d+i-e : d++ )), ymd = getYMD( x );
- str += '<td class="'+( i<s ? "prevMonth" : i>=e ? "nextMonth" : "currentMonth" );
- if (ymd==sel){ self.active = self.isActive ? self.active : i-self.opts.start; str += " selected"; }
- str += (ymd>=self.opts.min&&ymd<=self.opts.max?" valid":" invalid")+'"><div class="day'+(i%7)+'"';
- str += 'title="'+( ymd<self.opts.min ? self.opts.underMinTitle :
- ymd>self.opts.max ? self.opts.overMaxTitle : self.opts.title.apply(self.opts,Parse(x,'ymd')) );
- str += '"><span>'+self.opts.days[ x.getDate()-1 ]+'</span></div></td>'; // write the cell
- if (ymd==self.opts.min) self.$prev.hide(); if (ymd==self.opts.max) self.$next.hide();
- }
- self.$tbody.html( str + '</tr>' );
- self.$tds = $('td',self.$tbody);
- }
- else { // change the selection
- self.active = new Date(y,m,1).getDay();
- self.active += (self.active<=self.opts.start?7:0)+self.date.getDate()-1;
- self.$tds.removeClass("selected").eq(self.active-self.opts.start).addClass("selected");
- self.move();
- }
- },
- adjYears: function(y){
- var yr = this.$yr[0], l = yr.options.length,
- s = Math.max( y-this.opts.delta, parseInt(this.opts.min.substr(0,4),10) ),
- e = Math.min( y+this.opts.delta, parseInt(this.opts.max.substr(0,4),10) );
- if (l==0 || Pad(s,-4)!=yr.options[0].value || Pad(e,-4)!=yr.options[l-1].value){
- yr.options.length = 0;
- for ( var i=0; i<=e-s; i++ ){
- y = Pad( s+i, -4 );
- yr.options[i] = new Option( y, y );
- }
- }
- },
- changeSelects: function( y, m, d ){
- if (!this.disabled){
- y = y || parseInt(this.$yr.val(),10);
- m = is.Number(m) ? m : this.$mth[0].selectedIndex;
- d = d || this.$dy[0].selectedIndex+1;
- var l = this.$dy[0].options.length, x = monthSize(y,m),
- ymd = Math.min(Math.max(getYMD([y,m,Math.min(d,x)]),this.opts.min),this.opts.max);
- if (is.Date(ymd=Parse(Pad(ymd,-8),'date'))){
- this.date = ymd; //Parse(ymd,'date');
- x = monthSize(ymd.getFullYear(),ymd.getMonth()); // update month size
- if (x<l) this.$dy[0].options.length = x; // shorten the days
- else for (var i=l; i<x; i++) // lengthen days
- this.$dy[0].options[i] = new Option( this.opts.days[i], this.opts.days[i] );
- if (this.adjustYrs) this.adjYears(y); // move the year range based on selected year
- }
- this.Publish( "change", this.date ); // "change.PLUGIN"
- }
- this.setSelects();
- },
- setSelects: function(){
- var ymd = Parse(this.date,'ymd');
- try {
- if (this.$yr.val()!=Pad(ymd[0],-4)) this.$yr.val( Pad(ymd[0],-4) );
- if (this.$mth[0].selectedIndex!=ymd[1]) this.$mth[0].selectedIndex = ymd[1];
- if (this.$dy[0].selectedIndex!=ymd[2]-1) this.$dy[0].selectedIndex = ymd[2]-1;
- }
- catch(ex){ }
- this.$input.val( this.opts.value.apply( this.$input[0], ymd ) );
- },
- "show": function(){
- Hide();
- var self = this;
- if (!self.disabled){
- if (!self.ready) self.init();
- self.last = self.opts.title.apply(self.opts,Parse(self.date,'ymd'));
- self.$cancel.attr('title',self.last);
- self.newMonth( self.date.getFullYear(), self.date.getMonth() );
- self.$cal.appendTo(document.body).alignTo(self.$button,{auto:"point"}).show();
- $(document).bind("mousedown"+self.NS, function(){ self.hide(); });
- $(window).bind("keydown"+self.NS, function(ev){ self.keyPress(ev) });
- self.isOpen = true;
- this.Publish( "show" ); // "show.PLUGIN"
- Hide = self.hide;
- }
- },
- "hide": function(){
- if (this.isOpen){
- this.$cal.hide();
- $(document).unbind("mousedown"+this.NS);
- $(window).unbind("keydown"+this.NS);
- this.isOpen = false;
- this.Publish( "hide" ); // "hide.PLUGIN"
- }
- },
- "enable": function(){
- this.disabled = false;
- this.$input.attr('disabled',false);
- this.$sel.attr('disabled',false);
- this.Publish( "enable" ); // "enable.PLUGIN"
- },
- "disable": function(){
- this.hide();
- this.disabled = true;
- this.$input.attr('disabled',true);
- this.$sel.attr('disabled',true);
- this.Publish( "disable" ); // "disable.PLUGIN"
- },
- "destroy": function(){
- this.$button.unbind( this.NS );
- this.$input.unbind( this.NS );
- this.$span.empty().remove();
- this.Publish( "destroy" ); // "destroy.PLUGIN"
- $reg.drop( this ); // unregister
- }
- };
-/*******************************************************************************************/
-var // private helpers
-getYMD = function(str){
- if (is.empty(str)) return null;
- if (is.Array(str)) str = eval('new Date('+str.join(',')+')');
- var ymd = Parse(str,'ymd'); // [y,m,d]
- return ymd ? Pad(ymd[0],-4)+Pad(ymd[1]+1,-2)+Pad(ymd[2],-2) : null;
- },
-newSelect = function(arr){
- var sel = $('<select></select>');
- for (var i=0; i<arr.length; i++)
- sel[0].options[i] = new Option( arr[i], arr[i] );
- return sel;
- },
-monthSize = function(y,m){ return 32-( new Date(y,m,32).getDate() ); },
-Hide = function(){}, dv = '<div></div>', sp = '<span></span>';
-/*******************************************************************************************/
-})(jQuery) // secure the $ jQuery alias
View
67 Slider/jquery.Slider.css
@@ -1,67 +0,0 @@
-/*** SLIDER STYLES **************************/
-.Slider_wrap {
- position: relative;
- float: left;
- background: url("slider_bg.gif") no-repeat 0px 4px;
- width: 209px;
- height: 15px;
- cursor: pointer;
- margin-right: 10px;
- }
-.Slider_active {
- background-position: -209px 4px;
- cursor: w-resize;
- }
-.Slider_disabled {
- cursor: default;
- background-position: -418px 4px;
- }
-.Slider_track {
- position: absolute;
- width: 200px;
- height: 15px;
- left: 0;
- top: 0;
- padding: 0 9px 0 0;
- }
-.Slider_handle {
- position: absolute;
- width: 9px;
- height: 15px;
- background: url("slider_handle1.gif") no-repeat 0px 0px;
- cursor: w-resize;
- }
-.Slider_active .Slider_handle,
-.Slider_handle:hover {
- background-position: -9px 0px;
- }
-.Slider_disabled .Slider_handle {
- background-position: -18px 0px;
- cursor: default;
- }
-.Slider_input {
- width: 50px;
- }
-/* VERTICAL */
-.vSlider_wrap {
- position: relative;
- height: 260px;
- }
-.vSlider_bg {
- width: 50px;
- height: 220px;
- top: 25px;
- background: url(slider_bg_vert.gif) no-repeat 0px 0px;
- }
-.vSlider_marker {
- margin: 3px 3px;
- cursor: n-resize;
- position: absolute;
- width: 14px;
- height: 14px;
- background: url(slider_marker.png) no-repeat 0px 0px;
- }
-.vSlider_input {
- top: 0;
- left: 0;
- }
View
150 Slider/jquery.Slider.js
@@ -1,150 +0,0 @@
-(function($){ // confine scope
-/*******************************************************************************************/
-// jQuery.Slider.js - rev 14
-// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
-// Liscensed under the MIT License (MIT-LICENSE.txt)
-// http://www.opensource.org/licenses/mit-license.php
-// Created: 2007-02-27 | Updated: 2008-09-09
-/*******************************************************************************************/
-// REQUIRES: jquery 1.2.3+, utils.js, jquery.Register.js (rev 16+), jquery.event.drag.js
-/*******************************************************************************************/
-var PLUGIN = "Slider", // Register the PLUGIN... and public methods...
-$reg = new $.Register( PLUGIN, "enable,disable,destroy,value".split(',') );
-/*******************************************************************************************/
-// the jquery extension
-$.fn[ PLUGIN ] = function( arg ){
- if ( is.String( arg ) ){ // call a single public method
- var args = Slice( arguments, 1 );
- return this.each(function(){ $reg.call( this, arg, args ); });
- }
- // inherit defaults
- var opts = $.extend( {}, $[ PLUGIN ].defaults, arg||{} );
- // initialize the new feature
- return this.each(function(){
- var type = $(this).is(':'+PLUGIN) ? false : $(this).attr('type');
- if ( type=='text' || type=='hidden' || type=='button' )
- new $[ PLUGIN ].create( this, opts );
- });
- };
-/*******************************************************************************************/
-// the default settings
-$[ PLUGIN ].defaults = {
- val: 50, // the value to be set
- min: 0, // the minimum value
- max: 100, // the maximum value
- step: 20, // number of range subdivisions : (max-min)/snap = increments : (100-0)/20 = 5
- insert: "before", // string "after" or "before"
- axis: "H", // horizontal|h|x [or] vertical|v|y
- activeClass: "Slider_active",
- disabledClass: "Slider_disabled",
- wrapClass: "Slider_wrap",
- trackClass: "Slider_track",
- handleClass: "Slider_handle",
- inputClass: "Slider_input",
- round: 2, // number of decimal places to round to (-1=10s, 0=integer, 1=1/10ths)
- invert: false, // flip the max/min values: 100=>0, 0=>100
- formatValue: null, // optional value formatting (like $cash())
- unformatValue: null, // optional for cleaning up user entered values
- onChange: null
- };
-/*******************************************************************************************/
-// initialize the feature
-$[ PLUGIN ].create = function( input, opts ){
- var self = $reg.add( input, this, { // register the instance
- input: input, opts: opts, // store the args
- $input: $(input).addClass(opts.inputClass)
- });
- // create/insert the DOM elements
- self.$handle = $(dv).addClass(opts.handleClass);
- self.$track = $(dv).addClass(opts.trackClass).append( self.$handle );
- self.$wrap = $(dv).addClass(opts.wrapClass).append( self.$track )
- [ (/after/i).test(opts.insert) ? "insertAfter" : "insertBefore" ]( self.$input );
- // apply options, calculate ranges
- self.X = (/[hx]/i).test(opts.axis);
- var size = self.$track[ self.X ? "width" : "height" ](),
- mn = is.Number(opts.min) ? opts.min : $[ PLUGIN ].defaults.min,
- mx = is.Number(opts.max) ? opts.max : $[ PLUGIN ].defaults.max,
- st = is.Number(opts.step) ? opts.step : $[ PLUGIN ].defaults.step,
- snap = (size/opts.step), step = ((mx-mn)/opts.step);
- // some helper functions...
- self.change = function(v,fv){ if (is.Function(opts.onChange)) opts.onChange.call(self.$input[0],v,fv); };
- self.format = function(v){ return is.Function(opts.formatValue) ? opts.formatValue(v) : v; };
- self.unformat = function(v){ return is.Function(opts.unformatValue) ? opts.unformatValue(v) : v; };
- self.flip = function(v){ return opts.invert ? mx-v+mn : v; };
- self.range = function(v){ return Math.max(Math.min(mx,Math.round(v/step)*step),mn); };
- self.limit = function(p){ return Math.max(Math.min(size,Math.round(p/snap)*snap),0); };
- self.pos2val = function(p){ return (p/size)*(mx-mn)+mn; };
- self.val2pos = function(v){ return Math.round(size*((v-mn)/(mx-mn))); };
- // bind DOM events...
- self.$input.bind("blur"+self.NS, function(){ self.value.call(self,this.value); });
- self.$track // $.event.special.drag
- .bind('dragstart'+self.NS, function( event ){
- if ( self.dragging || self.disabled ) return false;
- self.dragging = true;
- self.$wrap.addClass(opts.activeClass);
- self.Publish( "start", event ); // "start.PLUGIN"
- })
- .bind('drag'+self.NS, {drop:false}, function( event ){
- if ( !self.dragging || self.disabled ) return false;
- var xy = self.X ?
- event.pageX - self.$track.offset().left :
- event.pageY - self.$track.offset().top ;
- self.position( xy );
- self.Publish( "move", event ); // "move.PLUGIN"
- })
- .bind('dragend'+self.NS, function( event ){
- self.dragging = false;
- self.$wrap.removeClass(opts.activeClass);
- self.Publish( "stop", event ); // "stop.PLUGIN"
- });
- // set the provided/default value
- self.value(opts.val);
- self.Publish( "create" ); // "create.PLUGIN"
- };
-/*******************************************************************************************/
-// inherited methods
-$[ PLUGIN ].create.prototype = {
- // setters
- position: function(p){
- p = this.limit( p );
- this.$handle.css( this.X ? 'left' : 'top', p );
- if (this.dragging) this.value( this.flip(this.pos2val(p)) );
- },
- value: function(v){
- v = this.range( this.unformat(v) );
- if (is.Number(this.opts.round)) v = Round(v,this.opts.round);
- var fv = this.format(v); // return false to cancel
- if (is.Number(v) && v!=this.lastV && fv!==false ){ // value changed
- this.lastV = v;
- this.$input.val( fv||v );
- if (!this.dragging) this.position( this.val2pos(this.flip(v)) );
- this.change(v,fv||v); // onChange callback
- }
- },
- // controllers
- enable: function(){
- this.disabled = false;
- this.$input[0].disabled = false;
- this.$wrap.removeClass(this.opts.disabledClass);
- this.Publish( "enable" ); // "enable.PLUGIN"
- },
- disable: function(){
- this.disabled = true;
- this.$input[0].disabled = true;
- this.$wrap.addClass(this.opts.disabledClass);
- this.Publish( "disable" ); // "disable.PLUGIN"
- },
- destroy: function(){
- this.$input.unbind( this.NS ).removeClass(this.opts.inputClass);
- this.$track.unbind( this.NS );
- this.$wrap.remove().empty(); // cleanup the DOM
- this.Publish( "destroy" ); // "destroy.PLUGIN"
- $reg.drop( this ); // unregister
- objectDestroy( this ); // self destruct
- }
- };
-/*******************************************************************************************/
-// private vars
-var dv = '<div></div>';
-/*******************************************************************************************/
-})(jQuery) // secure the $ jQuery alias
View
BIN Slider/slider_bg.gif
Deleted file not rendered
View
BIN Slider/slider_bg1.gif
Deleted file not rendered
View
BIN Slider/slider_bg2.gif
Deleted file not rendered
View
BIN Slider/slider_bg2.png
Deleted file not rendered
View
BIN Slider/slider_bg_vert.gif
Deleted file not rendered
View
BIN Slider/slider_handle1.gif
Deleted file not rendered
View
BIN Slider/slider_marker.png
Deleted file not rendered
View
BIN Slider/slider_marker2.png
Deleted file not rendered
View
BIN Slider/slider_swatch2.png
Deleted file not rendered
View
197 Sortable/jquery.Sortable.js
@@ -1,197 +0,0 @@
-;(function($){ // confine scope
-/*******************************************************************************************/
-// jQuery.Sortable.js - rev 9
-// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
-// Liscensed under the MIT License (MIT-LICENSE.txt)
-// http://www.opensource.org/licenses/mit-license.php
-// Created: 2007-11-28 | Updated: 2008-05-05
-/*******************************************************************************************/
-// REQUIRES: jquery 1.2.3+, utils.js, jquery.Register.js (rev 16+)
-/*******************************************************************************************/
-var PLUGIN = "Sortable", // Register the PLUGIN... and public methods...
-$reg = new $.Register( PLUGIN, "enable,disable,destroy,sort".split(',') );
-/*******************************************************************************************/
-// jquery extension
-$.fn[ PLUGIN ] = function( opts ){
- if ( is.String( opts ) ){ // call a single public method
- var args = Slice( arguments, 1 );
- return this.each(function(){ $reg.call( this, opts, args ); });
- }
- // initialize the feature
- opts = $.extend( {}, $[ PLUGIN ].defaults, opts||{} );
- return this.each(function(){
- var tag = $(this).is(':'+PLUGIN) ? false : this.nodeName.toLowerCase(),
- config = ( tag=='ul' || tag=='ol' ) ? { bod:$(this), row:"li" } :
- ( tag=='table' ) ? { ths:$('thead td',this), bod:$('tbody',this), row:"tr", cell:"td" } :
- ( tag=='select' ) ? { bod:$(this), row:"option" } : false;
- if ( tag && config ) new $[ PLUGIN ].create( this, opts, config );
- });
- };
-/*******************************************************************************************/
-// plugin defaults
-$[ PLUGIN ].defaults = {
- sortClass: 'sortAsc sortDsc',
- groupClass: 'group',
- groupClosed:'closed',
- cache: true,
- cols: [],
- groups: [],
- stripe: false,
- onSort: null, // executed before sorting, return false to prevent
- callback: null // executed whenever sorting completes
- };
-/*******************************************************************************************/
-// plugin constructor
-$[ PLUGIN ].create = function( el, opts, config ){
- var self = $.extend( $reg.add( el, this ), config, {
- el: el, opts: opts, rows: [], cache: []
- }); // register the instance, store args, init props
- self.ths = $( opts.head || self.ths || "<span></span>" );
- // bind click to the table headers
- if ( self.ths.jquery )
- self.ths.bind( "click"+self.NS, function(){
- self.sort( self.ths.index(this) );
- return false;
- });
- self.bod.each(function(i){
- self.rows[i] = $( self.row, this );
- self.cache[i] = [];
- }); // ref the init rows
- self.stripe();
- };
-/*******************************************************************************************/
-// plugin methods
-$[ PLUGIN ].create.prototype = {
- findData: function( b, dsc ){
- var o = this, x = o.active, fn, td, txt, group, grp = o.opts.groups[x],
- data = o.cache[b][x] || []; // load cached data
- if (is.empty(data)){ // read data
- fn = getParser( o.opts.cols[x], (o.cell?$(o.cell,o.rows[b]):$(o.rows[b])).eq(x).text() );
- group = is.Function(grp) ? grp : function(x){ return grp ? x : false; };
- o.rows[b].each(function(i){
- td = ( o.cell ? $(o.cell,this) : $(this) ).eq(x);
- txt = td.text();
- data[i] = { i:i, v:fn.call( td[0], txt ), g:group(txt) };
- });
- data.sort(function(a,b){
- return a.g < b.g ? -1 : a.g > b.g ? 1 :
- a.v < b.v ? -1 : a.v > b.v ? 1 : a.i - b.i;
- });// sort the data (asc)
- if (o.opts.cache) o.cache[b][x] = data; // cache (asc)
- }
- return dsc ? data.slice().reverse() : data;
- },
- sort: function( x, dsc ){
- var o = this, a = o.opts.sortClass.split(" "), lastGrp, tr, group = [], len, $trGrp, doGrp;
- if (o.allow(x)==false||is.not.Number(o.active)) return; // break
- if (is.not.defined(dsc)) dsc = o.ths.eq(o.active).is(".sortAsc"); // direction
- o.ths.removeClass(o.opts.sortClass); // unclass
- if (o.active>-1) { // sort column
- $.each( o.bod, function(j){
- $('tr.'+o.opts.groupClass,this).remove(); // ungroup
- $.each( o.findData(j,dsc), function(i,c){
- tr = o.rows[j][c.i]; doGrp = (c.g!==false);
- if (lastGrp!=c.g && doGrp){
- // bind event to previous group
- if (group.length) o.toggler( $trGrp, group );
- // create the next group
- len = $(tr).children().length;
- $trGrp = $('<tr class="'+o.opts.groupClass+'"></tr>')
- .append('<td colspan="'+( len )+'"><span class="toggle">'+( c.g )+'</span></td>');
- o.bod.eq(j).append( $trGrp );
- group = [ tr ];
- lastGrp = c.g;
- }
- else if (doGrp) group[ group.length ] = tr;
- o.bod.eq(j).append( $(tr).show() ); // move the row
- });
- // bind event to final group
- if (group.length && doGrp) o.toggler( $trGrp, group );
- });
- o.ths.eq(o.active).addClass(dsc?a[1]:a[0]); // sort class
- }
- else o.rows.each(function(i,v){ o.bod.append(v); }); // unsort
- this.Publish( "sort" ); // "sort.PLUGIN"
- o.stripe().exec( o.opts.callback, o.active );
- },
- toggler: function( $elem, rows ){
- var cls = this.opts.groupClosed;
- //$('span',$elem).html( '('+rows.length+')' );
- $elem.bind('click',function(){
- var dir = $( this ).is('.'+cls);
- $( rows )[ dir ? "show" : "hide" ]();
- $elem[ dir ? "removeClass" : "addClass" ]( cls );
- });
- },
- allow: function( x ){ var o = this;
- x = is.Number(x) && x<o.ths.length ? x : o.active || 0;
- if (o.disabled||o.opts.cols[x]===false) return false; // disabled
- if (o.exec(o.opts.onSort,x)===false) return false; // onSort = false;
- o.active = x;
- },
- stripe: function(){
- var str = this.opts.stripe, arr;
- if (is.String(str) && is.not.empty(str) && is.Array(arr=str.split(" ")))
- $( this.row, this.bod ).each(function(i){
- if ( $(this).is(":visible") )
- $( this ).removeClass( str )
- .addClass( arr[ i%arr.length ] );
- });
- return this;
- },
- exec: function( fn, arg ){ return is.Function( fn ) ? fn.call( this, arg ) : null; },
- enable: function(){
- this.disabled = false;
- this.Publish( "enable" ); // "enable.PLUGIN"
- },
- disable: function(){
- this.disabled = true;
- this.Publish( "disable" ); // "disable.PLUGIN"
- },
- destroy: function(){
- this.ths.unbind( "click"+this.NS );
- this.Publish( "destroy" ); // "destroy.PLUGIN"
- $reg.drop( this ); // unregister
- objectDestroy( this ); // self destruct
- }
- };
-/*******************************************************************************************/
-// private helpers
-var P = {}, // more private functions
-getParser = function(id,x){ var fn;
- if (is.Function(id)) fn = id;
- if (is.Function(P[id])) fn = P[id];
- if (is.not.Function(fn)) // try automatic decision
- Each("date time number money text".split(" "),function(i,v){
- if (is.Function(P[v]) && P[v](x)!=Infinity) fn = P[v];
- return is.not.Function(fn);
- });
- return fn;
- };
-/*******************************************************************************************/
-// PUBLIC fn to extend data parsing
-$[ PLUGIN ].learn = function( id, fn ){
- if (is.empty(id)||is.not.String(id)||is.not.Function(fn)) return false;
- else P[id] = fn; return true;
- };
-// Standard Parse Extensions
-$[ PLUGIN ].learn("text",function(x){
- return x.toLowerCase();
- });
-$[ PLUGIN ].learn("number",function(x){
- return isNaN(x=parseFloat(x)) ? Infinity : x;
- });
-$[ PLUGIN ].learn("money",function(x){
- return isNaN(x=parseFloat(x.replace(/(\$|\,)/g,""))) ? Infinity : x;
- });
-// the following require: Parse.js
-$[ PLUGIN ].learn("date",function(x){
- return is.not.Array( x = Parse(x,'ymd') ) ? Infinity : // YYYY+MM+DD+hh+mm+ss+ms.
- $.each( x, function(i,v){ x[i] = Pad( v, i==0 ? -4 : i==6 ? -3 : -2 ); }).join("");
- });
-$[ PLUGIN ].learn("time",function(x){
- return is.not.Array( x = Parse(x,'hms') ) ? Infinity : // hh+mm+ss+ms.
- $.each( x, function(i,v){ x[i] = Pad( v, i==3 ? -3 : -2 ); }).join("");
- });
-/*******************************************************************************************/
-})(jQuery) // secure the $ jQuery alias
View
117 SubSelect/jquery.SubSelect.js
@@ -1,117 +0,0 @@
-;(function($){ // confine scope
-/*******************************************************************************************/
-// jQuery.SubSelect.js - rev 15
-// Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
-// Liscensed under the MIT License (MIT-LICENSE.txt)
-// http://www.opensource.org/licenses/mit-license.php
-// Created: 2007-04-06 | Updated: 2008-09-17
-/*******************************************************************************************/
-// REQUIRES: jquery 1.2.3+, utils.js, jquery.Register.js
-/*******************************************************************************************/
-var PLUGIN = "SubSelect", // Register the PLUGIN... and public methods...
-$reg = $.Register( PLUGIN, "enable,disable,destroy,value".split(',') );
-/*******************************************************************************************/
-// jquery extension
-$.fn[ PLUGIN ] = function( map, opts ){
- if ( is.String( map ) ){ // call a single public method
- var args = Slice( arguments, 1 );
- if ( map=='value' && !args.length ) return $reg.call( this.filter(':'+PLUGIN)[0], map, args ); // get 1st value
- else return this.each(function(){ $reg.call( this, map, args ); });
- }
- // initialize the feature
- opts = $.extend( {}, $[ PLUGIN ].defaults, opts||{} );
- return this.each(function(){ new $[ PLUGIN ].create( this, map, opts ); });
- };
-/*******************************************************************************************/
-// plugin defaults
-$[ PLUGIN ].defaults = {
- selectClass: "", // classname(s) to add to generated <select>s
- formatText: function(s){ return s.split('#')[1]; }, // return <option> value or null for index
- formatValue: function(s){ return s.split('#')[0]; } // return <option> text or null for unformatted value
- };
-/*******************************************************************************************/
-// plugin constructor
-$[ PLUGIN ].create = function( el, map, opts ){
- var self = $reg.add( el, this, { el:el, map:map, opts:opts } ); // register the instance, store args
- self.root = self.subSel(map);
- $(el).append(self.root);
- self.set( opts.value ).get();
- self.Publish( "create" ); // "create.PLUGIN"
- };
-/*******************************************************************************************/
-// plugin methods
-$[ PLUGIN ].create.prototype = {
- value: function(v){ return is.defined(v) ? this.set(v) : this.get(); },
- set: function(v){
- var o = this, $s = o.root,
- i = 0; v = o.val = v || o.val;
- if ( is.Array(v) && v.length>0 )
- while ( is.defined( v[i], $s[0] ) ){
- $s.val( v[i++] ).trigger( "change"+o.NS );
- $s = $(":input",$s.next('span'));
- }
- else if ( is.not.empty(v) ) $s.val(v).trigger( "change"+o.NS );
- else { $s[0].selectedIndex = 0; $s.trigger( "change"+o.NS ); }
- return o;
- },
- get: function(){
- var o = this, i = 0; o.val = [];
- o.val[ i++ ] = o.root.val(); // root <select>
- $(":input", o.root.next('span') ) // each <subselect>
- .each(function(){ o.val[i++] = $(this).val(); });
- return o.val;
- },
- newSel: function(arr){
- var sel = $('<select class="'+this.opts.selectClass+'"></select><span></span>');
- for (var v,t,i=0; i<arr.length; i++)
- if (is.not.empty(arr[i])){
- v = is.Function(this.opts.formatValue) ? this.opts.formatValue(arr[i]) : i;
- t = is.Function(this.opts.formatText) ? this.opts.formatText(arr[i]) : arr[i];