forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.min.js
2 lines (2 loc) · 6.11 KB
/
bootstrap.min.js
1
2
"use strict";var directive={};directive.runnableExample=["$templateCache","$document",function(e,t){var n=".runnable-example-file",i=(t[0],'<nav class="runnable-example-tabs" ng-if="tabs"> <a ng-class="{active:$index==activeTabIndex}"ng-repeat="tab in tabs track by $index" href="" class="btn"ng-click="setTab($index)"> {{ tab }} </a></nav>');return{restrict:"C",scope:!0,controller:["$scope",function(e){e.setTab=function(t){var n=e.tabs[t];e.activeTabIndex=t,e.$broadcast("tabChange",t,n)}}],compile:function(e){return e.html(i+e.html()),function(e,t){{var i=t[0],a=i.querySelectorAll(n),o=[];Date.now()}angular.forEach(a,function(e){o.push(e.getAttribute("name"))}),o.length>0&&(e.tabs=o,e.$on("tabChange",function(e,t){angular.forEach(a,function(e){e.style.display="none"});var n=a[t];n.style.display="block"}),e.setTab(0))}}}}],directive.dropdownToggle=["$document","$location","$window",function(e,t){var n,i=null;return{restrict:"C",link:function(a,o){a.$watch(function(){return t.path()},function(){n&&n()}),o.parent().on("click",function(){n&&n()}),o.on("click",function(t){t.preventDefault(),t.stopPropagation();var a=!1;i&&(a=i===o,n()),a||(o.parent().addClass("open"),i=o,n=function(t){t&&t.preventDefault(),t&&t.stopPropagation(),e.off("click",n),o.parent().removeClass("open"),n=null,i=null},e.on("click",n))})}}}],directive.syntax=function(){return{restrict:"A",link:function(e,t,n){function i(e,t,n,i){return'<a href="'+n+'" class="btn syntax-'+e+'" target="_blank" rel="nofollow"><span class="'+i+'"></span> '+t+"</a>"}var a="",o={github:{text:"View on Github",key:"syntaxGithub",icon:"icon-github"},plunkr:{text:"View on Plunkr",key:"syntaxPlunkr",icon:"icon-arrow-down"},jsfiddle:{text:"View on JSFiddle",key:"syntaxFiddle",icon:"icon-cloud"}};for(var l in o){var r=o[l],s=n[r.key];s&&(a+=i(l,r.text,s,r.icon))}var c=document.createElement("nav");c.className="syntax-links",c.innerHTML=a;var u=t[0],d=u.parentNode;d.insertBefore(c,u)}}},directive.tabbable=function(){return{restrict:"C",compile:function(e){var t=angular.element('<ul class="nav nav-tabs"></ul>'),n=angular.element('<div class="tab-content"></div>');n.append(e.contents()),e.append(t).append(n)},controller:["$scope","$element",function(e,t){var n,i=t.contents().eq(0),a=t.controller("ngModel")||{},o=[];a.$render=function(){var e=this.$viewValue;if((n?n.value!=e:e)&&(n&&(n.paneElement.removeClass("active"),n.tabElement.removeClass("active"),n=null),e)){for(var t=0,i=o.length;i>t;t++)if(e==o[t].value){n=o[t];break}n&&(n.paneElement.addClass("active"),n.tabElement.addClass("active"))}},this.addPane=function(t,l){function r(){u.title=l.title,u.value=l.value||l.title,a.$setViewValue||a.$viewValue&&u!=n||(a.$viewValue=u.value),a.$render()}var s=angular.element("<li><a href></a></li>"),c=s.find("a"),u={paneElement:t,paneAttrs:l,tabElement:s};return o.push(u),l.$observe("value",r)(),l.$observe("title",function(){r(),c.text(u.title)})(),i.append(s),s.on("click",function(t){t.preventDefault(),t.stopPropagation(),a.$setViewValue?e.$apply(function(){a.$setViewValue(u.value),a.$render()}):(a.$viewValue=u.value,a.$render())}),function(){u.tabElement.remove();for(var e=0,t=o.length;t>e;e++)u==o[e]&&o.splice(e,1)}}}]}},directive.table=function(){return{restrict:"E",link:function(e,t,n){n["class"]||t.addClass("table table-bordered table-striped code-table")}}};var popoverElement=function(){var e={init:function(){this.element=angular.element('<div class="popover popover-incode top"><div class="arrow"></div><div class="popover-inner"><div class="popover-title"><code></code></div><div class="popover-content"></div></div></div>'),this.node=this.element[0],this.element.css({display:"block",position:"absolute"}),angular.element(document.body).append(this.element);var e=this.element.children()[1];this.titleElement=angular.element(e.childNodes[0].firstChild),this.contentElement=angular.element(e.childNodes[1]),this.element.bind("click",function(e){e.preventDefault(),e.stopPropagation()});var t=this;angular.element(document.body).bind("click",function(){t.visible()&&t.hide()})},show:function(e,t){this.element.addClass("visible"),this.position(e||0,t||0)},hide:function(){this.element.removeClass("visible"),this.position(-9999,-9999)},visible:function(){return this.position().y>=0},isSituatedAt:function(e){return this.besideElement?e[0]==this.besideElement[0]:!1},title:function(e){return this.titleElement.html(e)},content:function(e){return e&&e.length>0&&(e=marked(e)),this.contentElement.html(e)},positionArrow:function(e){this.node.className="popover "+e},positionAway:function(){this.besideElement=null,this.hide()},positionBeside:function(e){this.besideElement=e;var t=e[0],n=t.offsetLeft,i=t.offsetTop;n-=30,i-=this.node.offsetHeight+10,this.show(n,i)},position:function(e,t){return null==e||null==t?{x:this.node.offsetLeft,y:this.node.offsetTop}:(this.element.css("left",e+"px"),void this.element.css("top",t+"px"))}};return e.init(),e.hide(),e};directive.popover=["popoverElement",function(e){return{restrict:"A",priority:500,link:function(t,n,i){n.bind("click",function(t){t.preventDefault(),t.stopPropagation(),e.isSituatedAt(n)&&e.visible()?(e.title(""),e.content(""),e.positionAway()):(e.title(i.title),e.content(i.content),e.positionBeside(n))})}}}],directive.tabPane=function(){return{require:"^tabbable",restrict:"C",link:function(e,t,n,i){t.on("$remove",i.addPane(t,n))}}},directive.foldout=["$http","$animate","$window",function(e,t,n){return{restrict:"A",priority:500,link:function(i,a,o){var l,r,s=o.url;/\/build\//.test(n.location.href)&&(s="/build/docs"+s),a.bind("click",function(){i.$apply(function(){if(l)l.hasClass("ng-hide")?t.removeClass(l,"ng-hide"):t.addClass(l,"ng-hide");else{if(r)return;r=!0;var n=a.parent();l=angular.element('<div class="foldout">loading...</div>'),t.enter(l,null,n),e.get(s,{cache:!0}).success(function(e){r=!1,e='<div class="foldout-inner"><div calss="foldout-arrow"></div>'+e+"</div>",l.html(e),"block"==l.css("display")&&(l.css("display","none"),t.addClass(l,"ng-hide"))})}})})}}}],angular.module("bootstrap",[]).directive(directive).factory("popoverElement",popoverElement).run(function(){marked.setOptions({gfm:!0,tables:!0})});
//# sourceMappingURL=../../js/angular-bootstrap/bootstrap.min.js.map