rails-angular-strap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +21 -0
- data/lib/rails-angular-strap.rb +11 -0
- data/lib/rails-angular-strap/engine.rb +4 -0
- data/lib/rails-angular-strap/version.rb +4 -0
- data/vendor/assets/javascripts/angular-strap.js +2 -0
- data/vendor/assets/javascripts/angular-strap.min.js +2 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.js +5014 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.min.js +11 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.tpl.js +89 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/affix.js +249 -0
- data/vendor/assets/javascripts/angular-strap/modules/affix.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/affix.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.js +120 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/alert.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.js +96 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/aside.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/button.js +177 -0
- data/vendor/assets/javascripts/angular-strap/modules/button.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/button.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/collapse.js +273 -0
- data/vendor/assets/javascripts/angular-strap/modules/collapse.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/collapse.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-formatter.js +61 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-formatter.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-formatter.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-parser.js +273 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-parser.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/date-parser.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.js +640 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/datepicker.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/debounce.js +62 -0
- data/vendor/assets/javascripts/angular-strap/modules/debounce.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/debounce.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/dimensions.js +156 -0
- data/vendor/assets/javascripts/angular-strap/modules/dimensions.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/dimensions.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.js +149 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/dropdown.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.js +349 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/modal.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/navbar.js +72 -0
- data/vendor/assets/javascripts/angular-strap/modules/navbar.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/navbar.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/parse-options.js +76 -0
- data/vendor/assets/javascripts/angular-strap/modules/parse-options.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/parse-options.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.js +112 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/popover.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/raf.js +61 -0
- data/vendor/assets/javascripts/angular-strap/modules/raf.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/raf.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/scrollspy.js +261 -0
- data/vendor/assets/javascripts/angular-strap/modules/scrollspy.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/scrollspy.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.js +325 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/select.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.js +186 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/tab.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.js +485 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/timepicker.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.js +690 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/tooltip.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.js +266 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/modules/typeahead.tpl.min.js +8 -0
- metadata +143 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.navbar",[]).provider("$navbar",function(){var t=this.defaults={activeClass:"active",routeAttr:"data-match-route",strict:!1};this.$get=function(){return{defaults:t}}}).directive("bsNavbar",["$window","$location","$navbar",function(t,a,r){var e=r.defaults;return{restrict:"A",link:function(t,r,n){var i=angular.copy(e);angular.forEach(Object.keys(e),function(t){angular.isDefined(n[t])&&(i[t]=n[t])}),t.$watch(function(){return a.path()},function(t){var a=r[0].querySelectorAll("li["+i.routeAttr+"]");angular.forEach(a,function(a){var r=angular.element(a),e=r.attr(i.routeAttr).replace("/","\\/");i.strict&&(e="^"+e+"$");var n=new RegExp(e,["i"]);n.test(t)?r.addClass(i.activeClass):r.removeClass(i.activeClass)})})}}}]);
|
9
|
+
//# sourceMappingURL=navbar.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["navbar/navbar.js"],"names":[],"mappings":"qBASM,OAAQ,6DAIR,GAAQ,KAAU,4FAOpB,OAAI,SAAW,+EAOX,GAAI,EAAU,gFAQZ,QAAO,OAAU,KAAA,GAAA,SAAA,wFASX,MAEF,GAAU,EAAM,GAAA,iBAAU,MAAA,EAAA,UAAA,aAExB,QAAS,EAAW,SAAU,GAElC,GAAG,GAAY,QAAA,QAAW,GACxB,EAAU,EAAS,KAAQ,EAAA,WAAA,QAAA,IAAA,SACtB,SACL,EAAU,IAAA,EAAY","file":"navbar.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.navbar', [])\n\n .provider('$navbar', function() {\n\n var defaults = this.defaults = {\n activeClass: 'active',\n routeAttr: 'data-match-route',\n strict: false\n };\n\n this.$get = function() {\n return {defaults: defaults};\n };\n\n })\n\n .directive('bsNavbar', function($window, $location, $navbar) {\n\n var defaults = $navbar.defaults;\n\n return {\n restrict: 'A',\n link: function postLink(scope, element, attr, controller) {\n\n // Directive options\n var options = angular.copy(defaults);\n angular.forEach(Object.keys(defaults), function(key) {\n if(angular.isDefined(attr[key])) options[key] = attr[key];\n });\n\n // Watch for the $location\n scope.$watch(function() {\n\n return $location.path();\n\n }, function(newValue, oldValue) {\n\n var liElements = element[0].querySelectorAll('li[' + options.routeAttr + ']');\n\n angular.forEach(liElements, function(li) {\n\n var liElement = angular.element(li);\n var pattern = liElement.attr(options.routeAttr).replace('/', '\\\\/');\n if(options.strict) {\n pattern = '^' + pattern + '$';\n }\n var regexp = new RegExp(pattern, ['i']);\n\n if(regexp.test(newValue)) {\n liElement.addClass(options.activeClass);\n } else {\n liElement.removeClass(options.activeClass);\n }\n\n });\n\n });\n\n }\n\n };\n\n });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.helpers.parseOptions', [])
|
11
|
+
|
12
|
+
.provider('$parseOptions', function() {
|
13
|
+
|
14
|
+
var defaults = this.defaults = {
|
15
|
+
regexp: /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/
|
16
|
+
};
|
17
|
+
|
18
|
+
this.$get = ["$parse", "$q", function($parse, $q) {
|
19
|
+
|
20
|
+
function ParseOptionsFactory(attr, config) {
|
21
|
+
|
22
|
+
var $parseOptions = {};
|
23
|
+
|
24
|
+
// Common vars
|
25
|
+
var options = angular.extend({}, defaults, config);
|
26
|
+
$parseOptions.$values = [];
|
27
|
+
|
28
|
+
// Private vars
|
29
|
+
var match, displayFn, valueName, keyName, groupByFn, valueFn, valuesFn;
|
30
|
+
|
31
|
+
$parseOptions.init = function() {
|
32
|
+
$parseOptions.$match = match = attr.match(options.regexp);
|
33
|
+
displayFn = $parse(match[2] || match[1]),
|
34
|
+
valueName = match[4] || match[6],
|
35
|
+
keyName = match[5],
|
36
|
+
groupByFn = $parse(match[3] || ''),
|
37
|
+
valueFn = $parse(match[2] ? match[1] : valueName),
|
38
|
+
valuesFn = $parse(match[7]);
|
39
|
+
};
|
40
|
+
|
41
|
+
$parseOptions.valuesFn = function(scope, controller) {
|
42
|
+
return $q.when(valuesFn(scope, controller))
|
43
|
+
.then(function(values) {
|
44
|
+
$parseOptions.$values = values ? parseValues(values, scope) : {};
|
45
|
+
return $parseOptions.$values;
|
46
|
+
});
|
47
|
+
};
|
48
|
+
|
49
|
+
$parseOptions.displayValue = function(modelValue) {
|
50
|
+
var scope = {};
|
51
|
+
scope[valueName] = modelValue;
|
52
|
+
return displayFn(scope);
|
53
|
+
};
|
54
|
+
|
55
|
+
// Private functions
|
56
|
+
|
57
|
+
function parseValues(values, scope) {
|
58
|
+
return values.map(function(match, index) {
|
59
|
+
var locals = {}, label, value;
|
60
|
+
locals[valueName] = match;
|
61
|
+
label = displayFn(scope, locals);
|
62
|
+
value = valueFn(scope, locals);
|
63
|
+
return {label: label, value: value, index: index};
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
$parseOptions.init();
|
68
|
+
return $parseOptions;
|
69
|
+
|
70
|
+
}
|
71
|
+
|
72
|
+
return ParseOptionsFactory;
|
73
|
+
|
74
|
+
}];
|
75
|
+
|
76
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.helpers.parseOptions",[]).provider("$parseOptions",function(){var n=this.defaults={regexp:/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/};this.$get=["$parse","$q",function(r,e){function s(s,t){function a(n,r){return n.map(function(n,e){var s,t,a={};return a[c]=n,s=$(r,a),t=f(r,a),{label:s,value:t,index:e}})}var u={},i=angular.extend({},n,t);u.$values=[];var o,$,c,l,p,f,v;return u.init=function(){u.$match=o=s.match(i.regexp),$=r(o[2]||o[1]),c=o[4]||o[6],l=o[5],p=r(o[3]||""),f=r(o[2]?o[1]:c),v=r(o[7])},u.valuesFn=function(n,r){return e.when(v(n,r)).then(function(r){return u.$values=r?a(r,n):{},u.$values})},u.displayValue=function(n){var r={};return r[c]=n,$(r)},u.init(),u}return s}]});
|
9
|
+
//# sourceMappingURL=parse-options.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["helpers/parse-options.js"],"names":[],"mappings":"sIAcY,qLAGJ,MAAI,SAAU,KAAQ,SAAW,EAAA,iFA0CjC,GAAA,GAAc,EACd,EAAO,EAAA,EAAA,wCAvCP,GAAI,MAGF,EAAA,QAAc,UAAiB,EAAK,KACxB,cAGZ,GAAA,EAAmB,EAAY,EAAA,EAAA,EAAA,WAEpB,KAAO,wDAGpB,EAAc,EAAA,IAAW,EAAA,GACvB,EAAU,EAAK,KACT,EAAS,EAAQ,IAAA,MACrB,EAAc,EAAA,GAAU,EAAA,GAAS,KAC1B,EAAA,EAAc,8BAIzB,MAAA,GAAA,KAAc,EAAA,EAAe,IAC3B,KAAI,SAAQ,GAEZ,MADA,GAAM,QAAa,EAAA,EAAA,EAAA,MACZ,EAAU,sCAKnB,GAAA,YACE,GAAA,GAAkB,EACZ,EAAS","file":"parse-options.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.helpers.parseOptions', [])\n\n .provider('$parseOptions', function() {\n\n var defaults = this.defaults = {\n regexp: /^\\s*(.*?)(?:\\s+as\\s+(.*?))?(?:\\s+group\\s+by\\s+(.*))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+(.*?)(?:\\s+track\\s+by\\s+(.*?))?$/\n };\n\n this.$get = function($parse, $q) {\n\n function ParseOptionsFactory(attr, config) {\n\n var $parseOptions = {};\n\n // Common vars\n var options = angular.extend({}, defaults, config);\n $parseOptions.$values = [];\n\n // Private vars\n var match, displayFn, valueName, keyName, groupByFn, valueFn, valuesFn;\n\n $parseOptions.init = function() {\n $parseOptions.$match = match = attr.match(options.regexp);\n displayFn = $parse(match[2] || match[1]),\n valueName = match[4] || match[6],\n keyName = match[5],\n groupByFn = $parse(match[3] || ''),\n valueFn = $parse(match[2] ? match[1] : valueName),\n valuesFn = $parse(match[7]);\n };\n\n $parseOptions.valuesFn = function(scope, controller) {\n return $q.when(valuesFn(scope, controller))\n .then(function(values) {\n $parseOptions.$values = values ? parseValues(values, scope) : {};\n return $parseOptions.$values;\n });\n };\n\n $parseOptions.displayValue = function(modelValue) {\n var scope = {};\n scope[valueName] = modelValue;\n return displayFn(scope);\n };\n\n // Private functions\n\n function parseValues(values, scope) {\n return values.map(function(match, index) {\n var locals = {}, label, value;\n locals[valueName] = match;\n label = displayFn(scope, locals);\n value = valueFn(scope, locals);\n return {label: label, value: value, index: index};\n });\n }\n\n $parseOptions.init();\n return $parseOptions;\n\n }\n\n return ParseOptionsFactory;\n\n };\n\n });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.popover', ['mgcrea.ngStrap.tooltip'])
|
11
|
+
|
12
|
+
.provider('$popover', function() {
|
13
|
+
|
14
|
+
var defaults = this.defaults = {
|
15
|
+
animation: 'am-fade',
|
16
|
+
customClass: '',
|
17
|
+
container: false,
|
18
|
+
target: false,
|
19
|
+
placement: 'right',
|
20
|
+
template: 'popover/popover.tpl.html',
|
21
|
+
contentTemplate: false,
|
22
|
+
trigger: 'click',
|
23
|
+
keyboard: true,
|
24
|
+
html: false,
|
25
|
+
title: '',
|
26
|
+
content: '',
|
27
|
+
delay: 0,
|
28
|
+
autoClose: false
|
29
|
+
};
|
30
|
+
|
31
|
+
this.$get = ["$tooltip", function($tooltip) {
|
32
|
+
|
33
|
+
function PopoverFactory(element, config) {
|
34
|
+
|
35
|
+
// Common vars
|
36
|
+
var options = angular.extend({}, defaults, config);
|
37
|
+
|
38
|
+
var $popover = $tooltip(element, options);
|
39
|
+
|
40
|
+
// Support scope as string options [/*title, */content]
|
41
|
+
if(options.content) {
|
42
|
+
$popover.$scope.content = options.content;
|
43
|
+
}
|
44
|
+
|
45
|
+
return $popover;
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
return PopoverFactory;
|
50
|
+
|
51
|
+
}];
|
52
|
+
|
53
|
+
})
|
54
|
+
|
55
|
+
.directive('bsPopover', ["$window", "$sce", "$popover", function($window, $sce, $popover) {
|
56
|
+
|
57
|
+
var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout;
|
58
|
+
|
59
|
+
return {
|
60
|
+
restrict: 'EAC',
|
61
|
+
scope: true,
|
62
|
+
link: function postLink(scope, element, attr) {
|
63
|
+
|
64
|
+
// Directive options
|
65
|
+
var options = {scope: scope};
|
66
|
+
angular.forEach(['template', 'contentTemplate', 'placement', 'container', 'target', 'delay', 'trigger', 'keyboard', 'html', 'animation', 'customClass', 'autoClose', 'id'], function(key) {
|
67
|
+
if(angular.isDefined(attr[key])) options[key] = attr[key];
|
68
|
+
});
|
69
|
+
|
70
|
+
// Support scope as data-attrs
|
71
|
+
angular.forEach(['title', 'content'], function(key) {
|
72
|
+
attr[key] && attr.$observe(key, function(newValue, oldValue) {
|
73
|
+
scope[key] = $sce.trustAsHtml(newValue);
|
74
|
+
angular.isDefined(oldValue) && requestAnimationFrame(function() {
|
75
|
+
popover && popover.$applyPlacement();
|
76
|
+
});
|
77
|
+
});
|
78
|
+
});
|
79
|
+
|
80
|
+
// Support scope as an object
|
81
|
+
attr.bsPopover && scope.$watch(attr.bsPopover, function(newValue, oldValue) {
|
82
|
+
if(angular.isObject(newValue)) {
|
83
|
+
angular.extend(scope, newValue);
|
84
|
+
} else {
|
85
|
+
scope.content = newValue;
|
86
|
+
}
|
87
|
+
angular.isDefined(oldValue) && requestAnimationFrame(function() {
|
88
|
+
popover && popover.$applyPlacement();
|
89
|
+
});
|
90
|
+
}, true);
|
91
|
+
|
92
|
+
// Visibility binding support
|
93
|
+
attr.bsShow && scope.$watch(attr.bsShow, function(newValue, oldValue) {
|
94
|
+
if(!popover || !angular.isDefined(newValue)) return;
|
95
|
+
if(angular.isString(newValue)) newValue = !!newValue.match(/true|,?(popover),?/i);
|
96
|
+
newValue === true ? popover.show() : popover.hide();
|
97
|
+
});
|
98
|
+
|
99
|
+
// Initialize popover
|
100
|
+
var popover = $popover(element, options);
|
101
|
+
|
102
|
+
// Garbage collection
|
103
|
+
scope.$on('$destroy', function() {
|
104
|
+
if (popover) popover.destroy();
|
105
|
+
options = null;
|
106
|
+
popover = null;
|
107
|
+
});
|
108
|
+
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
}]);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.popover",["mgcrea.ngStrap.tooltip"]).provider("$popover",function(){var t=this.defaults={animation:"am-fade",customClass:"",container:!1,target:!1,placement:"right",template:"popover/popover.tpl.html",contentTemplate:!1,trigger:"click",keyboard:!0,html:!1,title:"",content:"",delay:0,autoClose:!1};this.$get=["$tooltip",function(e){function n(n,o){var a=angular.extend({},t,o),r=e(n,a);return a.content&&(r.$scope.content=a.content),r}return n}]}).directive("bsPopover",["$window","$sce","$popover",function(t,e,n){var o=t.requestAnimationFrame||t.setTimeout;return{restrict:"EAC",scope:!0,link:function(t,a,r){var i={scope:t};angular.forEach(["template","contentTemplate","placement","container","target","delay","trigger","keyboard","html","animation","customClass","autoClose","id"],function(t){angular.isDefined(r[t])&&(i[t]=r[t])}),angular.forEach(["title","content"],function(n){r[n]&&r.$observe(n,function(a,r){t[n]=e.trustAsHtml(a),angular.isDefined(r)&&o(function(){c&&c.$applyPlacement()})})}),r.bsPopover&&t.$watch(r.bsPopover,function(e,n){angular.isObject(e)?angular.extend(t,e):t.content=e,angular.isDefined(n)&&o(function(){c&&c.$applyPlacement()})},!0),r.bsShow&&t.$watch(r.bsShow,function(t){c&&angular.isDefined(t)&&(angular.isString(t)&&(t=!!t.match(/true|,?(popover),?/i)),t===!0?c.show():c.hide())});var c=n(a,i);t.$on("$destroy",function(){c&&c.destroy(),i=null,c=null})}}}]);
|
9
|
+
//# sourceMappingURL=popover.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["popover/popover.js"],"names":[],"mappings":"qBASM,OAAA,0BAAW,oCAEX,WAAW,cAEX,GAAA,KAAiB,UACjB,UAAS,UACT,YAAU,GACV,WAAM,EACN,QAAO,EACP,UAAS,QACT,SAAO,2BACP,iBAAW,8BAGb,MAAK,WAEH,QAAS,8BAKP,MAAI,WAAW,SAAS,gDAOxB,EAAO,EAAA,EAAA,sBAIT,EAAO,OAAA,QAAA,EAAA,kCAaD,aAAS,UAAgB,OAAS,WAAM,SAAA,EAAA,EAAA,+DAKvC,uCAKH,IAAa,MAAK,WAChB,SAAa,WAAK,kBAAY,YAAA,YAAA,SAAA,QAAA,UAAA,WAAA,OAAA,YAAA,cAAA,YAAA,MAAA,SAAA,GAC9B,QAAQ,UAAU,EAAA,MAAa,EAAA,GAAA,EAAA,6GAOnC,QAAK,UAAa,IAAa,EAAyB,WACnD,GAAQ,EAAS,0BAMlB,WAAW,EAAQ,OAAA,EAAA,UAAA,SAAA,EAAA,uBAEpB,QAAA,OAAA,EAAA,eAID,QAAI,UAAY,IAAQ,EAAqB,WAC7C,GAAW,EAAS,yBAKtB,EAAI,QAAU,EAAA,OAAS,EAAS,OAAA,SAAA,uFAGhC,KAAU,EAAY,EAAA,OAAW,EAAA,kEASpC,EAAA","file":"popover.min.js","sourcesContent":["'use strict';\n\nangular.module('mgcrea.ngStrap.popover', ['mgcrea.ngStrap.tooltip'])\n\n .provider('$popover', function() {\n\n var defaults = this.defaults = {\n animation: 'am-fade',\n customClass: '',\n container: false,\n target: false,\n placement: 'right',\n template: 'popover/popover.tpl.html',\n contentTemplate: false,\n trigger: 'click',\n keyboard: true,\n html: false,\n title: '',\n content: '',\n delay: 0,\n autoClose: false\n };\n\n this.$get = function($tooltip) {\n\n function PopoverFactory(element, config) {\n\n // Common vars\n var options = angular.extend({}, defaults, config);\n\n var $popover = $tooltip(element, options);\n\n // Support scope as string options [/*title, */content]\n if(options.content) {\n $popover.$scope.content = options.content;\n }\n\n return $popover;\n\n }\n\n return PopoverFactory;\n\n };\n\n })\n\n .directive('bsPopover', function($window, $sce, $popover) {\n\n var requestAnimationFrame = $window.requestAnimationFrame || $window.setTimeout;\n\n return {\n restrict: 'EAC',\n scope: true,\n link: function postLink(scope, element, attr) {\n\n // Directive options\n var options = {scope: scope};\n angular.forEach(['template', 'contentTemplate', 'placement', 'container', 'target', 'delay', 'trigger', 'keyboard', 'html', 'animation', 'customClass', 'autoClose', 'id'], function(key) {\n if(angular.isDefined(attr[key])) options[key] = attr[key];\n });\n\n // Support scope as data-attrs\n angular.forEach(['title', 'content'], function(key) {\n attr[key] && attr.$observe(key, function(newValue, oldValue) {\n scope[key] = $sce.trustAsHtml(newValue);\n angular.isDefined(oldValue) && requestAnimationFrame(function() {\n popover && popover.$applyPlacement();\n });\n });\n });\n\n // Support scope as an object\n attr.bsPopover && scope.$watch(attr.bsPopover, function(newValue, oldValue) {\n if(angular.isObject(newValue)) {\n angular.extend(scope, newValue);\n } else {\n scope.content = newValue;\n }\n angular.isDefined(oldValue) && requestAnimationFrame(function() {\n popover && popover.$applyPlacement();\n });\n }, true);\n\n // Visibility binding support\n attr.bsShow && scope.$watch(attr.bsShow, function(newValue, oldValue) {\n if(!popover || !angular.isDefined(newValue)) return;\n if(angular.isString(newValue)) newValue = !!newValue.match(/true|,?(popover),?/i);\n newValue === true ? popover.show() : popover.hide();\n });\n\n // Initialize popover\n var popover = $popover(element, options);\n\n // Garbage collection\n scope.$on('$destroy', function() {\n if (popover) popover.destroy();\n options = null;\n popover = null;\n });\n\n }\n };\n\n });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.popover').run(['$templateCache', function($templateCache) {
|
11
|
+
|
12
|
+
$templateCache.put('popover/popover.tpl.html', '<div class="popover"><div class="arrow"></div><h3 class="popover-title" ng-bind="title" ng-show="title"></h3><div class="popover-content" ng-bind="content"></div></div>');
|
13
|
+
|
14
|
+
}]);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.module("mgcrea.ngStrap.popover").run(["$templateCache",function(t){t.put("popover/popover.tpl.html",'<div class="popover"><div class="arrow"></div><h3 class="popover-title" ng-bind="title" ng-show="title"></h3><div class="popover-content" ng-bind="content"></div></div>')}]);
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
(angular.version.minor < 3 && angular.version.dot < 14) && angular.module('ng')
|
11
|
+
|
12
|
+
.factory('$$rAF', ["$window", "$timeout", function($window, $timeout) {
|
13
|
+
|
14
|
+
var requestAnimationFrame = $window.requestAnimationFrame ||
|
15
|
+
$window.webkitRequestAnimationFrame ||
|
16
|
+
$window.mozRequestAnimationFrame;
|
17
|
+
|
18
|
+
var cancelAnimationFrame = $window.cancelAnimationFrame ||
|
19
|
+
$window.webkitCancelAnimationFrame ||
|
20
|
+
$window.mozCancelAnimationFrame ||
|
21
|
+
$window.webkitCancelRequestAnimationFrame;
|
22
|
+
|
23
|
+
var rafSupported = !!requestAnimationFrame;
|
24
|
+
var raf = rafSupported ?
|
25
|
+
function(fn) {
|
26
|
+
var id = requestAnimationFrame(fn);
|
27
|
+
return function() {
|
28
|
+
cancelAnimationFrame(id);
|
29
|
+
};
|
30
|
+
} :
|
31
|
+
function(fn) {
|
32
|
+
var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
|
33
|
+
return function() {
|
34
|
+
$timeout.cancel(timer);
|
35
|
+
};
|
36
|
+
};
|
37
|
+
|
38
|
+
raf.supported = rafSupported;
|
39
|
+
|
40
|
+
return raf;
|
41
|
+
|
42
|
+
}]);
|
43
|
+
|
44
|
+
// .factory('$$animateReflow', function($$rAF, $document) {
|
45
|
+
|
46
|
+
// var bodyEl = $document[0].body;
|
47
|
+
|
48
|
+
// return function(fn) {
|
49
|
+
// //the returned function acts as the cancellation function
|
50
|
+
// return $$rAF(function() {
|
51
|
+
// //the line below will force the browser to perform a repaint
|
52
|
+
// //so that all the animated elements within the animation frame
|
53
|
+
// //will be properly updated and drawn on screen. This is
|
54
|
+
// //required to perform multi-class CSS based animations with
|
55
|
+
// //Firefox. DO NOT REMOVE THIS LINE.
|
56
|
+
// var a = bodyEl.offsetWidth + 1;
|
57
|
+
// fn();
|
58
|
+
// });
|
59
|
+
// };
|
60
|
+
|
61
|
+
// });
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
"use strict";angular.version.minor<3&&angular.version.dot<14&&angular.module("ng").factory("$$rAF",["$window","$timeout",function(n,e){var a=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame,t=n.cancelAnimationFrame||n.webkitCancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelRequestAnimationFrame,i=!!a,r=i?function(n){var e=a(n);return function(){t(e)}}:function(n){var a=e(n,16.66,!1);return function(){e.cancel(a)}};return r.supported=i,r}]);
|
9
|
+
//# sourceMappingURL=raf.min.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["helpers/raf.js"],"names":[],"mappings":"8GAW6B,WAAQ,SAAA,EAAA,SAER,EAAQ,sDAEd,EAAA,yBAEnB,EAAa,EAAA,sBACF,EAAsB,4BACb,EAAA,yBACK,EAAA,wCAGzB,EAAA,WACM,GACJ,GAAA,GAAO,EAAW,SAChB,mBAIN,SAAI,sBAEJ,OAAO","file":"raf.min.js","sourcesContent":["'use strict';\n\n(angular.version.minor < 3 && angular.version.dot < 14) && angular.module('ng')\n\n.factory('$$rAF', function($window, $timeout) {\n\n var requestAnimationFrame = $window.requestAnimationFrame ||\n $window.webkitRequestAnimationFrame ||\n $window.mozRequestAnimationFrame;\n\n var cancelAnimationFrame = $window.cancelAnimationFrame ||\n $window.webkitCancelAnimationFrame ||\n $window.mozCancelAnimationFrame ||\n $window.webkitCancelRequestAnimationFrame;\n\n var rafSupported = !!requestAnimationFrame;\n var raf = rafSupported ?\n function(fn) {\n var id = requestAnimationFrame(fn);\n return function() {\n cancelAnimationFrame(id);\n };\n } :\n function(fn) {\n var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n return function() {\n $timeout.cancel(timer);\n };\n };\n\n raf.supported = rafSupported;\n\n return raf;\n\n});\n\n// .factory('$$animateReflow', function($$rAF, $document) {\n\n// var bodyEl = $document[0].body;\n\n// return function(fn) {\n// //the returned function acts as the cancellation function\n// return $$rAF(function() {\n// //the line below will force the browser to perform a repaint\n// //so that all the animated elements within the animation frame\n// //will be properly updated and drawn on screen. This is\n// //required to perform multi-class CSS based animations with\n// //Firefox. DO NOT REMOVE THIS LINE.\n// var a = bodyEl.offsetWidth + 1;\n// fn();\n// });\n// };\n\n// });\n"],"sourceRoot":"/source/"}
|
@@ -0,0 +1,261 @@
|
|
1
|
+
/**
|
2
|
+
* angular-strap
|
3
|
+
* @version v2.1.6 - 2015-01-11
|
4
|
+
* @link http://mgcrea.github.io/angular-strap
|
5
|
+
* @author Olivier Louvignes (olivier@mg-crea.com)
|
6
|
+
* @license MIT License, http://www.opensource.org/licenses/MIT
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
angular.module('mgcrea.ngStrap.scrollspy', ['mgcrea.ngStrap.helpers.debounce', 'mgcrea.ngStrap.helpers.dimensions'])
|
11
|
+
|
12
|
+
.provider('$scrollspy', function() {
|
13
|
+
|
14
|
+
// Pool of registered spies
|
15
|
+
var spies = this.$$spies = {};
|
16
|
+
|
17
|
+
var defaults = this.defaults = {
|
18
|
+
debounce: 150,
|
19
|
+
throttle: 100,
|
20
|
+
offset: 100
|
21
|
+
};
|
22
|
+
|
23
|
+
this.$get = ["$window", "$document", "$rootScope", "dimensions", "debounce", "throttle", function($window, $document, $rootScope, dimensions, debounce, throttle) {
|
24
|
+
|
25
|
+
var windowEl = angular.element($window);
|
26
|
+
var docEl = angular.element($document.prop('documentElement'));
|
27
|
+
var bodyEl = angular.element($window.document.body);
|
28
|
+
|
29
|
+
// Helper functions
|
30
|
+
|
31
|
+
function nodeName(element, name) {
|
32
|
+
return element[0].nodeName && element[0].nodeName.toLowerCase() === name.toLowerCase();
|
33
|
+
}
|
34
|
+
|
35
|
+
function ScrollSpyFactory(config) {
|
36
|
+
|
37
|
+
// Common vars
|
38
|
+
var options = angular.extend({}, defaults, config);
|
39
|
+
if(!options.element) options.element = bodyEl;
|
40
|
+
var isWindowSpy = nodeName(options.element, 'body');
|
41
|
+
var scrollEl = isWindowSpy ? windowEl : options.element;
|
42
|
+
var scrollId = isWindowSpy ? 'window' : options.id;
|
43
|
+
|
44
|
+
// Use existing spy
|
45
|
+
if(spies[scrollId]) {
|
46
|
+
spies[scrollId].$$count++;
|
47
|
+
return spies[scrollId];
|
48
|
+
}
|
49
|
+
|
50
|
+
var $scrollspy = {};
|
51
|
+
|
52
|
+
// Private vars
|
53
|
+
var unbindViewContentLoaded, unbindIncludeContentLoaded;
|
54
|
+
var trackedElements = $scrollspy.$trackedElements = [];
|
55
|
+
var sortedElements = [];
|
56
|
+
var activeTarget;
|
57
|
+
var debouncedCheckPosition;
|
58
|
+
var throttledCheckPosition;
|
59
|
+
var debouncedCheckOffsets;
|
60
|
+
var viewportHeight;
|
61
|
+
var scrollTop;
|
62
|
+
|
63
|
+
$scrollspy.init = function() {
|
64
|
+
|
65
|
+
// Setup internal ref counter
|
66
|
+
this.$$count = 1;
|
67
|
+
|
68
|
+
// Bind events
|
69
|
+
debouncedCheckPosition = debounce(this.checkPosition, options.debounce);
|
70
|
+
throttledCheckPosition = throttle(this.checkPosition, options.throttle);
|
71
|
+
scrollEl.on('click', this.checkPositionWithEventLoop);
|
72
|
+
windowEl.on('resize', debouncedCheckPosition);
|
73
|
+
scrollEl.on('scroll', throttledCheckPosition);
|
74
|
+
|
75
|
+
debouncedCheckOffsets = debounce(this.checkOffsets, options.debounce);
|
76
|
+
unbindViewContentLoaded = $rootScope.$on('$viewContentLoaded', debouncedCheckOffsets);
|
77
|
+
unbindIncludeContentLoaded = $rootScope.$on('$includeContentLoaded', debouncedCheckOffsets);
|
78
|
+
debouncedCheckOffsets();
|
79
|
+
|
80
|
+
// Register spy for reuse
|
81
|
+
if(scrollId) {
|
82
|
+
spies[scrollId] = $scrollspy;
|
83
|
+
}
|
84
|
+
|
85
|
+
};
|
86
|
+
|
87
|
+
$scrollspy.destroy = function() {
|
88
|
+
|
89
|
+
// Check internal ref counter
|
90
|
+
this.$$count--;
|
91
|
+
if(this.$$count > 0) {
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
|
95
|
+
// Unbind events
|
96
|
+
scrollEl.off('click', this.checkPositionWithEventLoop);
|
97
|
+
windowEl.off('resize', debouncedCheckPosition);
|
98
|
+
scrollEl.off('scroll', throttledCheckPosition);
|
99
|
+
unbindViewContentLoaded();
|
100
|
+
unbindIncludeContentLoaded();
|
101
|
+
if (scrollId) {
|
102
|
+
delete spies[scrollId];
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
106
|
+
$scrollspy.checkPosition = function() {
|
107
|
+
|
108
|
+
// Not ready yet
|
109
|
+
if(!sortedElements.length) return;
|
110
|
+
|
111
|
+
// Calculate the scroll position
|
112
|
+
scrollTop = (isWindowSpy ? $window.pageYOffset : scrollEl.prop('scrollTop')) || 0;
|
113
|
+
|
114
|
+
// Calculate the viewport height for use by the components
|
115
|
+
viewportHeight = Math.max($window.innerHeight, docEl.prop('clientHeight'));
|
116
|
+
|
117
|
+
// Activate first element if scroll is smaller
|
118
|
+
if(scrollTop < sortedElements[0].offsetTop && activeTarget !== sortedElements[0].target) {
|
119
|
+
return $scrollspy.$activateElement(sortedElements[0]);
|
120
|
+
}
|
121
|
+
|
122
|
+
// Activate proper element
|
123
|
+
for (var i = sortedElements.length; i--;) {
|
124
|
+
if(angular.isUndefined(sortedElements[i].offsetTop) || sortedElements[i].offsetTop === null) continue;
|
125
|
+
if(activeTarget === sortedElements[i].target) continue;
|
126
|
+
if(scrollTop < sortedElements[i].offsetTop) continue;
|
127
|
+
if(sortedElements[i + 1] && scrollTop > sortedElements[i + 1].offsetTop) continue;
|
128
|
+
return $scrollspy.$activateElement(sortedElements[i]);
|
129
|
+
}
|
130
|
+
|
131
|
+
};
|
132
|
+
|
133
|
+
$scrollspy.checkPositionWithEventLoop = function() {
|
134
|
+
// IE 9 throws an error if we use 'this' instead of '$scrollspy'
|
135
|
+
// in this setTimeout call
|
136
|
+
setTimeout($scrollspy.checkPosition, 1);
|
137
|
+
};
|
138
|
+
|
139
|
+
// Protected methods
|
140
|
+
|
141
|
+
$scrollspy.$activateElement = function(element) {
|
142
|
+
if(activeTarget) {
|
143
|
+
var activeElement = $scrollspy.$getTrackedElement(activeTarget);
|
144
|
+
if(activeElement) {
|
145
|
+
activeElement.source.removeClass('active');
|
146
|
+
if(nodeName(activeElement.source, 'li') && nodeName(activeElement.source.parent().parent(), 'li')) {
|
147
|
+
activeElement.source.parent().parent().removeClass('active');
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
activeTarget = element.target;
|
152
|
+
element.source.addClass('active');
|
153
|
+
if(nodeName(element.source, 'li') && nodeName(element.source.parent().parent(), 'li')) {
|
154
|
+
element.source.parent().parent().addClass('active');
|
155
|
+
}
|
156
|
+
};
|
157
|
+
|
158
|
+
$scrollspy.$getTrackedElement = function(target) {
|
159
|
+
return trackedElements.filter(function(obj) {
|
160
|
+
return obj.target === target;
|
161
|
+
})[0];
|
162
|
+
};
|
163
|
+
|
164
|
+
// Track offsets behavior
|
165
|
+
|
166
|
+
$scrollspy.checkOffsets = function() {
|
167
|
+
|
168
|
+
angular.forEach(trackedElements, function(trackedElement) {
|
169
|
+
var targetElement = document.querySelector(trackedElement.target);
|
170
|
+
trackedElement.offsetTop = targetElement ? dimensions.offset(targetElement).top : null;
|
171
|
+
if(options.offset && trackedElement.offsetTop !== null) trackedElement.offsetTop -= options.offset * 1;
|
172
|
+
});
|
173
|
+
|
174
|
+
sortedElements = trackedElements
|
175
|
+
.filter(function(el) {
|
176
|
+
return el.offsetTop !== null;
|
177
|
+
})
|
178
|
+
.sort(function(a, b) {
|
179
|
+
return a.offsetTop - b.offsetTop;
|
180
|
+
});
|
181
|
+
|
182
|
+
debouncedCheckPosition();
|
183
|
+
|
184
|
+
};
|
185
|
+
|
186
|
+
$scrollspy.trackElement = function(target, source) {
|
187
|
+
trackedElements.push({target: target, source: source});
|
188
|
+
};
|
189
|
+
|
190
|
+
$scrollspy.untrackElement = function(target, source) {
|
191
|
+
var toDelete;
|
192
|
+
for (var i = trackedElements.length; i--;) {
|
193
|
+
if(trackedElements[i].target === target && trackedElements[i].source === source) {
|
194
|
+
toDelete = i;
|
195
|
+
break;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
trackedElements = trackedElements.splice(toDelete, 1);
|
199
|
+
};
|
200
|
+
|
201
|
+
$scrollspy.activate = function(i) {
|
202
|
+
trackedElements[i].addClass('active');
|
203
|
+
};
|
204
|
+
|
205
|
+
// Initialize plugin
|
206
|
+
|
207
|
+
$scrollspy.init();
|
208
|
+
return $scrollspy;
|
209
|
+
|
210
|
+
}
|
211
|
+
|
212
|
+
return ScrollSpyFactory;
|
213
|
+
|
214
|
+
}];
|
215
|
+
|
216
|
+
})
|
217
|
+
|
218
|
+
.directive('bsScrollspy', ["$rootScope", "debounce", "dimensions", "$scrollspy", function($rootScope, debounce, dimensions, $scrollspy) {
|
219
|
+
|
220
|
+
return {
|
221
|
+
restrict: 'EAC',
|
222
|
+
link: function postLink(scope, element, attr) {
|
223
|
+
|
224
|
+
var options = {scope: scope};
|
225
|
+
angular.forEach(['offset', 'target'], function(key) {
|
226
|
+
if(angular.isDefined(attr[key])) options[key] = attr[key];
|
227
|
+
});
|
228
|
+
|
229
|
+
var scrollspy = $scrollspy(options);
|
230
|
+
scrollspy.trackElement(options.target, element);
|
231
|
+
|
232
|
+
scope.$on('$destroy', function() {
|
233
|
+
if (scrollspy) {
|
234
|
+
scrollspy.untrackElement(options.target, element);
|
235
|
+
scrollspy.destroy();
|
236
|
+
}
|
237
|
+
options = null;
|
238
|
+
scrollspy = null;
|
239
|
+
});
|
240
|
+
|
241
|
+
}
|
242
|
+
};
|
243
|
+
|
244
|
+
}])
|
245
|
+
|
246
|
+
|
247
|
+
.directive('bsScrollspyList', ["$rootScope", "debounce", "dimensions", "$scrollspy", function($rootScope, debounce, dimensions, $scrollspy) {
|
248
|
+
|
249
|
+
return {
|
250
|
+
restrict: 'A',
|
251
|
+
compile: function postLink(element, attr) {
|
252
|
+
var children = element[0].querySelectorAll('li > a[href]');
|
253
|
+
angular.forEach(children, function(child) {
|
254
|
+
var childEl = angular.element(child);
|
255
|
+
childEl.parent().attr('bs-scrollspy', '').attr('data-target', childEl.attr('href'));
|
256
|
+
});
|
257
|
+
}
|
258
|
+
|
259
|
+
};
|
260
|
+
|
261
|
+
}]);
|