Permalink
Browse files

fixing bug with default overriding explicit false on clickToClose by …

…type
  • Loading branch information...
1 parent 2aa50e2 commit 240cb644f178cdb2d4379880f82945b025c90d29 @ianmassey committed Dec 20, 2011
Showing with 3 additions and 3 deletions.
  1. +2 −2 humane.js
  2. +1 −1 humane.min.js
View
4 humane.js
@@ -70,7 +70,7 @@
off (doc.body,'keypress',remove);
off (doc.body,'touchstart',remove);
eventing = false;
- if (humane[humane.currentType].clickToClose || humane.clickToClose) {
+ if (humane[humane.currentType].clickToClose || (humane[humane.currentType].clickToClose !== false && humane.clickToClose)) {
off (humaneEl,'click',remove);
off (humaneEl, 'touchstart', remove);
}
@@ -94,7 +94,7 @@
win.humane.currentType = type;
- if (humane[type].clickToClose || humane.clickToClose) {
+ if (humane[type].clickToClose || (humane[type].clickToClose !== false && humane.clickToClose)) {
on (humaneEl,'click',remove);
on (humaneEl, 'touchstart', remove);
}
View
2 humane.min.js
@@ -9,4 +9,4 @@
* @example
* humane('hello world');
* See more usage examples at: http://wavded.github.com/humane-js/
- */(function(a,b){function p(a){return l?l+a:a.toLowerCase()}function q(){h=b.createElement("div"),h.id="humane",h.className="humane",b.body.appendChild(h);for(vendor in k)h.style[vendor+"TransitionProperty"]!==undefined&&(l=k[vendor]);m=!0}function r(){d(b.body,"mousemove",r),d(b.body,"click",r),d(b.body,"keypress",r),d(b.body,"touchstart",r),f=!1;if(humane[humane.currentType].clickToClose||humane.clickToClose)d(h,"click",r),d(h,"touchstart",r);g&&t(0)}function s(){if(g&&!a.humane.forceNew)return;if(!n.length){r();return}o=null,g=!0,i&&(clearTimeout(i),i=null);var d=n.shift(),j=d[0],k=d[1],l=d[2];a.humane.currentType=j;if(humane[j].clickToClose||humane.clickToClose)c(h,"click",r),c(h,"touchstart",r);if(a.humane[j].timeout||a.humane.timeout)i=setTimeout(function(){f||(c(b.body,"mousemove",r),c(b.body,"click",r),c(b.body,"keypress",r),c(b.body,"touchstart",r),f=!0,a.humane.waitForMove||r())},a.humane[j].timeout||a.humane.timeout);o=l,e(k)&&(k="<ul><li>"+k.join("<li>")+"</ul>"),h.innerHTML=k,t(j,1)}function t(a,b){b===1?h.className="humane humane-"+a+" humane-animate":(h.className=h.className.replace(" humane-animate",""),o!=null&&c(h,p("TransitionEnd"),o),u())}function u(){setTimeout(function(){g=!1,s()},500)}function w(b,c){var d,e;c===1?(e=0,h.className="humane humane-js-animate humane-"+b,h.filters&&(h.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=0),a.humane.forceNew&&(e=j?h.filters.item("DXImageTransform.Microsoft.Alpha").Opacity/100|0:h.style.opacity|0),d=setInterval(function(){e<1?(e+=.1,e>1&&(e=1),v(e)):clearInterval(d)},5)):(e=1,d=setInterval(function(){e>0?(e-=.1,e<0&&(e=0),v(e)):(h.className=h.className.replace(" humane-js-animate",""),clearInterval(d),o!=null&&o(),u())},5))}function x(a){return function(b,c){n.push([a,b,c]),m&&s()}}var c,d,e,f=!1,g=!1,h=null,i=null,j=/msie [678]/i.test(navigator.userAgent),k={Webkit:"webkit",Moz:"",O:"o",ms:"MS"},l="",m=!1,n=[],o=null;"addEventListener"in a?(c=function(a,b,c){a.addEventListener(b,c,!1)},d=function(a,b,c){a.removeEventListener(b,c,!1)}):(c=function(a,b,c){a.attachEvent("on"+b,c)},d=function(a,b,c){a.detachEvent("on"+b,c)}),e=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},c(a,"load",function(){var a=function(a){var b=["MozT","WebkitT","OT","msT","KhtmlT","t"];for(var c=0,d;d=b[c];c++)if(d+"ransition"in a)return!0;return!1}(b.body.style);a||(t=w),q(),s()});var v=function(){return j?function(a){h.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=a*100}:function(a){h.style.opacity=String(a)}}();a.humane=x("log"),a.humane.currentType="log",a.humane.log=x("log"),a.humane.error=x("error"),a.humane.info=x("info"),a.humane.success=x("success"),a.humane.timeout=2500,a.humane.waitForMove=!1,a.humane.forceNew=!1,a.humane.clickToClose=!1})(window,document);
+ */(function(a,b){function p(a){return l?l+a:a.toLowerCase()}function q(){h=b.createElement("div"),h.id="humane",h.className="humane",b.body.appendChild(h);for(vendor in k)h.style[vendor+"TransitionProperty"]!==undefined&&(l=k[vendor]);m=!0}function r(){d(b.body,"mousemove",r),d(b.body,"click",r),d(b.body,"keypress",r),d(b.body,"touchstart",r),f=!1;if(humane[humane.currentType].clickToClose||humane[humane.currentType].clickToClose!==!1&&humane.clickToClose)d(h,"click",r),d(h,"touchstart",r);g&&t(0)}function s(){if(g&&!a.humane.forceNew)return;if(!n.length){r();return}o=null,g=!0,i&&(clearTimeout(i),i=null);var d=n.shift(),j=d[0],k=d[1],l=d[2];a.humane.currentType=j;if(humane[j].clickToClose||humane[j].clickToClose!==!1&&humane.clickToClose)c(h,"click",r),c(h,"touchstart",r);if(a.humane[j].timeout||a.humane.timeout)i=setTimeout(function(){f||(c(b.body,"mousemove",r),c(b.body,"click",r),c(b.body,"keypress",r),c(b.body,"touchstart",r),f=!0,a.humane.waitForMove||r())},a.humane[j].timeout||a.humane.timeout);o=l,e(k)&&(k="<ul><li>"+k.join("<li>")+"</ul>"),h.innerHTML=k,t(j,1)}function t(a,b){b===1?h.className="humane humane-"+a+" humane-animate":(h.className=h.className.replace(" humane-animate",""),o!=null&&c(h,p("TransitionEnd"),o),u())}function u(){setTimeout(function(){g=!1,s()},500)}function w(b,c){var d,e;c===1?(e=0,h.className="humane humane-js-animate humane-"+b,h.filters&&(h.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=0),a.humane.forceNew&&(e=j?h.filters.item("DXImageTransform.Microsoft.Alpha").Opacity/100|0:h.style.opacity|0),d=setInterval(function(){e<1?(e+=.1,e>1&&(e=1),v(e)):clearInterval(d)},5)):(e=1,d=setInterval(function(){e>0?(e-=.1,e<0&&(e=0),v(e)):(h.className=h.className.replace(" humane-js-animate",""),clearInterval(d),o!=null&&o(),u())},5))}function x(a){return function(b,c){n.push([a,b,c]),m&&s()}}var c,d,e,f=!1,g=!1,h=null,i=null,j=/msie [678]/i.test(navigator.userAgent),k={Webkit:"webkit",Moz:"",O:"o",ms:"MS"},l="",m=!1,n=[],o=null;"addEventListener"in a?(c=function(a,b,c){a.addEventListener(b,c,!1)},d=function(a,b,c){a.removeEventListener(b,c,!1)}):(c=function(a,b,c){a.attachEvent("on"+b,c)},d=function(a,b,c){a.detachEvent("on"+b,c)}),e=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},c(a,"load",function(){var a=function(a){var b=["MozT","WebkitT","OT","msT","KhtmlT","t"];for(var c=0,d;d=b[c];c++)if(d+"ransition"in a)return!0;return!1}(b.body.style);a||(t=w),q(),s()});var v=function(){return j?function(a){h.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=a*100}:function(a){h.style.opacity=String(a)}}();a.humane=x("log"),a.humane.currentType="log",a.humane.log=x("log"),a.humane.error=x("error"),a.humane.info=x("info"),a.humane.success=x("success"),a.humane.timeout=2500,a.humane.waitForMove=!1,a.humane.forceNew=!1,a.humane.clickToClose=!1})(window,document);

0 comments on commit 240cb64

Please sign in to comment.