diff --git a/bower.json b/bower.json index eb3b93b..ba87a36 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tipso", - "version": "1.0.2", + "version": "1.0.4", "description": "A Lightweight Responsive jQuery Tooltip Plugin", "main": ["src/tipso.min.js", "src/tipso.css"], "keywords": [ diff --git a/package.json b/package.json index 1c48bf5..a497f4b 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "mobile", "lightweight" ], - "version": "1.0.3", + "version": "1.0.4", "author": "Bojan Petkovski (http://object505.com/)", "licenses": [ { diff --git a/src/tipso.js b/src/tipso.js index ba995fc..0ad2074 100644 --- a/src/tipso.js +++ b/src/tipso.js @@ -1,5 +1,5 @@ /*! - * tipso - A Lightweight Responsive jQuery Tooltip Plugin v1.0.2 + * tipso - A Lightweight Responsive jQuery Tooltip Plugin v1.0.4 * Copyright (c) 2014-2015 Bojan Petkovski * http://tipso.object505.com * Licensed under the MIT license @@ -34,10 +34,8 @@ this._title = this.element.attr('title'); this.mode = 'hide'; this.ieFade = false; - if ( _isIE() ) { - if ( _isIE() <= 9 ) { - this.ieFade = true; - } + if ( !supportsTransitions ) { + this.ieFade = true; } this.init(); } @@ -202,10 +200,15 @@ return height; } - var _isIE = function () { - var ua = navigator.userAgent.toLowerCase(); - return (ua.indexOf('msie') != -1) ? parseInt(ua.split('msie')[1]) : false; - }; + var supportsTransitions = (function() { + var s = document.createElement('p').style, + v = ['ms','O','Moz','Webkit']; + if( s['transition'] == '' ) return true; + while( v.length ) + if( v.pop() + 'Transition' in s ) + return true; + return false; + })(); function reposition(thisthat) { var tipso_bubble = thisthat.tooltip(), diff --git a/src/tipso.min.js b/src/tipso.min.js index e2f9692..89e5616 100644 --- a/src/tipso.min.js +++ b/src/tipso.min.js @@ -1,6 +1,6 @@ /*! - * tipso - A Lightweight Responsive jQuery Tooltip Plugin v1.0.2 + * tipso - A Lightweight Responsive jQuery Tooltip Plugin v1.0.4 * Copyright (c) 2014-2015 Bojan Petkovski * http://tipso.object505.com */ - !function(t,o,e,s){function i(o,e){this.element=t(o),this.settings=t.extend({},l,e),this._defaults=l,this._name=d,this._title=this.element.attr("title"),this.mode="hide",this.ieFade=!1,f()&&f()<=9&&(this.ieFade=!0),this.init()}function n(){var t=o.navigator.msMaxTouchPoints,s="ontouchstart"in e.createElement("div");return t||s?!0:!1}function r(o){var e=o.clone();e.css("visibility","hidden"),t("body").append(e);var s=e.outerHeight();return e.remove(),s}function a(e){var s,i,n,a=e.tooltip(),d=e.element,l=e,f=t(o),p=10;switch(d.parent().outerWidth()>f.outerWidth()&&(f=d.parent()),l.settings.position){case"top":i=d.offset().left+d.outerWidth()/2-a.outerWidth()/2,s=d.offset().top-r(a)-p,a.find(".tipso_arrow").css({marginLeft:-8}),sf.scrollTop()+f.outerHeight()?(s=d.offset().top-r(a)-p,a.find(".tipso_arrow").css({"border-top-color":l.settings.background,"border-bottom-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass("top")):(a.find(".tipso_arrow").css({"border-bottom-color":l.settings.background,"border-top-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass(l.settings.position));break;case"left":i=d.offset().left-a.outerWidth()-p,s=d.offset().top+d.outerHeight()/2-r(a)/2,a.find(".tipso_arrow").css({marginTop:-8,marginLeft:""}),if.scrollLeft()+f.outerWidth()?(i=d.offset().left-a.outerWidth()-p,a.find(".tipso_arrow").css({"border-left-color":l.settings.background,"border-right-color":"transparent","border-top-color":"transparent","border-bottom-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass("left")):(a.find(".tipso_arrow").css({"border-right-color":l.settings.background,"border-left-color":"transparent","border-top-color":"transparent","border-bottom-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass(l.settings.position))}if.outerWidth()&&("bottom"==l.settings.position||"top"==l.settings.position)&&(n=f.outerWidth()-(i+l.settings.width),a.find(".tipso_arrow").css({marginLeft:-n-8,marginTop:""}),i+=n),if.outerWidth()&&(n=f.outerWidth()-(i+l.settings.width),a.find(".tipso_arrow").css({marginLeft:-n-8,marginTop:""}),i+=n),if.outerWidth()&&("left"==l.settings.position||"right"==l.settings.position)&&(i=d.offset().left+d.outerWidth()/2-a.outerWidth()/2,a.find(".tipso_arrow").css({marginLeft:-8,marginTop:""}),s=d.offset().top-r(a)-p,sf.outerWidth()&&(n=f.outerWidth()-(i+l.settings.width),a.find(".tipso_arrow").css({marginLeft:-n-8,marginTop:""}),i+=n),i
')),this.tipso_bubble},show:function(){var e=this.tooltip(),s=this,i=t(o);t.isFunction(s.settings.onBeforeShow)&&s.settings.onBeforeShow(t(this)),e.css({background:s.settings.background,color:s.settings.color,width:s.settings.width}).hide(),e.find(".tipso_content").html(s.content()),a(s),i.resize(function(){a(s)}),s.timeout=o.setTimeout(function(){s.ieFade||""===s.settings.animationIn||""===s.settings.animationOut?e.appendTo("body").stop(!0,!0).fadeIn(s.settings.speed,function(){s.mode="show",t.isFunction(s.settings.onShow)&&s.settings.onShow(t(this))}):e.remove().appendTo("body").stop(!0,!0).removeClass("animated "+s.settings.animationOut).addClass("noAnimation").removeClass("noAnimation").addClass("animated "+s.settings.animationIn).fadeIn(s.settings.speed,function(){t(this).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){t(this).removeClass("animated "+s.settings.animationIn)}),s.mode="show",t.isFunction(s.settings.onShow)&&s.settings.onShow(t(this))})},s.settings.delay)},hide:function(){var e=this,s=this.tooltip();o.clearTimeout(e.timeout),e.timeout=null,e.ieFade||""===e.settings.animationIn||""===e.settings.animationOut?s.stop(!0,!0).fadeOut(e.settings.speed,function(){t(this).remove(),t.isFunction(e.settings.onHide)&&"show"==e.mode&&e.settings.onHide(t(this)),e.mode="hide"}):s.stop(!0,!0).removeClass("animated "+e.settings.animationIn).addClass("noAnimation").removeClass("noAnimation").addClass("animated "+e.settings.animationOut).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){t(this).removeClass("animated "+e.settings.animationOut).remove(),t.isFunction(e.settings.onHide)&&"show"==e.mode&&e.settings.onHide(t(this)),e.mode="hide"})},destroy:function(){var t=this.element;t.off("."+d),t.removeData(d),t.removeClass("tipso_style").attr("title",this._title)},content:function(){var o,e=this.element,s=this,i=this._title;return o=s.settings.ajaxContentUrl?t.ajax({type:"GET",url:s.settings.ajaxContentUrl,async:!1}).responseText:s.settings.content?s.settings.content:s.settings.useTitle===!0?i:e.data("tipso")},update:function(t,o){var e=this;return o?void(e.settings[t]=o):e.settings[t]}});var f=function(){var t=navigator.userAgent.toLowerCase();return-1!=t.indexOf("msie")?parseInt(t.split("msie")[1]):!1};t[d]=t.fn[d]=function(o){var e=arguments;if(o===s||"object"==typeof o)return this instanceof t||t.extend(l,o),this.each(function(){t.data(this,"plugin_"+d)||t.data(this,"plugin_"+d,new i(this,o))});if("string"==typeof o&&"_"!==o[0]&&"init"!==o){var n;return this.each(function(){var s=t.data(this,"plugin_"+d);s||(s=t.data(this,"plugin_"+d,new i(this,o))),s instanceof i&&"function"==typeof s[o]&&(n=s[o].apply(s,Array.prototype.slice.call(e,1))),"destroy"===o&&t.data(this,"plugin_"+d,null)}),n!==s?n:this}}}(jQuery,window,document); \ No newline at end of file +!function(t,o,e,s){function i(o,e){this.element=t(o),this.settings=t.extend({},l,e),this._defaults=l,this._name=d,this._title=this.element.attr("title"),this.mode="hide",this.ieFade=!1,f||(this.ieFade=!0),this.init()}function n(){var t=o.navigator.msMaxTouchPoints,s="ontouchstart"in e.createElement("div");return t||s?!0:!1}function r(o){var e=o.clone();e.css("visibility","hidden"),t("body").append(e);var s=e.outerHeight();return e.remove(),s}function a(e){var s,i,n,a=e.tooltip(),d=e.element,l=e,f=t(o),p=10;switch(d.parent().outerWidth()>f.outerWidth()&&(f=d.parent()),l.settings.position){case"top":i=d.offset().left+d.outerWidth()/2-a.outerWidth()/2,s=d.offset().top-r(a)-p,a.find(".tipso_arrow").css({marginLeft:-8}),sf.scrollTop()+f.outerHeight()?(s=d.offset().top-r(a)-p,a.find(".tipso_arrow").css({"border-top-color":l.settings.background,"border-bottom-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass("top")):(a.find(".tipso_arrow").css({"border-bottom-color":l.settings.background,"border-top-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass(l.settings.position));break;case"left":i=d.offset().left-a.outerWidth()-p,s=d.offset().top+d.outerHeight()/2-r(a)/2,a.find(".tipso_arrow").css({marginTop:-8,marginLeft:""}),if.scrollLeft()+f.outerWidth()?(i=d.offset().left-a.outerWidth()-p,a.find(".tipso_arrow").css({"border-left-color":l.settings.background,"border-right-color":"transparent","border-top-color":"transparent","border-bottom-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass("left")):(a.find(".tipso_arrow").css({"border-right-color":l.settings.background,"border-left-color":"transparent","border-top-color":"transparent","border-bottom-color":"transparent"}),a.removeClass("top bottom left right"),a.addClass(l.settings.position))}if.outerWidth()&&("bottom"==l.settings.position||"top"==l.settings.position)&&(n=f.outerWidth()-(i+l.settings.width),a.find(".tipso_arrow").css({marginLeft:-n-8,marginTop:""}),i+=n),if.outerWidth()&&(n=f.outerWidth()-(i+l.settings.width),a.find(".tipso_arrow").css({marginLeft:-n-8,marginTop:""}),i+=n),if.outerWidth()&&("left"==l.settings.position||"right"==l.settings.position)&&(i=d.offset().left+d.outerWidth()/2-a.outerWidth()/2,a.find(".tipso_arrow").css({marginLeft:-8,marginTop:""}),s=d.offset().top-r(a)-p,sf.outerWidth()&&(n=f.outerWidth()-(i+l.settings.width),a.find(".tipso_arrow").css({marginLeft:-n-8,marginTop:""}),i+=n),i
')),this.tipso_bubble},show:function(){var e=this.tooltip(),s=this,i=t(o);t.isFunction(s.settings.onBeforeShow)&&s.settings.onBeforeShow(t(this)),e.css({background:s.settings.background,color:s.settings.color,width:s.settings.width}).hide(),e.find(".tipso_content").html(s.content()),a(s),i.resize(function(){a(s)}),s.timeout=o.setTimeout(function(){s.ieFade||""===s.settings.animationIn||""===s.settings.animationOut?e.appendTo("body").stop(!0,!0).fadeIn(s.settings.speed,function(){s.mode="show",t.isFunction(s.settings.onShow)&&s.settings.onShow(t(this))}):e.remove().appendTo("body").stop(!0,!0).removeClass("animated "+s.settings.animationOut).addClass("noAnimation").removeClass("noAnimation").addClass("animated "+s.settings.animationIn).fadeIn(s.settings.speed,function(){t(this).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){t(this).removeClass("animated "+s.settings.animationIn)}),s.mode="show",t.isFunction(s.settings.onShow)&&s.settings.onShow(t(this))})},s.settings.delay)},hide:function(){var e=this,s=this.tooltip();o.clearTimeout(e.timeout),e.timeout=null,e.ieFade||""===e.settings.animationIn||""===e.settings.animationOut?s.stop(!0,!0).fadeOut(e.settings.speed,function(){t(this).remove(),t.isFunction(e.settings.onHide)&&"show"==e.mode&&e.settings.onHide(t(this)),e.mode="hide"}):s.stop(!0,!0).removeClass("animated "+e.settings.animationIn).addClass("noAnimation").removeClass("noAnimation").addClass("animated "+e.settings.animationOut).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){t(this).removeClass("animated "+e.settings.animationOut).remove(),t.isFunction(e.settings.onHide)&&"show"==e.mode&&e.settings.onHide(t(this)),e.mode="hide"})},destroy:function(){var t=this.element;t.off("."+d),t.removeData(d),t.removeClass("tipso_style").attr("title",this._title)},content:function(){var o,e=this.element,s=this,i=this._title;return o=s.settings.ajaxContentUrl?t.ajax({type:"GET",url:s.settings.ajaxContentUrl,async:!1}).responseText:s.settings.content?s.settings.content:s.settings.useTitle===!0?i:e.data("tipso")},update:function(t,o){var e=this;return o?void(e.settings[t]=o):e.settings[t]}});var f=function(){var t=e.createElement("p").style,o=["ms","O","Moz","Webkit"];if(""==t.transition)return!0;for(;o.length;)if(o.pop()+"Transition"in t)return!0;return!1}();t[d]=t.fn[d]=function(o){var e=arguments;if(o===s||"object"==typeof o)return this instanceof t||t.extend(l,o),this.each(function(){t.data(this,"plugin_"+d)||t.data(this,"plugin_"+d,new i(this,o))});if("string"==typeof o&&"_"!==o[0]&&"init"!==o){var n;return this.each(function(){var s=t.data(this,"plugin_"+d);s||(s=t.data(this,"plugin_"+d,new i(this,o))),s instanceof i&&"function"==typeof s[o]&&(n=s[o].apply(s,Array.prototype.slice.call(e,1))),"destroy"===o&&t.data(this,"plugin_"+d,null)}),n!==s?n:this}}}(jQuery,window,document); \ No newline at end of file diff --git a/tipso.jquery.json b/tipso.jquery.json index 63f39b7..5efc467 100644 --- a/tipso.jquery.json +++ b/tipso.jquery.json @@ -10,7 +10,7 @@ "mobile", "lightweight" ], - "version": "1.0.2", + "version": "1.0.4", "author": { "name": "Bojan Petkovski", "url": "http://object505.com"