| author | Anthony Ly <anthonyly.com@gmail.com> |
| Tue, 14 May 2013 18:19:04 +0200 | |
| changeset 2 | 78f71aa0a477 |
| parent 1 | integration/back-office/js/bootstrap.js@b95aebb070b5 |
| permissions | -rwxr-xr-x |
|
1
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1 |
/* =================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2 |
* bootstrap-transition.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
3 |
* http://twitter.github.com/bootstrap/javascript.html#transitions |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
4 |
* =================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
5 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
6 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
7 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
8 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
9 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
10 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
12 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
13 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
14 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
15 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
16 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
17 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
18 |
* ========================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
19 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
20 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
21 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
22 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
23 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
24 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
25 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
26 |
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
27 |
* ======================================================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
28 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
29 |
$(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
30 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
31 |
$.support.transition = (function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
32 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
33 |
var transitionEnd = (function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
34 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
35 |
var el = document.createElement('bootstrap') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
36 |
, transEndEventNames = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
37 |
'WebkitTransition' : 'webkitTransitionEnd' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
38 |
, 'MozTransition' : 'transitionend' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
39 |
, 'OTransition' : 'oTransitionEnd otransitionend' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
40 |
, 'transition' : 'transitionend' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
41 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
42 |
, name |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
43 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
44 |
for (name in transEndEventNames){ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
45 |
if (el.style[name] !== undefined) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
46 |
return transEndEventNames[name] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
47 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
48 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
49 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
50 |
}()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
51 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
52 |
return transitionEnd && { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
53 |
end: transitionEnd |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
54 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
55 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
56 |
})() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
57 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
58 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
59 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
60 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
61 |
/* ========================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
62 |
* bootstrap-modal.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
63 |
* http://twitter.github.com/bootstrap/javascript.html#modals |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
64 |
* ========================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
65 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
66 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
67 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
68 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
69 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
70 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
71 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
72 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
73 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
74 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
75 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
76 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
77 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
78 |
* ========================================================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
79 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
80 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
81 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
82 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
83 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
84 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
85 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
86 |
/* MODAL CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
87 |
* ====================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
88 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
89 |
var Modal = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
90 |
this.options = options |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
91 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
92 |
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
93 |
this.options.remote && this.$element.find('.modal-body').load(this.options.remote) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
94 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
95 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
96 |
Modal.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
97 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
98 |
constructor: Modal |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
99 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
100 |
, toggle: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
101 |
return this[!this.isShown ? 'show' : 'hide']() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
102 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
103 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
104 |
, show: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
105 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
106 |
, e = $.Event('show') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
107 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
108 |
this.$element.trigger(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
109 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
110 |
if (this.isShown || e.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
111 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
112 |
this.isShown = true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
113 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
114 |
this.escape() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
115 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
116 |
this.backdrop(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
117 |
var transition = $.support.transition && that.$element.hasClass('fade') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
118 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
119 |
if (!that.$element.parent().length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
120 |
that.$element.appendTo(document.body) //don't move modals dom position |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
121 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
122 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
123 |
that.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
124 |
.show() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
125 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
126 |
if (transition) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
127 |
that.$element[0].offsetWidth // force reflow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
128 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
129 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
130 |
that.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
131 |
.addClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
132 |
.attr('aria-hidden', false) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
133 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
134 |
that.enforceFocus() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
135 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
136 |
transition ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
137 |
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
138 |
that.$element.focus().trigger('shown') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
139 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
140 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
141 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
142 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
143 |
, hide: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
144 |
e && e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
145 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
146 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
147 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
148 |
e = $.Event('hide') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
149 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
150 |
this.$element.trigger(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
151 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
152 |
if (!this.isShown || e.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
153 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
154 |
this.isShown = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
155 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
156 |
this.escape() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
157 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
158 |
$(document).off('focusin.modal') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
159 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
160 |
this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
161 |
.removeClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
162 |
.attr('aria-hidden', true) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
163 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
164 |
$.support.transition && this.$element.hasClass('fade') ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
165 |
this.hideWithTransition() : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
166 |
this.hideModal() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
167 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
168 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
169 |
, enforceFocus: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
170 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
171 |
$(document).on('focusin.modal', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
172 |
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
173 |
that.$element.focus() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
174 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
175 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
176 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
177 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
178 |
, escape: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
179 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
180 |
if (this.isShown && this.options.keyboard) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
181 |
this.$element.on('keyup.dismiss.modal', function ( e ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
182 |
e.which == 27 && that.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
183 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
184 |
} else if (!this.isShown) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
185 |
this.$element.off('keyup.dismiss.modal') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
186 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
187 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
188 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
189 |
, hideWithTransition: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
190 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
191 |
, timeout = setTimeout(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
192 |
that.$element.off($.support.transition.end) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
193 |
that.hideModal() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
194 |
}, 500) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
195 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
196 |
this.$element.one($.support.transition.end, function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
197 |
clearTimeout(timeout) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
198 |
that.hideModal() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
199 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
200 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
201 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
202 |
, hideModal: function (that) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
203 |
this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
204 |
.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
205 |
.trigger('hidden') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
206 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
207 |
this.backdrop() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
208 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
209 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
210 |
, removeBackdrop: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
211 |
this.$backdrop.remove() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
212 |
this.$backdrop = null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
213 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
214 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
215 |
, backdrop: function (callback) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
216 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
217 |
, animate = this.$element.hasClass('fade') ? 'fade' : '' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
218 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
219 |
if (this.isShown && this.options.backdrop) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
220 |
var doAnimate = $.support.transition && animate |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
221 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
222 |
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
223 |
.appendTo(document.body) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
224 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
225 |
this.$backdrop.click( |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
226 |
this.options.backdrop == 'static' ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
227 |
$.proxy(this.$element[0].focus, this.$element[0]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
228 |
: $.proxy(this.hide, this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
229 |
) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
230 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
231 |
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
232 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
233 |
this.$backdrop.addClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
234 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
235 |
doAnimate ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
236 |
this.$backdrop.one($.support.transition.end, callback) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
237 |
callback() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
238 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
239 |
} else if (!this.isShown && this.$backdrop) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
240 |
this.$backdrop.removeClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
241 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
242 |
$.support.transition && this.$element.hasClass('fade')? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
243 |
this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
244 |
this.removeBackdrop() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
245 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
246 |
} else if (callback) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
247 |
callback() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
248 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
249 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
250 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
251 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
252 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
253 |
/* MODAL PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
254 |
* ======================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
255 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
256 |
$.fn.modal = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
257 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
258 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
259 |
, data = $this.data('modal') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
260 |
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
261 |
if (!data) $this.data('modal', (data = new Modal(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
262 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
263 |
else if (options.show) data.show() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
264 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
265 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
266 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
267 |
$.fn.modal.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
268 |
backdrop: true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
269 |
, keyboard: true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
270 |
, show: true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
271 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
272 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
273 |
$.fn.modal.Constructor = Modal |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
274 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
275 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
276 |
/* MODAL DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
277 |
* ============== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
278 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
279 |
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
280 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
281 |
, href = $this.attr('href') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
282 |
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
283 |
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
284 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
285 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
286 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
287 |
$target |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
288 |
.modal(option) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
289 |
.one('hide', function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
290 |
$this.focus() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
291 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
292 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
293 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
294 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
295 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
296 |
/* ============================================================ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
297 |
* bootstrap-dropdown.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
298 |
* http://twitter.github.com/bootstrap/javascript.html#dropdowns |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
299 |
* ============================================================ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
300 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
301 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
302 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
303 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
304 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
305 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
306 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
307 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
308 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
309 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
310 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
311 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
312 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
313 |
* ============================================================ */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
314 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
315 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
316 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
317 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
318 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
319 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
320 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
321 |
/* DROPDOWN CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
322 |
* ========================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
323 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
324 |
var toggle = '[data-toggle=dropdown]' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
325 |
, Dropdown = function (element) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
326 |
var $el = $(element).on('click.dropdown.data-api', this.toggle) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
327 |
$('html').on('click.dropdown.data-api', function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
328 |
$el.parent().removeClass('open') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
329 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
330 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
331 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
332 |
Dropdown.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
333 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
334 |
constructor: Dropdown |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
335 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
336 |
, toggle: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
337 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
338 |
, $parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
339 |
, isActive |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
340 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
341 |
if ($this.is('.disabled, :disabled')) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
342 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
343 |
$parent = getParent($this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
344 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
345 |
isActive = $parent.hasClass('open') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
346 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
347 |
clearMenus() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
348 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
349 |
if (!isActive) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
350 |
$parent.toggleClass('open') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
351 |
$this.focus() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
352 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
353 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
354 |
return false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
355 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
356 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
357 |
, keydown: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
358 |
var $this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
359 |
, $items |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
360 |
, $active |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
361 |
, $parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
362 |
, isActive |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
363 |
, index |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
364 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
365 |
if (!/(38|40|27)/.test(e.keyCode)) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
366 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
367 |
$this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
368 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
369 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
370 |
e.stopPropagation() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
371 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
372 |
if ($this.is('.disabled, :disabled')) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
373 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
374 |
$parent = getParent($this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
375 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
376 |
isActive = $parent.hasClass('open') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
377 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
378 |
if (!isActive || (isActive && e.keyCode == 27)) return $this.click() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
379 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
380 |
$items = $('[role=menu] li:not(.divider) a', $parent) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
381 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
382 |
if (!$items.length) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
383 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
384 |
index = $items.index($items.filter(':focus')) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
385 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
386 |
if (e.keyCode == 38 && index > 0) index-- // up |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
387 |
if (e.keyCode == 40 && index < $items.length - 1) index++ // down |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
388 |
if (!~index) index = 0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
389 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
390 |
$items |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
391 |
.eq(index) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
392 |
.focus() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
393 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
394 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
395 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
396 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
397 |
function clearMenus() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
398 |
$(toggle).each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
399 |
getParent($(this)).removeClass('open') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
400 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
401 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
402 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
403 |
function getParent($this) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
404 |
var selector = $this.attr('data-target') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
405 |
, $parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
406 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
407 |
if (!selector) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
408 |
selector = $this.attr('href') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
409 |
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
410 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
411 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
412 |
$parent = $(selector) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
413 |
$parent.length || ($parent = $this.parent()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
414 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
415 |
return $parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
416 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
417 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
418 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
419 |
/* DROPDOWN PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
420 |
* ========================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
421 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
422 |
$.fn.dropdown = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
423 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
424 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
425 |
, data = $this.data('dropdown') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
426 |
if (!data) $this.data('dropdown', (data = new Dropdown(this))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
427 |
if (typeof option == 'string') data[option].call($this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
428 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
429 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
430 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
431 |
$.fn.dropdown.Constructor = Dropdown |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
432 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
433 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
434 |
/* APPLY TO STANDARD DROPDOWN ELEMENTS |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
435 |
* =================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
436 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
437 |
$(document) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
438 |
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
439 |
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
440 |
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
441 |
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
442 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
443 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
444 |
/* ============================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
445 |
* bootstrap-scrollspy.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
446 |
* http://twitter.github.com/bootstrap/javascript.html#scrollspy |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
447 |
* ============================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
448 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
449 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
450 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
451 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
452 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
453 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
454 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
455 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
456 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
457 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
458 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
459 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
460 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
461 |
* ============================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
462 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
463 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
464 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
465 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
466 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
467 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
468 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
469 |
/* SCROLLSPY CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
470 |
* ========================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
471 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
472 |
function ScrollSpy(element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
473 |
var process = $.proxy(this.process, this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
474 |
, $element = $(element).is('body') ? $(window) : $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
475 |
, href |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
476 |
this.options = $.extend({}, $.fn.scrollspy.defaults, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
477 |
this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
478 |
this.selector = (this.options.target |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
479 |
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
480 |
|| '') + ' .nav li > a' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
481 |
this.$body = $('body') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
482 |
this.refresh() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
483 |
this.process() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
484 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
485 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
486 |
ScrollSpy.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
487 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
488 |
constructor: ScrollSpy |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
489 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
490 |
, refresh: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
491 |
var self = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
492 |
, $targets |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
493 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
494 |
this.offsets = $([]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
495 |
this.targets = $([]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
496 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
497 |
$targets = this.$body |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
498 |
.find(this.selector) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
499 |
.map(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
500 |
var $el = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
501 |
, href = $el.data('target') || $el.attr('href') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
502 |
, $href = /^#\w/.test(href) && $(href) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
503 |
return ( $href |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
504 |
&& $href.length |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
505 |
&& [[ $href.position().top, href ]] ) || null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
506 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
507 |
.sort(function (a, b) { return a[0] - b[0] }) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
508 |
.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
509 |
self.offsets.push(this[0]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
510 |
self.targets.push(this[1]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
511 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
512 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
513 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
514 |
, process: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
515 |
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
516 |
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
517 |
, maxScroll = scrollHeight - this.$scrollElement.height() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
518 |
, offsets = this.offsets |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
519 |
, targets = this.targets |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
520 |
, activeTarget = this.activeTarget |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
521 |
, i |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
522 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
523 |
if (scrollTop >= maxScroll) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
524 |
return activeTarget != (i = targets.last()[0]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
525 |
&& this.activate ( i ) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
526 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
527 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
528 |
for (i = offsets.length; i--;) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
529 |
activeTarget != targets[i] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
530 |
&& scrollTop >= offsets[i] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
531 |
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
532 |
&& this.activate( targets[i] ) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
533 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
534 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
535 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
536 |
, activate: function (target) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
537 |
var active |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
538 |
, selector |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
539 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
540 |
this.activeTarget = target |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
541 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
542 |
$(this.selector) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
543 |
.parent('.active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
544 |
.removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
545 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
546 |
selector = this.selector |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
547 |
+ '[data-target="' + target + '"],' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
548 |
+ this.selector + '[href="' + target + '"]' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
549 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
550 |
active = $(selector) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
551 |
.parent('li') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
552 |
.addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
553 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
554 |
if (active.parent('.dropdown-menu').length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
555 |
active = active.closest('li.dropdown').addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
556 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
557 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
558 |
active.trigger('activate') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
559 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
560 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
561 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
562 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
563 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
564 |
/* SCROLLSPY PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
565 |
* =========================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
566 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
567 |
$.fn.scrollspy = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
568 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
569 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
570 |
, data = $this.data('scrollspy') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
571 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
572 |
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
573 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
574 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
575 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
576 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
577 |
$.fn.scrollspy.Constructor = ScrollSpy |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
578 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
579 |
$.fn.scrollspy.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
580 |
offset: 10 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
581 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
582 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
583 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
584 |
/* SCROLLSPY DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
585 |
* ================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
586 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
587 |
$(window).on('load', function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
588 |
$('[data-spy="scroll"]').each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
589 |
var $spy = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
590 |
$spy.scrollspy($spy.data()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
591 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
592 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
593 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
594 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
595 |
/* ======================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
596 |
* bootstrap-tab.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
597 |
* http://twitter.github.com/bootstrap/javascript.html#tabs |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
598 |
* ======================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
599 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
600 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
601 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
602 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
603 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
604 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
605 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
606 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
607 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
608 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
609 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
610 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
611 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
612 |
* ======================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
613 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
614 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
615 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
616 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
617 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
618 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
619 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
620 |
/* TAB CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
621 |
* ==================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
622 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
623 |
var Tab = function (element) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
624 |
this.element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
625 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
626 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
627 |
Tab.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
628 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
629 |
constructor: Tab |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
630 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
631 |
, show: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
632 |
var $this = this.element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
633 |
, $ul = $this.closest('ul:not(.dropdown-menu)') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
634 |
, selector = $this.attr('data-target') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
635 |
, previous |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
636 |
, $target |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
637 |
, e |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
638 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
639 |
if (!selector) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
640 |
selector = $this.attr('href') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
641 |
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
642 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
643 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
644 |
if ( $this.parent('li').hasClass('active') ) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
645 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
646 |
previous = $ul.find('.active:last a')[0] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
647 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
648 |
e = $.Event('show', { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
649 |
relatedTarget: previous |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
650 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
651 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
652 |
$this.trigger(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
653 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
654 |
if (e.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
655 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
656 |
$target = $(selector) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
657 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
658 |
this.activate($this.parent('li'), $ul) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
659 |
this.activate($target, $target.parent(), function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
660 |
$this.trigger({ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
661 |
type: 'shown' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
662 |
, relatedTarget: previous |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
663 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
664 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
665 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
666 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
667 |
, activate: function ( element, container, callback) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
668 |
var $active = container.find('> .active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
669 |
, transition = callback |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
670 |
&& $.support.transition |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
671 |
&& $active.hasClass('fade') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
672 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
673 |
function next() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
674 |
$active |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
675 |
.removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
676 |
.find('> .dropdown-menu > .active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
677 |
.removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
678 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
679 |
element.addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
680 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
681 |
if (transition) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
682 |
element[0].offsetWidth // reflow for transition |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
683 |
element.addClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
684 |
} else { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
685 |
element.removeClass('fade') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
686 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
687 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
688 |
if ( element.parent('.dropdown-menu') ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
689 |
element.closest('li.dropdown').addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
690 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
691 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
692 |
callback && callback() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
693 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
694 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
695 |
transition ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
696 |
$active.one($.support.transition.end, next) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
697 |
next() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
698 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
699 |
$active.removeClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
700 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
701 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
702 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
703 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
704 |
/* TAB PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
705 |
* ===================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
706 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
707 |
$.fn.tab = function ( option ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
708 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
709 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
710 |
, data = $this.data('tab') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
711 |
if (!data) $this.data('tab', (data = new Tab(this))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
712 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
713 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
714 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
715 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
716 |
$.fn.tab.Constructor = Tab |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
717 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
718 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
719 |
/* TAB DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
720 |
* ============ */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
721 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
722 |
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
723 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
724 |
$(this).tab('show') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
725 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
726 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
727 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
728 |
/* =========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
729 |
* bootstrap-tooltip.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
730 |
* http://twitter.github.com/bootstrap/javascript.html#tooltips |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
731 |
* Inspired by the original jQuery.tipsy by Jason Frame |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
732 |
* =========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
733 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
734 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
735 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
736 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
737 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
738 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
739 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
740 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
741 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
742 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
743 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
744 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
745 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
746 |
* ========================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
747 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
748 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
749 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
750 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
751 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
752 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
753 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
754 |
/* TOOLTIP PUBLIC CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
755 |
* =============================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
756 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
757 |
var Tooltip = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
758 |
this.init('tooltip', element, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
759 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
760 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
761 |
Tooltip.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
762 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
763 |
constructor: Tooltip |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
764 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
765 |
, init: function (type, element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
766 |
var eventIn |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
767 |
, eventOut |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
768 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
769 |
this.type = type |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
770 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
771 |
this.options = this.getOptions(options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
772 |
this.enabled = true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
773 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
774 |
if (this.options.trigger == 'click') { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
775 |
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
776 |
} else if (this.options.trigger != 'manual') { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
777 |
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
778 |
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
779 |
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
780 |
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
781 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
782 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
783 |
this.options.selector ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
784 |
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
785 |
this.fixTitle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
786 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
787 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
788 |
, getOptions: function (options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
789 |
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
790 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
791 |
if (options.delay && typeof options.delay == 'number') { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
792 |
options.delay = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
793 |
show: options.delay |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
794 |
, hide: options.delay |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
795 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
796 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
797 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
798 |
return options |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
799 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
800 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
801 |
, enter: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
802 |
var self = $(e.currentTarget)[this.type](this._options).data(this.type) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
803 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
804 |
if (!self.options.delay || !self.options.delay.show) return self.show() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
805 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
806 |
clearTimeout(this.timeout) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
807 |
self.hoverState = 'in' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
808 |
this.timeout = setTimeout(function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
809 |
if (self.hoverState == 'in') self.show() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
810 |
}, self.options.delay.show) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
811 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
812 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
813 |
, leave: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
814 |
var self = $(e.currentTarget)[this.type](this._options).data(this.type) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
815 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
816 |
if (this.timeout) clearTimeout(this.timeout) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
817 |
if (!self.options.delay || !self.options.delay.hide) return self.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
818 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
819 |
self.hoverState = 'out' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
820 |
this.timeout = setTimeout(function() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
821 |
if (self.hoverState == 'out') self.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
822 |
}, self.options.delay.hide) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
823 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
824 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
825 |
, show: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
826 |
var $tip |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
827 |
, inside |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
828 |
, pos |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
829 |
, actualWidth |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
830 |
, actualHeight |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
831 |
, placement |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
832 |
, tp |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
833 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
834 |
if (this.hasContent() && this.enabled) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
835 |
$tip = this.tip() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
836 |
this.setContent() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
837 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
838 |
if (this.options.animation) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
839 |
$tip.addClass('fade') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
840 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
841 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
842 |
placement = typeof this.options.placement == 'function' ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
843 |
this.options.placement.call(this, $tip[0], this.$element[0]) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
844 |
this.options.placement |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
845 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
846 |
inside = /in/.test(placement) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
847 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
848 |
$tip |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
849 |
.detach() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
850 |
.css({ top: 0, left: 0, display: 'block' }) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
851 |
.insertAfter(this.$element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
852 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
853 |
pos = this.getPosition(inside) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
854 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
855 |
actualWidth = $tip[0].offsetWidth |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
856 |
actualHeight = $tip[0].offsetHeight |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
857 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
858 |
switch (inside ? placement.split(' ')[1] : placement) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
859 |
case 'bottom': |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
860 |
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
861 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
862 |
case 'top': |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
863 |
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
864 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
865 |
case 'left': |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
866 |
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
867 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
868 |
case 'right': |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
869 |
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
870 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
871 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
872 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
873 |
$tip |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
874 |
.offset(tp) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
875 |
.addClass(placement) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
876 |
.addClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
877 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
878 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
879 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
880 |
, setContent: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
881 |
var $tip = this.tip() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
882 |
, title = this.getTitle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
883 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
884 |
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
885 |
$tip.removeClass('fade in top bottom left right') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
886 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
887 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
888 |
, hide: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
889 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
890 |
, $tip = this.tip() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
891 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
892 |
$tip.removeClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
893 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
894 |
function removeWithAnimation() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
895 |
var timeout = setTimeout(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
896 |
$tip.off($.support.transition.end).detach() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
897 |
}, 500) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
898 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
899 |
$tip.one($.support.transition.end, function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
900 |
clearTimeout(timeout) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
901 |
$tip.detach() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
902 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
903 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
904 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
905 |
$.support.transition && this.$tip.hasClass('fade') ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
906 |
removeWithAnimation() : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
907 |
$tip.detach() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
908 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
909 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
910 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
911 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
912 |
, fixTitle: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
913 |
var $e = this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
914 |
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
915 |
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
916 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
917 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
918 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
919 |
, hasContent: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
920 |
return this.getTitle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
921 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
922 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
923 |
, getPosition: function (inside) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
924 |
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
925 |
width: this.$element[0].offsetWidth |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
926 |
, height: this.$element[0].offsetHeight |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
927 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
928 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
929 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
930 |
, getTitle: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
931 |
var title |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
932 |
, $e = this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
933 |
, o = this.options |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
934 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
935 |
title = $e.attr('data-original-title') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
936 |
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
937 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
938 |
return title |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
939 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
940 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
941 |
, tip: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
942 |
return this.$tip = this.$tip || $(this.options.template) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
943 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
944 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
945 |
, validate: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
946 |
if (!this.$element[0].parentNode) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
947 |
this.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
948 |
this.$element = null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
949 |
this.options = null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
950 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
951 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
952 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
953 |
, enable: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
954 |
this.enabled = true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
955 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
956 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
957 |
, disable: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
958 |
this.enabled = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
959 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
960 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
961 |
, toggleEnabled: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
962 |
this.enabled = !this.enabled |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
963 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
964 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
965 |
, toggle: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
966 |
var self = $(e.currentTarget)[this.type](this._options).data(this.type) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
967 |
self[self.tip().hasClass('in') ? 'hide' : 'show']() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
968 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
969 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
970 |
, destroy: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
971 |
this.hide().$element.off('.' + this.type).removeData(this.type) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
972 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
973 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
974 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
975 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
976 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
977 |
/* TOOLTIP PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
978 |
* ========================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
979 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
980 |
$.fn.tooltip = function ( option ) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
981 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
982 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
983 |
, data = $this.data('tooltip') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
984 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
985 |
if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
986 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
987 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
988 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
989 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
990 |
$.fn.tooltip.Constructor = Tooltip |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
991 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
992 |
$.fn.tooltip.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
993 |
animation: true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
994 |
, placement: 'top' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
995 |
, selector: false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
996 |
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
997 |
, trigger: 'hover' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
998 |
, title: '' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
999 |
, delay: 0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1000 |
, html: false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1001 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1002 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1003 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1004 |
/* =========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1005 |
* bootstrap-popover.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1006 |
* http://twitter.github.com/bootstrap/javascript.html#popovers |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1007 |
* =========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1008 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1009 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1010 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1011 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1012 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1013 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1014 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1015 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1016 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1017 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1018 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1019 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1020 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1021 |
* =========================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1022 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1023 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1024 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1025 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1026 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1027 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1028 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1029 |
/* POPOVER PUBLIC CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1030 |
* =============================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1031 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1032 |
var Popover = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1033 |
this.init('popover', element, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1034 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1035 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1036 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1037 |
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1038 |
========================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1039 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1040 |
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1041 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1042 |
constructor: Popover |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1043 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1044 |
, setContent: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1045 |
var $tip = this.tip() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1046 |
, title = this.getTitle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1047 |
, content = this.getContent() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1048 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1049 |
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1050 |
$tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1051 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1052 |
$tip.removeClass('fade top bottom left right in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1053 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1054 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1055 |
, hasContent: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1056 |
return this.getTitle() || this.getContent() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1057 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1058 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1059 |
, getContent: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1060 |
var content |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1061 |
, $e = this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1062 |
, o = this.options |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1063 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1064 |
content = $e.attr('data-content') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1065 |
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1066 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1067 |
return content |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1068 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1069 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1070 |
, tip: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1071 |
if (!this.$tip) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1072 |
this.$tip = $(this.options.template) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1073 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1074 |
return this.$tip |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1075 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1076 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1077 |
, destroy: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1078 |
this.hide().$element.off('.' + this.type).removeData(this.type) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1079 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1080 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1081 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1082 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1083 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1084 |
/* POPOVER PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1085 |
* ======================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1086 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1087 |
$.fn.popover = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1088 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1089 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1090 |
, data = $this.data('popover') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1091 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1092 |
if (!data) $this.data('popover', (data = new Popover(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1093 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1094 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1095 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1096 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1097 |
$.fn.popover.Constructor = Popover |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1098 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1099 |
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1100 |
placement: 'right' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1101 |
, trigger: 'click' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1102 |
, content: '' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1103 |
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1104 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1105 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1106 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1107 |
/* ========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1108 |
* bootstrap-affix.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1109 |
* http://twitter.github.com/bootstrap/javascript.html#affix |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1110 |
* ========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1111 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1112 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1113 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1114 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1115 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1116 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1117 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1118 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1119 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1120 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1121 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1122 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1123 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1124 |
* ========================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1125 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1126 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1127 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1128 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1129 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1130 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1131 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1132 |
/* AFFIX CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1133 |
* ====================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1134 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1135 |
var Affix = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1136 |
this.options = $.extend({}, $.fn.affix.defaults, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1137 |
this.$window = $(window) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1138 |
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1139 |
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1140 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1141 |
this.checkPosition() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1142 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1143 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1144 |
Affix.prototype.checkPosition = function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1145 |
if (!this.$element.is(':visible')) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1146 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1147 |
var scrollHeight = $(document).height() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1148 |
, scrollTop = this.$window.scrollTop() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1149 |
, position = this.$element.offset() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1150 |
, offset = this.options.offset |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1151 |
, offsetBottom = offset.bottom |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1152 |
, offsetTop = offset.top |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1153 |
, reset = 'affix affix-top affix-bottom' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1154 |
, affix |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1155 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1156 |
if (typeof offset != 'object') offsetBottom = offsetTop = offset |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1157 |
if (typeof offsetTop == 'function') offsetTop = offset.top() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1158 |
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1159 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1160 |
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1161 |
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1162 |
'bottom' : offsetTop != null && scrollTop <= offsetTop ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1163 |
'top' : false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1164 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1165 |
if (this.affixed === affix) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1166 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1167 |
this.affixed = affix |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1168 |
this.unpin = affix == 'bottom' ? position.top - scrollTop : null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1169 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1170 |
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1171 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1172 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1173 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1174 |
/* AFFIX PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1175 |
* ======================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1176 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1177 |
$.fn.affix = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1178 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1179 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1180 |
, data = $this.data('affix') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1181 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1182 |
if (!data) $this.data('affix', (data = new Affix(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1183 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1184 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1185 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1186 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1187 |
$.fn.affix.Constructor = Affix |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1188 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1189 |
$.fn.affix.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1190 |
offset: 0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1191 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1192 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1193 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1194 |
/* AFFIX DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1195 |
* ============== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1196 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1197 |
$(window).on('load', function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1198 |
$('[data-spy="affix"]').each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1199 |
var $spy = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1200 |
, data = $spy.data() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1201 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1202 |
data.offset = data.offset || {} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1203 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1204 |
data.offsetBottom && (data.offset.bottom = data.offsetBottom) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1205 |
data.offsetTop && (data.offset.top = data.offsetTop) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1206 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1207 |
$spy.affix(data) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1208 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1209 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1210 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1211 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1212 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1213 |
/* ========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1214 |
* bootstrap-alert.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1215 |
* http://twitter.github.com/bootstrap/javascript.html#alerts |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1216 |
* ========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1217 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1218 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1219 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1220 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1221 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1222 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1223 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1224 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1225 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1226 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1227 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1228 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1229 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1230 |
* ========================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1231 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1232 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1233 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1234 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1235 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1236 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1237 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1238 |
/* ALERT CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1239 |
* ====================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1240 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1241 |
var dismiss = '[data-dismiss="alert"]' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1242 |
, Alert = function (el) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1243 |
$(el).on('click', dismiss, this.close) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1244 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1245 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1246 |
Alert.prototype.close = function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1247 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1248 |
, selector = $this.attr('data-target') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1249 |
, $parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1250 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1251 |
if (!selector) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1252 |
selector = $this.attr('href') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1253 |
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1254 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1255 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1256 |
$parent = $(selector) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1257 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1258 |
e && e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1259 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1260 |
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1261 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1262 |
$parent.trigger(e = $.Event('close')) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1263 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1264 |
if (e.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1265 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1266 |
$parent.removeClass('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1267 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1268 |
function removeElement() { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1269 |
$parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1270 |
.trigger('closed') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1271 |
.remove() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1272 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1273 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1274 |
$.support.transition && $parent.hasClass('fade') ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1275 |
$parent.on($.support.transition.end, removeElement) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1276 |
removeElement() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1277 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1278 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1279 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1280 |
/* ALERT PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1281 |
* ======================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1282 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1283 |
$.fn.alert = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1284 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1285 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1286 |
, data = $this.data('alert') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1287 |
if (!data) $this.data('alert', (data = new Alert(this))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1288 |
if (typeof option == 'string') data[option].call($this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1289 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1290 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1291 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1292 |
$.fn.alert.Constructor = Alert |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1293 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1294 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1295 |
/* ALERT DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1296 |
* ============== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1297 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1298 |
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1299 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1300 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1301 |
/* ============================================================ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1302 |
* bootstrap-button.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1303 |
* http://twitter.github.com/bootstrap/javascript.html#buttons |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1304 |
* ============================================================ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1305 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1306 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1307 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1308 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1309 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1310 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1311 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1312 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1313 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1314 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1315 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1316 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1317 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1318 |
* ============================================================ */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1319 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1320 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1321 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1322 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1323 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1324 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1325 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1326 |
/* BUTTON PUBLIC CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1327 |
* ============================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1328 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1329 |
var Button = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1330 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1331 |
this.options = $.extend({}, $.fn.button.defaults, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1332 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1333 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1334 |
Button.prototype.setState = function (state) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1335 |
var d = 'disabled' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1336 |
, $el = this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1337 |
, data = $el.data() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1338 |
, val = $el.is('input') ? 'val' : 'html' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1339 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1340 |
state = state + 'Text' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1341 |
data.resetText || $el.data('resetText', $el[val]()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1342 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1343 |
$el[val](data[state] || this.options[state]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1344 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1345 |
// push to event loop to allow forms to submit |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1346 |
setTimeout(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1347 |
state == 'loadingText' ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1348 |
$el.addClass(d).attr(d, d) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1349 |
$el.removeClass(d).removeAttr(d) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1350 |
}, 0) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1351 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1352 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1353 |
Button.prototype.toggle = function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1354 |
var $parent = this.$element.closest('[data-toggle="buttons-radio"]') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1355 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1356 |
$parent && $parent |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1357 |
.find('.active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1358 |
.removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1359 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1360 |
this.$element.toggleClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1361 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1362 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1363 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1364 |
/* BUTTON PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1365 |
* ======================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1366 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1367 |
$.fn.button = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1368 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1369 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1370 |
, data = $this.data('button') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1371 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1372 |
if (!data) $this.data('button', (data = new Button(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1373 |
if (option == 'toggle') data.toggle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1374 |
else if (option) data.setState(option) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1375 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1376 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1377 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1378 |
$.fn.button.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1379 |
loadingText: 'loading...' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1380 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1381 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1382 |
$.fn.button.Constructor = Button |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1383 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1384 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1385 |
/* BUTTON DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1386 |
* =============== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1387 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1388 |
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1389 |
var $btn = $(e.target) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1390 |
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1391 |
$btn.button('toggle') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1392 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1393 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1394 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1395 |
/* ============================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1396 |
* bootstrap-collapse.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1397 |
* http://twitter.github.com/bootstrap/javascript.html#collapse |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1398 |
* ============================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1399 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1400 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1401 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1402 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1403 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1404 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1405 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1406 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1407 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1408 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1409 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1410 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1411 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1412 |
* ============================================================ */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1413 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1414 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1415 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1416 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1417 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1418 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1419 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1420 |
/* COLLAPSE PUBLIC CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1421 |
* ================================ */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1422 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1423 |
var Collapse = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1424 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1425 |
this.options = $.extend({}, $.fn.collapse.defaults, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1426 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1427 |
if (this.options.parent) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1428 |
this.$parent = $(this.options.parent) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1429 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1430 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1431 |
this.options.toggle && this.toggle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1432 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1433 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1434 |
Collapse.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1435 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1436 |
constructor: Collapse |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1437 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1438 |
, dimension: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1439 |
var hasWidth = this.$element.hasClass('width') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1440 |
return hasWidth ? 'width' : 'height' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1441 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1442 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1443 |
, show: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1444 |
var dimension |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1445 |
, scroll |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1446 |
, actives |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1447 |
, hasData |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1448 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1449 |
if (this.transitioning) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1450 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1451 |
dimension = this.dimension() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1452 |
scroll = $.camelCase(['scroll', dimension].join('-')) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1453 |
actives = this.$parent && this.$parent.find('> .accordion-group > .in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1454 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1455 |
if (actives && actives.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1456 |
hasData = actives.data('collapse') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1457 |
if (hasData && hasData.transitioning) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1458 |
actives.collapse('hide') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1459 |
hasData || actives.data('collapse', null) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1460 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1461 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1462 |
this.$element[dimension](0) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1463 |
this.transition('addClass', $.Event('show'), 'shown') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1464 |
$.support.transition && this.$element[dimension](this.$element[0][scroll]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1465 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1466 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1467 |
, hide: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1468 |
var dimension |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1469 |
if (this.transitioning) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1470 |
dimension = this.dimension() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1471 |
this.reset(this.$element[dimension]()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1472 |
this.transition('removeClass', $.Event('hide'), 'hidden') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1473 |
this.$element[dimension](0) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1474 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1475 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1476 |
, reset: function (size) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1477 |
var dimension = this.dimension() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1478 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1479 |
this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1480 |
.removeClass('collapse') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1481 |
[dimension](size || 'auto') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1482 |
[0].offsetWidth |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1483 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1484 |
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1485 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1486 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1487 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1488 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1489 |
, transition: function (method, startEvent, completeEvent) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1490 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1491 |
, complete = function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1492 |
if (startEvent.type == 'show') that.reset() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1493 |
that.transitioning = 0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1494 |
that.$element.trigger(completeEvent) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1495 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1496 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1497 |
this.$element.trigger(startEvent) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1498 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1499 |
if (startEvent.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1500 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1501 |
this.transitioning = 1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1502 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1503 |
this.$element[method]('in') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1504 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1505 |
$.support.transition && this.$element.hasClass('collapse') ? |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1506 |
this.$element.one($.support.transition.end, complete) : |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1507 |
complete() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1508 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1509 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1510 |
, toggle: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1511 |
this[this.$element.hasClass('in') ? 'hide' : 'show']() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1512 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1513 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1514 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1515 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1516 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1517 |
/* COLLAPSIBLE PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1518 |
* ============================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1519 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1520 |
$.fn.collapse = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1521 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1522 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1523 |
, data = $this.data('collapse') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1524 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1525 |
if (!data) $this.data('collapse', (data = new Collapse(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1526 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1527 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1528 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1529 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1530 |
$.fn.collapse.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1531 |
toggle: true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1532 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1533 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1534 |
$.fn.collapse.Constructor = Collapse |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1535 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1536 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1537 |
/* COLLAPSIBLE DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1538 |
* ==================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1539 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1540 |
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1541 |
var $this = $(this), href |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1542 |
, target = $this.attr('data-target') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1543 |
|| e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1544 |
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1545 |
, option = $(target).data('collapse') ? 'toggle' : $this.data() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1546 |
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1547 |
$(target).collapse(option) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1548 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1549 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1550 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1551 |
/* ========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1552 |
* bootstrap-carousel.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1553 |
* http://twitter.github.com/bootstrap/javascript.html#carousel |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1554 |
* ========================================================== |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1555 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1556 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1557 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1558 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1559 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1560 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1561 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1562 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1563 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1564 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1565 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1566 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1567 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1568 |
* ========================================================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1569 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1570 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1571 |
!function ($) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1572 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1573 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1574 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1575 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1576 |
/* CAROUSEL CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1577 |
* ========================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1578 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1579 |
var Carousel = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1580 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1581 |
this.options = options |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1582 |
this.options.slide && this.slide(this.options.slide) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1583 |
this.options.pause == 'hover' && this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1584 |
.on('mouseenter', $.proxy(this.pause, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1585 |
.on('mouseleave', $.proxy(this.cycle, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1586 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1587 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1588 |
Carousel.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1589 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1590 |
cycle: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1591 |
if (!e) this.paused = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1592 |
this.options.interval |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1593 |
&& !this.paused |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1594 |
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1595 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1596 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1597 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1598 |
, to: function (pos) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1599 |
var $active = this.$element.find('.item.active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1600 |
, children = $active.parent().children() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1601 |
, activePos = children.index($active) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1602 |
, that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1603 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1604 |
if (pos > (children.length - 1) || pos < 0) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1605 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1606 |
if (this.sliding) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1607 |
return this.$element.one('slid', function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1608 |
that.to(pos) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1609 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1610 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1611 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1612 |
if (activePos == pos) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1613 |
return this.pause().cycle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1614 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1615 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1616 |
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1617 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1618 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1619 |
, pause: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1620 |
if (!e) this.paused = true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1621 |
if (this.$element.find('.next, .prev').length && $.support.transition.end) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1622 |
this.$element.trigger($.support.transition.end) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1623 |
this.cycle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1624 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1625 |
clearInterval(this.interval) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1626 |
this.interval = null |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1627 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1628 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1629 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1630 |
, next: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1631 |
if (this.sliding) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1632 |
return this.slide('next') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1633 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1634 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1635 |
, prev: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1636 |
if (this.sliding) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1637 |
return this.slide('prev') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1638 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1639 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1640 |
, slide: function (type, next) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1641 |
var $active = this.$element.find('.item.active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1642 |
, $next = next || $active[type]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1643 |
, isCycling = this.interval |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1644 |
, direction = type == 'next' ? 'left' : 'right' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1645 |
, fallback = type == 'next' ? 'first' : 'last' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1646 |
, that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1647 |
, e |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1648 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1649 |
this.sliding = true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1650 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1651 |
isCycling && this.pause() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1652 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1653 |
$next = $next.length ? $next : this.$element.find('.item')[fallback]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1654 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1655 |
e = $.Event('slide', { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1656 |
relatedTarget: $next[0] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1657 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1658 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1659 |
if ($next.hasClass('active')) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1660 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1661 |
if ($.support.transition && this.$element.hasClass('slide')) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1662 |
this.$element.trigger(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1663 |
if (e.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1664 |
$next.addClass(type) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1665 |
$next[0].offsetWidth // force reflow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1666 |
$active.addClass(direction) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1667 |
$next.addClass(direction) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1668 |
this.$element.one($.support.transition.end, function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1669 |
$next.removeClass([type, direction].join(' ')).addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1670 |
$active.removeClass(['active', direction].join(' ')) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1671 |
that.sliding = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1672 |
setTimeout(function () { that.$element.trigger('slid') }, 0) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1673 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1674 |
} else { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1675 |
this.$element.trigger(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1676 |
if (e.isDefaultPrevented()) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1677 |
$active.removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1678 |
$next.addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1679 |
this.sliding = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1680 |
this.$element.trigger('slid') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1681 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1682 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1683 |
isCycling && this.cycle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1684 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1685 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1686 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1687 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1688 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1689 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1690 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1691 |
/* CAROUSEL PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1692 |
* ========================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1693 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1694 |
$.fn.carousel = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1695 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1696 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1697 |
, data = $this.data('carousel') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1698 |
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1699 |
, action = typeof option == 'string' ? option : options.slide |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1700 |
if (!data) $this.data('carousel', (data = new Carousel(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1701 |
if (typeof option == 'number') data.to(option) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1702 |
else if (action) data[action]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1703 |
else if (options.interval) data.cycle() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1704 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1705 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1706 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1707 |
$.fn.carousel.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1708 |
interval: 5000 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1709 |
, pause: 'hover' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1710 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1711 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1712 |
$.fn.carousel.Constructor = Carousel |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1713 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1714 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1715 |
/* CAROUSEL DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1716 |
* ================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1717 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1718 |
$(document).on('click.carousel.data-api', '[data-slide]', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1719 |
var $this = $(this), href |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1720 |
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1721 |
, options = $.extend({}, $target.data(), $this.data()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1722 |
$target.carousel(options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1723 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1724 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1725 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1726 |
}(window.jQuery); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1727 |
/* ============================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1728 |
* bootstrap-typeahead.js v2.2.1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1729 |
* http://twitter.github.com/bootstrap/javascript.html#typeahead |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1730 |
* ============================================================= |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1731 |
* Copyright 2012 Twitter, Inc. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1732 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1733 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1734 |
* you may not use this file except in compliance with the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1735 |
* You may obtain a copy of the License at |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1736 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1737 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1738 |
* |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1739 |
* Unless required by applicable law or agreed to in writing, software |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1740 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1741 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1742 |
* See the License for the specific language governing permissions and |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1743 |
* limitations under the License. |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1744 |
* ============================================================ */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1745 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1746 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1747 |
!function($){ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1748 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1749 |
"use strict"; // jshint ;_; |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1750 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1751 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1752 |
/* TYPEAHEAD PUBLIC CLASS DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1753 |
* ================================= */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1754 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1755 |
var Typeahead = function (element, options) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1756 |
this.$element = $(element) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1757 |
this.options = $.extend({}, $.fn.typeahead.defaults, options) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1758 |
this.matcher = this.options.matcher || this.matcher |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1759 |
this.sorter = this.options.sorter || this.sorter |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1760 |
this.highlighter = this.options.highlighter || this.highlighter |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1761 |
this.updater = this.options.updater || this.updater |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1762 |
this.$menu = $(this.options.menu).appendTo('body') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1763 |
this.source = this.options.source |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1764 |
this.shown = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1765 |
this.listen() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1766 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1767 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1768 |
Typeahead.prototype = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1769 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1770 |
constructor: Typeahead |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1771 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1772 |
, select: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1773 |
var val = this.$menu.find('.active').attr('data-value') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1774 |
this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1775 |
.val(this.updater(val)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1776 |
.change() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1777 |
return this.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1778 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1779 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1780 |
, updater: function (item) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1781 |
return item |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1782 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1783 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1784 |
, show: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1785 |
var pos = $.extend({}, this.$element.offset(), { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1786 |
height: this.$element[0].offsetHeight |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1787 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1788 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1789 |
this.$menu.css({ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1790 |
top: pos.top + pos.height |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1791 |
, left: pos.left |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1792 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1793 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1794 |
this.$menu.show() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1795 |
this.shown = true |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1796 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1797 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1798 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1799 |
, hide: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1800 |
this.$menu.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1801 |
this.shown = false |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1802 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1803 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1804 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1805 |
, lookup: function (event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1806 |
var items |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1807 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1808 |
this.query = this.$element.val() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1809 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1810 |
if (!this.query || this.query.length < this.options.minLength) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1811 |
return this.shown ? this.hide() : this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1812 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1813 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1814 |
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1815 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1816 |
return items ? this.process(items) : this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1817 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1818 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1819 |
, process: function (items) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1820 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1821 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1822 |
items = $.grep(items, function (item) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1823 |
return that.matcher(item) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1824 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1825 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1826 |
items = this.sorter(items) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1827 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1828 |
if (!items.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1829 |
return this.shown ? this.hide() : this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1830 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1831 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1832 |
return this.render(items.slice(0, this.options.items)).show() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1833 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1834 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1835 |
, matcher: function (item) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1836 |
return ~item.toLowerCase().indexOf(this.query.toLowerCase()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1837 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1838 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1839 |
, sorter: function (items) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1840 |
var beginswith = [] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1841 |
, caseSensitive = [] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1842 |
, caseInsensitive = [] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1843 |
, item |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1844 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1845 |
while (item = items.shift()) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1846 |
if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1847 |
else if (~item.indexOf(this.query)) caseSensitive.push(item) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1848 |
else caseInsensitive.push(item) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1849 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1850 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1851 |
return beginswith.concat(caseSensitive, caseInsensitive) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1852 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1853 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1854 |
, highlighter: function (item) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1855 |
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1856 |
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1857 |
return '<strong>' + match + '</strong>' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1858 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1859 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1860 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1861 |
, render: function (items) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1862 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1863 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1864 |
items = $(items).map(function (i, item) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1865 |
i = $(that.options.item).attr('data-value', item) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1866 |
i.find('a').html(that.highlighter(item)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1867 |
return i[0] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1868 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1869 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1870 |
items.first().addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1871 |
this.$menu.html(items) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1872 |
return this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1873 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1874 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1875 |
, next: function (event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1876 |
var active = this.$menu.find('.active').removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1877 |
, next = active.next() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1878 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1879 |
if (!next.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1880 |
next = $(this.$menu.find('li')[0]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1881 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1882 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1883 |
next.addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1884 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1885 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1886 |
, prev: function (event) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1887 |
var active = this.$menu.find('.active').removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1888 |
, prev = active.prev() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1889 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1890 |
if (!prev.length) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1891 |
prev = this.$menu.find('li').last() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1892 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1893 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1894 |
prev.addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1895 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1896 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1897 |
, listen: function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1898 |
this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1899 |
.on('blur', $.proxy(this.blur, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1900 |
.on('keypress', $.proxy(this.keypress, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1901 |
.on('keyup', $.proxy(this.keyup, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1902 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1903 |
if (this.eventSupported('keydown')) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1904 |
this.$element.on('keydown', $.proxy(this.keydown, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1905 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1906 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1907 |
this.$menu |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1908 |
.on('click', $.proxy(this.click, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1909 |
.on('mouseenter', 'li', $.proxy(this.mouseenter, this)) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1910 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1911 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1912 |
, eventSupported: function(eventName) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1913 |
var isSupported = eventName in this.$element |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1914 |
if (!isSupported) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1915 |
this.$element.setAttribute(eventName, 'return;') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1916 |
isSupported = typeof this.$element[eventName] === 'function' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1917 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1918 |
return isSupported |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1919 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1920 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1921 |
, move: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1922 |
if (!this.shown) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1923 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1924 |
switch(e.keyCode) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1925 |
case 9: // tab |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1926 |
case 13: // enter |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1927 |
case 27: // escape |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1928 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1929 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1930 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1931 |
case 38: // up arrow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1932 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1933 |
this.prev() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1934 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1935 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1936 |
case 40: // down arrow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1937 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1938 |
this.next() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1939 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1940 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1941 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1942 |
e.stopPropagation() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1943 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1944 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1945 |
, keydown: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1946 |
this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27]) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1947 |
this.move(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1948 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1949 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1950 |
, keypress: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1951 |
if (this.suppressKeyPressRepeat) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1952 |
this.move(e) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1953 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1954 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1955 |
, keyup: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1956 |
switch(e.keyCode) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1957 |
case 40: // down arrow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1958 |
case 38: // up arrow |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1959 |
case 16: // shift |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1960 |
case 17: // ctrl |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1961 |
case 18: // alt |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1962 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1963 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1964 |
case 9: // tab |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1965 |
case 13: // enter |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1966 |
if (!this.shown) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1967 |
this.select() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1968 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1969 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1970 |
case 27: // escape |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1971 |
if (!this.shown) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1972 |
this.hide() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1973 |
break |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1974 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1975 |
default: |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1976 |
this.lookup() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1977 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1978 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1979 |
e.stopPropagation() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1980 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1981 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1982 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1983 |
, blur: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1984 |
var that = this |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1985 |
setTimeout(function () { that.hide() }, 150) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1986 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1987 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1988 |
, click: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1989 |
e.stopPropagation() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1990 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1991 |
this.select() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1992 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1993 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1994 |
, mouseenter: function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1995 |
this.$menu.find('.active').removeClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1996 |
$(e.currentTarget).addClass('active') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1997 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1998 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
1999 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2000 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2001 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2002 |
/* TYPEAHEAD PLUGIN DEFINITION |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2003 |
* =========================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2004 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2005 |
$.fn.typeahead = function (option) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2006 |
return this.each(function () { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2007 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2008 |
, data = $this.data('typeahead') |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2009 |
, options = typeof option == 'object' && option |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2010 |
if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2011 |
if (typeof option == 'string') data[option]() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2012 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2013 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2014 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2015 |
$.fn.typeahead.defaults = { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2016 |
source: [] |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2017 |
, items: 8 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2018 |
, menu: '<ul class="typeahead dropdown-menu"></ul>' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2019 |
, item: '<li><a href="#"></a></li>' |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2020 |
, minLength: 1 |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2021 |
} |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2022 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2023 |
$.fn.typeahead.Constructor = Typeahead |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2024 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2025 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2026 |
/* TYPEAHEAD DATA-API |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2027 |
* ================== */ |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2028 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2029 |
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2030 |
var $this = $(this) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2031 |
if ($this.data('typeahead')) return |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2032 |
e.preventDefault() |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2033 |
$this.typeahead($this.data()) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2034 |
}) |
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2035 |
|
|
b95aebb070b5
first commit back office front metadatacomposer
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff
changeset
|
2036 |
}(window.jQuery); |