diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/off.png b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/off.png
new file mode 100644
index 0000000..f414051
Binary files /dev/null and b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/off.png differ
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/on.png b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/on.png
new file mode 100644
index 0000000..94425e5
Binary files /dev/null and b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/on.png differ
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider.png b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider.png
new file mode 100644
index 0000000..80e05ff
Binary files /dev/null and b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider.png differ
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_center.png b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_center.png
new file mode 100644
index 0000000..310fc8c
Binary files /dev/null and b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_center.png differ
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_left.png b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_left.png
new file mode 100644
index 0000000..51576ce
Binary files /dev/null and b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_left.png differ
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_right.png b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_right.png
new file mode 100644
index 0000000..447d94a
Binary files /dev/null and b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/ios-style-checkboxes/slider_right.png differ
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/iphone-style-checkboxes b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/iphone-style-checkboxes
new file mode 120000
index 0000000..253829e
--- /dev/null
+++ b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/images/iphone-style-checkboxes
@@ -0,0 +1 @@
+ios-style-checkboxes
\ No newline at end of file
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.css b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.css
index 238f8f0..6768f5e 100644
--- a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.css
+++ b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.css
@@ -1,4 +1,5 @@
.iPhoneCheckContainer {
+ -webkit-transform:translate3d(0,0,0);
position: relative;
height: 27px;
cursor: pointer;
@@ -7,16 +8,14 @@
position: absolute;
top: 5px;
left: 30px;
- opacity: 0;
- -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); }
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
+ opacity: 0; }
.iPhoneCheckContainer label {
white-space: nowrap;
font-size: 17px;
line-height: 17px;
font-weight: bold;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
- text-transform: uppercase;
cursor: pointer;
display: block;
height: 27px;
@@ -31,13 +30,12 @@
-khtml-user-select: none; }
.iPhoneCheckDisabled {
- opacity: 0.5;
- -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); }
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
+ opacity: 0.5; }
label.iPhoneCheckLabelOn {
color: white;
- background: url('/img/iphone-style-checkboxes/on.png?1282083753') no-repeat;
+ background: url('images/iphone-style-checkboxes/on.png?1284697268') no-repeat;
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
left: 0;
padding-top: 5px; }
@@ -45,7 +43,7 @@ label.iPhoneCheckLabelOn {
padding-left: 8px; }
label.iPhoneCheckLabelOff {
color: #8b8b8b;
- background: url('/img/iphone-style-checkboxes/off.png?1282083753') no-repeat right 0;
+ background: url('images/iphone-style-checkboxes/off.png?1284697268') no-repeat right 0;
text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
text-align: right;
right: 0; }
@@ -60,16 +58,89 @@ label.iPhoneCheckLabelOff {
top: 0;
left: 0;
width: 0;
- background: url('/img/iphone-style-checkboxes/slider_left.png?1282083753') no-repeat;
+ background: url('images/iphone-style-checkboxes/slider_left.png?1284697268') no-repeat;
padding-left: 3px; }
.iPhoneCheckHandleRight {
height: 100%;
width: 100%;
padding-right: 3px;
- background: url('/img/iphone-style-checkboxes/slider_right.png?1282083753') no-repeat right 0; }
+ background: url('images/iphone-style-checkboxes/slider_right.png?1284697268') no-repeat right 0; }
.iPhoneCheckHandleCenter {
height: 100%;
width: 100%;
- background: url('/img/iphone-style-checkboxes/slider_center.png?1282083753'); }
+ background: url('images/iphone-style-checkboxes/slider_center.png?1284697268'); }
+
+.iOSCheckContainer {
+ position: relative;
+ height: 27px;
+ cursor: pointer;
+ overflow: hidden; }
+ .iOSCheckContainer input {
+ position: absolute;
+ top: 5px;
+ left: 30px;
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
+ opacity: 0; }
+ .iOSCheckContainer label {
+ white-space: nowrap;
+ font-size: 17px;
+ line-height: 17px;
+ font-weight: bold;
+ font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
+ cursor: pointer;
+ display: block;
+ height: 27px;
+ position: absolute;
+ width: auto;
+ top: 0;
+ padding-top: 5px;
+ overflow: hidden; }
+ .iOSCheckContainer, .iOSCheckContainer label {
+ user-select: none;
+ -moz-user-select: none;
+ -khtml-user-select: none; }
+
+.iOSCheckDisabled {
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
+ opacity: 0.5; }
+
+label.iOSCheckLabelOn {
+ color: white;
+ background: url('images/ios-style-checkboxes/on.png?1284697268') no-repeat;
+ text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
+ left: 0;
+ padding-top: 5px; }
+ label.iOSCheckLabelOn span {
+ padding-left: 8px; }
+label.iOSCheckLabelOff {
+ color: #8b8b8b;
+ background: url('images/ios-style-checkboxes/off.png?1284697268') no-repeat right 0;
+ text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
+ text-align: right;
+ right: 0; }
+ label.iOSCheckLabelOff span {
+ padding-right: 8px; }
+
+.iOSCheckHandle {
+ display: block;
+ height: 27px;
+ cursor: pointer;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 0;
+ background: url('images/ios-style-checkboxes/slider_left.png?1284697268') no-repeat;
+ padding-left: 3px; }
+
+.iOSCheckHandleRight {
+ height: 100%;
+ width: 100%;
+ padding-right: 3px;
+ background: url('images/ios-style-checkboxes/slider_right.png?1284697268') no-repeat right 0; }
+
+.iOSCheckHandleCenter {
+ height: 100%;
+ width: 100%;
+ background: url('images/ios-style-checkboxes/slider_center.png?1284697268'); }
diff --git a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.js b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.js
index 14a9beb..3559614 100644
--- a/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.js
+++ b/webif/html/lib/jquery.plugin/iphone-style-checkboxes/iphone-style-checkboxes.js
@@ -1,231 +1,350 @@
-/*!
-// iPhone-style Checkboxes jQuery plugin
-// Copyright Thomas Reynolds, licensed GPL & MIT
-*/
-;(function($, iphoneStyle) {
+// Generated by CoffeeScript 1.6.2
+(function() {
+ var iOSCheckbox, matched, userAgent,
+ __slice = [].slice;
-// Constructor
-$[iphoneStyle] = function(elem, options) {
- this.$elem = $(elem);
-
- // Import options into instance variables
- var obj = this;
- $.each(options, function(key, value) {
- obj[key] = value;
- });
-
- // Initialize the control
- this.wrapCheckboxWithDivs();
- this.attachEvents();
- this.disableTextSelection();
-
- if (this.resizeHandle) { this.optionallyResize('handle'); }
- if (this.resizeContainer) { this.optionallyResize('container'); }
-
- this.initialPosition();
-};
+ if ($.browser == null) {
+ userAgent = navigator.userAgent || "";
+ jQuery.uaMatch = function(ua) {
+ var match;
-$.extend($[iphoneStyle].prototype, {
- // Wrap the existing input[type=checkbox] with divs for styling and grab DOM references to the created nodes
- wrapCheckboxWithDivs: function() {
- this.$elem.wrap('
');
- this.container = this.$elem.parent();
-
- this.offLabel = $('').appendTo(this.container);
- this.offSpan = this.offLabel.children('span');
-
- this.onLabel = $('').appendTo(this.container);
- this.onSpan = this.onLabel.children('span');
-
- this.handle = $('').appendTo(this.container);
- },
-
- // Disable IE text selection, other browsers are handled in CSS
- disableTextSelection: function() {
- return;
-// if (!$.browser.msie) { return; }
-
- // Elements containing text should be unselectable
- $.each([this.handle, this.offLabel, this.onLabel, this.container], function() {
- $(this).attr("unselectable", "on");
- });
- },
-
- // Automatically resize the handle or container
- optionallyResize: function(mode) {
- var onLabelWidth = this.onLabel.width(),
- offLabelWidth = this.offLabel.width();
-
- if (mode == 'container') {
- var newWidth = (onLabelWidth > offLabelWidth) ? onLabelWidth : offLabelWidth;
- newWidth += this.handle.width() + 15;
- } else {
- var newWidth = (onLabelWidth < offLabelWidth) ? onLabelWidth : offLabelWidth;
+ ua = ua.toLowerCase();
+ match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(ua) || [];
+ return {
+ browser: match[1] || "",
+ version: match[2] || "0"
+ };
+ };
+ matched = jQuery.uaMatch(userAgent);
+ jQuery.browser = {};
+ if (matched.browser) {
+ jQuery.browser[matched.browser] = true;
+ jQuery.browser.version = matched.version;
}
-
- this[mode].css({ width: newWidth });
- },
-
- attachEvents: function() {
- var obj = this;
-
- // A mousedown anywhere in the control will start tracking for dragging
- this.container
- .bind('mousedown touchstart', function(event) {
- event.preventDefault();
-
- if (obj.$elem.is(':disabled')) { return; }
-
- var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
- $[iphoneStyle].currentlyClicking = obj.handle;
- $[iphoneStyle].dragStartPosition = x;
- $[iphoneStyle].handleLeftOffset = parseInt(obj.handle.css('left'), 10) || 0;
- $[iphoneStyle].dragStartedOn = obj.$elem;
- })
-
- // Utilize event bubbling to handle drag on any element beneath the container
- .bind('iPhoneDrag', function(event, x) {
- event.preventDefault();
-
- if (obj.$elem.is(':disabled')) { return; }
- if (obj.$elem != $[iphoneStyle].dragStartedOn) { return; }
-
- var p = (x + $[iphoneStyle].handleLeftOffset - $[iphoneStyle].dragStartPosition) / obj.rightSide;
- if (p < 0) { p = 0; }
- if (p > 1) { p = 1; }
- obj.handle.css({ left: p * obj.rightSide });
- obj.onLabel.css({ width: p * obj.rightSide + 4 });
- obj.offSpan.css({ marginRight: -p * obj.rightSide });
- obj.onSpan.css({ marginLeft: -(1 - p) * obj.rightSide });
- })
-
- // Utilize event bubbling to handle drag end on any element beneath the container
- .bind('iPhoneDragEnd', function(event, x) {
- if (obj.$elem.is(':disabled')) { return; }
-
- var checked;
- if ($[iphoneStyle].dragging) {
- var p = (x - $[iphoneStyle].dragStartPosition) / obj.rightSide;
- checked = (p < 0) ? Math.abs(p) < 0.5 : p >= 0.5;
- } else {
- checked = !obj.$elem.prop('checked');
- }
-
- obj.$elem.prop('checked', checked);
+ if (jQuery.browser.webkit) {
+ jQuery.browser.safari = true;
+ }
+ }
- $[iphoneStyle].currentlyClicking = null;
- $[iphoneStyle].dragging = null;
- obj.$elem.change();
+ iOSCheckbox = (function() {
+ function iOSCheckbox(elem, options) {
+ var key, opts, value;
+
+ this.elem = $(elem);
+ opts = $.extend({}, iOSCheckbox.defaults, options);
+ for (key in opts) {
+ value = opts[key];
+ this[key] = value;
+ }
+ this.elem.data(this.dataName, this);
+ this.wrapCheckboxWithDivs();
+ this.attachEvents();
+ this.disableTextSelection();
+ this.calculateDimensions();
+ }
+
+ iOSCheckbox.prototype.calculateDimensions = function() {
+ if (this.resizeHandle) {
+ this.optionallyResize('handle');
+ }
+ if (this.resizeContainer) {
+ this.optionallyResize('container');
+ }
+ return this.initialPosition();
+ };
+
+ iOSCheckbox.prototype.isDisabled = function() {
+ return this.elem.is(':disabled');
+ };
+
+ iOSCheckbox.prototype.wrapCheckboxWithDivs = function() {
+ this.elem.wrap("");
+ this.container = this.elem.parent();
+ this.offLabel = $("").appendTo(this.container);
+ this.offSpan = this.offLabel.children('span');
+ this.onLabel = $("").appendTo(this.container);
+ this.onSpan = this.onLabel.children('span');
+ return this.handle = $("").appendTo(this.container);
+ };
+
+ iOSCheckbox.prototype.disableTextSelection = function() {
+ if ($.browser.msie) {
+ return $([this.handle, this.offLabel, this.onLabel, this.container]).attr("unselectable", "on");
+ }
+ };
+
+ iOSCheckbox.prototype._getDimension = function(elem, dimension) {
+ if ($.fn.actual != null) {
+ return elem.actual(dimension);
+ } else {
+ return elem[dimension]();
+ }
+ };
+
+ iOSCheckbox.prototype.optionallyResize = function(mode) {
+ var newWidth, offLabelWidth, offSpan, onLabelWidth, onSpan;
+
+ onSpan = this.onLabel.find('span');
+ onLabelWidth = this._getDimension(onSpan, "width");
+ onLabelWidth += parseInt(onSpan.css('padding-left'), 10);
+ offSpan = this.offLabel.find('span');
+ offLabelWidth = this._getDimension(offSpan, "width");
+ offLabelWidth += parseInt(offSpan.css('padding-right'), 10);
+ if (mode === "container") {
+ newWidth = onLabelWidth > offLabelWidth ? onLabelWidth : offLabelWidth;
+ newWidth += this._getDimension(this.handle, "width") + this.handleMargin;
+ return this.container.css({
+ width: newWidth
+ });
+ } else {
+ newWidth = onLabelWidth > offLabelWidth ? onLabelWidth : offLabelWidth;
+ return this.handle.css({
+ width: newWidth
+ });
+ }
+ };
+
+ iOSCheckbox.prototype.onMouseDown = function(event) {
+ var x;
+
+ event.preventDefault();
+ if (this.isDisabled()) {
+ return;
+ }
+ x = event.pageX || event.originalEvent.changedTouches[0].pageX;
+ iOSCheckbox.currentlyClicking = this.handle;
+ iOSCheckbox.dragStartPosition = x;
+ return iOSCheckbox.handleLeftOffset = parseInt(this.handle.css('left'), 10) || 0;
+ };
+
+ iOSCheckbox.prototype.onDragMove = function(event, x) {
+ var newWidth, p;
+
+ if (iOSCheckbox.currentlyClicking !== this.handle) {
+ return;
+ }
+ p = (x + iOSCheckbox.handleLeftOffset - iOSCheckbox.dragStartPosition) / this.rightSide;
+ if (p < 0) {
+ p = 0;
+ }
+ if (p > 1) {
+ p = 1;
+ }
+ newWidth = p * this.rightSide;
+ this.handle.css({
+ left: newWidth
});
-
- // Animate when we get a change event
- this.$elem.change(function() {
- if (obj.$elem.is(':disabled')) {
- obj.container.addClass(obj.disabledClass);
+ this.onLabel.css({
+ width: newWidth + this.handleRadius
+ });
+ this.offSpan.css({
+ marginRight: -newWidth
+ });
+ return this.onSpan.css({
+ marginLeft: -(1 - p) * this.rightSide
+ });
+ };
+
+ iOSCheckbox.prototype.onDragEnd = function(event, x) {
+ var p;
+
+ if (iOSCheckbox.currentlyClicking !== this.handle) {
+ return;
+ }
+ if (this.isDisabled()) {
+ return;
+ }
+ if (iOSCheckbox.dragging) {
+ p = (x - iOSCheckbox.dragStartPosition) / this.rightSide;
+ this.elem.prop('checked', p >= 0.5);
+ } else {
+ this.elem.prop('checked', !this.elem.prop('checked'));
+ }
+ iOSCheckbox.currentlyClicking = null;
+ iOSCheckbox.dragging = null;
+ return this.didChange();
+ };
+
+ iOSCheckbox.prototype.refresh = function() {
+ return this.didChange();
+ };
+
+ iOSCheckbox.prototype.didChange = function() {
+ var new_left;
+
+ if (typeof this.onChange === "function") {
+ this.onChange(this.elem, this.elem.prop('checked'));
+ }
+ if (this.isDisabled()) {
+ this.container.addClass(this.disabledClass);
return false;
} else {
- obj.container.removeClass(obj.disabledClass);
+ this.container.removeClass(this.disabledClass);
}
-
- var new_left = obj.$elem.prop('checked') ? obj.rightSide : 0;
+ new_left = this.elem.prop('checked') ? this.rightSide : 0;
+ this.handle.animate({
+ left: new_left
+ }, this.duration);
+ this.onLabel.animate({
+ width: new_left + this.handleRadius
+ }, this.duration);
+ this.offSpan.animate({
+ marginRight: -new_left
+ }, this.duration);
+ return this.onSpan.animate({
+ marginLeft: new_left - this.rightSide
+ }, this.duration);
+ };
- obj.handle.animate({ left: new_left }, obj.duration);
- obj.onLabel.animate({ width: new_left + 4 }, obj.duration);
- obj.offSpan.animate({ marginRight: -new_left }, obj.duration);
- obj.onSpan.animate({ marginLeft: new_left - obj.rightSide }, obj.duration);
- });
- },
-
- // Setup the control's inital position
- initialPosition: function() {
- this.offLabel.css({ width: this.container.width() - 5 });
+ iOSCheckbox.prototype.attachEvents = function() {
+ var localMouseMove, localMouseUp, self;
-// var offset = ($.browser.msie && $.browser.version < 7) ? 3 : 6;
- var offset = 6;
- this.rightSide = this.container.width() - this.handle.width() - offset;
-
- if (this.$elem.is(':checked')) {
- this.handle.css({ left: this.rightSide });
- this.onLabel.css({ width: this.rightSide + 4 });
- this.offSpan.css({ marginRight: -this.rightSide });
- } else {
- this.onLabel.css({ width: 0 });
- this.onSpan.css({ marginLeft: -this.rightSide });
- }
-
- if (this.$elem.is(':disabled')) {
- this.container.addClass(this.disabledClass);
- }
- }
-});
-
-// jQuery-specific code
-$.fn[iphoneStyle] = function(options) {
- var checkboxes = this.filter(':checkbox');
-
- // Fail early if we don't have any checkboxes passed in
- if (!checkboxes.length) { return this; }
-
- // Merge options passed in with global defaults
- var opt = $.extend({}, $[iphoneStyle].defaults, options);
-
- checkboxes.each(function() {
- $(this).data(iphoneStyle, new $[iphoneStyle](this, opt));
- });
-
- if (!$[iphoneStyle].initComplete) {
- // As the mouse moves on the page, animate if we are in a drag state
- $(document)
- .bind('mousemove touchmove', function(event) {
- if (!$[iphoneStyle].currentlyClicking) { return; }
- event.preventDefault();
-
- var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
- if (!$[iphoneStyle].dragging &&
- (Math.abs($[iphoneStyle].dragStartPosition - x) > opt.dragThreshold)) {
- $[iphoneStyle].dragging = true;
- }
-
- $(event.target).trigger('iPhoneDrag', [x]);
- })
-
- // When the mouse comes up, leave drag state
- .bind('mouseup touchend', function(event) {
- if (!$[iphoneStyle].currentlyClicking) { return; }
- event.preventDefault();
-
- var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
- $($[iphoneStyle].currentlyClicking).trigger('iPhoneDragEnd', [x]);
+ self = this;
+ localMouseMove = function(event) {
+ return self.onGlobalMove.apply(self, arguments);
+ };
+ localMouseUp = function(event) {
+ self.onGlobalUp.apply(self, arguments);
+ $(document).unbind('mousemove touchmove', localMouseMove);
+ return $(document).unbind('mouseup touchend', localMouseUp);
+ };
+ this.elem.change(function() {
+ return self.refresh();
});
-
- $[iphoneStyle].initComplete = true;
- }
-
- return this;
-}; // End of $.fn[iphoneStyle]
+ return this.container.bind('mousedown touchstart', function(event) {
+ self.onMouseDown.apply(self, arguments);
+ $(document).bind('mousemove touchmove', localMouseMove);
+ return $(document).bind('mouseup touchend', localMouseUp);
+ });
+ };
-$[iphoneStyle].defaults = {
- duration: 200, // Time spent during slide animation
- checkedLabel: 'ON', // Text content of "on" state
- uncheckedLabel: 'OFF', // Text content of "off" state
- resizeHandle: true, // Automatically resize the handle to cover either label
- resizeContainer: true, // Automatically resize the widget to contain the labels
- disabledClass: 'iPhoneCheckDisabled',
- containerClass: 'iPhoneCheckContainer',
- labelOnClass: 'iPhoneCheckLabelOn',
- labelOffClass: 'iPhoneCheckLabelOff',
- handleClass: 'iPhoneCheckHandle',
- handleCenterClass: 'iPhoneCheckHandleCenter',
- handleRightClass: 'iPhoneCheckHandleRight',
- dragThreshold: 5 // Pixels that must be dragged for a click to be ignored
-};
+ iOSCheckbox.prototype.initialPosition = function() {
+ var containerWidth, offset;
-})(jQuery, 'iphoneStyle');
+ containerWidth = this._getDimension(this.container, "width");
+ this.offLabel.css({
+ width: containerWidth - this.containerRadius
+ });
+ offset = this.containerRadius + 1;
+ if ($.browser.msie && $.browser.version < 7) {
+ offset -= 3;
+ }
+ this.rightSide = containerWidth - this._getDimension(this.handle, "width") - offset;
+ if (this.elem.is(':checked')) {
+ this.handle.css({
+ left: this.rightSide
+ });
+ this.onLabel.css({
+ width: this.rightSide + this.handleRadius
+ });
+ this.offSpan.css({
+ marginRight: -this.rightSide
+ });
+ } else {
+ this.onLabel.css({
+ width: 0
+ });
+ this.onSpan.css({
+ marginLeft: -this.rightSide
+ });
+ }
+ if (this.isDisabled()) {
+ return this.container.addClass(this.disabledClass);
+ }
+ };
+
+ iOSCheckbox.prototype.onGlobalMove = function(event) {
+ var x;
+
+ if (!(!this.isDisabled() && iOSCheckbox.currentlyClicking)) {
+ return;
+ }
+ event.preventDefault();
+ x = event.pageX || event.originalEvent.changedTouches[0].pageX;
+ if (!iOSCheckbox.dragging && (Math.abs(iOSCheckbox.dragStartPosition - x) > this.dragThreshold)) {
+ iOSCheckbox.dragging = true;
+ }
+ return this.onDragMove(event, x);
+ };
+
+ iOSCheckbox.prototype.onGlobalUp = function(event) {
+ var x;
+
+ if (!iOSCheckbox.currentlyClicking) {
+ return;
+ }
+ event.preventDefault();
+ x = event.pageX || event.originalEvent.changedTouches[0].pageX;
+ this.onDragEnd(event, x);
+ return false;
+ };
+
+ iOSCheckbox.defaults = {
+ duration: 200,
+ checkedLabel: 'ON',
+ uncheckedLabel: 'OFF',
+ resizeHandle: true,
+ resizeContainer: true,
+ disabledClass: 'iPhoneCheckDisabled',
+ containerClass: 'iPhoneCheckContainer',
+ labelOnClass: 'iPhoneCheckLabelOn',
+ labelOffClass: 'iPhoneCheckLabelOff',
+ handleClass: 'iPhoneCheckHandle',
+ handleCenterClass: 'iPhoneCheckHandleCenter',
+ handleRightClass: 'iPhoneCheckHandleRight',
+ dragThreshold: 5,
+ handleMargin: 15,
+ handleRadius: 4,
+ containerRadius: 5,
+ dataName: "iphoneStyle",
+ onChange: function() {}
+ };
+
+ return iOSCheckbox;
+
+ })();
+
+ $.iphoneStyle = this.iOSCheckbox = iOSCheckbox;
+
+ $.fn.iphoneStyle = function() {
+ var args, checkbox, dataName, existingControl, method, params, _i, _len, _ref, _ref1, _ref2, _ref3;
+
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ dataName = (_ref = (_ref1 = args[0]) != null ? _ref1.dataName : void 0) != null ? _ref : iOSCheckbox.defaults.dataName;
+ _ref2 = this.filter(':checkbox');
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ checkbox = _ref2[_i];
+ existingControl = $(checkbox).data(dataName);
+ if (existingControl != null) {
+ method = args[0], params = 2 <= args.length ? __slice.call(args, 1) : [];
+ if ((_ref3 = existingControl[method]) != null) {
+ _ref3.apply(existingControl, params);
+ }
+ } else {
+ new iOSCheckbox(checkbox, args[0]);
+ }
+ }
+ return this;
+ };
+
+ $.fn.iOSCheckbox = function(options) {
+ var opts;
+
+ if (options == null) {
+ options = {};
+ }
+ opts = $.extend({}, options, {
+ resizeHandle: false,
+ disabledClass: 'iOSCheckDisabled',
+ containerClass: 'iOSCheckContainer',
+ labelOnClass: 'iOSCheckLabelOn',
+ labelOffClass: 'iOSCheckLabelOff',
+ handleClass: 'iOSCheckHandle',
+ handleCenterClass: 'iOSCheckHandleCenter',
+ handleRightClass: 'iOSCheckHandleRight',
+ dataName: 'iOSCheckbox'
+ });
+ return this.iphoneStyle(opts);
+ };
+
+}).call(this);