' : persPS + '
' + (s.headerText ? '
' : ''));
for (i = 0; i < s.wheels.length; i++) {
html += '
';
}
html += (s.display != 'inline' ? '
' + s.setText + '' + (s.button3 ? '' + s.button3Text + '' : '') + '' + s.cancelText + '
' + persPE : '
') + '
';
dw = $(html);
scrollToPos();
// Show
if (s.display != 'inline') {
dw.appendTo('body');
} else if (elm.is('div')) {
elm.html(dw);
} else {
dw.insertAfter(elm);
}
visible = true;
if (s.display != 'inline') {
// Init buttons
$('.dwb-s span', dw).click(function () {
if (that.hide() !== false) {
that.setValue(false, true);
event('onSelect', [that.val]);
}
return false;
});
$('.dwb-c span', dw).click(function () {
if (that.hide() !== false) {
event('onCancel', [that.val]);
}
return false;
});
if (s.button3) {
$('.dwb-n span', dw).click(s.button3);
}
// prevent scrolling if not specified otherwise
if (s.scrollLock) {
dw.bind('touchmove', function (e) {
e.preventDefault();
});
}
// Disable inputs to prevent bleed through (Android bug)
$('input,select').each(function () {
if (!$(this).prop('disabled')) {
$(this).addClass('dwtd');
}
});
$('input,select').prop('disabled', true);
// Set position
position();
$(window).bind('resize.dw', position);
}
// Events
dw.delegate('.dwwl', 'DOMMouseScroll mousewheel', function (e) {
if (!isReadOnly(this)) {
e.preventDefault();
e = e.originalEvent;
var delta = e.wheelDelta ? (e.wheelDelta / 120) : (e.detail ? (-e.detail / 3) : 0),
t = $('ul', this),
p = +t.data('pos'),
val = Math.round(p - delta);
setGlobals(t);
calc(t, val, delta < 0 ? 1 : 2);
}
}).delegate('.dwb, .dwwb', START_EVENT, function (e) {
// Active button
$(this).addClass('dwb-a');
}).delegate('.dwwb', START_EVENT, function (e) {
var w = $(this).closest('.dwwl');
if (!isReadOnly(w) && !w.hasClass('dwa')) {
// + Button
e.preventDefault();
e.stopPropagation();
var t = w.find('ul'),
func = $(this).hasClass('dwwbp') ? plus : minus;
click = true;
setGlobals(t);
clearInterval(timer);
timer = setInterval(function () { func(t); }, s.delay);
func(t);
}
}).delegate('.dwwl', START_EVENT, function (e) {
// Prevent scroll
e.preventDefault();
// Scroll start
if (!move && !isReadOnly(this) && !click && s.mode != 'clickpick') {
move = true;
target = $('ul', this);
target.closest('.dwwl').addClass('dwa');
pos = +target.data('pos');
setGlobals(target);
moved = iv[index] !== undefined; // Don't allow tap, if still moving
start = getY(e);
startTime = new Date();
stop = start;
that.scroll(target, index, pos);
}
});
event('onShow', [dw, v]);
// Theme init
theme.init(dw, that);
};
/**
* Scroller initialization.
*/
that.init = function (ss) {
// Get theme defaults
theme = extend({ defaults: {}, init: empty }, ms.themes[ss.theme || s.theme]);
// Get language defaults
lang = ms.i18n[ss.lang || s.lang];
extend(settings, ss); // Update original user settings
extend(s, theme.defaults, lang, settings);
that.settings = s;
// Unbind all events (if re-init)
elm.unbind('.dw');
var preset = ms.presets[s.preset];
if (preset) {
pres = preset.call(e, that);
extend(s, pres, settings); // Load preset settings
extend(methods, pres.methods); // Extend core methods
}
// Set private members
m = Math.floor(s.rows / 2);
hi = s.height;
if (elm.data('dwro') !== undefined) {
e.readOnly = bool(elm.data('dwro'));
}
if (visible) {
that.hide();
}
if (s.display == 'inline') {
that.show();
} else {
read();
if (input && s.showOnFocus) {
// Set element readonly, save original state
elm.data('dwro', e.readOnly);
e.readOnly = true;
// Init show datewheel
elm.bind('focus.dw', function () { that.show(); });
}
}
};
that.values = null;
that.val = null;
that.temp = null;
that.init(settings);
}
function testProps(props) {
var i;
for (i in props) {
if (mod[props[i]] !== undefined) {
return true;
}
}
return false;
}
function testPrefix() {
var prefixes = ['Webkit', 'Moz', 'O', 'ms'],
p;
for (p in prefixes) {
if (testProps([prefixes[p] + 'Transform'])) {
return '-' + prefixes[p].toLowerCase();
}
}
return '';
}
function getInst(e) {
return scrollers[e.id];
}
function getY(e) {
var org = e.originalEvent,
ct = e.changedTouches;
return ct || (org && org.changedTouches) ? (org ? org.changedTouches[0].pageY : ct[0].pageY) : e.pageY;
}
function bool(v) {
return (v === true || v == 'true');
}
function constrain(val, min, max) {
val = val > max ? max : val;
val = val < min ? min : val;
return val;
}
function calc(t, val, dir, anim, orig) {
val = constrain(val, min, max);
var cell = $('li', t).eq(val),
idx = index,
time = anim ? (val == orig ? 0.1 : Math.abs((val - orig) * 0.1)) : 0;
inst.scroll(t, idx, val, time, orig, function() {
// Set selected scroller value
inst.temp[idx] = cell.attr('data-val');
// Validate on animation end
inst.validate(idx, dir);
});
}
function init(that, method, args) {
if (methods[method]) {
return methods[method].apply(that, Array.prototype.slice.call(args, 1));
}
if (typeof method === 'object') {
return methods.init.call(that, method);
}
return that;
}
var scrollers = {},
timer,
empty = function () { },
h,
min,
max,
inst, // Current instance
date = new Date(),
uuid = date.getTime(),
move,
click,
target,
index,
start,
stop,
startTime,
pos,
moved,
mod = document.createElement('modernizr').style,
has3d = testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']),
prefix = testPrefix(),
extend = $.extend,
START_EVENT = 'touchstart mousedown',
MOVE_EVENT = 'touchmove mousemove',
END_EVENT = 'touchend mouseup',
defaults = {
// Options
width: 70,
height: 40,
rows: 3,
delay: 300,
disabled: false,
readonly: false,
showOnFocus: true,
showLabel: true,
wheels: [],
theme: '',
headerText: '{value}',
display: 'modal',
mode: 'scroller',
preset: '',
lang: 'en-US',
setText: 'Set',
cancelText: 'Cancel',
scrollLock: true,
formatResult: function (d) {
return d.join(' ');
},
parseValue: function (value, inst) {
var w = inst.settings.wheels,
val = value.split(' '),
ret = [],
j = 0,
i,
l,
v;
for (i = 0; i < w.length; i++) {
for (l in w[i]) {
if (w[i][l][val[j]] !== undefined) {
ret.push(val[j]);
} else {
for (v in w[i][l]) { // Select first value from wheel
ret.push(v);
break;
}
}
j++;
}
}
return ret;
}
},
methods = {
init: function (options) {
if (options === undefined) {
options = {};
}
return this.each(function () {
if (!this.id) {
uuid += 1;
this.id = 'scoller' + uuid;
}
scrollers[this.id] = new Scroller(this, options);
});
},
enable: function () {
return this.each(function () {
var inst = getInst(this);
if (inst) {
inst.enable();
}
});
},
disable: function () {
return this.each(function () {
var inst = getInst(this);
if (inst) {
inst.disable();
}
});
},
isDisabled: function () {
var inst = getInst(this[0]);
if (inst) {
return inst.settings.disabled;
}
},
option: function (option, value) {
return this.each(function () {
var inst = getInst(this);
if (inst) {
var obj = {};
if (typeof option === 'object') {
obj = option;
} else {
obj[option] = value;
}
inst.init(obj);
}
});
},
setValue: function (d, fill, time, temp) {
return this.each(function () {
var inst = getInst(this);
if (inst) {
inst.temp = d;
inst.setValue(true, fill, time, temp);
}
});
},
getInst: function () {
return getInst(this[0]);
},
getValue: function () {
var inst = getInst(this[0]);
if (inst) {
return inst.values;
}
},
show: function () {
var inst = getInst(this[0]);
if (inst) {
return inst.show();
}
},
hide: function () {
return this.each(function () {
var inst = getInst(this);
if (inst) {
inst.hide();
}
});
},
destroy: function () {
return this.each(function () {
var inst = getInst(this);
if (inst) {
inst.hide();
$(this).unbind('.dw');
delete scrollers[this.id];
if ($(this).is('input')) {
this.readOnly = bool($(this).data('dwro'));
}
}
});
}
};
$(document).bind(MOVE_EVENT, function (e) {
if (move) {
e.preventDefault();
stop = getY(e);
inst.scroll(target, index, constrain(pos + (start - stop) / h, min - 1, max + 1));
moved = true;
}
});
$(document).bind(END_EVENT, function (e) {
if (move) {
e.preventDefault();
var time = new Date() - startTime,
val = constrain(pos + (start - stop) / h, min - 1, max + 1),
speed,
dist,
tindex,
ttop = target.offset().top;
if (time < 300) {
speed = (stop - start) / time;
dist = (speed * speed) / (2 * 0.0006);
if (stop - start < 0) {
dist = -dist;
}
} else {
dist = stop - start;
}
if (!dist && !moved) { // this is a "tap"
tindex = Math.floor((stop - ttop) / h);
var li = $('li', target).eq(tindex)
li.addClass('dw-hl'); // Highlight
setTimeout(function() {
li.removeClass('dw-hl');
}, 200);
} else {
tindex = Math.round(pos - dist / h);
}
calc(target, tindex, 0, true, Math.round(val));
move = false;
target = null;
}
if (click) {
clearInterval(timer);
click = false;
}
$('.dwb-a').removeClass('dwb-a');
});
$.fn.mobiscroll = function (method) {
extend(this, $.mobiscroll.shorts);
return init(this, method, arguments);
};
$.mobiscroll = $.mobiscroll || {
/**
* Set settings for all instances.
* @param {Object} o - New default settings.
*/
setDefaults: function (o) {
extend(defaults, o);
},
presetShort: function(name) {
this.shorts[name] = function(method) {
return init(this, extend(method, { preset: name }), arguments);
};
},
shorts: {},
presets: {},
themes: {},
i18n: {}
};
$.scroller = $.scroller || $.mobiscroll;
$.fn.scroller = $.fn.scroller || $.fn.mobiscroll;
})(jQuery);
; FI"dependency_digest; F"%46d6b50309384823ee0c202c9e4dca74I"required_paths; F[I"/Users/patricknegri/.rvm/gems/ruby-1.9.2-p290/gems/iugu-ux-0.9.2/vendor/assets/javascripts/vendor/mobiscroll.core-2.3.1.js; FI"dependency_paths; F[{I" path; FI"/Users/patricknegri/.rvm/gems/ruby-1.9.2-p290/gems/iugu-ux-0.9.2/vendor/assets/javascripts/vendor/mobiscroll.core-2.3.1.js; FI"
mtime; FI"2013-01-17T19:18:49-02:00; FI"digest; F"%7144536e7418152ed70354fbb186becdI"
_version; F"%6776f581a4329e299531e1d52aa59832