collagePlus-rails 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +1 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/jquery.collageCaption.js +143 -0
- data/app/assets/javascripts/jquery.collagePlus.js +401 -0
- data/app/assets/javascripts/jquery.removeWhitespace.js +13 -0
- data/app/assets/stylesheets/transitions.css +202 -0
- data/collagePlus-rails.gemspec +23 -0
- data/lib/collagePlus-rails.rb +8 -0
- data/lib/collagePlus-rails/version.rb +5 -0
- metadata +82 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA512:
|
|
3
|
+
data.tar.gz: bf664c0d55adf51d9e4a771adbe3819e6dd42abcac906d0c09ff78375d554362a03ef5bfc6a2450e98c0e839c8c268eef337169e00c2a1c6eae47230a17d323e
|
|
4
|
+
metadata.gz: c7d3021e9b06f9c723abf5e5005daa6774865c033995454bc95577702fa734bf82d1302cf631a158ce3ccad6407d055fdb0f4f109bc53476c02e153259c567ed
|
|
5
|
+
SHA1:
|
|
6
|
+
data.tar.gz: c5a57e9c7515e868272d5359be3747044ccf665a
|
|
7
|
+
metadata.gz: 81a4313b624de71725051cc8d4e65bcd7fc082b0
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2015 producao02
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# collagePlus-rails
|
data/Rakefile
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* jQuery collageCaption Plugin v0.1.1
|
|
4
|
+
* extra for collagePlus plugin
|
|
5
|
+
* https://github.com/ed-lea/jquery-collagePlus
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2012, Ed Lea twitter.com/ed_lea
|
|
8
|
+
*
|
|
9
|
+
* built for http://qiip.me
|
|
10
|
+
*
|
|
11
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
12
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
13
|
+
* http://www.opensource.org/licenses/GPL-2.0
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
;(function( $ ) {
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
$.fn.collageCaption = function( options ) {
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// Defaults
|
|
28
|
+
var defaults = {
|
|
29
|
+
// object that contains the images to collage
|
|
30
|
+
'images' : $(this).children(),
|
|
31
|
+
// colour for the caption background
|
|
32
|
+
'background' : "black",
|
|
33
|
+
// opacity for the caption background
|
|
34
|
+
'opacity' : "0.5",
|
|
35
|
+
// speed of the reveal / hide animation
|
|
36
|
+
'speed' : 100,
|
|
37
|
+
// css class for the caption wrapper
|
|
38
|
+
'cssClass' : "Caption"
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var settings = $.extend({}, defaults, options);
|
|
42
|
+
|
|
43
|
+
return this.each(function() {
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
*
|
|
47
|
+
* set up vars
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
// track row width
|
|
52
|
+
var row = 0,
|
|
53
|
+
// collect elements to be resized in current row
|
|
54
|
+
elements = [];
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
settings.images.each(
|
|
58
|
+
function(index){
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
*
|
|
62
|
+
* Cache selector
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
var $this = $(this);
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
*
|
|
69
|
+
* Do we need to do anything with captions
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
if (typeof $this.data("caption") == 'undefined'){
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
*
|
|
78
|
+
* The HTML to append to the containing element
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
var html = '<div class="' + settings.cssClass + '" style="position:relative;"><div class="Caption_Background" style="background-color:' +
|
|
82
|
+
settings.background + ';opacity:' +
|
|
83
|
+
settings.opacity + ';position:relative;top:0;"></div><div class="Caption_Content" style="position:relative;">' +
|
|
84
|
+
$this.data("caption") + '</div></div>';
|
|
85
|
+
$this.append(html);
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
*
|
|
89
|
+
* Cache the caption selectors
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
var $cap = $this.find("." + settings.cssClass),
|
|
93
|
+
$capbg = $this.find(".Caption_Background"),
|
|
94
|
+
$captxt = $this.find(".Caption_Content");
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
*
|
|
99
|
+
* Calculate the caption height
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
var h = $cap.height();
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/*
|
|
106
|
+
*
|
|
107
|
+
* Set the background for the caption
|
|
108
|
+
*
|
|
109
|
+
*/
|
|
110
|
+
$capbg.height(h);
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
*
|
|
114
|
+
* Overlap the caption content
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
$captxt.css("top", "-" + h + "px");
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
/*
|
|
121
|
+
*
|
|
122
|
+
* Bind the rollover action to the element
|
|
123
|
+
*
|
|
124
|
+
*/
|
|
125
|
+
$this.bind(
|
|
126
|
+
{
|
|
127
|
+
mouseenter: function(e) {
|
|
128
|
+
$cap.animate({ top: (-1 * h) }, { duration: settings.speed, queue: false });
|
|
129
|
+
},
|
|
130
|
+
mouseleave: function(e) {
|
|
131
|
+
$cap.animate({ top: 0 }, { duration: settings.speed, queue: false });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
return this;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
};
|
|
143
|
+
})( jQuery );
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* jQuery collagePlus Plugin v0.3.3
|
|
4
|
+
* https://github.com/ed-lea/jquery-collagePlus
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2012, Ed Lea twitter.com/ed_lea
|
|
7
|
+
*
|
|
8
|
+
* built for http://qiip.me
|
|
9
|
+
*
|
|
10
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
11
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
12
|
+
* http://www.opensource.org/licenses/GPL-2.0
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
;(function( $ ) {
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
$.fn.collagePlus = function( options ) {
|
|
24
|
+
|
|
25
|
+
return this.each(function() {
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
*
|
|
29
|
+
* set up vars
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
// track row width by adding images, padding and css borders etc
|
|
34
|
+
var row = 0,
|
|
35
|
+
// collect elements to be re-sized in current row
|
|
36
|
+
elements = [],
|
|
37
|
+
// track the number of rows generated
|
|
38
|
+
rownum = 1,
|
|
39
|
+
// needed for creating some additional defaults that are actually obtained
|
|
40
|
+
// from the dom, which maybe doesn't make them defaults ?!
|
|
41
|
+
$this = $(this);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
// width of the area the collage will be in
|
|
45
|
+
$.fn.collagePlus.defaults.albumWidth = $this.width();
|
|
46
|
+
// padding between the images. Using padding left as we assume padding is even all the way round
|
|
47
|
+
$.fn.collagePlus.defaults.padding = parseFloat( $this.css('padding-left') );
|
|
48
|
+
// object that contains the images to collage
|
|
49
|
+
$.fn.collagePlus.defaults.images = $this.children();
|
|
50
|
+
|
|
51
|
+
var settings = $.extend({}, $.fn.collagePlus.defaults, options);
|
|
52
|
+
|
|
53
|
+
settings.images.each(
|
|
54
|
+
function(index){
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
*
|
|
58
|
+
* Cache selector
|
|
59
|
+
* Even if first child is not an image the whole sizing is based on images
|
|
60
|
+
* so where we take measurements, we take them on the images
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
var $this = $(this),
|
|
64
|
+
$img = ($this.is("img")) ? $this : $(this).find("img");
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
*
|
|
70
|
+
* get the current image size. Get image size in this order
|
|
71
|
+
*
|
|
72
|
+
* 1. from <img> tag
|
|
73
|
+
* 2. from data set from initial calculation
|
|
74
|
+
* 3. after loading the image and checking it's actual size
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
var w = (typeof $img.data("width") != 'undefined') ? $img.data("width") : $img.width(),
|
|
78
|
+
h = (typeof $img.data("height") != 'undefined') ? $img.data("height") : $img.height();
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
*
|
|
84
|
+
* Get any current additional properties that may affect the width or height
|
|
85
|
+
* like css borders for example
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
var imgParams = getImgProperty($img);
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
*
|
|
93
|
+
* store the original size for resize events
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
$img.data("width", w);
|
|
97
|
+
$img.data("height", h);
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
*
|
|
103
|
+
* calculate the w/h based on target height
|
|
104
|
+
* this is our ideal size, but later we'll resize to make it fit
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
var nw = Math.ceil(w/h*settings.targetHeight),
|
|
108
|
+
nh = Math.ceil(settings.targetHeight);
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
*
|
|
112
|
+
* Keep track of which images are in our row so far
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
elements.push([this, nw, nh, imgParams['w'], imgParams['h']]);
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
*
|
|
119
|
+
* calculate the width of the element including extra properties
|
|
120
|
+
* like css borders
|
|
121
|
+
*
|
|
122
|
+
*/
|
|
123
|
+
row += nw + imgParams['w'] + settings.padding;
|
|
124
|
+
|
|
125
|
+
/*
|
|
126
|
+
*
|
|
127
|
+
* if the current row width is wider than the parent container
|
|
128
|
+
* it's time to make a row out of our images
|
|
129
|
+
*
|
|
130
|
+
*/
|
|
131
|
+
if( row > settings.albumWidth && elements.length != 0 ){
|
|
132
|
+
|
|
133
|
+
// call the method that calculates the final image sizes
|
|
134
|
+
// remove one set of padding as it's not needed for the last image in the row
|
|
135
|
+
resizeRow(elements, (row - settings.padding), settings, rownum);
|
|
136
|
+
|
|
137
|
+
// reset our row
|
|
138
|
+
delete row;
|
|
139
|
+
delete elements;
|
|
140
|
+
row = 0;
|
|
141
|
+
elements = [];
|
|
142
|
+
rownum += 1;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
*
|
|
148
|
+
* if the images left are not enough to make a row
|
|
149
|
+
* then we'll force them to make one anyway
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
if ( settings.images.length-1 == index && elements.length != 0){
|
|
153
|
+
resizeRow(elements, row, settings, rownum);
|
|
154
|
+
|
|
155
|
+
// reset our row
|
|
156
|
+
delete row;
|
|
157
|
+
delete elements;
|
|
158
|
+
row = 0;
|
|
159
|
+
elements = [];
|
|
160
|
+
rownum += 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
function resizeRow( obj, row, settings, rownum) {
|
|
168
|
+
|
|
169
|
+
/*
|
|
170
|
+
*
|
|
171
|
+
* How much bigger is this row than the available space?
|
|
172
|
+
* At this point we have adjusted the images height to fit our target height
|
|
173
|
+
* so the image size will already be different from the original.
|
|
174
|
+
* The resizing we're doing here is to adjust it to the album width.
|
|
175
|
+
*
|
|
176
|
+
* We also need to change the album width (basically available space) by
|
|
177
|
+
* the amount of padding and css borders for the images otherwise
|
|
178
|
+
* this will skew the result.
|
|
179
|
+
*
|
|
180
|
+
* This is because padding and borders remain at a fixed size and we only
|
|
181
|
+
* need to scale the images.
|
|
182
|
+
*
|
|
183
|
+
*/
|
|
184
|
+
var imageExtras = (settings.padding * (obj.length - 1)) + (obj.length * obj[0][3]),
|
|
185
|
+
albumWidthAdjusted = settings.albumWidth - imageExtras,
|
|
186
|
+
overPercent = albumWidthAdjusted / (row - imageExtras),
|
|
187
|
+
// start tracking our width with know values that will make up the total width
|
|
188
|
+
// like borders and padding
|
|
189
|
+
trackWidth = imageExtras,
|
|
190
|
+
// guess whether this is the last row in a set by checking if the width is less
|
|
191
|
+
// than the parent width.
|
|
192
|
+
lastRow = (row < settings.albumWidth ? true : false);
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* Resize the images by the above % so that they'll fit in the album space
|
|
200
|
+
*/
|
|
201
|
+
for (var i = 0; i < obj.length; i++) {
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
var $obj = $(obj[i][0]),
|
|
206
|
+
fw = Math.floor(obj[i][1] * overPercent),
|
|
207
|
+
fh = Math.floor(obj[i][2] * overPercent),
|
|
208
|
+
// if the element is the last in the row,
|
|
209
|
+
// don't apply right hand padding (this is our flag for later)
|
|
210
|
+
isNotLast = !!(( i < obj.length - 1 ));
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
* Checking if the user wants to not stretch the images of the last row to fit the
|
|
214
|
+
* parent element size
|
|
215
|
+
*/
|
|
216
|
+
if(settings.allowPartialLastRow === true && lastRow === true){
|
|
217
|
+
fw = obj[i][1];
|
|
218
|
+
fh = obj[i][2];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
*
|
|
224
|
+
* Because we use % to calculate the widths, it's possible that they are
|
|
225
|
+
* a few pixels out in which case we need to track this and adjust the
|
|
226
|
+
* last image accordingly
|
|
227
|
+
*
|
|
228
|
+
*/
|
|
229
|
+
trackWidth += fw;
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
/*
|
|
233
|
+
*
|
|
234
|
+
* here we check if the combined images are exactly the width
|
|
235
|
+
* of the parent. If not then we add a few pixels on to make
|
|
236
|
+
* up the difference.
|
|
237
|
+
*
|
|
238
|
+
* This will alter the aspect ratio of the image slightly, but
|
|
239
|
+
* by a noticable amount.
|
|
240
|
+
*
|
|
241
|
+
* If the user doesn't want full width last row, we check for that here
|
|
242
|
+
*
|
|
243
|
+
*/
|
|
244
|
+
if(!isNotLast && trackWidth < settings.albumWidth){
|
|
245
|
+
if(settings.allowPartialLastRow === true && lastRow === true){
|
|
246
|
+
fw = fw;
|
|
247
|
+
}else{
|
|
248
|
+
fw = fw + (settings.albumWidth - trackWidth);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
fw--;
|
|
253
|
+
|
|
254
|
+
/*
|
|
255
|
+
*
|
|
256
|
+
* We'll be doing a few things to the image so here we cache the image selector
|
|
257
|
+
*
|
|
258
|
+
*
|
|
259
|
+
*/
|
|
260
|
+
var $img = ( $obj.is("img") ) ? $obj : $obj.find("img");
|
|
261
|
+
|
|
262
|
+
/*
|
|
263
|
+
*
|
|
264
|
+
* Set the width of the image and parent element
|
|
265
|
+
* if the resized element is not an image, we apply it to the child image also
|
|
266
|
+
*
|
|
267
|
+
* We need to check if it's an image as the css borders are only measured on
|
|
268
|
+
* images. If the parent is a div, we need make the contained image smaller
|
|
269
|
+
* to accommodate the css image borders.
|
|
270
|
+
*
|
|
271
|
+
*/
|
|
272
|
+
$img.width(fw);
|
|
273
|
+
if( !$obj.is("img") ){
|
|
274
|
+
$obj.width(fw + obj[i][3]);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
/*
|
|
279
|
+
*
|
|
280
|
+
* Set the height of the image
|
|
281
|
+
* if the resized element is not an image, we apply it to the child image also
|
|
282
|
+
*
|
|
283
|
+
*/
|
|
284
|
+
$img.height(fh);
|
|
285
|
+
if( !$obj.is("img") ){
|
|
286
|
+
$obj.height(fh + obj[i][4]);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
*
|
|
292
|
+
* Apply the css extras like padding
|
|
293
|
+
*
|
|
294
|
+
*/
|
|
295
|
+
applyModifications($obj, isNotLast, settings);
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
/*
|
|
299
|
+
*
|
|
300
|
+
* Assign the effect to show the image
|
|
301
|
+
* Default effect is using jquery and not CSS3 to support more browsers
|
|
302
|
+
* Wait until the image is loaded to do this
|
|
303
|
+
*
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
$img
|
|
307
|
+
.one('load', function (target) {
|
|
308
|
+
return function(){
|
|
309
|
+
if( settings.effect == 'default'){
|
|
310
|
+
target.animate({opacity: '1'},{duration: settings.fadeSpeed});
|
|
311
|
+
} else {
|
|
312
|
+
if(settings.direction == 'vertical'){
|
|
313
|
+
var sequence = (rownum <= 10 ? rownum : 10);
|
|
314
|
+
} else {
|
|
315
|
+
var sequence = (i <= 9 ? i+1 : 10);
|
|
316
|
+
}
|
|
317
|
+
/* Remove old classes with the "effect-" name */
|
|
318
|
+
target.removeClass(function (index, css) {
|
|
319
|
+
return (css.match(/\beffect-\S+/g) || []).join(' ');
|
|
320
|
+
});
|
|
321
|
+
target.addClass(settings.effect);
|
|
322
|
+
target.addClass("effect-duration-" + sequence);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}($obj))
|
|
326
|
+
/*
|
|
327
|
+
* fix for cached or loaded images
|
|
328
|
+
* For example if images are loaded in a "window.load" call we need to trigger
|
|
329
|
+
* the load call again
|
|
330
|
+
*/
|
|
331
|
+
.each(function() {
|
|
332
|
+
if(this.complete) $(this).trigger('load');
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/*
|
|
344
|
+
*
|
|
345
|
+
* This private function applies the required css to space the image gallery
|
|
346
|
+
* It applies it to the parent element so if an image is wrapped in a <div> then
|
|
347
|
+
* the css is applied to the <div>
|
|
348
|
+
*
|
|
349
|
+
*/
|
|
350
|
+
function applyModifications($obj, isNotLast, settings) {
|
|
351
|
+
var css = {
|
|
352
|
+
// Applying padding to element for the grid gap effect
|
|
353
|
+
'margin-bottom' : settings.padding + "px",
|
|
354
|
+
'margin-right' : (isNotLast) ? settings.padding + "px" : "0px",
|
|
355
|
+
// Set it to an inline-block by default so that it doesn't break the row
|
|
356
|
+
'display' : settings.display,
|
|
357
|
+
// Set vertical alignment otherwise you get 4px extra padding
|
|
358
|
+
'vertical-align' : "bottom",
|
|
359
|
+
// Hide the overflow to hide the caption
|
|
360
|
+
'overflow' : "hidden"
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
return $obj.css(css);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
/*
|
|
368
|
+
*
|
|
369
|
+
* This private function calculates any extras like padding, border associated
|
|
370
|
+
* with the image that will impact on the width calculations
|
|
371
|
+
*
|
|
372
|
+
*/
|
|
373
|
+
function getImgProperty( img )
|
|
374
|
+
{
|
|
375
|
+
$img = $(img);
|
|
376
|
+
var params = new Array();
|
|
377
|
+
params["w"] = (parseFloat($img.css("border-left-width")) + parseFloat($img.css("border-right-width")));
|
|
378
|
+
params["h"] = (parseFloat($img.css("border-top-width")) + parseFloat($img.css("border-bottom-width")));
|
|
379
|
+
return params;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
$.fn.collagePlus.defaults = {
|
|
385
|
+
// the ideal height you want your images to be
|
|
386
|
+
'targetHeight' : 400,
|
|
387
|
+
// how quickly you want images to fade in once ready can be in ms, "slow" or "fast"
|
|
388
|
+
'fadeSpeed' : "fast",
|
|
389
|
+
// how the resized block should be displayed. inline-block by default so that it doesn't break the row
|
|
390
|
+
'display' : "inline-block",
|
|
391
|
+
// which effect you want to use for revealing the images (note CSS3 browsers only),
|
|
392
|
+
'effect' : 'default',
|
|
393
|
+
// effect delays can either be applied per row to give the impression of descending appearance
|
|
394
|
+
// or horizontally, so more like a flock of birds changing direction
|
|
395
|
+
'direction' : 'vertical',
|
|
396
|
+
// Sometimes there is just one image on the last row and it gets blown up to a huge size to fit the
|
|
397
|
+
// parent div width. To stop this behaviour, set this to true
|
|
398
|
+
'allowPartialLastRow' : false
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
})( jQuery );
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
A library of transitions for revealing the loaded images
|
|
4
|
+
(Heavily) Inspired by http://tympanus.net/codrops/2013/07/02/loading-effects-for-grid-items-with-css-animations/
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.effect-parent {
|
|
9
|
+
-webkit-perspective: 1300px;
|
|
10
|
+
-moz-perspective: 1300px;
|
|
11
|
+
perspective: 1300px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/* EFFECT 1 */
|
|
16
|
+
.effect-1 {
|
|
17
|
+
-webkit-transform-style: preserve-3d;
|
|
18
|
+
-moz-transform-style: preserve-3d;
|
|
19
|
+
transform-style: preserve-3d;
|
|
20
|
+
-webkit-transform-origin: 50% 50% -300px;
|
|
21
|
+
-moz-transform-origin: 50% 50% -300px;
|
|
22
|
+
transform-origin: 50% 50% -300px;
|
|
23
|
+
-webkit-transform: rotateX(-180deg);
|
|
24
|
+
-moz-transform: rotateX(-180deg);
|
|
25
|
+
transform: rotateX(-180deg);
|
|
26
|
+
-webkit-animation: fly ease-in-out forwards;
|
|
27
|
+
-moz-animation: fly ease-in-out forwards;
|
|
28
|
+
animation: fly ease-in-out forwards;
|
|
29
|
+
}
|
|
30
|
+
@-webkit-keyframes fly {
|
|
31
|
+
100% { -webkit-transform: rotateX(0deg); opacity: 1; -webkit-transform-origin:50% 50% 0; }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@-moz-keyframes fly {
|
|
35
|
+
100% { -moz-transform: rotateX(0deg); opacity: 1; -moz-transform-origin:50% 50% 0; }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@keyframes fly {
|
|
39
|
+
100% { transform: rotateX(0deg); opacity: 1; transform-origin:50% 50% 0; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/* EFFECT 2 */
|
|
45
|
+
.effect-2 {
|
|
46
|
+
-webkit-transform: translateY(200px);
|
|
47
|
+
-moz-transform: translateY(200px);
|
|
48
|
+
transform: translateY(200px);
|
|
49
|
+
-webkit-animation: moveUp ease forwards;
|
|
50
|
+
-moz-animation: moveUp ease forwards;
|
|
51
|
+
animation: moveUp ease forwards;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@-webkit-keyframes moveUp {
|
|
55
|
+
to { -webkit-transform: translateY(0); opacity: 1; }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@-moz-keyframes moveUp {
|
|
59
|
+
to { -moz-transform: translateY(0); opacity: 1; }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@keyframes moveUp {
|
|
63
|
+
to { transform: translateY(0); opacity: 1; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/* EFFECT 3 */
|
|
68
|
+
.effect-3 {
|
|
69
|
+
-webkit-transform-style: preserve-3d;
|
|
70
|
+
-moz-transform-style: preserve-3d;
|
|
71
|
+
transform-style: preserve-3d;
|
|
72
|
+
-webkit-transform: translateZ(400px) translateY(300px) rotateX(-90deg);
|
|
73
|
+
-moz-transform: translateZ(400px) translateY(300px) rotateX(-90deg);
|
|
74
|
+
transform: translateZ(400px) translateY(300px) rotateX(-90deg);
|
|
75
|
+
-webkit-animation: fallPerspective ease-in-out forwards;
|
|
76
|
+
-moz-animation: fallPerspective ease-in-out forwards;
|
|
77
|
+
animation: fallPerspective ease-in-out forwards;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@-webkit-keyframes fallPerspective {
|
|
81
|
+
100% { -webkit-transform: translateZ(0px) translateY(0px) rotateX(0deg); opacity: 1; }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@-moz-keyframes fallPerspective {
|
|
85
|
+
100% { -moz-transform: translateZ(0px) translateY(0px) rotateX(0deg); opacity: 1; }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@keyframes fallPerspective {
|
|
89
|
+
100% { transform: translateZ(0px) translateY(0px) rotateX(0deg); opacity: 1; }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
/* EFFECT 4 */
|
|
94
|
+
.effect-4 {
|
|
95
|
+
-webkit-transform-style: preserve-3d;
|
|
96
|
+
-moz-transform-style: preserve-3d;
|
|
97
|
+
transform-style: preserve-3d;
|
|
98
|
+
-webkit-transform-origin: 0% 0%;
|
|
99
|
+
-moz-transform-origin: 0% 0%;
|
|
100
|
+
transform-origin: 0% 0%;
|
|
101
|
+
-webkit-transform: rotateX(-80deg);
|
|
102
|
+
-moz-transform: rotateX(-80deg);
|
|
103
|
+
transform: rotateX(-80deg);
|
|
104
|
+
-webkit-animation: flip ease-in-out forwards;
|
|
105
|
+
-moz-animation: flip ease-in-out forwards;
|
|
106
|
+
animation: flip ease-in-out forwards;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@-webkit-keyframes flip {
|
|
110
|
+
100% { -webkit-transform: rotateX(0deg); opacity: 1; }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@-moz-keyframes flip {
|
|
114
|
+
100% { -moz-transform: rotateX(0deg); opacity: 1; }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes flip {
|
|
118
|
+
100% { transform: rotateX(0deg); opacity: 1; }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/* EFFECT 5 */
|
|
123
|
+
.effect-5 {
|
|
124
|
+
-webkit-transform-style: preserve-3d;
|
|
125
|
+
-moz-transform-style: preserve-3d;
|
|
126
|
+
transform-style: preserve-3d;
|
|
127
|
+
-webkit-transform: rotateY(-180deg);
|
|
128
|
+
-moz-transform: rotateY(-180deg);
|
|
129
|
+
transform: rotateY(-180deg);
|
|
130
|
+
-webkit-animation: moveUp ease-in-out forwards;
|
|
131
|
+
-moz-animation: moveUp ease-in-out forwards;
|
|
132
|
+
animation: moveUp ease-in-out forwards;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
/* EFFECT 6 */
|
|
137
|
+
.effect-6 {
|
|
138
|
+
|
|
139
|
+
-webkit-transform: scale(0.638) translate(-179px);
|
|
140
|
+
-moz-transform: scale(0.638) translate(-179px);
|
|
141
|
+
transform: scale(0.638) translate(-179px);
|
|
142
|
+
|
|
143
|
+
-webkit-animation: moveUp ease-in-out forwards;
|
|
144
|
+
-moz-animation: moveUp ease-in-out forwards;
|
|
145
|
+
animation: moveUp ease-in-out forwards;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
/* Universal durations */
|
|
153
|
+
.effect-duration-1{
|
|
154
|
+
-webkit-animation-duration: .4s;
|
|
155
|
+
-moz-animation-duration: .4s;
|
|
156
|
+
animation-duration: .4s;
|
|
157
|
+
}
|
|
158
|
+
.effect-duration-2{
|
|
159
|
+
-webkit-animation-duration: .5s;
|
|
160
|
+
-moz-animation-duration: .5s;
|
|
161
|
+
animation-duration: .5s;
|
|
162
|
+
}
|
|
163
|
+
.effect-duration-3{
|
|
164
|
+
-webkit-animation-duration: .6s;
|
|
165
|
+
-moz-animation-duration: .6s;
|
|
166
|
+
animation-duration: .6s;
|
|
167
|
+
}
|
|
168
|
+
.effect-duration-4{
|
|
169
|
+
-webkit-animation-duration: .7s;
|
|
170
|
+
-moz-animation-duration: .7s;
|
|
171
|
+
animation-duration: .7s;
|
|
172
|
+
}
|
|
173
|
+
.effect-duration-5{
|
|
174
|
+
-webkit-animation-duration: .8s;
|
|
175
|
+
-moz-animation-duration: .8s;
|
|
176
|
+
animation-duration: .8s;
|
|
177
|
+
}
|
|
178
|
+
.effect-duration-6{
|
|
179
|
+
-webkit-animation-duration: .9s;
|
|
180
|
+
-moz-animation-duration: .9s;
|
|
181
|
+
animation-duration: .9s;
|
|
182
|
+
}
|
|
183
|
+
.effect-duration-7{
|
|
184
|
+
-webkit-animation-duration: .95s;
|
|
185
|
+
-moz-animation-duration: .95s;
|
|
186
|
+
animation-duration: .95s;
|
|
187
|
+
}
|
|
188
|
+
.effect-duration-8{
|
|
189
|
+
-webkit-animation-duration: 1s;
|
|
190
|
+
-moz-animation-duration: 1s;
|
|
191
|
+
animation-duration: 1s;
|
|
192
|
+
}
|
|
193
|
+
.effect-duration-9{
|
|
194
|
+
-webkit-animation-duration: 1.05s;
|
|
195
|
+
-moz-animation-duration: 1.05s;
|
|
196
|
+
animation-duration: 1.05s;
|
|
197
|
+
}
|
|
198
|
+
.effect-duration-10{
|
|
199
|
+
-webkit-animation-duration: 1.1s;
|
|
200
|
+
-moz-animation-duration: 1.1s;
|
|
201
|
+
animation-duration: 1.1s;
|
|
202
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'collagePlus-rails/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "collagePlus-rails"
|
|
8
|
+
spec.version = CollagePlus::Rails::VERSION
|
|
9
|
+
spec.authors = ["TwoWeb"]
|
|
10
|
+
spec.email = ["dev@twoweb.com.br"]
|
|
11
|
+
spec.summary = "gem jQuery CollagePlus"
|
|
12
|
+
spec.description = "An image gallery plugin for jQuery"
|
|
13
|
+
spec.homepage = "https://github.com/twoweb/collagePlus-rails"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: collagePlus-rails
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- TwoWeb
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2015-07-11 00:00:00 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: bundler
|
|
16
|
+
prerelease: false
|
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: "1.7"
|
|
22
|
+
type: :development
|
|
23
|
+
version_requirements: *id001
|
|
24
|
+
- !ruby/object:Gem::Dependency
|
|
25
|
+
name: rake
|
|
26
|
+
prerelease: false
|
|
27
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
28
|
+
requirements:
|
|
29
|
+
- - ~>
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: "10.0"
|
|
32
|
+
type: :development
|
|
33
|
+
version_requirements: *id002
|
|
34
|
+
description: An image gallery plugin for jQuery
|
|
35
|
+
email:
|
|
36
|
+
- dev@twoweb.com.br
|
|
37
|
+
executables: []
|
|
38
|
+
|
|
39
|
+
extensions: []
|
|
40
|
+
|
|
41
|
+
extra_rdoc_files: []
|
|
42
|
+
|
|
43
|
+
files:
|
|
44
|
+
- Gemfile
|
|
45
|
+
- LICENSE.txt
|
|
46
|
+
- README.md
|
|
47
|
+
- Rakefile
|
|
48
|
+
- app/assets/javascripts/jquery.collageCaption.js
|
|
49
|
+
- app/assets/javascripts/jquery.collagePlus.js
|
|
50
|
+
- app/assets/javascripts/jquery.removeWhitespace.js
|
|
51
|
+
- app/assets/stylesheets/transitions.css
|
|
52
|
+
- collagePlus-rails.gemspec
|
|
53
|
+
- lib/collagePlus-rails.rb
|
|
54
|
+
- lib/collagePlus-rails/version.rb
|
|
55
|
+
homepage: https://github.com/twoweb/collagePlus-rails
|
|
56
|
+
licenses:
|
|
57
|
+
- MIT
|
|
58
|
+
metadata: {}
|
|
59
|
+
|
|
60
|
+
post_install_message:
|
|
61
|
+
rdoc_options: []
|
|
62
|
+
|
|
63
|
+
require_paths:
|
|
64
|
+
- lib
|
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- &id003
|
|
68
|
+
- ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: "0"
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- *id003
|
|
74
|
+
requirements: []
|
|
75
|
+
|
|
76
|
+
rubyforge_project:
|
|
77
|
+
rubygems_version: 2.0.14
|
|
78
|
+
signing_key:
|
|
79
|
+
specification_version: 4
|
|
80
|
+
summary: gem jQuery CollagePlus
|
|
81
|
+
test_files: []
|
|
82
|
+
|