Updated hint position
authorThierry Florac <thierry.florac@onf.fr>
Mon, 17 Dec 2018 10:24:14 +0100
changeset 493 4f5d2b45814f
parent 492 4bb674a6a379
child 494 6ca0da3caede
Updated hint position
src/pyams_skin/resources/js/ext/jquery-tipsy.js
src/pyams_skin/resources/js/ext/jquery-tipsy.min.js
--- a/src/pyams_skin/resources/js/ext/jquery-tipsy.js	Fri Dec 14 18:33:40 2018 +0100
+++ b/src/pyams_skin/resources/js/ext/jquery-tipsy.js	Mon Dec 17 10:24:14 2018 +0100
@@ -64,10 +64,10 @@
 				if (gravity.length == 2) {
 					if (gravity.charAt(1) == 'w') {
 						tp.left = pos.width < 15 ? pos.left + (pos.width / 2) - 14
-							: pos.left - 5;
+							: pos.left + (pos.width / 2) - 14;
 					} else {
 						tp.left = pos.width < 15 ? pos.left + pos.width - actualWidth + (pos.width / 2) + 4
-							: pos.left + pos.width - actualWidth + 5;
+							: pos.left + (pos.width / 2) - actualWidth + 14;
 					}
 				}
 
--- a/src/pyams_skin/resources/js/ext/jquery-tipsy.min.js	Fri Dec 14 18:33:40 2018 +0100
+++ b/src/pyams_skin/resources/js/ext/jquery-tipsy.min.js	Mon Dec 17 10:24:14 2018 +0100
@@ -1,1 +1,1 @@
-(function(c){function a(d){if(d.attr("title")||typeof(d.attr("original-title"))!="string"){d.attr("original-title",d.attr("title")||"").removeAttr("title")}}function b(e,d){this.$element=c(e);this.options=d;this.enabled=true;a(this.$element)}b.prototype={show:function(){var h=this.getTitle();if(h&&this.enabled){var g=this.tip();g.find(".tipsy-inner")[this.options.html?"html":"text"](h);g[0].className="tipsy";g.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var k=c.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var d=g[0].offsetWidth,j=g[0].offsetHeight;var i=(typeof this.options.gravity=="function")?this.options.gravity.call(this.$element[0]):this.options.gravity;var f=(typeof this.options.offset=="function")?this.options.offset.call(this.$element[0]):this.options.offset;var e;switch(i.charAt(0)){case"n":e={top:k.top+k.height+f,left:k.left+k.width/2-d/2};break;case"s":e={top:k.top-j-f,left:k.left+k.width/2-d/2};break;case"e":e={top:k.top+k.height/2-j/2,left:k.left-d-f};break;case"w":e={top:k.top+k.height/2-j/2,left:k.left+k.width+f};break}if(i.length==2){if(i.charAt(1)=="w"){e.left=k.width<15?k.left+(k.width/2)-14:k.left-5}else{e.left=k.width<15?k.left+k.width-d+(k.width/2)+4:k.left+k.width-d+5}}e.left=Math.min(e.left,c("html").width()-d-10);g.css(e).addClass("tipsy-"+i);if(this.options.fade){g.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity})}else{g.css({visibility:"visible",opacity:this.options.opacity})}}},hide:function(){if(this.options.fade){this.tip().stop().fadeOut(function(){c(this).remove()})}else{this.tip().remove()}},getTitle:function(){var f,d=this.$element,e=this.options;a(d);var f,e=this.options;if(typeof e.title=="string"){f=d.attr(e.title=="title"?"original-title":e.title)}else{if(typeof e.title=="function"){f=e.title.call(d[0])}}f=(""+f).replace(/(^\s*|\s*$)/,"");return f||e.fallback},tip:function(){if(!this.$tip){this.$tip=c('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>')}return this.$tip},validate:function(){if(!this.$element[0].parentNode){this.hide();this.$element=null;this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled}};c.fn.tipsy=function(h){if(h===true){return this.data("tipsy")}else{if(typeof h=="string"){return this.data("tipsy")[h]()}}h=c.extend({},c.fn.tipsy.defaults,h);function g(k){var l=c.data(k,"tipsy");if(!l){l=new b(k,c.fn.tipsy.elementOptions(k,h));c.data(k,"tipsy",l)}return l}function j(){var k=g(this);k.hoverState="in";if(h.delayIn==0){k.show()}else{setTimeout(function(){if(k.hoverState=="in"){k.show()}},h.delayIn)}}function f(){var k=g(this);k.hoverState="out";if(h.delayOut==0){k.hide()}else{setTimeout(function(){if(k.hoverState=="out"){k.hide()}},h.delayOut)}}if(!h.live){this.each(function(){g(this)})}if(h.trigger!="manual"){var d=h.live?"live":"bind",i=h.trigger=="hover"?"mouseenter":"focus",e=h.trigger=="hover"?"mouseleave":"blur";this[d](i,j)[d](e,f)}return this};c.fn.tipsy.defaults={delayIn:0,delayOut:0,fade:false,fallback:"",gravity:"n",html:false,live:false,offset:0,opacity:0.8,title:"title",trigger:"hover"};c.fn.tipsy.elementOptions=function(e,d){return c.metadata?c.extend({},d,c(e).metadata()):d};c.fn.tipsy.autoNS=function(){return c(this).offset().top>(c(document).scrollTop()+c(window).height()/2)?"s":"n"};c.fn.tipsy.autoWE=function(){return c(this).offset().left>(c(document).scrollLeft()+c(window).width()/2)?"e":"w"}})(jQuery);
\ No newline at end of file
+!function(t){function i(t){(t.attr("title")||"string"!=typeof t.attr("original-title"))&&t.attr("original-title",t.attr("title")||"").removeAttr("title")}function e(e,s){this.$element=t(e),this.options=s,this.enabled=!0,i(this.$element)}e.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var e=this.tip();e.find(".tipsy-inner")[this.options.html?"html":"text"](i),e[0].className="tipsy",e.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var s,n=t.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=e[0].offsetWidth,l=e[0].offsetHeight,a="function"==typeof this.options.gravity?this.options.gravity.call(this.$element[0]):this.options.gravity,h="function"==typeof this.options.offset?this.options.offset.call(this.$element[0]):this.options.offset;switch(a.charAt(0)){case"n":s={top:n.top+n.height+h,left:n.left+n.width/2-o/2};break;case"s":s={top:n.top-l-h,left:n.left+n.width/2-o/2};break;case"e":s={top:n.top+n.height/2-l/2,left:n.left-o-h};break;case"w":s={top:n.top+n.height/2-l/2,left:n.left+n.width+h}}2==a.length&&("w"==a.charAt(1)?s.left=(n.width,n.left+n.width/2-14):s.left=n.width<15?n.left+n.width-o+n.width/2+4:n.left+n.width/2-o+14),s.left=Math.min(s.left,t("html").width()-o-10),e.css(s).addClass("tipsy-"+a),this.options.fade?e.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):e.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){t(this).remove()}):this.tip().remove()},getTitle:function(){var t=this.$element,e=this.options;i(t);var s;return"string"==typeof(e=this.options).title?s=t.attr("title"==e.title?"original-title":e.title):"function"==typeof e.title&&(s=e.title.call(t[0])),(s=(""+s).replace(/(^\s*|\s*$)/,""))||e.fallback},tip:function(){return this.$tip||(this.$tip=t('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>')),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},t.fn.tipsy=function(i){function s(s){var n=t.data(s,"tipsy");return n||(n=new e(s,t.fn.tipsy.elementOptions(s,i)),t.data(s,"tipsy",n)),n}if(!0===i)return this.data("tipsy");if("string"==typeof i)return this.data("tipsy")[i]();if((i=t.extend({},t.fn.tipsy.defaults,i)).live||this.each(function(){s(this)}),"manual"!=i.trigger){var n=i.live?"live":"bind",o="hover"==i.trigger?"mouseenter":"focus",l="hover"==i.trigger?"mouseleave":"blur";this[n](o,function(){var t=s(this);t.hoverState="in",0==i.delayIn?t.show():setTimeout(function(){"in"==t.hoverState&&t.show()},i.delayIn)})[n](l,function(){var t=s(this);t.hoverState="out",0==i.delayOut?t.hide():setTimeout(function(){"out"==t.hoverState&&t.hide()},i.delayOut)})}return this},t.fn.tipsy.defaults={delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},t.fn.tipsy.elementOptions=function(i,e){return t.metadata?t.extend({},e,t(i).metadata()):e},t.fn.tipsy.autoNS=function(){return t(this).offset().top>t(document).scrollTop()+t(window).height()/2?"s":"n"},t.fn.tipsy.autoWE=function(){return t(this).offset().left>t(document).scrollLeft()+t(window).width()/2?"e":"w"}}(jQuery);