From c8c1af84e4b90b4aea31466aad09bf877619e943 Mon Sep 17 00:00:00 2001 From: Damir Sultanov Date: Fri, 9 Oct 2020 14:41:24 +0300 Subject: [PATCH] iOS 13 support, fixes #424, fixes #419 --- CHANGELOG.md | 5 ++++- README.md | 16 +++++++++++----- bower.json | 2 +- demo/index.html | 10 +++++----- icheck.jquery.json | 2 +- icheck.js | 2 +- icheck.min.js | 12 ++++++------ 7 files changed, 29 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d99580..7bc8535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.3] - 2020-10-10 +### Added +- iOS 13 support @markusbroman + ### Changed -- Reformatted changelog +- Reformatted changelog @lasseeee ### Fixed - Fire change event when toggled @rafatmyo diff --git a/README.md b/README.md index 9a1d234..165aaf8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [iCheck plugin](http://fronteed.com/iCheck/) [1.0.2](#march-03-2014) +# [iCheck plugin](http://fronteed.com/iCheck/) [1.0.3](#october-10-2020) #### Highly customizable checkboxes and radio buttons for jQuery and Zepto. Refer to the [iCheck website](http://fronteed.com/iCheck/) for examples. @@ -366,6 +366,12 @@ Mobile browsers (like Opera mini, Chrome mobile, Safari mobile, Android browser, Changelog --------------- +## October 10, 2020 + +* iOS 13 support @markusbroman +* Reformatted changelog @lasseeee +* Fire change event when toggled @rafatmyo + ### March 03, 2014 * Better HiDPI screens support @ddctd143 @@ -385,12 +391,12 @@ Changelog * Ability to switch off some of the callbacks when you don't need them (global or per input) * Inline styles dropped - iCheck won't add any inline styles to the elements until it's highly needed (`cursor` or `area` option) * Fast click support - removes a 300ms click delay on mobile devices without any dependencies (iCheck compatible with the `fastclick` plugin), see the `tap` option -* Ability to ignore customization for the selected inputs using `init` option (if set to `false`) +* Ability to ignore customization for the selected inputs using `init` option (if set to `false`) * Optimized event bindings - iCheck binds only a few global events for the all inputs (doesn't increase on elements addition), instead of a couple for the each customized element -* Doesn't store tons of arbitrary data (event in jQuery or Zepto cache), defines customized elements by specific classnames +* Doesn't store tons of arbitrary data (event in jQuery or Zepto cache), defines customized elements by specific classnames * Extra `ins` tag is dropped (less DOM modifications), iCheck wraps each input with a single `div` and doesn't use any extra markup for the any option -* Optimized reflows and repaints on init and state changes -* Better options handling - iCheck will never run a single line of JS to process an options that are off or empty +* Optimized reflows and repaints on init and state changes +* Better options handling - iCheck will never run a single line of JS to process an options that are off or empty * Ability to auto customize the ajax loaded inputs without using any extra code (`autoAjax` option, on by default) * Auto inits on domready using the specified selector (`autoInit` option) - searches for `.icheck` by default. Classnames can be changed using the `window.classes` object * Memory usage optimization - uses only a few amount of memory (works well on low-memory devices) diff --git a/bower.json b/bower.json index a2b8288..bf6d635 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "iCheck", - "version": "1.0.2", + "version": "1.0.3", "description": "Highly customizable checkboxes and radio buttons (jQuery & Zepto)", "keywords": [ "icheck", diff --git a/demo/index.html b/demo/index.html index 9d53bb5..44986ee 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,17 +4,17 @@ Checkboxes and radio buttons customization (jQuery and Zepto) plugin - - + + - - + +

super customized checkboxes and radio buttons for jQuery & Zepto

-

iCheck v1.0.2

+

iCheck v1.0.3

@Fronteed
diff --git a/icheck.jquery.json b/icheck.jquery.json index e7018a6..6d36334 100644 --- a/icheck.jquery.json +++ b/icheck.jquery.json @@ -1,6 +1,6 @@ { "name": "icheck", - "version": "1.0.2", + "version": "1.0.3", "title": "iCheck", "author": { "name": "Damir Sultanov", diff --git a/icheck.js b/icheck.js index 44e1dd2..ca66154 100644 --- a/icheck.js +++ b/icheck.js @@ -28,7 +28,7 @@ _callback = 'trigger', _label = 'label', _cursor = 'cursor', - _mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent); + _mobile = /ip(hone|od|ad)|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); // Plugin init $.fn[_iCheck] = function(options, fire) { diff --git a/icheck.min.js b/icheck.min.js index d88b75e..11f1e48 100644 --- a/icheck.min.js +++ b/icheck.min.js @@ -10,9 +10,9 @@ d="checked"==b,l="indeterminate"==b,t="disabled"==b,u=l?"determinate":d?"unchecked":"enabled",x=q(a,u+C(c.type)),y=q(a,b+C(c.type));if(!0!==c[b]){if(!e&&"checked"==b&&"radio"==c.type&&c.name){var z=a.closest("form"),r='input[name="'+c.name+'"]';r=z.length?z.find(r):k(r);r.each(function(){this!==c&&k(this).data("iCheck")&&v(k(this),b)})}l?(c[b]=!0,c.checked&&v(a,"checked","force")):(e||(c[b]=!0),d&&c.indeterminate&&v(a,"indeterminate",!1));I(a,d,b,e)}c.disabled&&q(a,"cursor",!0)&&f.find(".iCheck-helper").css("cursor", "default");f.addClass(y||q(a,b)||"");f.attr("role")&&!l&&f.attr("aria-"+(t?"disabled":"checked"),"true");f.removeClass(x||q(a,u)||"")}function v(a,b,e){var c=a[0],f=a.parent(),d="checked"==b,l="indeterminate"==b,t="disabled"==b,u=l?"determinate":d?"unchecked":"enabled",x=q(a,u+C(c.type)),y=q(a,b+C(c.type));if(!1!==c[b]){if(l||!e||"force"==e)c[b]=!1;I(a,d,u,e)}!c.disabled&&q(a,"cursor",!0)&&f.find(".iCheck-helper").css("cursor","pointer");f.removeClass(y||q(a,b)||"");f.attr("role")&&!l&&f.attr("aria-"+ (t?"disabled":"checked"),"false");f.addClass(x||q(a,u)||"")}function J(a,b){a.data("iCheck")&&(a.parent().html(a.attr("style",a.data("iCheck").s||"")),b&&a.trigger(b),a.off(".i").unwrap(),k('label[for="'+a[0].id+'"]').add(a.closest("label")).off(".i"))}function q(a,b,e){if(a.data("iCheck"))return a.data("iCheck").o[b+(e?"":"Class")]}function C(a){return a.charAt(0).toUpperCase()+a.slice(1)}function I(a,b,e,c){c||(b&&a.trigger("ifToggled"),a.trigger("change").trigger("ifChanged").trigger("if"+C(e)))} - var G=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);k.fn.iCheck=function(a,b){var e='input[type="checkbox"], input[type="radio"]',c=k(),f=function(g){g.each(function(){var m=k(this);c=m.is(e)?c.add(m):c.add(m.find(e))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),f(this),c.each(function(){var g=k(this);"destroy"==a?J(g,"ifDestroyed"):E(g,!0,a);k.isFunction(b)&&b()});if("object"!= - typeof a&&a)return this;var d=k.extend({checkedClass:"checked",disabledClass:"disabled",indeterminateClass:"indeterminate",labelHover:!0},a),l=d.handle,t=d.hoverClass||"hover",u=d.focusClass||"focus",x=d.activeClass||"active",y=!!d.labelHover,z=d.labelHoverClass||"hover",r=(""+d.increaseArea).replace("%","")|0;if("checkbox"==l||"radio"==l)e='input[type="'+l+'"]';-50>r&&(r=-50);f(this);return c.each(function(){var g=k(this);J(g);var m=this,H=m.id,F=-r+"%",w=100+2*r+"%";w={position:"absolute",top:F, - left:F,display:"block",width:w,height:w,margin:0,padding:0,background:"#fff",border:0,opacity:0};F=G?{position:"absolute",visibility:"hidden"}:r?w:{position:"absolute",opacity:0};var M="checkbox"==m.type?d.checkboxClass||"icheckbox":d.radioClass||"iradio",D=k('label[for="'+H+'"]').add(g.closest("label")),K=!!d.aria,L="iCheck-"+Math.random().toString(36).substr(2,6),h='
").trigger("ifCreated").parent().append(d.insert);w=k('').css(w).appendTo(h);g.data("iCheck",{o:d,s:g.attr("style")}).css(F);d.inheritClass&&h.addClass(m.className||"");d.inheritID&&H&&h.attr("id","iCheck-"+H);"static"==h.css("position")&&h.css("position","relative");E(g,!0,"update");if(D.length)D.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i",function(p){var n=p.type,A=k(this);if(!m.disabled){if("click"==n){if(k(p.target).is("a"))return; - E(g,!1,!0)}else y&&(/ut|nd/.test(n)?(h.removeClass(t),A.removeClass(z)):(h.addClass(t),A.addClass(z)));if(G)p.stopPropagation();else return!1}});g.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(p){var n=p.type;p=p.keyCode;if("click"==n)return!1;if("keydown"==n&&32==p)return"radio"==m.type&&m.checked||(m.checked?v(g,"checked"):B(g,"checked")),!1;if("keyup"==n&&"radio"==m.type)!m.checked&&B(g,"checked");else if(/us|ur/.test(n))h["blur"==n?"removeClass":"addClass"](u)});w.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i", - function(p){var n=p.type,A=/wn|up/.test(n)?x:t;if(!m.disabled){if("click"==n)E(g,!1,!0);else if(/wn|er|in/.test(n)?h.addClass(A):h.removeClass(A+" "+x),D.length&&y&&A==t)D[/ut|nd/.test(n)?"removeClass":"addClass"](z);if(G)p.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto); \ No newline at end of file + var G=/ip(hone|od|ad)|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent)||"MacIntel"===navigator.platform&&1r&&(r=-50);f(this);return c.each(function(){var g=k(this);J(g);var m= + this,H=m.id,F=-r+"%",w=100+2*r+"%";w={position:"absolute",top:F,left:F,display:"block",width:w,height:w,margin:0,padding:0,background:"#fff",border:0,opacity:0};F=G?{position:"absolute",visibility:"hidden"}:r?w:{position:"absolute",opacity:0};var M="checkbox"==m.type?d.checkboxClass||"icheckbox":d.radioClass||"iradio",D=k('label[for="'+H+'"]').add(g.closest("label")),K=!!d.aria,L="iCheck-"+Math.random().toString(36).substr(2,6),h='
").trigger("ifCreated").parent().append(d.insert);w=k('').css(w).appendTo(h);g.data("iCheck",{o:d,s:g.attr("style")}).css(F);d.inheritClass&&h.addClass(m.className||"");d.inheritID&&H&&h.attr("id","iCheck-"+H);"static"==h.css("position")&&h.css("position","relative");E(g,!0,"update");if(D.length)D.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i",function(p){var n=p.type,A=k(this); + if(!m.disabled){if("click"==n){if(k(p.target).is("a"))return;E(g,!1,!0)}else y&&(/ut|nd/.test(n)?(h.removeClass(t),A.removeClass(z)):(h.addClass(t),A.addClass(z)));if(G)p.stopPropagation();else return!1}});g.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(p){var n=p.type;p=p.keyCode;if("click"==n)return!1;if("keydown"==n&&32==p)return"radio"==m.type&&m.checked||(m.checked?v(g,"checked"):B(g,"checked")),!1;if("keyup"==n&&"radio"==m.type)!m.checked&&B(g,"checked");else if(/us|ur/.test(n))h["blur"== + n?"removeClass":"addClass"](u)});w.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i",function(p){var n=p.type,A=/wn|up/.test(n)?x:t;if(!m.disabled){if("click"==n)E(g,!1,!0);else if(/wn|er|in/.test(n)?h.addClass(A):h.removeClass(A+" "+x),D.length&&y&&A==t)D[/ut|nd/.test(n)?"removeClass":"addClass"](z);if(G)p.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto); \ No newline at end of file