rails-angularstrap 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +89 -0
- data/Rakefile +2 -0
- data/lib/rails/angularstrap.rb +8 -0
- data/lib/rails/angularstrap/version.rb +5 -0
- data/vendor/assets/javascripts/angular-strap/LICENSE.md +21 -0
- data/vendor/assets/javascripts/angular-strap/README.md +112 -0
- data/vendor/assets/javascripts/angular-strap/angular-strap.nuspec +23 -0
- data/vendor/assets/javascripts/angular-strap/bower.json +53 -0
- data/vendor/assets/javascripts/angular-strap/dist/angular-strap.js +5014 -0
- data/vendor/assets/javascripts/angular-strap/dist/angular-strap.min.js +11 -0
- data/vendor/assets/javascripts/angular-strap/dist/angular-strap.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/angular-strap.tpl.js +89 -0
- data/vendor/assets/javascripts/angular-strap/dist/angular-strap.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/affix.js +249 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/affix.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/affix.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/alert.js +120 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/alert.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/alert.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/alert.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/alert.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/aside.js +96 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/aside.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/aside.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/aside.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/aside.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/button.js +177 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/button.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/button.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/collapse.js +273 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/collapse.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/collapse.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/date-formatter.js +61 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/date-formatter.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/date-formatter.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/date-parser.js +273 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/date-parser.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/date-parser.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.js +640 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/datepicker.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/debounce.js +62 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/debounce.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/debounce.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dimensions.js +156 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dimensions.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dimensions.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.js +149 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/dropdown.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/modal.js +349 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/modal.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/modal.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/modal.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/modal.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/navbar.js +72 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/navbar.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/navbar.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/parse-options.js +76 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/parse-options.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/parse-options.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/popover.js +112 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/popover.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/popover.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/popover.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/popover.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/raf.js +61 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/raf.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/raf.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/scrollspy.js +261 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/scrollspy.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/scrollspy.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/select.js +325 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/select.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/select.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/select.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/select.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tab.js +186 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tab.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tab.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tab.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tab.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.js +485 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/timepicker.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.js +690 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/tooltip.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.js +266 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.min.js +9 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.min.js.map +1 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.tpl.js +14 -0
- data/vendor/assets/javascripts/angular-strap/dist/modules/typeahead.tpl.min.js +8 -0
- data/vendor/assets/javascripts/angular-strap/gulpfile.js +489 -0
- data/vendor/assets/javascripts/angular-strap/package.json +73 -0
- data/vendor/assets/javascripts/angular-strap/src/affix/affix.js +258 -0
- data/vendor/assets/javascripts/angular-strap/src/alert/alert.js +113 -0
- data/vendor/assets/javascripts/angular-strap/src/alert/alert.tpl.html +4 -0
- data/vendor/assets/javascripts/angular-strap/src/aside/aside.js +89 -0
- data/vendor/assets/javascripts/angular-strap/src/aside/aside.tpl.html +14 -0
- data/vendor/assets/javascripts/angular-strap/src/button/button.js +174 -0
- data/vendor/assets/javascripts/angular-strap/src/collapse/collapse.js +266 -0
- data/vendor/assets/javascripts/angular-strap/src/datepicker/datepicker.js +633 -0
- data/vendor/assets/javascripts/angular-strap/src/datepicker/datepicker.tpl.html +33 -0
- data/vendor/assets/javascripts/angular-strap/src/dropdown/dropdown.js +143 -0
- data/vendor/assets/javascripts/angular-strap/src/dropdown/dropdown.tpl.html +6 -0
- data/vendor/assets/javascripts/angular-strap/src/helpers/date-formatter.js +54 -0
- data/vendor/assets/javascripts/angular-strap/src/helpers/date-parser.js +266 -0
- data/vendor/assets/javascripts/angular-strap/src/helpers/debounce.js +55 -0
- data/vendor/assets/javascripts/angular-strap/src/helpers/dimensions.js +212 -0
- data/vendor/assets/javascripts/angular-strap/src/helpers/parse-options.js +69 -0
- data/vendor/assets/javascripts/angular-strap/src/helpers/raf.js +54 -0
- data/vendor/assets/javascripts/angular-strap/src/modal/modal.js +348 -0
- data/vendor/assets/javascripts/angular-strap/src/modal/modal.tpl.html +14 -0
- data/vendor/assets/javascripts/angular-strap/src/module.js +19 -0
- data/vendor/assets/javascripts/angular-strap/src/navbar/navbar.js +65 -0
- data/vendor/assets/javascripts/angular-strap/src/popover/popover.js +111 -0
- data/vendor/assets/javascripts/angular-strap/src/popover/popover.tpl.html +5 -0
- data/vendor/assets/javascripts/angular-strap/src/scrollspy/scrollspy.js +254 -0
- data/vendor/assets/javascripts/angular-strap/src/select/select.js +321 -0
- data/vendor/assets/javascripts/angular-strap/src/select/select.tpl.html +14 -0
- data/vendor/assets/javascripts/angular-strap/src/tab/tab.js +183 -0
- data/vendor/assets/javascripts/angular-strap/src/tab/tab.tpl.html +7 -0
- data/vendor/assets/javascripts/angular-strap/src/timepicker/timepicker.js +493 -0
- data/vendor/assets/javascripts/angular-strap/src/timepicker/timepicker.tpl.html +62 -0
- data/vendor/assets/javascripts/angular-strap/src/tooltip/tooltip.js +806 -0
- data/vendor/assets/javascripts/angular-strap/src/tooltip/tooltip.tpl.html +4 -0
- data/vendor/assets/javascripts/angular-strap/src/typeahead/typeahead.js +262 -0
- data/vendor/assets/javascripts/angular-strap/src/typeahead/typeahead.tpl.html +5 -0
- data/vendor/assets/javascripts/angular/README.md +64 -0
- data/vendor/assets/javascripts/angular/angular-csp.css +13 -0
- data/vendor/assets/javascripts/angular/angular.js +26181 -0
- data/vendor/assets/javascripts/angular/angular.min.js +250 -0
- data/vendor/assets/javascripts/angular/angular.min.js.gzip +0 -0
- data/vendor/assets/javascripts/angular/angular.min.js.map +8 -0
- data/vendor/assets/javascripts/angular/bower.json +8 -0
- data/vendor/assets/javascripts/angular/index.js +2 -0
- data/vendor/assets/javascripts/angular/package.json +25 -0
- metadata +237 -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
|
+
}]);
|