summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Bootstrap/bootstrap-affix.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-affix.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Bootstrap/bootstrap-affix.js140
1 files changed, 0 insertions, 140 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-affix.js b/frontend/gamma/js/Bootstrap/bootstrap-affix.js
deleted file mode 100644
index 052ecad..0000000
--- a/frontend/gamma/js/Bootstrap/bootstrap-affix.js
+++ b/dev/null
@@ -1,140 +0,0 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24/* ==========================================================
25 * bootstrap-affix.js v2.2.2
26 * http://twitter.github.com/bootstrap/javascript.html#affix
27 * ==========================================================
28 * Copyright 2012 Twitter, Inc.
29 *
30 * Licensed under the Apache License, Version 2.0 (the "License");
31 * you may not use this file except in compliance with the License.
32 * You may obtain a copy of the License at
33 *
34 * http://www.apache.org/licenses/LICENSE-2.0
35 *
36 * Unless required by applicable law or agreed to in writing, software
37 * distributed under the License is distributed on an "AS IS" BASIS,
38 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 * See the License for the specific language governing permissions and
40 * limitations under the License.
41 * ========================================================== */
42
43
44!function ($) {
45
46 "use strict"; // jshint ;_;
47
48
49 /* AFFIX CLASS DEFINITION
50 * ====================== */
51
52 var Affix = function (element, options) {
53 this.options = $.extend({}, $.fn.affix.defaults, options)
54 this.$window = $(window)
55 .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
56 .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
57 this.$element = $(element)
58 this.checkPosition()
59 }
60
61 Affix.prototype.checkPosition = function () {
62 if (!this.$element.is(':visible')) return
63
64 var scrollHeight = $(document).height()
65 , scrollTop = this.$window.scrollTop()
66 , position = this.$element.offset()
67 , offset = this.options.offset
68 , offsetBottom = offset.bottom
69 , offsetTop = offset.top
70 , reset = 'affix affix-top affix-bottom'
71 , affix
72
73 if (typeof offset != 'object') offsetBottom = offsetTop = offset
74 if (typeof offsetTop == 'function') offsetTop = offset.top()
75 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
76
77 affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
78 false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
79 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
80 'top' : false
81
82 if (this.affixed === affix) return
83
84 this.affixed = affix
85 this.unpin = affix == 'bottom' ? position.top - scrollTop : null
86
87 this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
88 }
89
90
91 /* AFFIX PLUGIN DEFINITION
92 * ======================= */
93
94 var old = $.fn.affix
95
96 $.fn.affix = function (option) {
97 return this.each(function () {
98 var $this = $(this)
99 , data = $this.data('affix')
100 , options = typeof option == 'object' && option
101 if (!data) $this.data('affix', (data = new Affix(this, options)))
102 if (typeof option == 'string') data[option]()
103 })
104 }
105
106 $.fn.affix.Constructor = Affix
107
108 $.fn.affix.defaults = {
109 offset: 0
110 }
111
112
113 /* AFFIX NO CONFLICT
114 * ================= */
115
116 $.fn.affix.noConflict = function () {
117 $.fn.affix = old
118 return this
119 }
120
121
122 /* AFFIX DATA-API
123 * ============== */
124
125 $(window).on('load', function () {
126 $('[data-spy="affix"]').each(function () {
127 var $spy = $(this)
128 , data = $spy.data()
129
130 data.offset = data.offset || {}
131
132 data.offsetBottom && (data.offset.bottom = data.offsetBottom)
133 data.offsetTop && (data.offset.top = data.offsetTop)
134
135 $spy.affix(data)
136 })
137 })
138
139
140}(window.jQuery); \ No newline at end of file