mice 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/lib/mice/version.rb +1 -1
- data/vendor/assets/javascripts/mice/jquery.autofix_anything.js +83 -0
- data/vendor/assets/javascripts/mice/jquery.onepage-scroll.js +411 -0
- data/vendor/assets/javascripts/mice/modal.coffee +237 -0
- data/vendor/assets/javascripts/mice/tooltip.coffee +6 -9
- data/vendor/assets/stylesheets/mice/_autofix_anything.scss +14 -0
- data/vendor/assets/stylesheets/mice/_lists.scss +8 -0
- metadata +6 -3
- data/vendor/assets/javascripts/mice/modal.js +0 -280
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08abe83931750028a816534a2d97322922005f45
|
4
|
+
data.tar.gz: 2eb65dfd427f403b3758ff4cf4c13e740346b536
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 027acda6996becc236dd007244ba57b8ef7256759dd845098606ffdce6880662c5197ab9bad7b960429c5b86c3d84210c0542f38e2d5b54529ea905c8688899f
|
7
|
+
data.tar.gz: c76f80c983db9e91d7c7c4ee011c520dc09c93356bdccba81bfd6e3df4df82fdfd93d4eefcccb8636b7e2b4f1fb5e16c206fce7aa19c19823077b23c2b878d69
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mice (0.2.
|
4
|
+
mice (0.2.10)
|
5
5
|
sass (~> 3.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (4.1.
|
10
|
+
activesupport (4.1.4)
|
11
11
|
i18n (~> 0.6, >= 0.6.9)
|
12
12
|
json (~> 1.7, >= 1.7.7)
|
13
13
|
minitest (~> 5.1)
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
coffee-script (2.2.0)
|
18
18
|
coffee-script-source
|
19
19
|
execjs
|
20
|
-
coffee-script-source (1.7.
|
20
|
+
coffee-script-source (1.7.1)
|
21
21
|
compass (0.12.6)
|
22
22
|
chunky_png (~> 1.2)
|
23
23
|
fssm (>= 0.2.7)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
http_parser.rb (~> 0.6.0)
|
30
30
|
erubis (2.7.0)
|
31
31
|
eventmachine (1.0.3)
|
32
|
-
execjs (2.1
|
32
|
+
execjs (2.2.1)
|
33
33
|
ffi (1.9.3)
|
34
34
|
fssm (0.2.10)
|
35
35
|
haml (4.0.5)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
hooks (0.4.0)
|
39
39
|
uber (~> 0.0.4)
|
40
40
|
http_parser.rb (0.6.0)
|
41
|
-
i18n (0.6.
|
41
|
+
i18n (0.6.11)
|
42
42
|
json (1.8.1)
|
43
43
|
kramdown (1.3.3)
|
44
44
|
listen (1.3.1)
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
middleman-syntax (2.0.0)
|
81
81
|
middleman-core (~> 3.2)
|
82
82
|
rouge (~> 1.0)
|
83
|
-
minitest (5.
|
83
|
+
minitest (5.4.0)
|
84
84
|
multi_json (1.10.1)
|
85
85
|
padrino-helpers (0.12.2)
|
86
86
|
i18n (~> 0.6, >= 0.6.7)
|
@@ -113,10 +113,10 @@ GEM
|
|
113
113
|
thor (0.19.1)
|
114
114
|
thread_safe (0.3.4)
|
115
115
|
tilt (1.4.1)
|
116
|
-
tzinfo (1.2.
|
116
|
+
tzinfo (1.2.2)
|
117
117
|
thread_safe (~> 0.1)
|
118
118
|
uber (0.0.6)
|
119
|
-
uglifier (2.5.
|
119
|
+
uglifier (2.5.3)
|
120
120
|
execjs (>= 0.3.0)
|
121
121
|
json (>= 1.8.0)
|
122
122
|
|
data/lib/mice/version.rb
CHANGED
@@ -0,0 +1,83 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* jquery.autofix_anything.js v1
|
3
|
+
* ===========================================================
|
4
|
+
* Copyright 2013 Pete Rojwongsuriya.
|
5
|
+
* http://www.thepetedesign.com
|
6
|
+
*
|
7
|
+
* Fix position of anything on your website automatically
|
8
|
+
* with one js call
|
9
|
+
*
|
10
|
+
* https://github.com/peachananr/autofix_anything
|
11
|
+
*
|
12
|
+
* ========================================================== */
|
13
|
+
|
14
|
+
!function($){
|
15
|
+
|
16
|
+
var defaults = {
|
17
|
+
customOffset: false,
|
18
|
+
manual: false,
|
19
|
+
onlyInContainer: true
|
20
|
+
};
|
21
|
+
|
22
|
+
$.fn.autofix_anything = function(options){
|
23
|
+
var settings = $.extend({}, defaults, options),
|
24
|
+
el = $(this),
|
25
|
+
curpos = el.position(),
|
26
|
+
offset = settings.customOffset,
|
27
|
+
pos = el.offset();
|
28
|
+
|
29
|
+
el.addClass("autofix_sb")
|
30
|
+
|
31
|
+
$.fn.manualfix = function() {
|
32
|
+
var el = $(this),
|
33
|
+
pos = el.offset();
|
34
|
+
if (el.hasClass("fixed")) {
|
35
|
+
el.removeClass("fixed")
|
36
|
+
} else {
|
37
|
+
el.addClass("fixed").css({
|
38
|
+
top: 0,
|
39
|
+
left: pos.left,
|
40
|
+
right: "auto",
|
41
|
+
bottom: "auto"
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
fixAll = function(el, settings, curpos, pos){
|
48
|
+
if (settings.customOffset == false) offset = el.parent().offset().top
|
49
|
+
if($(document).scrollTop() > offset && $(document).scrollTop() <= (el.parent().height() + (offset - $(window).height()))) {
|
50
|
+
el.removeClass("bottom").addClass("fixed").css({
|
51
|
+
top: 0,
|
52
|
+
left: pos.left,
|
53
|
+
right: "auto",
|
54
|
+
bottom: "auto"
|
55
|
+
});
|
56
|
+
} else {
|
57
|
+
if($(document).scrollTop() > offset) {
|
58
|
+
if (settings.onlyInContainer == true ) {
|
59
|
+
if($(document).scrollTop() > (el.parent().height() - $(window).height())) {
|
60
|
+
el.addClass("bottom fixed").removeAttr( 'style' ).css({
|
61
|
+
left: curpos.left
|
62
|
+
});
|
63
|
+
}else {
|
64
|
+
el.removeClass("bottom fixed").removeAttr( 'style' );
|
65
|
+
|
66
|
+
}
|
67
|
+
}
|
68
|
+
} else {
|
69
|
+
el.removeClass("bottom fixed").removeAttr( 'style' );
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
}
|
74
|
+
if (settings.manual == false) {
|
75
|
+
$(window).scroll(function() {
|
76
|
+
fixAll(el, settings, curpos, pos)
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
|
81
|
+
}
|
82
|
+
}(window.jQuery);
|
83
|
+
|
@@ -0,0 +1,411 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* jquery-onepage-scroll.js v1.3
|
3
|
+
* ===========================================================
|
4
|
+
* Copyright 2013 Pete Rojwongsuriya.
|
5
|
+
* http://www.thepetedesign.com
|
6
|
+
*
|
7
|
+
* Create an Apple-like website that let user scroll
|
8
|
+
* one page at a time
|
9
|
+
*
|
10
|
+
* Credit: Eike Send for the awesome swipe event
|
11
|
+
* https://github.com/peachananr/onepage-scroll
|
12
|
+
*
|
13
|
+
* License: GPL v3
|
14
|
+
*
|
15
|
+
* ========================================================== */
|
16
|
+
|
17
|
+
!function($){
|
18
|
+
|
19
|
+
var defaults = {
|
20
|
+
sectionContainer: "section",
|
21
|
+
easing: "ease",
|
22
|
+
animationTime: 1000,
|
23
|
+
pagination: true,
|
24
|
+
updateURL: false,
|
25
|
+
keyboard: true,
|
26
|
+
beforeMove: null,
|
27
|
+
afterMove: null,
|
28
|
+
loop: true,
|
29
|
+
responsiveFallback: false,
|
30
|
+
direction : 'vertical'
|
31
|
+
};
|
32
|
+
|
33
|
+
/*------------------------------------------------*/
|
34
|
+
/* Credit: Eike Send for the awesome swipe event */
|
35
|
+
/*------------------------------------------------*/
|
36
|
+
|
37
|
+
$.fn.swipeEvents = function() {
|
38
|
+
return this.each(function() {
|
39
|
+
|
40
|
+
var startX,
|
41
|
+
startY,
|
42
|
+
$this = $(this);
|
43
|
+
|
44
|
+
$this.bind('touchstart', touchstart);
|
45
|
+
|
46
|
+
function touchstart(event) {
|
47
|
+
var touches = event.originalEvent.touches;
|
48
|
+
if (touches && touches.length) {
|
49
|
+
startX = touches[0].pageX;
|
50
|
+
startY = touches[0].pageY;
|
51
|
+
$this.bind('touchmove', touchmove);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
function touchmove(event) {
|
56
|
+
var touches = event.originalEvent.touches;
|
57
|
+
if (touches && touches.length) {
|
58
|
+
var deltaX = startX - touches[0].pageX;
|
59
|
+
var deltaY = startY - touches[0].pageY;
|
60
|
+
|
61
|
+
if (deltaX >= 50) {
|
62
|
+
$this.trigger("swipeLeft");
|
63
|
+
}
|
64
|
+
if (deltaX <= -50) {
|
65
|
+
$this.trigger("swipeRight");
|
66
|
+
}
|
67
|
+
if (deltaY >= 50) {
|
68
|
+
$this.trigger("swipeUp");
|
69
|
+
}
|
70
|
+
if (deltaY <= -50) {
|
71
|
+
$this.trigger("swipeDown");
|
72
|
+
}
|
73
|
+
if (Math.abs(deltaX) >= 50 || Math.abs(deltaY) >= 50) {
|
74
|
+
$this.unbind('touchmove', touchmove);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
});
|
80
|
+
};
|
81
|
+
|
82
|
+
|
83
|
+
$.fn.onepage_scroll = function(options){
|
84
|
+
var settings = $.extend({}, defaults, options),
|
85
|
+
el = $(this),
|
86
|
+
sections = $(settings.sectionContainer)
|
87
|
+
total = sections.length,
|
88
|
+
status = "off",
|
89
|
+
topPos = 0,
|
90
|
+
leftPos = 0,
|
91
|
+
lastAnimation = 0,
|
92
|
+
quietPeriod = 500,
|
93
|
+
paginationList = "";
|
94
|
+
|
95
|
+
$.fn.transformPage = function(settings, pos, index) {
|
96
|
+
if (typeof settings.beforeMove == 'function') settings.beforeMove(index);
|
97
|
+
$(this).css({
|
98
|
+
"-webkit-transform": ( settings.direction == 'horizontal' ) ? "translate3d(" + pos + "%, 0, 0)" : "translate3d(0, " + pos + "%, 0)",
|
99
|
+
"-webkit-transition": "all " + settings.animationTime + "ms " + settings.easing,
|
100
|
+
"-moz-transform": ( settings.direction == 'horizontal' ) ? "translate3d(" + pos + "%, 0, 0)" : "translate3d(0, " + pos + "%, 0)",
|
101
|
+
"-moz-transition": "all " + settings.animationTime + "ms " + settings.easing,
|
102
|
+
"-ms-transform": ( settings.direction == 'horizontal' ) ? "translate3d(" + pos + "%, 0, 0)" : "translate3d(0, " + pos + "%, 0)",
|
103
|
+
"-ms-transition": "all " + settings.animationTime + "ms " + settings.easing,
|
104
|
+
"transform": ( settings.direction == 'horizontal' ) ? "translate3d(" + pos + "%, 0, 0)" : "translate3d(0, " + pos + "%, 0)",
|
105
|
+
"transition": "all " + settings.animationTime + "ms " + settings.easing
|
106
|
+
});
|
107
|
+
$(this).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
|
108
|
+
if (typeof settings.afterMove == 'function') settings.afterMove(index);
|
109
|
+
});
|
110
|
+
}
|
111
|
+
|
112
|
+
$.fn.moveDown = function() {
|
113
|
+
var el = $(this)
|
114
|
+
index = $(settings.sectionContainer +".active").data("index");
|
115
|
+
current = $(settings.sectionContainer + "[data-index='" + index + "']");
|
116
|
+
next = $(settings.sectionContainer + "[data-index='" + (index + 1) + "']");
|
117
|
+
if(next.length < 1) {
|
118
|
+
if (settings.loop == true) {
|
119
|
+
pos = 0;
|
120
|
+
next = $(settings.sectionContainer + "[data-index='1']");
|
121
|
+
} else {
|
122
|
+
return
|
123
|
+
}
|
124
|
+
|
125
|
+
}else {
|
126
|
+
pos = (index * 100) * -1;
|
127
|
+
}
|
128
|
+
if (typeof settings.beforeMove == 'function') settings.beforeMove( next.data("index"));
|
129
|
+
current.removeClass("active")
|
130
|
+
next.addClass("active");
|
131
|
+
if(settings.pagination == true) {
|
132
|
+
$(".onepage-pagination li a" + "[data-index='" + index + "']").removeClass("active");
|
133
|
+
$(".onepage-pagination li a" + "[data-index='" + next.data("index") + "']").addClass("active");
|
134
|
+
}
|
135
|
+
|
136
|
+
$("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, '');
|
137
|
+
$("body").addClass("viewing-page-"+next.data("index"))
|
138
|
+
|
139
|
+
if (history.replaceState && settings.updateURL == true) {
|
140
|
+
var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (index + 1);
|
141
|
+
history.pushState( {}, document.title, href );
|
142
|
+
}
|
143
|
+
el.transformPage(settings, pos, next.data("index"));
|
144
|
+
}
|
145
|
+
|
146
|
+
$.fn.moveUp = function() {
|
147
|
+
var el = $(this)
|
148
|
+
index = $(settings.sectionContainer +".active").data("index");
|
149
|
+
current = $(settings.sectionContainer + "[data-index='" + index + "']");
|
150
|
+
next = $(settings.sectionContainer + "[data-index='" + (index - 1) + "']");
|
151
|
+
|
152
|
+
if(next.length < 1) {
|
153
|
+
if (settings.loop == true) {
|
154
|
+
pos = ((total - 1) * 100) * -1;
|
155
|
+
next = $(settings.sectionContainer + "[data-index='"+total+"']");
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
return
|
159
|
+
}
|
160
|
+
}else {
|
161
|
+
pos = ((next.data("index") - 1) * 100) * -1;
|
162
|
+
}
|
163
|
+
if (typeof settings.beforeMove == 'function') settings.beforeMove(next.data("index"));
|
164
|
+
current.removeClass("active")
|
165
|
+
next.addClass("active")
|
166
|
+
if(settings.pagination == true) {
|
167
|
+
$(".onepage-pagination li a" + "[data-index='" + index + "']").removeClass("active");
|
168
|
+
$(".onepage-pagination li a" + "[data-index='" + next.data("index") + "']").addClass("active");
|
169
|
+
}
|
170
|
+
$("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, '');
|
171
|
+
$("body").addClass("viewing-page-"+next.data("index"))
|
172
|
+
|
173
|
+
if (history.replaceState && settings.updateURL == true) {
|
174
|
+
var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (index - 1);
|
175
|
+
history.pushState( {}, document.title, href );
|
176
|
+
}
|
177
|
+
el.transformPage(settings, pos, next.data("index"));
|
178
|
+
}
|
179
|
+
|
180
|
+
$.fn.moveTo = function(page_index) {
|
181
|
+
current = $(settings.sectionContainer + ".active")
|
182
|
+
next = $(settings.sectionContainer + "[data-index='" + (page_index) + "']");
|
183
|
+
if(next.length > 0) {
|
184
|
+
if (typeof settings.beforeMove == 'function') settings.beforeMove(next.data("index"));
|
185
|
+
current.removeClass("active")
|
186
|
+
next.addClass("active")
|
187
|
+
$(".onepage-pagination li a" + ".active").removeClass("active");
|
188
|
+
$(".onepage-pagination li a" + "[data-index='" + (page_index) + "']").addClass("active");
|
189
|
+
$("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, '');
|
190
|
+
$("body").addClass("viewing-page-"+next.data("index"))
|
191
|
+
|
192
|
+
pos = ((page_index - 1) * 100) * -1;
|
193
|
+
|
194
|
+
if (history.replaceState && settings.updateURL == true) {
|
195
|
+
var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (page_index - 1);
|
196
|
+
history.pushState( {}, document.title, href );
|
197
|
+
}
|
198
|
+
el.transformPage(settings, pos, page_index);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
function responsive() {
|
203
|
+
//start modification
|
204
|
+
var valForTest = false;
|
205
|
+
var typeOfRF = typeof settings.responsiveFallback
|
206
|
+
|
207
|
+
if(typeOfRF == "number"){
|
208
|
+
valForTest = $(window).width() < settings.responsiveFallback;
|
209
|
+
}
|
210
|
+
if(typeOfRF == "boolean"){
|
211
|
+
valForTest = settings.responsiveFallback;
|
212
|
+
}
|
213
|
+
if(typeOfRF == "function"){
|
214
|
+
valFunction = settings.responsiveFallback();
|
215
|
+
valForTest = valFunction;
|
216
|
+
typeOFv = typeof valForTest;
|
217
|
+
if(typeOFv == "number"){
|
218
|
+
valForTest = $(window).width() < valFunction;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
//end modification
|
223
|
+
if (valForTest) {
|
224
|
+
$("body").addClass("disabled-onepage-scroll");
|
225
|
+
$(document).unbind('mousewheel DOMMouseScroll MozMousePixelScroll');
|
226
|
+
el.swipeEvents().unbind("swipeDown swipeUp");
|
227
|
+
} else {
|
228
|
+
if($("body").hasClass("disabled-onepage-scroll")) {
|
229
|
+
$("body").removeClass("disabled-onepage-scroll");
|
230
|
+
$("html, body, .wrapper").animate({ scrollTop: 0 }, "fast");
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
el.swipeEvents().bind("swipeDown", function(event){
|
235
|
+
if (!$("body").hasClass("disabled-onepage-scroll")) event.preventDefault();
|
236
|
+
el.moveUp();
|
237
|
+
}).bind("swipeUp", function(event){
|
238
|
+
if (!$("body").hasClass("disabled-onepage-scroll")) event.preventDefault();
|
239
|
+
el.moveDown();
|
240
|
+
});
|
241
|
+
|
242
|
+
$(document).bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(event) {
|
243
|
+
event.preventDefault();
|
244
|
+
var delta = event.originalEvent.wheelDelta || -event.originalEvent.detail;
|
245
|
+
init_scroll(event, delta);
|
246
|
+
});
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
|
251
|
+
function init_scroll(event, delta) {
|
252
|
+
deltaOfInterest = delta;
|
253
|
+
var timeNow = new Date().getTime();
|
254
|
+
// Cancel scroll if currently animating or within quiet period
|
255
|
+
if(timeNow - lastAnimation < quietPeriod + settings.animationTime) {
|
256
|
+
event.preventDefault();
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
|
260
|
+
if (deltaOfInterest < 0) {
|
261
|
+
el.moveDown()
|
262
|
+
} else {
|
263
|
+
el.moveUp()
|
264
|
+
}
|
265
|
+
lastAnimation = timeNow;
|
266
|
+
}
|
267
|
+
|
268
|
+
// Prepare everything before binding wheel scroll
|
269
|
+
|
270
|
+
el.addClass("onepage-wrapper").css("position","relative");
|
271
|
+
$.each( sections, function(i) {
|
272
|
+
$(this).css({
|
273
|
+
position: "absolute",
|
274
|
+
top: topPos + "%"
|
275
|
+
}).addClass("section").attr("data-index", i+1);
|
276
|
+
|
277
|
+
|
278
|
+
$(this).css({
|
279
|
+
position: "absolute",
|
280
|
+
left: ( settings.direction == 'horizontal' )
|
281
|
+
? leftPos + "%"
|
282
|
+
: 0,
|
283
|
+
top: ( settings.direction == 'vertical' || settings.direction != 'horizontal' )
|
284
|
+
? topPos + "%"
|
285
|
+
: 0
|
286
|
+
});
|
287
|
+
|
288
|
+
if (settings.direction == 'horizontal')
|
289
|
+
leftPos = leftPos + 100;
|
290
|
+
else
|
291
|
+
topPos = topPos + 100;
|
292
|
+
|
293
|
+
|
294
|
+
if(settings.pagination == true) {
|
295
|
+
paginationList += "<li><a data-index='"+(i+1)+"' href='#" + (i+1) + "'></a></li>"
|
296
|
+
}
|
297
|
+
});
|
298
|
+
|
299
|
+
el.swipeEvents().bind("swipeDown", function(event){
|
300
|
+
if (!$("body").hasClass("disabled-onepage-scroll")) event.preventDefault();
|
301
|
+
el.moveUp();
|
302
|
+
}).bind("swipeUp", function(event){
|
303
|
+
if (!$("body").hasClass("disabled-onepage-scroll")) event.preventDefault();
|
304
|
+
el.moveDown();
|
305
|
+
});
|
306
|
+
|
307
|
+
// Create Pagination and Display Them
|
308
|
+
if (settings.pagination == true) {
|
309
|
+
if ($('ul.onepage-pagination').length < 1) $("<ul class='onepage-pagination'></ul>").prependTo("body");
|
310
|
+
|
311
|
+
if( settings.direction == 'horizontal' ) {
|
312
|
+
posLeft = (el.find(".onepage-pagination").width() / 2) * -1;
|
313
|
+
el.find(".onepage-pagination").css("margin-left", posLeft);
|
314
|
+
} else {
|
315
|
+
posTop = (el.find(".onepage-pagination").height() / 2) * -1;
|
316
|
+
el.find(".onepage-pagination").css("margin-top", posTop);
|
317
|
+
}
|
318
|
+
$('ul.onepage-pagination').html(paginationList);
|
319
|
+
}
|
320
|
+
|
321
|
+
if(window.location.hash != "" && window.location.hash != "#1") {
|
322
|
+
init_index = window.location.hash.replace("#", "")
|
323
|
+
|
324
|
+
if (parseInt(init_index) <= total && parseInt(init_index) > 0) {
|
325
|
+
$(settings.sectionContainer + "[data-index='" + init_index + "']").addClass("active")
|
326
|
+
$("body").addClass("viewing-page-"+ init_index)
|
327
|
+
if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='" + init_index + "']").addClass("active");
|
328
|
+
|
329
|
+
next = $(settings.sectionContainer + "[data-index='" + (init_index) + "']");
|
330
|
+
if(next) {
|
331
|
+
next.addClass("active")
|
332
|
+
if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='" + (init_index) + "']").addClass("active");
|
333
|
+
$("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, '');
|
334
|
+
$("body").addClass("viewing-page-"+next.data("index"))
|
335
|
+
if (history.replaceState && settings.updateURL == true) {
|
336
|
+
var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (init_index);
|
337
|
+
history.pushState( {}, document.title, href );
|
338
|
+
}
|
339
|
+
}
|
340
|
+
pos = ((init_index - 1) * 100) * -1;
|
341
|
+
el.transformPage(settings, pos, init_index);
|
342
|
+
} else {
|
343
|
+
$(settings.sectionContainer + "[data-index='1']").addClass("active")
|
344
|
+
$("body").addClass("viewing-page-1")
|
345
|
+
if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='1']").addClass("active");
|
346
|
+
}
|
347
|
+
}else{
|
348
|
+
$(settings.sectionContainer + "[data-index='1']").addClass("active")
|
349
|
+
$("body").addClass("viewing-page-1")
|
350
|
+
if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='1']").addClass("active");
|
351
|
+
}
|
352
|
+
|
353
|
+
if(settings.pagination == true) {
|
354
|
+
$(".onepage-pagination li a").click(function (){
|
355
|
+
var page_index = $(this).data("index");
|
356
|
+
el.moveTo(page_index);
|
357
|
+
});
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
$(document).bind('mousewheel DOMMouseScroll MozMousePixelScroll', function(event) {
|
362
|
+
event.preventDefault();
|
363
|
+
var delta = event.originalEvent.wheelDelta || -event.originalEvent.detail;
|
364
|
+
if(!$("body").hasClass("disabled-onepage-scroll")) init_scroll(event, delta);
|
365
|
+
});
|
366
|
+
|
367
|
+
|
368
|
+
if(settings.responsiveFallback != false) {
|
369
|
+
$(window).resize(function() {
|
370
|
+
responsive();
|
371
|
+
});
|
372
|
+
|
373
|
+
responsive();
|
374
|
+
}
|
375
|
+
|
376
|
+
if(settings.keyboard == true) {
|
377
|
+
$(document).keydown(function(e) {
|
378
|
+
var tag = e.target.tagName.toLowerCase();
|
379
|
+
|
380
|
+
if (!$("body").hasClass("disabled-onepage-scroll")) {
|
381
|
+
switch(e.which) {
|
382
|
+
case 38:
|
383
|
+
if (tag != 'input' && tag != 'textarea') el.moveUp()
|
384
|
+
break;
|
385
|
+
case 40:
|
386
|
+
if (tag != 'input' && tag != 'textarea') el.moveDown()
|
387
|
+
break;
|
388
|
+
case 33: //pageg up
|
389
|
+
if (tag != 'input' && tag != 'textarea') el.moveUp()
|
390
|
+
break;
|
391
|
+
case 34: //page dwn
|
392
|
+
if (tag != 'input' && tag != 'textarea') el.moveDown()
|
393
|
+
break;
|
394
|
+
case 36: //home
|
395
|
+
el.moveTo(1);
|
396
|
+
break;
|
397
|
+
case 35: //end
|
398
|
+
el.moveTo(total);
|
399
|
+
break;
|
400
|
+
default: return;
|
401
|
+
}
|
402
|
+
}
|
403
|
+
|
404
|
+
});
|
405
|
+
}
|
406
|
+
return false;
|
407
|
+
}
|
408
|
+
|
409
|
+
|
410
|
+
}(window.jQuery);
|
411
|
+
|
@@ -0,0 +1,237 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
(($) ->
|
4
|
+
|
5
|
+
# MODAL CLASS DEFINITION
|
6
|
+
# ======================
|
7
|
+
|
8
|
+
class Modal
|
9
|
+
constructor: (element, options) ->
|
10
|
+
@options = options
|
11
|
+
@$body = $(document.body)
|
12
|
+
@$element = $(element)
|
13
|
+
@$backdrop
|
14
|
+
@isShown = null
|
15
|
+
@scrollbarWidth = 0
|
16
|
+
|
17
|
+
if @options.remote
|
18
|
+
@$element.find('.modal-content').load(@options.remote, $.proxy( (-> @$element.trigger('loaded.modal')) , @))
|
19
|
+
|
20
|
+
Modal.VERSION = '3.2.0'
|
21
|
+
|
22
|
+
Modal.DEFAULTS =
|
23
|
+
backdrop: true
|
24
|
+
keyboard: true
|
25
|
+
show: true
|
26
|
+
|
27
|
+
|
28
|
+
Modal::toggle = (_relatedTarget) ->
|
29
|
+
if @isShown then @hide() else @show(_relatedTarget)
|
30
|
+
|
31
|
+
|
32
|
+
Modal::show = (_relatedTarget) ->
|
33
|
+
e = $.Event('show.modal', relatedTarget: _relatedTarget)
|
34
|
+
|
35
|
+
@$element.trigger(e)
|
36
|
+
|
37
|
+
return if (@isShown || e.isDefaultPrevented())
|
38
|
+
|
39
|
+
@isShown = true
|
40
|
+
|
41
|
+
@checkScrollbar()
|
42
|
+
@$body.addClass('modal-open')
|
43
|
+
|
44
|
+
@setScrollbar()
|
45
|
+
@escape()
|
46
|
+
|
47
|
+
@$element.on 'click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(@hide, @)
|
48
|
+
|
49
|
+
@backdrop =>
|
50
|
+
transition = $.support.transition && @$element.hasClass('fade')
|
51
|
+
|
52
|
+
@$element.appendTo(@$body) unless @$element.parent().length # don't move modals dom position
|
53
|
+
|
54
|
+
@$element.show().scrollTop(0)
|
55
|
+
|
56
|
+
@$element[0].offsetWidth if transition # force reflow
|
57
|
+
|
58
|
+
@$element.addClass('in').attr('aria-hidden', false)
|
59
|
+
|
60
|
+
@enforceFocus()
|
61
|
+
|
62
|
+
e = $.Event('shown.modal', relatedTarget: _relatedTarget)
|
63
|
+
|
64
|
+
if transition
|
65
|
+
@$element.find('.modal-dialog') # wait for modal to slide in
|
66
|
+
.one 'miceTransitionEnd', -> @$element.trigger('focus').trigger(e)
|
67
|
+
.emulateTransitionEnd(300)
|
68
|
+
else
|
69
|
+
@$element.trigger('focus').trigger(e)
|
70
|
+
|
71
|
+
|
72
|
+
Modal::hide = (e) ->
|
73
|
+
if (e) then e.preventDefault()
|
74
|
+
|
75
|
+
e = $.Event('hide.modal')
|
76
|
+
|
77
|
+
@$element.trigger(e)
|
78
|
+
|
79
|
+
return if (!@isShown || e.isDefaultPrevented())
|
80
|
+
|
81
|
+
@isShown = false
|
82
|
+
|
83
|
+
@$body.removeClass('modal-open')
|
84
|
+
|
85
|
+
@resetScrollbar()
|
86
|
+
@escape()
|
87
|
+
|
88
|
+
$(document).off('focusin.modal')
|
89
|
+
|
90
|
+
@$element.removeClass('in').attr('aria-hidden', true).off('click.dismiss.modal')
|
91
|
+
|
92
|
+
if $.support.transition && @$element.hasClass('fade')
|
93
|
+
@$element.one('miceTransitionEnd', $.proxy(@hideModal, @)).emulateTransitionEnd(300)
|
94
|
+
else
|
95
|
+
@hideModal()
|
96
|
+
|
97
|
+
|
98
|
+
Modal::enforceFocus = ->
|
99
|
+
$(document)
|
100
|
+
.off 'focusin.modal' # guard against infinite focus loop
|
101
|
+
.on 'focusin.modal',
|
102
|
+
$.proxy (e) ->
|
103
|
+
@$element.trigger('focus') if @$element[0] != e.target && !@$element.has(e.target).length
|
104
|
+
, @
|
105
|
+
|
106
|
+
|
107
|
+
Modal::escape = ->
|
108
|
+
if @isShown && @options.keyboard
|
109
|
+
@$element.on 'keyup.dismiss.modal', ($.proxy (e) -> e.which == 27 && @hide()), @
|
110
|
+
else if !@isShown
|
111
|
+
@$element.off('keyup.dismiss.modal')
|
112
|
+
|
113
|
+
|
114
|
+
Modal::hideModal = ->
|
115
|
+
@$element.hide()
|
116
|
+
@backdrop => @$element.trigger('hidden.modal')
|
117
|
+
|
118
|
+
Modal::removeBackdrop = ->
|
119
|
+
@$backdrop && @$backdrop.remove()
|
120
|
+
@$backdrop = null
|
121
|
+
|
122
|
+
|
123
|
+
Modal::backdrop = (callback) ->
|
124
|
+
animate = if @$element.hasClass('fade') then 'fade' else ''
|
125
|
+
|
126
|
+
if @isShown && @options.backdrop
|
127
|
+
doAnimate = $.support.transition && animate
|
128
|
+
|
129
|
+
@$backdrop = $('<div class="modal-backdrop ' + animate + '" />').appendTo(@$body)
|
130
|
+
|
131
|
+
@$element.on 'click.dismiss.modal',
|
132
|
+
$.proxy (e) ->
|
133
|
+
return if e.target != e.currentTarget
|
134
|
+
if @options.backdrop == 'static' then @$element[0].focus.call(@$element[0]) else @hide.call(@)
|
135
|
+
, @
|
136
|
+
|
137
|
+
@$backdrop[0].offsetWidth if doAnimate # force reflow
|
138
|
+
|
139
|
+
@$backdrop.addClass('in')
|
140
|
+
|
141
|
+
return unless callback
|
142
|
+
|
143
|
+
if doAnimate then @$backdrop.one('miceTransitionEnd', callback).emulateTransitionEnd(150) else callback()
|
144
|
+
|
145
|
+
else if !@isShown && @$backdrop
|
146
|
+
@$backdrop.removeClass('in')
|
147
|
+
|
148
|
+
callbackRemove = =>
|
149
|
+
@removeBackdrop()
|
150
|
+
callback && callback()
|
151
|
+
|
152
|
+
if $.support.transition && @$element.hasClass('fade')
|
153
|
+
@$backdrop.one('miceTransitionEnd', callbackRemove).emulateTransitionEnd(150)
|
154
|
+
else
|
155
|
+
callbackRemove()
|
156
|
+
|
157
|
+
else if callback
|
158
|
+
callback()
|
159
|
+
|
160
|
+
|
161
|
+
Modal::checkScrollbar = ->
|
162
|
+
return if document.body.clientWidth >= window.innerWidth
|
163
|
+
@scrollbarWidth = @scrollbarWidth || @measureScrollbar()
|
164
|
+
|
165
|
+
|
166
|
+
Modal::setScrollbar = ->
|
167
|
+
bodyPad = parseInt @$body.css('padding-right') || 0, 10
|
168
|
+
@$body.css('padding-right', bodyPad + @scrollbarWidth) if @scrollbarWidth
|
169
|
+
|
170
|
+
|
171
|
+
Modal::resetScrollbar = ->
|
172
|
+
@$body.css 'padding-right', ''
|
173
|
+
|
174
|
+
|
175
|
+
Modal::measureScrollbar = -> # thx walsh
|
176
|
+
scrollDiv = document.createElement('div')
|
177
|
+
scrollDiv.className = 'modal-scrollbar-measure'
|
178
|
+
@$body.append(scrollDiv)
|
179
|
+
scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
|
180
|
+
@$body[0].removeChild(scrollDiv)
|
181
|
+
scrollbarWidth
|
182
|
+
|
183
|
+
|
184
|
+
# MODAL PLUGIN DEFINITION
|
185
|
+
# =======================
|
186
|
+
|
187
|
+
Plugin = (option, _relatedTarget) ->
|
188
|
+
@each ->
|
189
|
+
$element = $(@)
|
190
|
+
data = $element.data('modal')
|
191
|
+
options = $.extend({}, Modal.DEFAULTS, $element.data(), typeof option == 'object' && option)
|
192
|
+
|
193
|
+
if (!data)
|
194
|
+
$element.data 'modal', (data = new Modal(@, options))
|
195
|
+
|
196
|
+
if typeof option == 'string'
|
197
|
+
data[option](_relatedTarget)
|
198
|
+
|
199
|
+
else if options.show
|
200
|
+
data.show(_relatedTarget)
|
201
|
+
|
202
|
+
old = $.fn.modal
|
203
|
+
|
204
|
+
$.fn.modal = Plugin
|
205
|
+
$.fn.modal.Constructor = Modal
|
206
|
+
|
207
|
+
|
208
|
+
# MODAL NO CONFLICT
|
209
|
+
# =================
|
210
|
+
|
211
|
+
$.fn.modal.noConflict = ->
|
212
|
+
$.fn.modal = old
|
213
|
+
@
|
214
|
+
|
215
|
+
|
216
|
+
# MODAL DATA-API
|
217
|
+
# ==============
|
218
|
+
|
219
|
+
$(document).on 'click.modal.data-api',
|
220
|
+
'[data-toggle="modal"]',
|
221
|
+
(e) ->
|
222
|
+
$element = $(@)
|
223
|
+
href = $element.attr('href')
|
224
|
+
$target = $($element.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) # strip for ie7
|
225
|
+
option = if $target.data('modal') then 'toggle' else $.extend({ remote: !/#/.test(href) && href }, $target.data(), $element.data())
|
226
|
+
|
227
|
+
e.preventDefault() if $element.is('a')
|
228
|
+
|
229
|
+
$target.one 'show.modal', (showEvent) ->
|
230
|
+
return if (showEvent.isDefaultPrevented()) # only register focus restorer if modal will actually get shown
|
231
|
+
$target.one 'hidden.modal', -> $element.is(':visible') && $element.trigger('focus')
|
232
|
+
|
233
|
+
Plugin.call($target, option, @)
|
234
|
+
|
235
|
+
return
|
236
|
+
|
237
|
+
) jQuery
|
@@ -110,8 +110,6 @@
|
|
110
110
|
inDom = $.contains(document.documentElement, @$element[0])
|
111
111
|
return if e.isDefaultPrevented() or !inDom
|
112
112
|
|
113
|
-
that = @
|
114
|
-
|
115
113
|
$tip = @tip()
|
116
114
|
@setContent()
|
117
115
|
|
@@ -147,9 +145,9 @@
|
|
147
145
|
|
148
146
|
@applyPlacement calculatedOffset, placement
|
149
147
|
|
150
|
-
complete =
|
151
|
-
|
152
|
-
|
148
|
+
complete = =>
|
149
|
+
@$element.trigger('shown.mice.' + @type)
|
150
|
+
@hoverState = null
|
153
151
|
|
154
152
|
if $.support.transition and @$tip.hasClass('fade') then $tip.one('miceTransitionEnd', complete).emulateTransitionEnd(150) else complete()
|
155
153
|
|
@@ -196,13 +194,12 @@
|
|
196
194
|
@tip().find('.inner')[if @options.html then 'html' else 'text'](@getTitle()).removeClass('fade in top bottom left right')
|
197
195
|
|
198
196
|
hide: ->
|
199
|
-
that = @
|
200
197
|
$tip = @tip()
|
201
198
|
e = $.Event('hide.mice.' + @type)
|
202
199
|
|
203
|
-
complete =
|
204
|
-
$tip.detach() if
|
205
|
-
|
200
|
+
complete = =>
|
201
|
+
$tip.detach() if @hoverState != 'in'
|
202
|
+
@$element.trigger('hidden.mice.' + @type)
|
206
203
|
|
207
204
|
@$element.trigger(e)
|
208
205
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miclle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -65,12 +65,14 @@ files:
|
|
65
65
|
- vendor/assets/javascripts/mice/alert.js
|
66
66
|
- vendor/assets/javascripts/mice/carousel.js
|
67
67
|
- vendor/assets/javascripts/mice/jquery.autocomplete.min.js
|
68
|
+
- vendor/assets/javascripts/mice/jquery.autofix_anything.js
|
68
69
|
- vendor/assets/javascripts/mice/jquery.email-autocomplete.js
|
69
70
|
- vendor/assets/javascripts/mice/jquery.js
|
70
71
|
- vendor/assets/javascripts/mice/jquery.min.js
|
71
72
|
- vendor/assets/javascripts/mice/jquery.min.map
|
73
|
+
- vendor/assets/javascripts/mice/jquery.onepage-scroll.js
|
72
74
|
- vendor/assets/javascripts/mice/message.coffee
|
73
|
-
- vendor/assets/javascripts/mice/modal.
|
75
|
+
- vendor/assets/javascripts/mice/modal.coffee
|
74
76
|
- vendor/assets/javascripts/mice/slider.coffee
|
75
77
|
- vendor/assets/javascripts/mice/slider.js
|
76
78
|
- vendor/assets/javascripts/mice/tooltip.coffee
|
@@ -78,6 +80,7 @@ files:
|
|
78
80
|
- vendor/assets/stylesheets/mice-mobile.scss
|
79
81
|
- vendor/assets/stylesheets/mice.scss
|
80
82
|
- vendor/assets/stylesheets/mice/_alerts.scss
|
83
|
+
- vendor/assets/stylesheets/mice/_autofix_anything.scss
|
81
84
|
- vendor/assets/stylesheets/mice/_breadcrumbs.scss
|
82
85
|
- vendor/assets/stylesheets/mice/_buttons.scss
|
83
86
|
- vendor/assets/stylesheets/mice/_callouts.scss
|
@@ -1,280 +0,0 @@
|
|
1
|
-
/* ========================================================================
|
2
|
-
* Bootstrap: modal.js v3.2.0
|
3
|
-
* http://getbootstrap.com/javascript/#modals
|
4
|
-
* ========================================================================
|
5
|
-
* Copyright 2011-2014 Twitter, Inc.
|
6
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
-
* ======================================================================== */
|
8
|
-
|
9
|
-
|
10
|
-
+function ($) {
|
11
|
-
'use strict';
|
12
|
-
|
13
|
-
// MODAL CLASS DEFINITION
|
14
|
-
// ======================
|
15
|
-
|
16
|
-
var Modal = function (element, options) {
|
17
|
-
this.options = options
|
18
|
-
this.$body = $(document.body)
|
19
|
-
this.$element = $(element)
|
20
|
-
this.$backdrop =
|
21
|
-
this.isShown = null
|
22
|
-
this.scrollbarWidth = 0
|
23
|
-
|
24
|
-
if (this.options.remote) {
|
25
|
-
this.$element
|
26
|
-
.find('.modal-content')
|
27
|
-
.load(this.options.remote, $.proxy(function () {
|
28
|
-
this.$element.trigger('loaded.bs.modal')
|
29
|
-
}, this))
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
Modal.VERSION = '3.2.0'
|
34
|
-
|
35
|
-
Modal.DEFAULTS = {
|
36
|
-
backdrop: true,
|
37
|
-
keyboard: true,
|
38
|
-
show: true
|
39
|
-
}
|
40
|
-
|
41
|
-
Modal.prototype.toggle = function (_relatedTarget) {
|
42
|
-
return this.isShown ? this.hide() : this.show(_relatedTarget)
|
43
|
-
}
|
44
|
-
|
45
|
-
Modal.prototype.show = function (_relatedTarget) {
|
46
|
-
var that = this
|
47
|
-
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
|
48
|
-
|
49
|
-
this.$element.trigger(e)
|
50
|
-
|
51
|
-
if (this.isShown || e.isDefaultPrevented()) return
|
52
|
-
|
53
|
-
this.isShown = true
|
54
|
-
|
55
|
-
this.checkScrollbar()
|
56
|
-
this.$body.addClass('modal-open')
|
57
|
-
|
58
|
-
this.setScrollbar()
|
59
|
-
this.escape()
|
60
|
-
|
61
|
-
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
|
62
|
-
|
63
|
-
this.backdrop(function () {
|
64
|
-
var transition = $.support.transition && that.$element.hasClass('fade')
|
65
|
-
|
66
|
-
if (!that.$element.parent().length) {
|
67
|
-
that.$element.appendTo(that.$body) // don't move modals dom position
|
68
|
-
}
|
69
|
-
|
70
|
-
that.$element
|
71
|
-
.show()
|
72
|
-
.scrollTop(0)
|
73
|
-
|
74
|
-
if (transition) {
|
75
|
-
that.$element[0].offsetWidth // force reflow
|
76
|
-
}
|
77
|
-
|
78
|
-
that.$element
|
79
|
-
.addClass('in')
|
80
|
-
.attr('aria-hidden', false)
|
81
|
-
|
82
|
-
that.enforceFocus()
|
83
|
-
|
84
|
-
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
|
85
|
-
|
86
|
-
transition ?
|
87
|
-
that.$element.find('.modal-dialog') // wait for modal to slide in
|
88
|
-
.one('miceTransitionEnd', function () {
|
89
|
-
that.$element.trigger('focus').trigger(e)
|
90
|
-
})
|
91
|
-
.emulateTransitionEnd(300) :
|
92
|
-
that.$element.trigger('focus').trigger(e)
|
93
|
-
})
|
94
|
-
}
|
95
|
-
|
96
|
-
Modal.prototype.hide = function (e) {
|
97
|
-
if (e) e.preventDefault()
|
98
|
-
|
99
|
-
e = $.Event('hide.bs.modal')
|
100
|
-
|
101
|
-
this.$element.trigger(e)
|
102
|
-
|
103
|
-
if (!this.isShown || e.isDefaultPrevented()) return
|
104
|
-
|
105
|
-
this.isShown = false
|
106
|
-
|
107
|
-
this.$body.removeClass('modal-open')
|
108
|
-
|
109
|
-
this.resetScrollbar()
|
110
|
-
this.escape()
|
111
|
-
|
112
|
-
$(document).off('focusin.bs.modal')
|
113
|
-
|
114
|
-
this.$element
|
115
|
-
.removeClass('in')
|
116
|
-
.attr('aria-hidden', true)
|
117
|
-
.off('click.dismiss.bs.modal')
|
118
|
-
|
119
|
-
$.support.transition && this.$element.hasClass('fade') ?
|
120
|
-
this.$element
|
121
|
-
.one('miceTransitionEnd', $.proxy(this.hideModal, this))
|
122
|
-
.emulateTransitionEnd(300) :
|
123
|
-
this.hideModal()
|
124
|
-
}
|
125
|
-
|
126
|
-
Modal.prototype.enforceFocus = function () {
|
127
|
-
$(document)
|
128
|
-
.off('focusin.bs.modal') // guard against infinite focus loop
|
129
|
-
.on('focusin.bs.modal', $.proxy(function (e) {
|
130
|
-
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
131
|
-
this.$element.trigger('focus')
|
132
|
-
}
|
133
|
-
}, this))
|
134
|
-
}
|
135
|
-
|
136
|
-
Modal.prototype.escape = function () {
|
137
|
-
if (this.isShown && this.options.keyboard) {
|
138
|
-
this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
|
139
|
-
e.which == 27 && this.hide()
|
140
|
-
}, this))
|
141
|
-
} else if (!this.isShown) {
|
142
|
-
this.$element.off('keyup.dismiss.bs.modal')
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
Modal.prototype.hideModal = function () {
|
147
|
-
var that = this
|
148
|
-
this.$element.hide()
|
149
|
-
this.backdrop(function () {
|
150
|
-
that.$element.trigger('hidden.bs.modal')
|
151
|
-
})
|
152
|
-
}
|
153
|
-
|
154
|
-
Modal.prototype.removeBackdrop = function () {
|
155
|
-
this.$backdrop && this.$backdrop.remove()
|
156
|
-
this.$backdrop = null
|
157
|
-
}
|
158
|
-
|
159
|
-
Modal.prototype.backdrop = function (callback) {
|
160
|
-
var that = this
|
161
|
-
var animate = this.$element.hasClass('fade') ? 'fade' : ''
|
162
|
-
|
163
|
-
if (this.isShown && this.options.backdrop) {
|
164
|
-
var doAnimate = $.support.transition && animate
|
165
|
-
|
166
|
-
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
167
|
-
.appendTo(this.$body)
|
168
|
-
|
169
|
-
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
|
170
|
-
if (e.target !== e.currentTarget) return
|
171
|
-
this.options.backdrop == 'static'
|
172
|
-
? this.$element[0].focus.call(this.$element[0])
|
173
|
-
: this.hide.call(this)
|
174
|
-
}, this))
|
175
|
-
|
176
|
-
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
177
|
-
|
178
|
-
this.$backdrop.addClass('in')
|
179
|
-
|
180
|
-
if (!callback) return
|
181
|
-
|
182
|
-
doAnimate ?
|
183
|
-
this.$backdrop
|
184
|
-
.one('miceTransitionEnd', callback)
|
185
|
-
.emulateTransitionEnd(150) :
|
186
|
-
callback()
|
187
|
-
|
188
|
-
} else if (!this.isShown && this.$backdrop) {
|
189
|
-
this.$backdrop.removeClass('in')
|
190
|
-
|
191
|
-
var callbackRemove = function () {
|
192
|
-
that.removeBackdrop()
|
193
|
-
callback && callback()
|
194
|
-
}
|
195
|
-
$.support.transition && this.$element.hasClass('fade') ?
|
196
|
-
this.$backdrop
|
197
|
-
.one('miceTransitionEnd', callbackRemove)
|
198
|
-
.emulateTransitionEnd(150) :
|
199
|
-
callbackRemove()
|
200
|
-
|
201
|
-
} else if (callback) {
|
202
|
-
callback()
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
Modal.prototype.checkScrollbar = function () {
|
207
|
-
if (document.body.clientWidth >= window.innerWidth) return
|
208
|
-
this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
|
209
|
-
}
|
210
|
-
|
211
|
-
Modal.prototype.setScrollbar = function () {
|
212
|
-
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
|
213
|
-
if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
|
214
|
-
}
|
215
|
-
|
216
|
-
Modal.prototype.resetScrollbar = function () {
|
217
|
-
this.$body.css('padding-right', '')
|
218
|
-
}
|
219
|
-
|
220
|
-
Modal.prototype.measureScrollbar = function () { // thx walsh
|
221
|
-
var scrollDiv = document.createElement('div')
|
222
|
-
scrollDiv.className = 'modal-scrollbar-measure'
|
223
|
-
this.$body.append(scrollDiv)
|
224
|
-
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
|
225
|
-
this.$body[0].removeChild(scrollDiv)
|
226
|
-
return scrollbarWidth
|
227
|
-
}
|
228
|
-
|
229
|
-
|
230
|
-
// MODAL PLUGIN DEFINITION
|
231
|
-
// =======================
|
232
|
-
|
233
|
-
function Plugin(option, _relatedTarget) {
|
234
|
-
return this.each(function () {
|
235
|
-
var $this = $(this)
|
236
|
-
var data = $this.data('bs.modal')
|
237
|
-
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
238
|
-
|
239
|
-
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
|
240
|
-
if (typeof option == 'string') data[option](_relatedTarget)
|
241
|
-
else if (options.show) data.show(_relatedTarget)
|
242
|
-
})
|
243
|
-
}
|
244
|
-
|
245
|
-
var old = $.fn.modal
|
246
|
-
|
247
|
-
$.fn.modal = Plugin
|
248
|
-
$.fn.modal.Constructor = Modal
|
249
|
-
|
250
|
-
|
251
|
-
// MODAL NO CONFLICT
|
252
|
-
// =================
|
253
|
-
|
254
|
-
$.fn.modal.noConflict = function () {
|
255
|
-
$.fn.modal = old
|
256
|
-
return this
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
// MODAL DATA-API
|
261
|
-
// ==============
|
262
|
-
|
263
|
-
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
|
264
|
-
var $this = $(this)
|
265
|
-
var href = $this.attr('href')
|
266
|
-
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
|
267
|
-
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
|
268
|
-
|
269
|
-
if ($this.is('a')) e.preventDefault()
|
270
|
-
|
271
|
-
$target.one('show.bs.modal', function (showEvent) {
|
272
|
-
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
|
273
|
-
$target.one('hidden.bs.modal', function () {
|
274
|
-
$this.is(':visible') && $this.trigger('focus')
|
275
|
-
})
|
276
|
-
})
|
277
|
-
Plugin.call($target, option, this)
|
278
|
-
})
|
279
|
-
|
280
|
-
}(jQuery);
|