Removed static and uploads URLs from urls.py. staticfiles_urlpatterns handles
[e_cidadania.git] / docs / _templates / tr / static / bootstrap-scrollspy.js
blobefbc4329605bc350ab4123e78769ab37d642bc25
1 /* =============================================================
2  * bootstrap-scrollspy.js v1.4.0
3  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
4  * =============================================================
5  * Copyright 2011 Twitter, Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============================================================== */
21 !function ( $ ) {
23   "use strict"
25   var $window = $(window)
27   function ScrollSpy( topbar, selector ) {
28     var processScroll = $.proxy(this.processScroll, this)
29     this.$topbar = $(topbar)
30     this.selector = selector || 'li > a'
31     this.refresh()
32     this.$topbar.delegate(this.selector, 'click', processScroll)
33     $window.scroll(processScroll)
34     this.processScroll()
35   }
37   ScrollSpy.prototype = {
39       refresh: function () {
40         this.targets = this.$topbar.find(this.selector).map(function () {
41           var href = $(this).attr('href')
42           return /^#\w/.test(href) && $(href).length ? href : null
43         })
45         this.offsets = $.map(this.targets, function (id) {
46           return $(id).offset().top
47         })
48       }
50     , processScroll: function () {
51         var scrollTop = $window.scrollTop() + 10
52           , offsets = this.offsets
53           , targets = this.targets
54           , activeTarget = this.activeTarget
55           , i
57         for (i = offsets.length; i--;) {
58           activeTarget != targets[i]
59             && scrollTop >= offsets[i]
60             && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
61             && this.activateButton( targets[i] )
62         }
63       }
65     , activateButton: function (target) {
66         this.activeTarget = target
68         this.$topbar
69           .find(this.selector).parent('.active')
70           .removeClass('active')
72         this.$topbar
73           .find(this.selector + '[href="' + target + '"]')
74           .parent('li')
75           .addClass('active')
76       }
78   }
80   /* SCROLLSPY PLUGIN DEFINITION
81    * =========================== */
83   $.fn.scrollSpy = function( options ) {
84     var scrollspy = this.data('scrollspy')
86     if (!scrollspy) {
87       return this.each(function () {
88         $(this).data('scrollspy', new ScrollSpy( this, options ))
89       })
90     }
92     if ( options === true ) {
93       return scrollspy
94     }
96     if ( typeof options == 'string' ) {
97       scrollspy[options]()
98     }
100     return this
101   }
103   $(document).ready(function () {
104     $('body').scrollSpy('[data-scrollspy] li > a')
105   })
107 }( window.jQuery || window.ender );