rails-bootstrap-ui 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,107 @@
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
+ * ============================================================== */
19
+
20
+
21
+ !function ( $ ) {
22
+
23
+ "use strict"
24
+
25
+ var $window = $(window)
26
+
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
+ }
36
+
37
+ ScrollSpy.prototype = {
38
+
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
+ })
44
+
45
+ this.offsets = $.map(this.targets, function (id) {
46
+ return $(id).offset().top
47
+ })
48
+ }
49
+
50
+ , processScroll: function () {
51
+ var scrollTop = $window.scrollTop() + 10
52
+ , offsets = this.offsets
53
+ , targets = this.targets
54
+ , activeTarget = this.activeTarget
55
+ , i
56
+
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
+ }
64
+
65
+ , activateButton: function (target) {
66
+ this.activeTarget = target
67
+
68
+ this.$topbar
69
+ .find(this.selector).parent('.active')
70
+ .removeClass('active')
71
+
72
+ this.$topbar
73
+ .find(this.selector + '[href="' + target + '"]')
74
+ .parent('li')
75
+ .addClass('active')
76
+ }
77
+
78
+ }
79
+
80
+ /* SCROLLSPY PLUGIN DEFINITION
81
+ * =========================== */
82
+
83
+ $.fn.scrollSpy = function( options ) {
84
+ var scrollspy = this.data('scrollspy')
85
+
86
+ if (!scrollspy) {
87
+ return this.each(function () {
88
+ $(this).data('scrollspy', new ScrollSpy( this, options ))
89
+ })
90
+ }
91
+
92
+ if ( options === true ) {
93
+ return scrollspy
94
+ }
95
+
96
+ if ( typeof options == 'string' ) {
97
+ scrollspy[options]()
98
+ }
99
+
100
+ return this
101
+ }
102
+
103
+ $(document).ready(function () {
104
+ $('body').scrollSpy('[data-scrollspy] li > a')
105
+ })
106
+
107
+ }( window.jQuery || window.ender );
@@ -0,0 +1,80 @@
1
+ /* ========================================================
2
+ * bootstrap-tabs.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#tabs
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
+ * ======================================================== */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ function activate ( element, container ) {
26
+ container
27
+ .find('> .active')
28
+ .removeClass('active')
29
+ .find('> .dropdown-menu > .active')
30
+ .removeClass('active')
31
+
32
+ element.addClass('active')
33
+
34
+ if ( element.parent('.dropdown-menu') ) {
35
+ element.closest('li.dropdown').addClass('active')
36
+ }
37
+ }
38
+
39
+ function tab( e ) {
40
+ var $this = $(this)
41
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
42
+ , href = $this.attr('href')
43
+ , previous
44
+ , $href
45
+
46
+ if ( /^#\w+/.test(href) ) {
47
+ e.preventDefault()
48
+
49
+ if ( $this.parent('li').hasClass('active') ) {
50
+ return
51
+ }
52
+
53
+ previous = $ul.find('.active a').last()[0]
54
+ $href = $(href)
55
+
56
+ activate($this.parent('li'), $ul)
57
+ activate($href, $href.parent())
58
+
59
+ $this.trigger({
60
+ type: 'change'
61
+ , relatedTarget: previous
62
+ })
63
+ }
64
+ }
65
+
66
+
67
+ /* TABS/PILLS PLUGIN DEFINITION
68
+ * ============================ */
69
+
70
+ $.fn.tabs = $.fn.pills = function ( selector ) {
71
+ return this.each(function () {
72
+ $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
73
+ })
74
+ }
75
+
76
+ $(document).ready(function () {
77
+ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
78
+ })
79
+
80
+ }( window.jQuery || window.ender );
@@ -0,0 +1,321 @@
1
+ /* ==========================================================
2
+ * bootstrap-twipsy.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#twipsy
4
+ * Adapted from the original jQuery.tipsy by Jason Frame
5
+ * ==========================================================
6
+ * Copyright 2011 Twitter, Inc.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ * ========================================================== */
20
+
21
+
22
+ !function( $ ) {
23
+
24
+ "use strict"
25
+
26
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27
+ * ======================================================= */
28
+
29
+ var transitionEnd
30
+
31
+ $(document).ready(function () {
32
+
33
+ $.support.transition = (function () {
34
+ var thisBody = document.body || document.documentElement
35
+ , thisStyle = thisBody.style
36
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
37
+ return support
38
+ })()
39
+
40
+ // set CSS transition event type
41
+ if ( $.support.transition ) {
42
+ transitionEnd = "TransitionEnd"
43
+ if ( $.browser.webkit ) {
44
+ transitionEnd = "webkitTransitionEnd"
45
+ } else if ( $.browser.mozilla ) {
46
+ transitionEnd = "transitionend"
47
+ } else if ( $.browser.opera ) {
48
+ transitionEnd = "oTransitionEnd"
49
+ }
50
+ }
51
+
52
+ })
53
+
54
+
55
+ /* TWIPSY PUBLIC CLASS DEFINITION
56
+ * ============================== */
57
+
58
+ var Twipsy = function ( element, options ) {
59
+ this.$element = $(element)
60
+ this.options = options
61
+ this.enabled = true
62
+ this.fixTitle()
63
+ }
64
+
65
+ Twipsy.prototype = {
66
+
67
+ show: function() {
68
+ var pos
69
+ , actualWidth
70
+ , actualHeight
71
+ , placement
72
+ , $tip
73
+ , tp
74
+
75
+ if (this.hasContent() && this.enabled) {
76
+ $tip = this.tip()
77
+ this.setContent()
78
+
79
+ if (this.options.animate) {
80
+ $tip.addClass('fade')
81
+ }
82
+
83
+ $tip
84
+ .remove()
85
+ .css({ top: 0, left: 0, display: 'block' })
86
+ .prependTo(document.body)
87
+
88
+ pos = $.extend({}, this.$element.offset(), {
89
+ width: this.$element[0].offsetWidth
90
+ , height: this.$element[0].offsetHeight
91
+ })
92
+
93
+ actualWidth = $tip[0].offsetWidth
94
+ actualHeight = $tip[0].offsetHeight
95
+
96
+ placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
97
+
98
+ switch (placement) {
99
+ case 'below':
100
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
101
+ break
102
+ case 'above':
103
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
104
+ break
105
+ case 'left':
106
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
107
+ break
108
+ case 'right':
109
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
110
+ break
111
+ }
112
+
113
+ $tip
114
+ .css(tp)
115
+ .addClass(placement)
116
+ .addClass('in')
117
+ }
118
+ }
119
+
120
+ , setContent: function () {
121
+ var $tip = this.tip()
122
+ $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
123
+ $tip[0].className = 'twipsy'
124
+ }
125
+
126
+ , hide: function() {
127
+ var that = this
128
+ , $tip = this.tip()
129
+
130
+ $tip.removeClass('in')
131
+
132
+ function removeElement () {
133
+ $tip.remove()
134
+ }
135
+
136
+ $.support.transition && this.$tip.hasClass('fade') ?
137
+ $tip.bind(transitionEnd, removeElement) :
138
+ removeElement()
139
+ }
140
+
141
+ , fixTitle: function() {
142
+ var $e = this.$element
143
+ if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
144
+ $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
145
+ }
146
+ }
147
+
148
+ , hasContent: function () {
149
+ return this.getTitle()
150
+ }
151
+
152
+ , getTitle: function() {
153
+ var title
154
+ , $e = this.$element
155
+ , o = this.options
156
+
157
+ this.fixTitle()
158
+
159
+ if (typeof o.title == 'string') {
160
+ title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
161
+ } else if (typeof o.title == 'function') {
162
+ title = o.title.call($e[0])
163
+ }
164
+
165
+ title = ('' + title).replace(/(^\s*|\s*$)/, "")
166
+
167
+ return title || o.fallback
168
+ }
169
+
170
+ , tip: function() {
171
+ return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
172
+ }
173
+
174
+ , validate: function() {
175
+ if (!this.$element[0].parentNode) {
176
+ this.hide()
177
+ this.$element = null
178
+ this.options = null
179
+ }
180
+ }
181
+
182
+ , enable: function() {
183
+ this.enabled = true
184
+ }
185
+
186
+ , disable: function() {
187
+ this.enabled = false
188
+ }
189
+
190
+ , toggleEnabled: function() {
191
+ this.enabled = !this.enabled
192
+ }
193
+
194
+ , toggle: function () {
195
+ this[this.tip().hasClass('in') ? 'hide' : 'show']()
196
+ }
197
+
198
+ }
199
+
200
+
201
+ /* TWIPSY PRIVATE METHODS
202
+ * ====================== */
203
+
204
+ function maybeCall ( thing, ctx, args ) {
205
+ return typeof thing == 'function' ? thing.apply(ctx, args) : thing
206
+ }
207
+
208
+ /* TWIPSY PLUGIN DEFINITION
209
+ * ======================== */
210
+
211
+ $.fn.twipsy = function (options) {
212
+ $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
213
+ return this
214
+ }
215
+
216
+ $.fn.twipsy.initWith = function (options, Constructor, name) {
217
+ var twipsy
218
+ , binder
219
+ , eventIn
220
+ , eventOut
221
+
222
+ if (options === true) {
223
+ return this.data(name)
224
+ } else if (typeof options == 'string') {
225
+ twipsy = this.data(name)
226
+ if (twipsy) {
227
+ twipsy[options]()
228
+ }
229
+ return this
230
+ }
231
+
232
+ options = $.extend({}, $.fn[name].defaults, options)
233
+
234
+ function get(ele) {
235
+ var twipsy = $.data(ele, name)
236
+
237
+ if (!twipsy) {
238
+ twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
239
+ $.data(ele, name, twipsy)
240
+ }
241
+
242
+ return twipsy
243
+ }
244
+
245
+ function enter() {
246
+ var twipsy = get(this)
247
+ twipsy.hoverState = 'in'
248
+
249
+ if (options.delayIn == 0) {
250
+ twipsy.show()
251
+ } else {
252
+ twipsy.fixTitle()
253
+ setTimeout(function() {
254
+ if (twipsy.hoverState == 'in') {
255
+ twipsy.show()
256
+ }
257
+ }, options.delayIn)
258
+ }
259
+ }
260
+
261
+ function leave() {
262
+ var twipsy = get(this)
263
+ twipsy.hoverState = 'out'
264
+ if (options.delayOut == 0) {
265
+ twipsy.hide()
266
+ } else {
267
+ setTimeout(function() {
268
+ if (twipsy.hoverState == 'out') {
269
+ twipsy.hide()
270
+ }
271
+ }, options.delayOut)
272
+ }
273
+ }
274
+
275
+ if (!options.live) {
276
+ this.each(function() {
277
+ get(this)
278
+ })
279
+ }
280
+
281
+ if (options.trigger != 'manual') {
282
+ binder = options.live ? 'live' : 'bind'
283
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
284
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
285
+ this[binder](eventIn, enter)[binder](eventOut, leave)
286
+ }
287
+
288
+ return this
289
+ }
290
+
291
+ $.fn.twipsy.Twipsy = Twipsy
292
+
293
+ $.fn.twipsy.defaults = {
294
+ animate: true
295
+ , delayIn: 0
296
+ , delayOut: 0
297
+ , fallback: ''
298
+ , placement: 'above'
299
+ , html: false
300
+ , live: false
301
+ , offset: 0
302
+ , title: 'title'
303
+ , trigger: 'hover'
304
+ , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
305
+ }
306
+
307
+ $.fn.twipsy.rejectAttrOptions = [ 'title' ]
308
+
309
+ $.fn.twipsy.elementOptions = function(ele, options) {
310
+ var data = $(ele).data()
311
+ , rejects = $.fn.twipsy.rejectAttrOptions
312
+ , i = rejects.length
313
+
314
+ while (i--) {
315
+ delete data[rejects[i]]
316
+ }
317
+
318
+ return $.extend({}, options, data)
319
+ }
320
+
321
+ }( window.jQuery || window.ender );
@@ -0,0 +1,16 @@
1
+ //= require bootstrap-alerts
2
+ //= require bootstrap-dropdown
3
+ //= require bootstrap-modal
4
+ //= require bootstrap-scrollspy
5
+ //= require bootstrap-tabs
6
+ //= require bootstrap-twipsy
7
+ //= require bootstrap-popover
8
+ //= require jquery.hotkeys
9
+ //= require jquery.mousewheel
10
+ //= require jquery.jscrollpane
11
+
12
+ $(document).ready(function() {
13
+ $('.dropdown').dropdown();
14
+ $('.alert-message').alert();
15
+ $('.scrollable').jScrollPane();
16
+ });
@@ -0,0 +1,99 @@
1
+ /*
2
+ * jQuery Hotkeys Plugin
3
+ * Copyright 2010, John Resig
4
+ * Dual licensed under the MIT or GPL Version 2 licenses.
5
+ *
6
+ * Based upon the plugin by Tzury Bar Yochay:
7
+ * http://github.com/tzuryby/hotkeys
8
+ *
9
+ * Original idea by:
10
+ * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
11
+ */
12
+
13
+ (function(jQuery){
14
+
15
+ jQuery.hotkeys = {
16
+ version: "0.8",
17
+
18
+ specialKeys: {
19
+ 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
20
+ 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
21
+ 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
22
+ 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
23
+ 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
24
+ 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
25
+ 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
26
+ },
27
+
28
+ shiftNums: {
29
+ "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
30
+ "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
31
+ ".": ">", "/": "?", "\\": "|"
32
+ }
33
+ };
34
+
35
+ function keyHandler( handleObj ) {
36
+ // Only care when a possible input has been specified
37
+ if ( typeof handleObj.data !== "string" ) {
38
+ return;
39
+ }
40
+
41
+ var origHandler = handleObj.handler,
42
+ keys = handleObj.data.toLowerCase().split(" ");
43
+
44
+ handleObj.handler = function( event ) {
45
+ // Don't fire in text-accepting inputs that we didn't directly bind to
46
+ if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
47
+ event.target.type === "text") ) {
48
+ return;
49
+ }
50
+
51
+ // Keypress represents characters, not special keys
52
+ var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
53
+ character = String.fromCharCode( event.which ).toLowerCase(),
54
+ key, modif = "", possible = {};
55
+
56
+ // check combinations (alt|ctrl|shift+anything)
57
+ if ( event.altKey && special !== "alt" ) {
58
+ modif += "alt+";
59
+ }
60
+
61
+ if ( event.ctrlKey && special !== "ctrl" ) {
62
+ modif += "ctrl+";
63
+ }
64
+
65
+ // TODO: Need to make sure this works consistently across platforms
66
+ if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
67
+ modif += "meta+";
68
+ }
69
+
70
+ if ( event.shiftKey && special !== "shift" ) {
71
+ modif += "shift+";
72
+ }
73
+
74
+ if ( special ) {
75
+ possible[ modif + special ] = true;
76
+
77
+ } else {
78
+ possible[ modif + character ] = true;
79
+ possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
80
+
81
+ // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
82
+ if ( modif === "shift+" ) {
83
+ possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
84
+ }
85
+ }
86
+
87
+ for ( var i = 0, l = keys.length; i < l; i++ ) {
88
+ if ( possible[ keys[i] ] ) {
89
+ return origHandler.apply( this, arguments );
90
+ }
91
+ }
92
+ };
93
+ }
94
+
95
+ jQuery.each([ "keydown", "keyup", "keypress" ], function() {
96
+ jQuery.event.special[ this ] = { add: keyHandler };
97
+ });
98
+
99
+ })( jQuery );
@@ -0,0 +1,11 @@
1
+ /*
2
+ * jScrollPane - v2.0.0beta10 - 2011-04-17
3
+ * http://jscrollpane.kelvinluck.com/
4
+ *
5
+ * Copyright (c) 2010 Kelvin Luck
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ */
8
+ (function(b,a,c){b.fn.jScrollPane=function(f){function d(E,P){var aA,R=this,Z,al,w,an,U,aa,z,r,aB,aG,aw,j,J,i,k,ab,V,ar,Y,u,B,at,ag,ao,H,m,av,az,y,ax,aJ,g,M,ak=true,Q=true,aI=false,l=false,aq=E.clone(false,false).empty(),ad=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aJ=E.css("paddingTop")+" "+E.css("paddingRight")+" "+E.css("paddingBottom")+" "+E.css("paddingLeft");g=(parseInt(E.css("paddingLeft"),10)||0)+(parseInt(E.css("paddingRight"),10)||0);function au(aS){var aN,aP,aO,aL,aK,aR,aQ=false,aM=false;aA=aS;if(Z===c){aK=E.scrollTop();aR=E.scrollLeft();E.css({overflow:"hidden",padding:0});al=E.innerWidth()+g;w=E.innerHeight();E.width(al);Z=b('<div class="jspPane" />').css("padding",aJ).append(E.children());an=b('<div class="jspContainer" />').css({width:al+"px",height:w+"px"}).append(Z).appendTo(E)}else{E.css("width","");aQ=aA.stickToBottom&&L();aM=aA.stickToRight&&C();aL=E.innerWidth()+g!=al||E.outerHeight()!=w;if(aL){al=E.innerWidth()+g;w=E.innerHeight();an.css({width:al+"px",height:w+"px"})}if(!aL&&M==U&&Z.outerHeight()==aa){E.width(al);return}M=U;Z.css("width","");E.width(al);an.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}Z.css("overflow","auto");if(aS.contentWidth){U=aS.contentWidth}else{U=Z[0].scrollWidth}aa=Z[0].scrollHeight;Z.css("overflow","");z=U/al;r=aa/w;aB=r>1;aG=z>1;if(!(aG||aB)){E.removeClass("jspScrollable");Z.css({top:0,width:an.width()-g});o();F();S();x();aj()}else{E.addClass("jspScrollable");aN=aA.maintainPosition&&(J||ab);if(aN){aP=aE();aO=aC()}aH();A();G();if(aN){O(aM?(U-al):aP,false);N(aQ?(aa-w):aO,false)}K();ah();ap();if(aA.enableKeyboardNavigation){T()}if(aA.clickOnTrack){q()}D();if(aA.hijackInternalLinks){n()}}if(aA.autoReinitialise&&!ax){ax=setInterval(function(){au(aA)},aA.autoReinitialiseDelay)}else{if(!aA.autoReinitialise&&ax){clearInterval(ax)}}aK&&E.scrollTop(0)&&N(aK,false);aR&&E.scrollLeft(0)&&O(aR,false);E.trigger("jsp-initialised",[aG||aB])}function aH(){if(aB){an.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));V=an.find(">.jspVerticalBar");ar=V.find(">.jspTrack");aw=ar.find(">.jspDrag");if(aA.showArrows){at=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aF(0,-1)).bind("click.jsp",aD);ag=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aF(0,1)).bind("click.jsp",aD);if(aA.arrowScrollOnHover){at.bind("mouseover.jsp",aF(0,-1,at));ag.bind("mouseover.jsp",aF(0,1,ag))}am(ar,aA.verticalArrowPositions,at,ag)}u=w;an.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){u-=b(this).outerHeight()});aw.hover(function(){aw.addClass("jspHover")},function(){aw.removeClass("jspHover")}).bind("mousedown.jsp",function(aK){b("html").bind("dragstart.jsp selectstart.jsp",aD);aw.addClass("jspActive");var s=aK.pageY-aw.position().top;b("html").bind("mousemove.jsp",function(aL){W(aL.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ay);return false});p()}}function p(){ar.height(u+"px");J=0;Y=aA.verticalGutter+ar.outerWidth();Z.width(al-Y-g);try{if(V.position().left===0){Z.css("margin-left",Y+"px")}}catch(s){}}function A(){if(aG){an.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));ao=an.find(">.jspHorizontalBar");H=ao.find(">.jspTrack");i=H.find(">.jspDrag");if(aA.showArrows){az=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aF(-1,0)).bind("click.jsp",aD);y=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aF(1,0)).bind("click.jsp",aD);
9
+ if(aA.arrowScrollOnHover){az.bind("mouseover.jsp",aF(-1,0,az));y.bind("mouseover.jsp",aF(1,0,y))}am(H,aA.horizontalArrowPositions,az,y)}i.hover(function(){i.addClass("jspHover")},function(){i.removeClass("jspHover")}).bind("mousedown.jsp",function(aK){b("html").bind("dragstart.jsp selectstart.jsp",aD);i.addClass("jspActive");var s=aK.pageX-i.position().left;b("html").bind("mousemove.jsp",function(aL){X(aL.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ay);return false});m=an.innerWidth();ai()}}function ai(){an.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){m-=b(this).outerWidth()});H.width(m+"px");ab=0}function G(){if(aG&&aB){var aK=H.outerHeight(),s=ar.outerWidth();u-=aK;b(ao).find(">.jspCap:visible,>.jspArrow").each(function(){m+=b(this).outerWidth()});m-=s;w-=s;al-=aK;H.parent().append(b('<div class="jspCorner" />').css("width",aK+"px"));p();ai()}if(aG){Z.width((an.outerWidth()-g)+"px")}aa=Z.outerHeight();r=aa/w;if(aG){av=Math.ceil(1/z*m);if(av>aA.horizontalDragMaxWidth){av=aA.horizontalDragMaxWidth}else{if(av<aA.horizontalDragMinWidth){av=aA.horizontalDragMinWidth}}i.width(av+"px");k=m-av;af(ab)}if(aB){B=Math.ceil(1/r*u);if(B>aA.verticalDragMaxHeight){B=aA.verticalDragMaxHeight}else{if(B<aA.verticalDragMinHeight){B=aA.verticalDragMinHeight}}aw.height(B+"px");j=u-B;ae(J)}}function am(aL,aN,aK,s){var aP="before",aM="after",aO;if(aN=="os"){aN=/Mac/.test(navigator.platform)?"after":"split"}if(aN==aP){aM=aN}else{if(aN==aM){aP=aN;aO=aK;aK=s;s=aO}}aL[aP](aK)[aM](s)}function aF(aK,s,aL){return function(){I(aK,s,this,aL);this.blur();return false}}function I(aN,aM,aQ,aP){aQ=b(aQ).addClass("jspActive");var aO,aL,aK=true,s=function(){if(aN!==0){R.scrollByX(aN*aA.arrowButtonSpeed)}if(aM!==0){R.scrollByY(aM*aA.arrowButtonSpeed)}aL=setTimeout(s,aK?aA.initialDelay:aA.arrowRepeatFreq);aK=false};s();aO=aP?"mouseout.jsp":"mouseup.jsp";aP=aP||b("html");aP.bind(aO,function(){aQ.removeClass("jspActive");aL&&clearTimeout(aL);aL=null;aP.unbind(aO)})}function q(){x();if(aB){ar.bind("mousedown.jsp",function(aP){if(aP.originalTarget===c||aP.originalTarget==aP.currentTarget){var aN=b(this),aQ=aN.offset(),aO=aP.pageY-aQ.top-J,aL,aK=true,s=function(){var aT=aN.offset(),aU=aP.pageY-aT.top-B/2,aR=w*aA.scrollPagePercent,aS=j*aR/(aa-w);if(aO<0){if(J-aS>aU){R.scrollByY(-aR)}else{W(aU)}}else{if(aO>0){if(J+aS<aU){R.scrollByY(aR)}else{W(aU)}}else{aM();return}}aL=setTimeout(s,aK?aA.initialDelay:aA.trackClickRepeatFreq);aK=false},aM=function(){aL&&clearTimeout(aL);aL=null;b(document).unbind("mouseup.jsp",aM)};s();b(document).bind("mouseup.jsp",aM);return false}})}if(aG){H.bind("mousedown.jsp",function(aP){if(aP.originalTarget===c||aP.originalTarget==aP.currentTarget){var aN=b(this),aQ=aN.offset(),aO=aP.pageX-aQ.left-ab,aL,aK=true,s=function(){var aT=aN.offset(),aU=aP.pageX-aT.left-av/2,aR=al*aA.scrollPagePercent,aS=k*aR/(U-al);if(aO<0){if(ab-aS>aU){R.scrollByX(-aR)}else{X(aU)}}else{if(aO>0){if(ab+aS<aU){R.scrollByX(aR)}else{X(aU)}}else{aM();return}}aL=setTimeout(s,aK?aA.initialDelay:aA.trackClickRepeatFreq);aK=false},aM=function(){aL&&clearTimeout(aL);aL=null;b(document).unbind("mouseup.jsp",aM)};s();b(document).bind("mouseup.jsp",aM);return false}})}}function x(){if(H){H.unbind("mousedown.jsp")}if(ar){ar.unbind("mousedown.jsp")}}function ay(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(aw){aw.removeClass("jspActive")}if(i){i.removeClass("jspActive")}}function W(s,aK){if(!aB){return}if(s<0){s=0}else{if(s>j){s=j}}if(aK===c){aK=aA.animateScroll}if(aK){R.animate(aw,"top",s,ae)}else{aw.css("top",s);ae(s)}}function ae(aK){if(aK===c){aK=aw.position().top}an.scrollTop(0);J=aK;var aN=J===0,aL=J==j,aM=aK/j,s=-aM*(aa-w);if(ak!=aN||aI!=aL){ak=aN;aI=aL;E.trigger("jsp-arrow-change",[ak,aI,Q,l])}v(aN,aL);Z.css("top",s);E.trigger("jsp-scroll-y",[-s,aN,aL]).trigger("scroll")}function X(aK,s){if(!aG){return}if(aK<0){aK=0}else{if(aK>k){aK=k}}if(s===c){s=aA.animateScroll}if(s){R.animate(i,"left",aK,af)
10
+ }else{i.css("left",aK);af(aK)}}function af(aK){if(aK===c){aK=i.position().left}an.scrollTop(0);ab=aK;var aN=ab===0,aM=ab==k,aL=aK/k,s=-aL*(U-al);if(Q!=aN||l!=aM){Q=aN;l=aM;E.trigger("jsp-arrow-change",[ak,aI,Q,l])}t(aN,aM);Z.css("left",s);E.trigger("jsp-scroll-x",[-s,aN,aM]).trigger("scroll")}function v(aK,s){if(aA.showArrows){at[aK?"addClass":"removeClass"]("jspDisabled");ag[s?"addClass":"removeClass"]("jspDisabled")}}function t(aK,s){if(aA.showArrows){az[aK?"addClass":"removeClass"]("jspDisabled");y[s?"addClass":"removeClass"]("jspDisabled")}}function N(s,aK){var aL=s/(aa-w);W(aL*j,aK)}function O(aK,s){var aL=aK/(U-al);X(aL*k,s)}function ac(aX,aS,aL){var aP,aM,aN,s=0,aW=0,aK,aR,aQ,aU,aT,aV;try{aP=b(aX)}catch(aO){return}aM=aP.outerHeight();aN=aP.outerWidth();an.scrollTop(0);an.scrollLeft(0);while(!aP.is(".jspPane")){s+=aP.position().top;aW+=aP.position().left;aP=aP.offsetParent();if(/^body|html$/i.test(aP[0].nodeName)){return}}aK=aC();aQ=aK+w;if(s<aK||aS){aT=s-aA.verticalGutter}else{if(s+aM>aQ){aT=s-w+aM+aA.verticalGutter}}if(aT){N(aT,aL)}aR=aE();aU=aR+al;if(aW<aR||aS){aV=aW-aA.horizontalGutter}else{if(aW+aN>aU){aV=aW-al+aN+aA.horizontalGutter}}if(aV){O(aV,aL)}}function aE(){return -Z.position().left}function aC(){return -Z.position().top}function L(){var s=aa-w;return(s>20)&&(s-aC()<10)}function C(){var s=U-al;return(s>20)&&(s-aE()<10)}function ah(){an.unbind(ad).bind(ad,function(aN,aO,aM,aK){var aL=ab,s=J;R.scrollBy(aM*aA.mouseWheelSpeed,-aK*aA.mouseWheelSpeed,false);return aL==ab&&s==J})}function o(){an.unbind(ad)}function aD(){return false}function K(){Z.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){ac(s.target,false)})}function F(){Z.find(":input,a").unbind("focus.jsp")}function T(){var s,aK,aM=[];aG&&aM.push(ao[0]);aB&&aM.push(V[0]);Z.focus(function(){E.focus()});E.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aP){if(aP.target!==this&&!(aM.length&&b(aP.target).closest(aM).length)){return}var aO=ab,aN=J;switch(aP.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aP.keyCode;aL();break;case 35:N(aa-w);s=null;break;case 36:N(0);s=null;break}aK=aP.keyCode==s&&aO!=ab||aN!=J;return !aK}).bind("keypress.jsp",function(aN){if(aN.keyCode==s){aL()}return !aK});if(aA.hideFocus){E.css("outline","none");if("hideFocus" in an[0]){E.attr("hideFocus",true)}}else{E.css("outline","");if("hideFocus" in an[0]){E.attr("hideFocus",false)}}function aL(){var aO=ab,aN=J;switch(s){case 40:R.scrollByY(aA.keyboardSpeed,false);break;case 38:R.scrollByY(-aA.keyboardSpeed,false);break;case 34:case 32:R.scrollByY(w*aA.scrollPagePercent,false);break;case 33:R.scrollByY(-w*aA.scrollPagePercent,false);break;case 39:R.scrollByX(aA.keyboardSpeed,false);break;case 37:R.scrollByX(-aA.keyboardSpeed,false);break}aK=aO!=ab||aN!=J;return aK}}function S(){E.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function D(){if(location.hash&&location.hash.length>1){var aL,aK;try{aL=b(location.hash)}catch(s){return}if(aL.length&&Z.find(location.hash)){if(an.scrollTop()===0){aK=setInterval(function(){if(an.scrollTop()>0){ac(location.hash,true);b(document).scrollTop(an.position().top);clearInterval(aK)}},50)}else{ac(location.hash,true);b(document).scrollTop(an.position().top)}}}}function aj(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function n(){aj();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aK;if(s.length>1){aK=s[1];if(aK.length>0&&Z.find("#"+aK).length>0){ac("#"+aK,true);return false}}})}function ap(){var aL,aK,aN,aM,aO,s=false;an.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aP){var aQ=aP.originalEvent.touches[0];aL=aE();aK=aC();aN=aQ.pageX;aM=aQ.pageY;aO=false;s=true}).bind("touchmove.jsp",function(aS){if(!s){return}var aR=aS.originalEvent.touches[0],aQ=ab,aP=J;R.scrollTo(aL+aN-aR.pageX,aK+aM-aR.pageY);aO=aO||Math.abs(aN-aR.pageX)>5||Math.abs(aM-aR.pageY)>5;
11
+ return aQ==ab&&aP==J}).bind("touchend.jsp",function(aP){s=false}).bind("click.jsp-touchclick",function(aP){if(aO){aO=false;return false}})}function h(){var s=aC(),aK=aE();E.removeClass("jspScrollable").unbind(".jsp");E.replaceWith(aq.append(Z.children()));aq.scrollTop(s);aq.scrollLeft(aK)}b.extend(R,{reinitialise:function(aK){aK=b.extend({},aA,aK);au(aK)},scrollToElement:function(aL,aK,s){ac(aL,aK,s)},scrollTo:function(aL,s,aK){O(aL,aK);N(s,aK)},scrollToX:function(aK,s){O(aK,s)},scrollToY:function(s,aK){N(s,aK)},scrollToPercentX:function(aK,s){O(aK*(U-al),s)},scrollToPercentY:function(aK,s){N(aK*(aa-w),s)},scrollBy:function(aK,s,aL){R.scrollByX(aK,aL);R.scrollByY(s,aL)},scrollByX:function(s,aL){var aK=aE()+s,aM=aK/(U-al);X(aM*k,aL)},scrollByY:function(s,aL){var aK=aC()+s,aM=aK/(aa-w);W(aM*j,aL)},positionDragX:function(s,aK){X(s,aK)},positionDragY:function(aK,s){W(aK,s)},animate:function(aK,aN,s,aM){var aL={};aL[aN]=s;aK.animate(aL,{duration:aA.animateDuration,ease:aA.animateEase,queue:false,step:aM})},getContentPositionX:function(){return aE()},getContentPositionY:function(){return aC()},getContentWidth:function(){return U},getContentHeight:function(){return aa},getPercentScrolledX:function(){return aE()/(U-al)},getPercentScrolledY:function(){return aC()/(aa-w)},getIsScrollableH:function(){return aG},getIsScrollableV:function(){return aB},getContentPane:function(){return Z},scrollToBottom:function(s){W(j,s)},hijackInternalLinks:function(){n()},destroy:function(){h()}});au(P)}f=b.extend({},b.fn.jScrollPane.defaults,f);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){f[this]=f[this]||f.speed});var e;this.each(function(){var g=b(this),h=g.data("jsp");if(h){h.reinitialise(f)}else{h=new d(g,f);g.data("jsp",h)}e=e?e.add(g):g});return e};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,stickToBottom:false,stickToRight:false,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:c,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this);