aladdin 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aladdin/app.rb +5 -23
- data/lib/aladdin/constants.rb +1 -1
- data/lib/aladdin/render/html.rb +5 -3
- data/lib/aladdin/render/templates/problem.rb +1 -1
- data/lib/aladdin/render/templates/template.rb +1 -1
- data/lib/aladdin/submission.rb +6 -6
- data/lib/aladdin/version.rb +1 -1
- data/views/haml/layout.haml +24 -24
- data/views/haml/multi.haml +1 -3
- data/views/haml/short.haml +1 -3
- data/views/haml/table.haml +1 -3
- metadata +3 -49
- data/assets/__font/general_foundicons.eot +0 -0
- data/assets/__font/general_foundicons.svg +0 -15
- data/assets/__font/general_foundicons.ttf +0 -0
- data/assets/__font/general_foundicons.woff +0 -0
- data/assets/__img/graphic.png +0 -0
- data/assets/__img/no_gravatar.gif +0 -0
- data/assets/__js/app.js +0 -76
- data/assets/__js/foundation/app.js +0 -38
- data/assets/__js/foundation/jquery.cookie.js +0 -72
- data/assets/__js/foundation/jquery.event.move.js +0 -580
- data/assets/__js/foundation/jquery.event.swipe.js +0 -130
- data/assets/__js/foundation/jquery.foundation.accordion.js +0 -34
- data/assets/__js/foundation/jquery.foundation.alerts.js +0 -20
- data/assets/__js/foundation/jquery.foundation.buttons.js +0 -74
- data/assets/__js/foundation/jquery.foundation.clearing.js +0 -468
- data/assets/__js/foundation/jquery.foundation.forms.js +0 -486
- data/assets/__js/foundation/jquery.foundation.joyride.js +0 -639
- data/assets/__js/foundation/jquery.foundation.magellan.js +0 -85
- data/assets/__js/foundation/jquery.foundation.mediaQueryToggle.js +0 -27
- data/assets/__js/foundation/jquery.foundation.navigation.js +0 -55
- data/assets/__js/foundation/jquery.foundation.orbit.js +0 -897
- data/assets/__js/foundation/jquery.foundation.reveal.js +0 -794
- data/assets/__js/foundation/jquery.foundation.tabs.js +0 -43
- data/assets/__js/foundation/jquery.foundation.tooltips.js +0 -193
- data/assets/__js/foundation/jquery.foundation.topbar.js +0 -152
- data/assets/__js/foundation/jquery.js +0 -9440
- data/assets/__js/foundation/jquery.offcanvas.js +0 -50
- data/assets/__js/foundation/jquery.placeholder.js +0 -157
- data/assets/__js/foundation/modernizr.foundation.js +0 -4
- data/assets/favicon.ico +0 -0
@@ -1,130 +0,0 @@
|
|
1
|
-
// jQuery.event.swipe
|
2
|
-
// 0.5
|
3
|
-
// Stephen Band
|
4
|
-
|
5
|
-
// Dependencies
|
6
|
-
// jQuery.event.move 1.2
|
7
|
-
|
8
|
-
// One of swipeleft, swiperight, swipeup or swipedown is triggered on
|
9
|
-
// moveend, when the move has covered a threshold ratio of the dimension
|
10
|
-
// of the target node, or has gone really fast. Threshold and velocity
|
11
|
-
// sensitivity changed with:
|
12
|
-
//
|
13
|
-
// jQuery.event.special.swipe.settings.threshold
|
14
|
-
// jQuery.event.special.swipe.settings.sensitivity
|
15
|
-
|
16
|
-
(function (module) {
|
17
|
-
if (typeof define === 'function' && define.amd) {
|
18
|
-
// AMD. Register as an anonymous module.
|
19
|
-
define(['jquery'], module);
|
20
|
-
} else {
|
21
|
-
// Browser globals
|
22
|
-
module(jQuery);
|
23
|
-
}
|
24
|
-
})(function(jQuery, undefined){
|
25
|
-
var add = jQuery.event.add,
|
26
|
-
|
27
|
-
remove = jQuery.event.remove,
|
28
|
-
|
29
|
-
// Just sugar, so we can have arguments in the same order as
|
30
|
-
// add and remove.
|
31
|
-
trigger = function(node, type, data) {
|
32
|
-
jQuery.event.trigger(type, data, node);
|
33
|
-
},
|
34
|
-
|
35
|
-
settings = {
|
36
|
-
// Ratio of distance over target finger must travel to be
|
37
|
-
// considered a swipe.
|
38
|
-
threshold: 0.4,
|
39
|
-
// Faster fingers can travel shorter distances to be considered
|
40
|
-
// swipes. 'sensitivity' controls how much. Bigger is shorter.
|
41
|
-
sensitivity: 6
|
42
|
-
};
|
43
|
-
|
44
|
-
function moveend(e) {
|
45
|
-
var w, h, event;
|
46
|
-
|
47
|
-
w = e.target.offsetWidth;
|
48
|
-
h = e.target.offsetHeight;
|
49
|
-
|
50
|
-
// Copy over some useful properties from the move event
|
51
|
-
event = {
|
52
|
-
distX: e.distX,
|
53
|
-
distY: e.distY,
|
54
|
-
velocityX: e.velocityX,
|
55
|
-
velocityY: e.velocityY,
|
56
|
-
finger: e.finger
|
57
|
-
};
|
58
|
-
|
59
|
-
// Find out which of the four directions was swiped
|
60
|
-
if (e.distX > e.distY) {
|
61
|
-
if (e.distX > -e.distY) {
|
62
|
-
if (e.distX/w > settings.threshold || e.velocityX * e.distX/w * settings.sensitivity > 1) {
|
63
|
-
event.type = 'swiperight';
|
64
|
-
trigger(e.currentTarget, event);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
if (-e.distY/h > settings.threshold || e.velocityY * e.distY/w * settings.sensitivity > 1) {
|
69
|
-
event.type = 'swipeup';
|
70
|
-
trigger(e.currentTarget, event);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
if (e.distX > -e.distY) {
|
76
|
-
if (e.distY/h > settings.threshold || e.velocityY * e.distY/w * settings.sensitivity > 1) {
|
77
|
-
event.type = 'swipedown';
|
78
|
-
trigger(e.currentTarget, event);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
else {
|
82
|
-
if (-e.distX/w > settings.threshold || e.velocityX * e.distX/w * settings.sensitivity > 1) {
|
83
|
-
event.type = 'swipeleft';
|
84
|
-
trigger(e.currentTarget, event);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
function getData(node) {
|
91
|
-
var data = jQuery.data(node, 'event_swipe');
|
92
|
-
|
93
|
-
if (!data) {
|
94
|
-
data = { count: 0 };
|
95
|
-
jQuery.data(node, 'event_swipe', data);
|
96
|
-
}
|
97
|
-
|
98
|
-
return data;
|
99
|
-
}
|
100
|
-
|
101
|
-
jQuery.event.special.swipe =
|
102
|
-
jQuery.event.special.swipeleft =
|
103
|
-
jQuery.event.special.swiperight =
|
104
|
-
jQuery.event.special.swipeup =
|
105
|
-
jQuery.event.special.swipedown = {
|
106
|
-
setup: function( data, namespaces, eventHandle ) {
|
107
|
-
var data = getData(this);
|
108
|
-
|
109
|
-
// If another swipe event is already setup, don't setup again.
|
110
|
-
if (data.count++ > 0) { return; }
|
111
|
-
|
112
|
-
add(this, 'moveend', moveend);
|
113
|
-
|
114
|
-
return true;
|
115
|
-
},
|
116
|
-
|
117
|
-
teardown: function() {
|
118
|
-
var data = getData(this);
|
119
|
-
|
120
|
-
// If another swipe event is still setup, don't teardown.
|
121
|
-
if (--data.count > 0) { return; }
|
122
|
-
|
123
|
-
remove(this, 'moveend', moveend);
|
124
|
-
|
125
|
-
return true;
|
126
|
-
},
|
127
|
-
|
128
|
-
settings: settings
|
129
|
-
};
|
130
|
-
});
|
@@ -1,34 +0,0 @@
|
|
1
|
-
;(function ($, window, undefined){
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
$.fn.foundationAccordion = function (options) {
|
5
|
-
var $accordion = $('.accordion');
|
6
|
-
|
7
|
-
if ($accordion.hasClass('hover') && !Modernizr.touch) {
|
8
|
-
$('.accordion li', this).on({
|
9
|
-
mouseenter : function () {
|
10
|
-
console.log('due');
|
11
|
-
var p = $(this).parent(),
|
12
|
-
flyout = $(this).children('.content').first();
|
13
|
-
|
14
|
-
$('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
|
15
|
-
flyout.show(0, function () {
|
16
|
-
flyout.parent('li').addClass('active');
|
17
|
-
});
|
18
|
-
}
|
19
|
-
});
|
20
|
-
} else {
|
21
|
-
$('.accordion li', this).on('click.fndtn', function () {
|
22
|
-
var p = $(this).parent(),
|
23
|
-
flyout = $(this).children('.content').first();
|
24
|
-
|
25
|
-
$('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
|
26
|
-
flyout.show(0, function () {
|
27
|
-
flyout.parent('li').addClass('active');
|
28
|
-
});
|
29
|
-
});
|
30
|
-
}
|
31
|
-
|
32
|
-
};
|
33
|
-
|
34
|
-
})( jQuery, this );
|
@@ -1,20 +0,0 @@
|
|
1
|
-
;(function ($, window, undefined) {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
$.fn.foundationAlerts = function (options) {
|
5
|
-
var settings = $.extend({
|
6
|
-
callback: $.noop
|
7
|
-
}, options);
|
8
|
-
|
9
|
-
$(document).on("click", ".alert-box a.close", function (e) {
|
10
|
-
e.preventDefault();
|
11
|
-
$(this).closest(".alert-box").fadeOut(function () {
|
12
|
-
$(this).remove();
|
13
|
-
// Do something else after the alert closes
|
14
|
-
settings.callback();
|
15
|
-
});
|
16
|
-
});
|
17
|
-
|
18
|
-
};
|
19
|
-
|
20
|
-
})(jQuery, this);
|
@@ -1,74 +0,0 @@
|
|
1
|
-
;(function ($, window, undefined) {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
$.fn.foundationButtons = function (options) {
|
5
|
-
var $doc = $(document),
|
6
|
-
config = $.extend({
|
7
|
-
dropdownAsToggle:true,
|
8
|
-
activeClass:'active'
|
9
|
-
}, options),
|
10
|
-
|
11
|
-
// close all dropdowns except for the dropdown passed
|
12
|
-
closeDropdowns = function (dropdown) {
|
13
|
-
$('.button.dropdown').find('ul').not(dropdown).removeClass('show-dropdown');
|
14
|
-
},
|
15
|
-
// reset all toggle states except for the button passed
|
16
|
-
resetToggles = function (button) {
|
17
|
-
var buttons = $('.button.dropdown').not(button);
|
18
|
-
buttons.add($('> span.' + config.activeClass, buttons)).removeClass(config.activeClass);
|
19
|
-
};
|
20
|
-
|
21
|
-
// Prevent event propagation on disabled buttons
|
22
|
-
$doc.on('click.fndtn', '.button.disabled', function (e) {
|
23
|
-
e.preventDefault();
|
24
|
-
});
|
25
|
-
|
26
|
-
$('.button.dropdown > ul', this).addClass('no-hover');
|
27
|
-
|
28
|
-
// reset other active states
|
29
|
-
$doc.on('click.fndtn', '.button.dropdown:not(.split), .button.dropdown.split span', function (e) {
|
30
|
-
var $el = $(this),
|
31
|
-
button = $el.closest('.button.dropdown'),
|
32
|
-
dropdown = $('> ul', button);
|
33
|
-
e.preventDefault();
|
34
|
-
|
35
|
-
// close other dropdowns
|
36
|
-
closeDropdowns(config.dropdownAsToggle ? dropdown : '');
|
37
|
-
dropdown.toggleClass('show-dropdown');
|
38
|
-
|
39
|
-
if (config.dropdownAsToggle) {
|
40
|
-
resetToggles(button);
|
41
|
-
$el.toggleClass(config.activeClass);
|
42
|
-
}
|
43
|
-
});
|
44
|
-
|
45
|
-
// close all dropdowns and deactivate all buttons
|
46
|
-
$doc.on('click.fndtn', 'body, html', function (e) {
|
47
|
-
// check original target instead of stopping event propagation to play nice with other events
|
48
|
-
if (!$(e.originalEvent.target).is('.button.dropdown:not(.split), .button.dropdown.split span')) {
|
49
|
-
closeDropdowns();
|
50
|
-
if (config.dropdownAsToggle) {
|
51
|
-
resetToggles();
|
52
|
-
}
|
53
|
-
}
|
54
|
-
});
|
55
|
-
|
56
|
-
// Positioning the Flyout List
|
57
|
-
var normalButtonHeight = $('.button.dropdown:not(.large):not(.small):not(.tiny)', this).outerHeight() - 1,
|
58
|
-
largeButtonHeight = $('.button.large.dropdown', this).outerHeight() - 1,
|
59
|
-
smallButtonHeight = $('.button.small.dropdown', this).outerHeight() - 1,
|
60
|
-
tinyButtonHeight = $('.button.tiny.dropdown', this).outerHeight() - 1;
|
61
|
-
|
62
|
-
$('.button.dropdown:not(.large):not(.small):not(.tiny) > ul', this).css('top', normalButtonHeight);
|
63
|
-
$('.button.dropdown.large > ul', this).css('top', largeButtonHeight);
|
64
|
-
$('.button.dropdown.small > ul', this).css('top', smallButtonHeight);
|
65
|
-
$('.button.dropdown.tiny > ul', this).css('top', tinyButtonHeight);
|
66
|
-
|
67
|
-
$('.button.dropdown.up:not(.large):not(.small):not(.tiny) > ul', this).css('top', 'auto').css('bottom', normalButtonHeight - 2);
|
68
|
-
$('.button.dropdown.up.large > ul', this).css('top', 'auto').css('bottom', largeButtonHeight - 2);
|
69
|
-
$('.button.dropdown.up.small > ul', this).css('top', 'auto').css('bottom', smallButtonHeight - 2);
|
70
|
-
$('.button.dropdown.up.tiny > ul', this).css('top', 'auto').css('bottom', tinyButtonHeight - 2);
|
71
|
-
|
72
|
-
};
|
73
|
-
|
74
|
-
})( jQuery, this );
|
@@ -1,468 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery Foundation Clearing 1.0
|
3
|
-
* http://foundation.zurb.com
|
4
|
-
* Copyright 2012, ZURB
|
5
|
-
* Free to use under the MIT license.
|
6
|
-
* http://www.opensource.org/licenses/mit-license.php
|
7
|
-
*/
|
8
|
-
|
9
|
-
/*jslint unparam: true, browser: true, indent: 2 */
|
10
|
-
|
11
|
-
;(function ($, window, undefined) {
|
12
|
-
'use strict';
|
13
|
-
|
14
|
-
var defaults = {
|
15
|
-
templates : {
|
16
|
-
viewing : '<a href="#" class="clearing-close">×</a>' +
|
17
|
-
'<div class="visible-img" style="display: none"><img src="#">' +
|
18
|
-
'<p class="clearing-caption"></p><a href="#" class="clearing-main-left"></a>' +
|
19
|
-
'<a href="#" class="clearing-main-right"></a></div>'
|
20
|
-
},
|
21
|
-
locked : false
|
22
|
-
},
|
23
|
-
|
24
|
-
superMethods = {},
|
25
|
-
|
26
|
-
methods = {
|
27
|
-
init : function (options, extendMethods) {
|
28
|
-
return this.find('ul[data-clearing]').each(function () {
|
29
|
-
var doc = $(document),
|
30
|
-
$el = $(this),
|
31
|
-
options = options || {},
|
32
|
-
extendMethods = extendMethods || {},
|
33
|
-
settings = $el.data('fndtn.clearing.settings');
|
34
|
-
|
35
|
-
if (!settings) {
|
36
|
-
options.$parent = $el.parent();
|
37
|
-
|
38
|
-
$el.data('fndtn.clearing.settings', $.extend({}, defaults, options));
|
39
|
-
|
40
|
-
// developer goodness experiment
|
41
|
-
methods.extend(methods, extendMethods);
|
42
|
-
|
43
|
-
// if the gallery hasn't been built yet...build it
|
44
|
-
methods.assemble($el.find('li'));
|
45
|
-
|
46
|
-
methods.events();
|
47
|
-
|
48
|
-
}
|
49
|
-
});
|
50
|
-
},
|
51
|
-
|
52
|
-
events : function () {
|
53
|
-
var doc = $(document);
|
54
|
-
|
55
|
-
doc.on('click.fndtn.clearing', 'ul[data-clearing] li', function (e, current, target) {
|
56
|
-
var current = current || $(this),
|
57
|
-
target = target || current;
|
58
|
-
|
59
|
-
e.preventDefault();
|
60
|
-
|
61
|
-
// set current and target to the clicked li if not otherwise defined.
|
62
|
-
methods.open($(e.target), current, target);
|
63
|
-
methods.update_paddles(target);
|
64
|
-
});
|
65
|
-
|
66
|
-
$(window).on('resize.fndtn.clearing', function () {
|
67
|
-
var image = $('.clearing-blackout .visible-img').find('img');
|
68
|
-
|
69
|
-
if (image.length > 0) {
|
70
|
-
methods.center(image);
|
71
|
-
}
|
72
|
-
});
|
73
|
-
|
74
|
-
doc.on('click.fndtn.clearing', '.clearing-main-right', function (e) {
|
75
|
-
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
76
|
-
|
77
|
-
e.preventDefault();
|
78
|
-
methods.go(clearing, 'next');
|
79
|
-
});
|
80
|
-
|
81
|
-
doc.on('click.fndtn.clearing', '.clearing-main-left', function (e) {
|
82
|
-
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
83
|
-
|
84
|
-
e.preventDefault();
|
85
|
-
methods.go(clearing, 'prev');
|
86
|
-
});
|
87
|
-
|
88
|
-
doc.on('click.fndtn.clearing', 'a.clearing-close, div.clearing-blackout', function (e) {
|
89
|
-
var root = (function (target) {
|
90
|
-
if (/blackout/.test(target.selector)) {
|
91
|
-
return target;
|
92
|
-
} else {
|
93
|
-
return target.closest('.clearing-blackout');
|
94
|
-
}
|
95
|
-
}($(this))), container, visible_image;
|
96
|
-
|
97
|
-
if (this === e.target && root) {
|
98
|
-
container = root.find('div:first'),
|
99
|
-
visible_image = container.find('.visible-img');
|
100
|
-
|
101
|
-
defaults.prev_index = 0;
|
102
|
-
|
103
|
-
root.find('ul[data-clearing]').attr('style', '')
|
104
|
-
root.removeClass('clearing-blackout');
|
105
|
-
container.removeClass('clearing-container');
|
106
|
-
visible_image.hide();
|
107
|
-
}
|
108
|
-
|
109
|
-
return false;
|
110
|
-
});
|
111
|
-
|
112
|
-
// should specify a target selector
|
113
|
-
doc.on('keydown.fndtn.clearing', function (e) {
|
114
|
-
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
115
|
-
|
116
|
-
// right
|
117
|
-
if (e.which === 39) {
|
118
|
-
methods.go(clearing, 'next');
|
119
|
-
}
|
120
|
-
|
121
|
-
// left
|
122
|
-
if (e.which === 37) {
|
123
|
-
methods.go(clearing, 'prev');
|
124
|
-
}
|
125
|
-
});
|
126
|
-
|
127
|
-
doc.on('movestart', function(e) {
|
128
|
-
|
129
|
-
// If the movestart is heading off in an upwards or downwards
|
130
|
-
// direction, prevent it so that the browser scrolls normally.
|
131
|
-
|
132
|
-
if ((e.distX > e.distY && e.distX < -e.distY) ||
|
133
|
-
(e.distX < e.distY && e.distX > -e.distY)) {
|
134
|
-
e.preventDefault();
|
135
|
-
}
|
136
|
-
});
|
137
|
-
|
138
|
-
doc.bind('swipeleft', 'ul[data-clearing] li', function () {
|
139
|
-
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
140
|
-
methods.go(clearing, 'next');
|
141
|
-
});
|
142
|
-
|
143
|
-
doc.bind('swiperight', 'ul[data-clearing] li', function () {
|
144
|
-
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
|
145
|
-
methods.go(clearing, 'prev');
|
146
|
-
});
|
147
|
-
},
|
148
|
-
|
149
|
-
assemble : function ($li, target) {
|
150
|
-
var $el = $li.parent(),
|
151
|
-
settings = $el.data('fndtn.clearing.settings'),
|
152
|
-
grid = $el.detach(),
|
153
|
-
data = {
|
154
|
-
grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
|
155
|
-
viewing: settings.templates.viewing
|
156
|
-
},
|
157
|
-
wrapper = '<div class="clearing-assembled"><div>' + data.viewing + data.grid + '</div></div>';
|
158
|
-
|
159
|
-
return settings.$parent.append(wrapper);
|
160
|
-
},
|
161
|
-
|
162
|
-
open : function ($image, current, target) {
|
163
|
-
var root = target.closest('.clearing-assembled'),
|
164
|
-
container = root.find('div:first'),
|
165
|
-
visible_image = container.find('.visible-img'),
|
166
|
-
image = visible_image.find('img').not($image);
|
167
|
-
|
168
|
-
if (!methods.locked()) {
|
169
|
-
|
170
|
-
// set the image to the selected thumbnail
|
171
|
-
image.attr('src', this.load($image));
|
172
|
-
|
173
|
-
image.is_good(function () {
|
174
|
-
// toggle the gallery if not visible
|
175
|
-
root.addClass('clearing-blackout');
|
176
|
-
container.addClass('clearing-container');
|
177
|
-
methods.caption(visible_image.find('.clearing-caption'), $image);
|
178
|
-
visible_image.show();
|
179
|
-
methods.fix_height(target);
|
180
|
-
|
181
|
-
methods.center(image);
|
182
|
-
|
183
|
-
// shift the thumbnails if necessary
|
184
|
-
methods.shift(current, target, function () {
|
185
|
-
target.siblings().removeClass('visible');
|
186
|
-
target.addClass('visible');
|
187
|
-
});
|
188
|
-
});
|
189
|
-
}
|
190
|
-
},
|
191
|
-
|
192
|
-
fix_height : function (target) {
|
193
|
-
var lis = target.siblings();
|
194
|
-
|
195
|
-
lis.each(function () {
|
196
|
-
var li = $(this),
|
197
|
-
image = li.find('img');
|
198
|
-
|
199
|
-
if (li.height() > image.outerHeight()) {
|
200
|
-
li.addClass('fix-height');
|
201
|
-
}
|
202
|
-
});
|
203
|
-
lis.closest('ul').width(lis.length * 100 + '%');
|
204
|
-
},
|
205
|
-
|
206
|
-
update_paddles : function (target) {
|
207
|
-
var visible_image = target.closest('.carousel').siblings('.visible-img');
|
208
|
-
|
209
|
-
if (target.next().length > 0) {
|
210
|
-
visible_image.find('.clearing-main-right').removeClass('disabled');
|
211
|
-
} else {
|
212
|
-
visible_image.find('.clearing-main-right').addClass('disabled');
|
213
|
-
}
|
214
|
-
|
215
|
-
if (target.prev().length > 0) {
|
216
|
-
visible_image.find('.clearing-main-left').removeClass('disabled');
|
217
|
-
} else {
|
218
|
-
visible_image.find('.clearing-main-left').addClass('disabled');
|
219
|
-
}
|
220
|
-
},
|
221
|
-
|
222
|
-
load : function ($image) {
|
223
|
-
var href = $image.parent().attr('href');
|
224
|
-
|
225
|
-
// preload next and previous
|
226
|
-
this.preload($image);
|
227
|
-
|
228
|
-
if (href) {
|
229
|
-
return href;
|
230
|
-
}
|
231
|
-
|
232
|
-
return $image.attr('src');
|
233
|
-
},
|
234
|
-
|
235
|
-
preload : function ($image) {
|
236
|
-
var next = $image.closest('li').next(),
|
237
|
-
prev = $image.closest('li').prev(),
|
238
|
-
next_a, prev_a,
|
239
|
-
next_img, prev_img;
|
240
|
-
|
241
|
-
if (next.length > 0) {
|
242
|
-
next_img = new Image();
|
243
|
-
next_a = next.find('a');
|
244
|
-
if (next_a.length > 0) {
|
245
|
-
next_img.src = next_a.attr('href');
|
246
|
-
} else {
|
247
|
-
next_img.src = next.find('img').attr('src');
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
if (prev.length > 0) {
|
252
|
-
prev_img = new Image();
|
253
|
-
prev_a = prev.find('a');
|
254
|
-
if (prev_a.length > 0) {
|
255
|
-
prev_img.src = prev_a.attr('href');
|
256
|
-
} else {
|
257
|
-
prev_img.src = prev.find('img').attr('src');
|
258
|
-
}
|
259
|
-
}
|
260
|
-
},
|
261
|
-
|
262
|
-
caption : function (container, $image) {
|
263
|
-
var caption = $image.data('caption');
|
264
|
-
|
265
|
-
if (caption) {
|
266
|
-
container.text(caption).show();
|
267
|
-
} else {
|
268
|
-
container.text('').hide();
|
269
|
-
}
|
270
|
-
},
|
271
|
-
|
272
|
-
go : function ($ul, direction) {
|
273
|
-
var current = $ul.find('.visible'),
|
274
|
-
target = current[direction]();
|
275
|
-
|
276
|
-
if (target.length > 0) {
|
277
|
-
target.find('img').trigger('click', [current, target]);
|
278
|
-
}
|
279
|
-
},
|
280
|
-
|
281
|
-
shift : function (current, target, callback) {
|
282
|
-
var clearing = target.parent(),
|
283
|
-
container = clearing.closest('.clearing-container'),
|
284
|
-
target_offset = target.position().left,
|
285
|
-
thumbs_offset = clearing.position().left,
|
286
|
-
old_index = defaults.prev_index,
|
287
|
-
direction = this.direction(clearing, current, target),
|
288
|
-
left = parseInt(clearing.css('left'), 10),
|
289
|
-
width = target.outerWidth(),
|
290
|
-
skip_shift;
|
291
|
-
|
292
|
-
// we use jQuery animate instead of CSS transitions because we
|
293
|
-
// need a callback to unlock the next animation
|
294
|
-
|
295
|
-
if (target.index() !== old_index && !/skip/.test(direction)){
|
296
|
-
if (/left/.test(direction)) {
|
297
|
-
methods.lock();
|
298
|
-
clearing.animate({left : left + width}, 300, methods.unlock);
|
299
|
-
} else if (/right/.test(direction)) {
|
300
|
-
methods.lock();
|
301
|
-
clearing.animate({left : left - width}, 300, methods.unlock);
|
302
|
-
}
|
303
|
-
} else if (/skip/.test(direction)) {
|
304
|
-
|
305
|
-
// the target image is not adjacent to the current image, so
|
306
|
-
// do we scroll right or not
|
307
|
-
skip_shift = target.index() - defaults.up_count;
|
308
|
-
methods.lock();
|
309
|
-
|
310
|
-
if (skip_shift > 0) {
|
311
|
-
clearing.animate({left : -(skip_shift * width)}, 300, methods.unlock);
|
312
|
-
} else {
|
313
|
-
clearing.animate({left : 0}, 300, methods.unlock);
|
314
|
-
}
|
315
|
-
}
|
316
|
-
|
317
|
-
callback();
|
318
|
-
},
|
319
|
-
|
320
|
-
lock : function () {
|
321
|
-
defaults.locked = true;
|
322
|
-
},
|
323
|
-
|
324
|
-
unlock : function () {
|
325
|
-
defaults.locked = false;
|
326
|
-
},
|
327
|
-
|
328
|
-
locked : function () {
|
329
|
-
return defaults.locked;
|
330
|
-
},
|
331
|
-
|
332
|
-
direction : function ($el, current, target) {
|
333
|
-
var lis = $el.find('li'),
|
334
|
-
li_width = lis.outerWidth() + (lis.outerWidth() / 4),
|
335
|
-
container = $('.clearing-container'),
|
336
|
-
up_count = Math.floor(container.outerWidth() / li_width) - 1,
|
337
|
-
shift_count = lis.length - up_count,
|
338
|
-
target_index = lis.index(target),
|
339
|
-
current_index = lis.index(current),
|
340
|
-
response;
|
341
|
-
|
342
|
-
defaults.up_count = up_count;
|
343
|
-
|
344
|
-
if (this.adjacent(defaults.prev_index, target_index)) {
|
345
|
-
if ((target_index > up_count) && target_index > defaults.prev_index) {
|
346
|
-
response = 'right';
|
347
|
-
} else if ((target_index > up_count - 1) && target_index <= defaults.prev_index) {
|
348
|
-
response = 'left';
|
349
|
-
} else {
|
350
|
-
response = false;
|
351
|
-
}
|
352
|
-
} else {
|
353
|
-
response = 'skip';
|
354
|
-
}
|
355
|
-
|
356
|
-
defaults.prev_index = target_index;
|
357
|
-
|
358
|
-
return response;
|
359
|
-
},
|
360
|
-
|
361
|
-
adjacent : function (current_index, target_index) {
|
362
|
-
if (target_index - 1 === current_index) {
|
363
|
-
return true;
|
364
|
-
} else if (target_index + 1 === current_index) {
|
365
|
-
return true;
|
366
|
-
} else if (target_index === current_index) {
|
367
|
-
return true;
|
368
|
-
}
|
369
|
-
|
370
|
-
return false;
|
371
|
-
},
|
372
|
-
|
373
|
-
center : function (target) {
|
374
|
-
target.css({
|
375
|
-
marginLeft : -(target.outerWidth() / 2),
|
376
|
-
marginTop : -(target.outerHeight() / 2)
|
377
|
-
});
|
378
|
-
},
|
379
|
-
|
380
|
-
outerHTML : function (el) {
|
381
|
-
// support FireFox < 11
|
382
|
-
return el.outerHTML || new XMLSerializer().serializeToString(el);
|
383
|
-
},
|
384
|
-
|
385
|
-
// experimental functionality for overwriting or extending
|
386
|
-
// clearing methods during initialization.
|
387
|
-
//
|
388
|
-
// ex $doc.foundationClearing({}, {
|
389
|
-
// shift : function (current, target, callback) {
|
390
|
-
// // modify arguments, etc.
|
391
|
-
// this._super('shift', [current, target, callback]);
|
392
|
-
// // do something else here.
|
393
|
-
// }
|
394
|
-
// });
|
395
|
-
|
396
|
-
extend : function (supers, extendMethods) {
|
397
|
-
$.each(supers, function (name, method) {
|
398
|
-
if (extendMethods.hasOwnProperty(name)) {
|
399
|
-
superMethods[name] = method;
|
400
|
-
}
|
401
|
-
});
|
402
|
-
|
403
|
-
$.extend(methods, extendMethods);
|
404
|
-
},
|
405
|
-
|
406
|
-
// you can call this._super('methodName', [args]) to call
|
407
|
-
// the original method and wrap it in your own code
|
408
|
-
|
409
|
-
_super : function (method, args) {
|
410
|
-
return superMethods[method].apply(this, args);
|
411
|
-
}
|
412
|
-
};
|
413
|
-
|
414
|
-
$.fn.foundationClearing = function (method) {
|
415
|
-
if (methods[method]) {
|
416
|
-
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
417
|
-
} else if (typeof method === 'object' || !method) {
|
418
|
-
return methods.init.apply(this, arguments);
|
419
|
-
} else {
|
420
|
-
$.error('Method ' + method + ' does not exist on jQuery.foundationClearing');
|
421
|
-
}
|
422
|
-
};
|
423
|
-
|
424
|
-
// jquery.imageready.js
|
425
|
-
// @weblinc, @jsantell, (c) 2012
|
426
|
-
|
427
|
-
(function( $ ) {
|
428
|
-
$.fn.is_good = function ( callback, userSettings ) {
|
429
|
-
var
|
430
|
-
options = $.extend( {}, $.fn.is_good.defaults, userSettings ),
|
431
|
-
$images = this.find( 'img' ).add( this.filter( 'img' ) ),
|
432
|
-
unloadedImages = $images.length;
|
433
|
-
|
434
|
-
function loaded () {
|
435
|
-
unloadedImages -= 1;
|
436
|
-
!unloadedImages && callback();
|
437
|
-
}
|
438
|
-
|
439
|
-
function bindLoad () {
|
440
|
-
this.one( 'load', loaded );
|
441
|
-
if ( $.browser.msie ) {
|
442
|
-
var
|
443
|
-
src = this.attr( 'src' ),
|
444
|
-
param = src.match( /\?/ ) ? '&' : '?';
|
445
|
-
param += options.cachePrefix + '=' + ( new Date() ).getTime();
|
446
|
-
this.attr( 'src', src + param );
|
447
|
-
}
|
448
|
-
}
|
449
|
-
|
450
|
-
return $images.each(function () {
|
451
|
-
var $this = $( this );
|
452
|
-
if ( !$this.attr( 'src' ) ) {
|
453
|
-
loaded();
|
454
|
-
return;
|
455
|
-
}
|
456
|
-
this.complete || this.readyState === 4 ?
|
457
|
-
loaded() :
|
458
|
-
bindLoad.call( $this );
|
459
|
-
});
|
460
|
-
};
|
461
|
-
|
462
|
-
$.fn.is_good.defaults = {
|
463
|
-
cachePrefix: 'random'
|
464
|
-
};
|
465
|
-
|
466
|
-
}(jQuery));
|
467
|
-
|
468
|
-
}(jQuery, this));
|