UNPKG

mavensmate

Version:

Core APIs that drive MavensMate IDEs for Salesforce1/Force.com

1 lines 3.28 kB
if("undefined"==typeof jQuery.aljs)throw new Error("Please include the ALJS initializer file");!function(t){var e=15,o=15,l=function(e){var o=e.data,l=t(e.target).is(t(o.selector))?t(e.target):t(e.target).closest(o.selector||'[data-aljs="popover"]'),n=!!l.attr("data-aljs-show");l.attr("data-aljs-title")||(l.attr("data-aljs-title",l.attr("title")),l.attr("title",""));var p=l.parent().hasClass("slds-button")?' style="line-height: normal;"':"",d=l.attr("data-aljs-id")||"aljs-"+(new Date).valueOf(),f=n?t("#"+l.data("aljs-show")).html():s(l.data("aljs-title")),h=l.attr("data-aljs-placement")||"top",c={top:"bottom",bottom:"top",left:"right",right:"left"},u="overflow: visible; display: inline-block; position: absolute;",g=""!=o.modifier?" slds-popover--"+o.modifier:"",v=""!=o.theme?" slds-theme--"+o.theme:"",m='<div id="'+d+'" aria-describedby="'+d+'" class="slds-popover'+g+v+" slds-nubbin--"+(c[h]||"top")+'" style="'+u+'"><div class="slds-popover__body"'+p+">"+f+"</div></div>";if(0===l.next(".slds-popover").length){var b=t.aljs.scoped?t(m).appendTo(".slds"):t(m).appendTo("body"),w=b[0].offsetWidth,j=b[0].offsetHeight,y=r(l),x=i(h,y,w,j);a(x,h,w,j,b)}},s=function(t){var e=String(t);return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\//g,"&#x2F;")},a=function(t,e,o,l,s){var a=n(e,t,o,l);a.left?t.left+=a.left:t.top+=a.top,s.offset(t)},i=function(t,l,s,a){var i={};switch(t){case"bottom":i={top:l.top+l.height+e,left:l.left+l.width/2-s/2};break;case"top":i={top:l.top-a-e,left:l.left+l.width/2-s/2};break;case"left":i={top:l.top+l.height/2-a/2,left:l.left-s-o};break;default:i={top:l.top+l.height/2-a/2,left:l.left+l.width+o}}return i},r=function(e){e=e||this.$element;var o=e[0],l="BODY"==o.tagName,s=o.getBoundingClientRect();null==s.width&&(s=t.extend({},s,{width:s.right-s.left,height:s.bottom-s.top}));var a=l?{top:0,left:0}:e.offset(),i={scroll:l?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},r=l?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},s,i,r,a)},n=function(e,o,l,s){var a={top:0,left:0},i=r(t("body"));if(/right|left/.test(e)){var n=o.top-i.scroll,p=o.top-i.scroll+s;n<i.top?a.top=i.top-n:p>i.top+i.height&&(a.top=i.top+i.height-p)}else{var d=o.left,f=o.left+l;d<i.left?a.left=i.left-d:f>i.right&&(a.left=i.left+i.width-f)}return a},p=function(e){var o=t("body").find(".slds-popover");o.length>0&&o.remove()};t.fn.popover=function(e){var o=t.extend({assetsLocation:t.aljs.assetsLocation,modifier:"",theme:""},e);return this.each(function(){t("#"+t(this).data("aljs-show")).addClass("slds-hide")}),o.selector&&1===this.length?this.on("mouseenter",o.selector,o,l).on("focusin",o.selector,o,l).on("mouseleave",o.selector,o,p).on("blur",o.selector,o,p).on("touchstart",o.selector,o,function(e){e.stopPropagation();var s="tooltip"==o.modifier?".slds-popover--tooltip":".slds-popover";0==t(s).length?l():p()}):this.each(function(){var e=JSON.parse(JSON.stringify(o));e.selector=this,t(this).on("mouseenter",e,l).on("focusin",e,l).on("mouseleave",e,p).on("blur",e,p).on("touchstart",e,function(o){o.stopPropagation();var s="tooltip"==e.modifier?".slds-popover--tooltip":".slds-popover";0==t(s).length?l():p()})})}}(jQuery);