Skip to content

Commit

Permalink
Finished conversion with fixes to jQueryUI
Browse files Browse the repository at this point in the history
These fixes are so hawt their not even in the master branch yet!
  • Loading branch information
Dean Sofer committed Jun 29, 2012
1 parent 4e5f758 commit 31647d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions jquery.ui.widget.js
Expand Up @@ -349,7 +349,7 @@ $.Widget.prototype = {
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
element = null;
} else {
// accept selectors, DOM elements
element = $( element );
Expand Down Expand Up @@ -380,9 +380,9 @@ $.Widget.prototype = {
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
instance.widget().delegate( selector, eventName, handlerProxy );
(element || instance.widget()).delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
(element || instance.element).bind( eventName, handlerProxy );
}
});
},
Expand Down
38 changes: 19 additions & 19 deletions rotary-datepicker.js
Expand Up @@ -36,11 +36,11 @@
days: ''
};

this.$picker = build();
this.$picker = this._build();

this.rotationSize = calculate();
this.rotationSize = this._calculate();

bind();
this._bind();
},
_destroy : function() {
this.element.removeClass('.rotoDate .rotoDate-active');
Expand Down Expand Up @@ -75,8 +75,8 @@

// Adding Years
$group = $('<ul></ul>');
n = opts.years.stop + 1;
while (n--, n > opts.years.start - 1) {
n = this.options.years.stop + 1;
while (n--, n > this.options.years.start - 1) {
$group.prepend('<li>'+n+'</li>');
}
$picker.append($group);
Expand All @@ -94,12 +94,12 @@
years: 0,
months: 0,
days: 0
};
}, that = this;
$.each(this.options.dials, function(i, radial){
$('.rotoDate-'+radial+' li', this.$picker).each(function(i, elm){
var count = $('.rotoDate-'+radial+' li', this.$picker).length;
$('.rotoDate-'+radial+' li', that.$picker).each(function(i, elm){
var count = $('.rotoDate-'+radial+' li', that.$picker).length;
rotationSize[radial] = 360/count;
rotator($(elm), i * rotationSize[radial]);
that._rotator($(elm), i * rotationSize[radial]);
});
});
return rotationSize;
Expand All @@ -116,18 +116,18 @@
event.preventDefault();
},
'click li' : function(event, elm) {
var $li = $(elm);
var $li = $(event.currentTarget);
var rotation = $li.index() * 360 / ($li.siblings().length+1);
var radial = $li.closest('div').attr('class').substr(9);
this.rotate[radial] = rotation;
rotator($li.closest('div'), rotation);
this._rotator($li.closest('div'), rotation);
this.active[radial] = $li.text();
refresh();
this._refresh();
}
});

// Bind 'cancel' keypress
this._on(window, { 'keyup' : function(event) {
this._on(this.document, { 'keyup' : function(event) {
if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
event.keyCode === 27 ) {
this.close();
Expand All @@ -139,10 +139,10 @@
if ($.fn.mousewheel && this.options.scroll) {
var dials = this.options.dials.join(', .rotoDate-');
var events = {};
events['mousewheel .rotoDate-'+dials] = function(event, delta, elm) {
events['mousewheel .rotoDate-'+dials] = function(event, delta) {
event.preventDefault();
var $elm = $(elm);
var radialClass = $e.attr('class');
var $elm = $(event.currentTarget);
var radialClass = $elm.attr('class');
var radial = radialClass.substr(9);
if (delta > 0) {
this.rotate[radial] += this.rotationSize[radial];
Expand All @@ -157,10 +157,10 @@
item = 0;
}
this.active[radial] = $('.'+radialClass+' li', this.$picker).eq(item).text();
refresh();
rotator($elm, this.rotate[radial]);
this._refresh();
this._rotator($elm, this.rotate[radial]);
};
this._on(this.picker, events);
this._on(this.$picker, events);
}
},
_rotator : function($elm, rotation) {
Expand Down

0 comments on commit 31647d8

Please sign in to comment.