social_stream-documents 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/social_stream-documents.js +1 -1
- data/app/views/pictures/_picture.html.erb +3 -1
- data/lib/social_stream/documents/version.rb +1 -1
- data/social_stream-documents.gemspec +1 -1
- data/vendor/assets/javascripts/jquery.lightbox-with-resize-plugin.js +533 -0
- metadata +8 -8
- data/vendor/assets/javascripts/jquery.lightbox.min.js +0 -42
@@ -30,10 +30,12 @@
|
|
30
30
|
<%= javascript_tag do %>
|
31
31
|
$(document).ready(function() {
|
32
32
|
$('.picture_thumbnail_show a').lightBox({
|
33
|
+
maxHeight: 920,
|
34
|
+
maxWidth: 920,
|
33
35
|
imageLoading: 'assets/lightbox-ico-loading.gif',
|
34
36
|
imageBtnClose: 'assets/lightbox-btn-close.gif',
|
35
37
|
imageBtnPrev: 'assets/lightbox-btn-prev.gif',
|
36
38
|
imageBtnNext: 'assets/lightbox-btn-next.gif',
|
37
|
-
imageBlank: 'assets/lightbox-blank.gif'});
|
39
|
+
imageBlank: 'assets/lightbox-blank.gif'});
|
38
40
|
})
|
39
41
|
<% end %>
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.9.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.9.20')
|
16
16
|
s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
|
17
17
|
s.add_runtime_dependency('paperclip','2.3.11')
|
18
18
|
s.add_runtime_dependency('delayed_paperclip','>= 0.7.2')
|
@@ -0,0 +1,533 @@
|
|
1
|
+
/**
|
2
|
+
* jQuery lightBox plugin
|
3
|
+
* This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
|
4
|
+
* and adapted to me for use like a plugin from jQuery.
|
5
|
+
* @name jquery-lightbox-0.5.js
|
6
|
+
* @author Leandro Vieira Pinho - http://leandrovieira.com
|
7
|
+
* @version 0.5
|
8
|
+
* @date April 11, 2008
|
9
|
+
* @category jQuery plugin
|
10
|
+
* @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
|
11
|
+
* @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
|
12
|
+
* @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
|
13
|
+
*/
|
14
|
+
|
15
|
+
// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias
|
16
|
+
(function($) {
|
17
|
+
/**
|
18
|
+
* $ is an alias to jQuery object
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
$.fn.lightBox = function(settings) {
|
22
|
+
// Settings to configure the jQuery lightBox plugin how you like
|
23
|
+
settings = jQuery.extend({
|
24
|
+
maxWidth : null,
|
25
|
+
maxHeight : null,
|
26
|
+
// Configuration related to overlay
|
27
|
+
overlayBgColor : '#000', // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
|
28
|
+
overlayOpacity : 0.8, // (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
|
29
|
+
// Configuration related to navigation
|
30
|
+
fixedNavigation : false, // (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
|
31
|
+
// Configuration related to images
|
32
|
+
imageLoading : 'images/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon
|
33
|
+
imageBtnPrev : 'images/lightbox-btn-prev.gif', // (string) Path and the name of the prev button image
|
34
|
+
imageBtnNext : 'images/lightbox-btn-next.gif', // (string) Path and the name of the next button image
|
35
|
+
imageBtnClose : 'images/lightbox-btn-close.gif', // (string) Path and the name of the close btn
|
36
|
+
imageBlank : 'images/lightbox-blank.gif', // (string) Path and the name of a blank image (one pixel)
|
37
|
+
// Configuration related to container image box
|
38
|
+
containerBorderSize : 10, // (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
|
39
|
+
containerResizeSpeed : 400, // (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
|
40
|
+
// Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
|
41
|
+
txtImage : 'Image', // (string) Specify text "Image"
|
42
|
+
txtOf : 'of', // (string) Specify text "of"
|
43
|
+
// Configuration related to keyboard navigation
|
44
|
+
keyToClose : 'c', // (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to.
|
45
|
+
keyToPrev : 'p', // (string) (p = previous) Letter to show the previous image
|
46
|
+
keyToNext : 'n', // (string) (n = next) Letter to show the next image.
|
47
|
+
// Don�t alter these variables in any way
|
48
|
+
imageArray : [],
|
49
|
+
activeImage : 0
|
50
|
+
}, settings);
|
51
|
+
// Caching the jQuery object with all elements matched
|
52
|
+
var jQueryMatchedObj = this;
|
53
|
+
// This, in this context, refer to jQuery object
|
54
|
+
/**
|
55
|
+
* Initializing the plugin calling the start function
|
56
|
+
*
|
57
|
+
* @return boolean false
|
58
|
+
*/
|
59
|
+
function _initialize() {
|
60
|
+
_start(this, jQueryMatchedObj);
|
61
|
+
// This, in this context, refer to object (link) which the user have clicked
|
62
|
+
return false;
|
63
|
+
// Avoid the browser following the link
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Start the jQuery lightBox plugin
|
68
|
+
*
|
69
|
+
* @param object objClicked The object (link) whick the user have clicked
|
70
|
+
* @param object jQueryMatchedObj The jQuery object with all elements matched
|
71
|
+
*/
|
72
|
+
function _start(objClicked, jQueryMatchedObj) {
|
73
|
+
// Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
|
74
|
+
$('embed, object, select').css({
|
75
|
+
'visibility' : 'hidden'
|
76
|
+
});
|
77
|
+
// Call the function to create the markup structure; style some elements; assign events in some elements.
|
78
|
+
_set_interface();
|
79
|
+
// Unset total images in imageArray
|
80
|
+
settings.imageArray.length = 0;
|
81
|
+
// Unset image active information
|
82
|
+
settings.activeImage = 0;
|
83
|
+
// We have an image set? Or just an image? Let�s see it.
|
84
|
+
if(jQueryMatchedObj.length == 1) {
|
85
|
+
settings.imageArray.push(new Array(objClicked.getAttribute('href'), objClicked.getAttribute('title')));
|
86
|
+
} else {
|
87
|
+
// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references
|
88
|
+
for(var i = 0; i < jQueryMatchedObj.length; i++) {
|
89
|
+
settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'), jQueryMatchedObj[i].getAttribute('title')));
|
90
|
+
}
|
91
|
+
}
|
92
|
+
while(settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href')) {
|
93
|
+
settings.activeImage++;
|
94
|
+
}
|
95
|
+
// Call the function that prepares image exibition
|
96
|
+
_set_image_to_view();
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Create the jQuery lightBox plugin interface
|
101
|
+
*
|
102
|
+
* The HTML markup will be like that:
|
103
|
+
<div id="jquery-overlay"></div>
|
104
|
+
<div id="jquery-lightbox">
|
105
|
+
<div id="lightbox-container-image-box">
|
106
|
+
<div id="lightbox-container-image">
|
107
|
+
<img src="../fotos/XX.jpg" id="lightbox-image">
|
108
|
+
<div id="lightbox-nav">
|
109
|
+
<a href="#" id="lightbox-nav-btnPrev"></a>
|
110
|
+
<a href="#" id="lightbox-nav-btnNext"></a>
|
111
|
+
</div>
|
112
|
+
<div id="lightbox-loading">
|
113
|
+
<a href="#" id="lightbox-loading-link">
|
114
|
+
<img src="../images/lightbox-ico-loading.gif">
|
115
|
+
</a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
<div id="lightbox-container-image-data-box">
|
120
|
+
<div id="lightbox-container-image-data">
|
121
|
+
<div id="lightbox-image-details">
|
122
|
+
<span id="lightbox-image-details-caption"></span>
|
123
|
+
<span id="lightbox-image-details-currentNumber"></span>
|
124
|
+
</div>
|
125
|
+
<div id="lightbox-secNav">
|
126
|
+
<a href="#" id="lightbox-secNav-btnClose">
|
127
|
+
<img src="../images/lightbox-btn-close.gif">
|
128
|
+
</a>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
*
|
134
|
+
*/
|
135
|
+
function _set_interface() {
|
136
|
+
// Apply the HTML markup into body tag
|
137
|
+
$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');
|
138
|
+
// Get page sizes
|
139
|
+
var arrPageSizes = ___getPageSize();
|
140
|
+
// Style overlay and show it
|
141
|
+
$('#jquery-overlay').css({
|
142
|
+
backgroundColor : settings.overlayBgColor,
|
143
|
+
opacity : settings.overlayOpacity,
|
144
|
+
width : arrPageSizes[0],
|
145
|
+
height : arrPageSizes[1]
|
146
|
+
}).fadeIn();
|
147
|
+
// Get page scroll
|
148
|
+
var arrPageScroll = ___getPageScroll();
|
149
|
+
// Calculate top and left offset for the jquery-lightbox div object and show it
|
150
|
+
$('#jquery-lightbox').css({
|
151
|
+
top : arrPageScroll[1] + (arrPageSizes[3] / 10),
|
152
|
+
left : arrPageScroll[0]
|
153
|
+
}).show();
|
154
|
+
// Assigning click events in elements to close overlay
|
155
|
+
$('#jquery-overlay,#jquery-lightbox').click(function() {
|
156
|
+
_finish();
|
157
|
+
});
|
158
|
+
// Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects
|
159
|
+
$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
|
160
|
+
_finish();
|
161
|
+
return false;
|
162
|
+
});
|
163
|
+
// If window was resized, calculate the new overlay dimensions
|
164
|
+
$(window).resize(function() {
|
165
|
+
// Get page sizes
|
166
|
+
var arrPageSizes = ___getPageSize();
|
167
|
+
// Style overlay and show it
|
168
|
+
$('#jquery-overlay').css({
|
169
|
+
width : arrPageSizes[0],
|
170
|
+
height : arrPageSizes[1]
|
171
|
+
});
|
172
|
+
// Get page scroll
|
173
|
+
var arrPageScroll = ___getPageScroll();
|
174
|
+
// Calculate top and left offset for the jquery-lightbox div object and show it
|
175
|
+
$('#jquery-lightbox').css({
|
176
|
+
top : arrPageScroll[1] + (arrPageSizes[3] / 10),
|
177
|
+
left : arrPageScroll[0]
|
178
|
+
});
|
179
|
+
});
|
180
|
+
}
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Prepares image exibition; doing a image�s preloader to calculate it�s size
|
184
|
+
*
|
185
|
+
*/
|
186
|
+
function _set_image_to_view() {// show the loading
|
187
|
+
// Show the loading
|
188
|
+
$('#lightbox-loading').show();
|
189
|
+
if(settings.fixedNavigation) {
|
190
|
+
$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
|
191
|
+
} else {
|
192
|
+
// Hide some elements
|
193
|
+
$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
|
194
|
+
}
|
195
|
+
// Image preload process
|
196
|
+
var objImagePreloader = new Image();
|
197
|
+
objImagePreloader.onload = function() {
|
198
|
+
$('#lightbox-image').attr('src', settings.imageArray[settings.activeImage][0]);
|
199
|
+
// Perfomance an effect in the image container resizing it
|
200
|
+
_resize_container_image_box(objImagePreloader.width, objImagePreloader.height);
|
201
|
+
// clear onLoad, IE behaves irratically with animated gifs otherwise
|
202
|
+
objImagePreloader.onload = function() {
|
203
|
+
};
|
204
|
+
};
|
205
|
+
objImagePreloader.src = settings.imageArray[settings.activeImage][0];
|
206
|
+
};
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Perfomance an effect in the image container resizing it
|
210
|
+
*
|
211
|
+
* @param integer intImageWidth The image�s width that will be showed
|
212
|
+
* @param integer intImageHeight The image�s height that will be showed
|
213
|
+
*/
|
214
|
+
function _resize_container_image_box(intImageWidth, intImageHeight) {
|
215
|
+
//rescale if necessary
|
216
|
+
if((settings.maxWidth != null && settings.maxHeight != null) && (intImageWidth > settings.maxWidth || intImageHeight > settings.maxHeight)) {
|
217
|
+
var isWider = intImageWidth > intImageHeight;
|
218
|
+
//is the image wide or tall?
|
219
|
+
var scale = isWider ? settings.maxWidth / intImageWidth : settings.maxHeight / intImageHeight;
|
220
|
+
intImageWidth = intImageWidth * scale;
|
221
|
+
intImageHeight = intImageHeight * scale;
|
222
|
+
}
|
223
|
+
|
224
|
+
$('#lightbox-image').height(intImageHeight);
|
225
|
+
$('#lightbox-image').width(intImageWidth);
|
226
|
+
// Get current width and height
|
227
|
+
var intCurrentWidth = $('#lightbox-container-image-box').width();
|
228
|
+
var intCurrentHeight = $('#lightbox-container-image-box').height();
|
229
|
+
// Get the width and height of the selected image plus the padding
|
230
|
+
var intWidth = (intImageWidth + (settings.containerBorderSize * 2));
|
231
|
+
// Plus the image�s width and the left and right padding value
|
232
|
+
var intHeight = (intImageHeight + (settings.containerBorderSize * 2));
|
233
|
+
// Plus the image�s height and the left and right padding value
|
234
|
+
// Diferences
|
235
|
+
var intDiffW = intCurrentWidth - intWidth;
|
236
|
+
var intDiffH = intCurrentHeight - intHeight;
|
237
|
+
// Perfomance the effect
|
238
|
+
$('#lightbox-container-image-box').animate({
|
239
|
+
width : intWidth,
|
240
|
+
height : intHeight
|
241
|
+
}, settings.containerResizeSpeed, function() { _show_image();
|
242
|
+
});
|
243
|
+
if((intDiffW == 0 ) && (intDiffH == 0 )) {
|
244
|
+
if($.browser.msie) {
|
245
|
+
___pause(250);
|
246
|
+
} else {
|
247
|
+
___pause(100);
|
248
|
+
}
|
249
|
+
}
|
250
|
+
$('#lightbox-container-image-data-box').css({
|
251
|
+
width : intImageWidth
|
252
|
+
});
|
253
|
+
$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({
|
254
|
+
height : intImageHeight + (settings.containerBorderSize * 2)
|
255
|
+
});
|
256
|
+
};
|
257
|
+
|
258
|
+
/**
|
259
|
+
* Show the prepared image
|
260
|
+
*
|
261
|
+
*/
|
262
|
+
function _show_image() {
|
263
|
+
$('#lightbox-loading').hide();
|
264
|
+
$('#lightbox-image').fadeIn(function() {
|
265
|
+
_show_image_data();
|
266
|
+
_set_navigation();
|
267
|
+
});
|
268
|
+
_preload_neighbor_images();
|
269
|
+
};
|
270
|
+
|
271
|
+
/**
|
272
|
+
* Show the image information
|
273
|
+
*
|
274
|
+
*/
|
275
|
+
function _show_image_data() {
|
276
|
+
$('#lightbox-container-image-data-box').slideDown('fast');
|
277
|
+
$('#lightbox-image-details-caption').hide();
|
278
|
+
if(settings.imageArray[settings.activeImage][1]) {
|
279
|
+
$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();
|
280
|
+
}
|
281
|
+
// If we have a image set, display 'Image X of X'
|
282
|
+
if(settings.imageArray.length > 1) {
|
283
|
+
$('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + (settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
/**
|
288
|
+
* Display the button navigations
|
289
|
+
*
|
290
|
+
*/
|
291
|
+
function _set_navigation() {
|
292
|
+
$('#lightbox-nav').show();
|
293
|
+
|
294
|
+
// Instead to define this configuration in CSS file, we define here. And it�s need to IE. Just.
|
295
|
+
$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({
|
296
|
+
'background' : 'transparent url(' + settings.imageBlank + ') no-repeat'
|
297
|
+
});
|
298
|
+
|
299
|
+
// Show the prev button, if not the first image in set
|
300
|
+
if(settings.activeImage != 0) {
|
301
|
+
if(settings.fixedNavigation) {
|
302
|
+
$('#lightbox-nav-btnPrev').css({
|
303
|
+
'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat'
|
304
|
+
}).unbind().bind('click', function() {
|
305
|
+
settings.activeImage = settings.activeImage - 1;
|
306
|
+
_set_image_to_view();
|
307
|
+
return false;
|
308
|
+
});
|
309
|
+
} else {
|
310
|
+
// Show the images button for Next buttons
|
311
|
+
$('#lightbox-nav-btnPrev').unbind().hover(function() {
|
312
|
+
$(this).css({
|
313
|
+
'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat'
|
314
|
+
});
|
315
|
+
}, function() {
|
316
|
+
$(this).css({
|
317
|
+
'background' : 'transparent url(' + settings.imageBlank + ') no-repeat'
|
318
|
+
});
|
319
|
+
}).show().bind('click', function() {
|
320
|
+
settings.activeImage = settings.activeImage - 1;
|
321
|
+
_set_image_to_view();
|
322
|
+
return false;
|
323
|
+
});
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
// Show the next button, if not the last image in set
|
328
|
+
if(settings.activeImage != (settings.imageArray.length - 1 )) {
|
329
|
+
if(settings.fixedNavigation) {
|
330
|
+
$('#lightbox-nav-btnNext').css({
|
331
|
+
'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat'
|
332
|
+
}).unbind().bind('click', function() {
|
333
|
+
settings.activeImage = settings.activeImage + 1;
|
334
|
+
_set_image_to_view();
|
335
|
+
return false;
|
336
|
+
});
|
337
|
+
} else {
|
338
|
+
// Show the images button for Next buttons
|
339
|
+
$('#lightbox-nav-btnNext').unbind().hover(function() {
|
340
|
+
$(this).css({
|
341
|
+
'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat'
|
342
|
+
});
|
343
|
+
}, function() {
|
344
|
+
$(this).css({
|
345
|
+
'background' : 'transparent url(' + settings.imageBlank + ') no-repeat'
|
346
|
+
});
|
347
|
+
}).show().bind('click', function() {
|
348
|
+
settings.activeImage = settings.activeImage + 1;
|
349
|
+
_set_image_to_view();
|
350
|
+
return false;
|
351
|
+
});
|
352
|
+
}
|
353
|
+
}
|
354
|
+
// Enable keyboard navigation
|
355
|
+
_enable_keyboard_navigation();
|
356
|
+
}
|
357
|
+
|
358
|
+
/**
|
359
|
+
* Enable a support to keyboard navigation
|
360
|
+
*
|
361
|
+
*/
|
362
|
+
function _enable_keyboard_navigation() {
|
363
|
+
$(document).keydown(function(objEvent) {
|
364
|
+
_keyboard_action(objEvent);
|
365
|
+
});
|
366
|
+
}
|
367
|
+
|
368
|
+
/**
|
369
|
+
* Disable the support to keyboard navigation
|
370
|
+
*
|
371
|
+
*/
|
372
|
+
function _disable_keyboard_navigation() {
|
373
|
+
$(document).unbind();
|
374
|
+
}
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Perform the keyboard actions
|
378
|
+
*
|
379
|
+
*/
|
380
|
+
function _keyboard_action(objEvent) {
|
381
|
+
// To ie
|
382
|
+
if(objEvent == null) {
|
383
|
+
keycode = event.keyCode;
|
384
|
+
escapeKey = 27;
|
385
|
+
// To Mozilla
|
386
|
+
} else {
|
387
|
+
keycode = objEvent.keyCode;
|
388
|
+
escapeKey = objEvent.DOM_VK_ESCAPE;
|
389
|
+
}
|
390
|
+
// Get the key in lower case form
|
391
|
+
key = String.fromCharCode(keycode).toLowerCase();
|
392
|
+
// Verify the keys to close the ligthBox
|
393
|
+
if((key == settings.keyToClose ) || (key == 'x' ) || (keycode == escapeKey )) {
|
394
|
+
_finish();
|
395
|
+
}
|
396
|
+
// Verify the key to show the previous image
|
397
|
+
if((key == settings.keyToPrev ) || (keycode == 37 )) {
|
398
|
+
// If we�re not showing the first image, call the previous
|
399
|
+
if(settings.activeImage != 0) {
|
400
|
+
settings.activeImage = settings.activeImage - 1;
|
401
|
+
_set_image_to_view();
|
402
|
+
_disable_keyboard_navigation();
|
403
|
+
}
|
404
|
+
}
|
405
|
+
// Verify the key to show the next image
|
406
|
+
if((key == settings.keyToNext ) || (keycode == 39 )) {
|
407
|
+
// If we�re not showing the last image, call the next
|
408
|
+
if(settings.activeImage != (settings.imageArray.length - 1 )) {
|
409
|
+
settings.activeImage = settings.activeImage + 1;
|
410
|
+
_set_image_to_view();
|
411
|
+
_disable_keyboard_navigation();
|
412
|
+
}
|
413
|
+
}
|
414
|
+
}
|
415
|
+
|
416
|
+
/**
|
417
|
+
* Preload prev and next images being showed
|
418
|
+
*
|
419
|
+
*/
|
420
|
+
function _preload_neighbor_images() {
|
421
|
+
if((settings.imageArray.length - 1) > settings.activeImage) {
|
422
|
+
objNext = new Image();
|
423
|
+
objNext.src = settings.imageArray[settings.activeImage + 1][0];
|
424
|
+
}
|
425
|
+
if(settings.activeImage > 0) {
|
426
|
+
objPrev = new Image();
|
427
|
+
objPrev.src = settings.imageArray[settings.activeImage -1][0];
|
428
|
+
}
|
429
|
+
}
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Remove jQuery lightBox plugin HTML markup
|
433
|
+
*
|
434
|
+
*/
|
435
|
+
function _finish() {
|
436
|
+
$('#jquery-lightbox').remove();
|
437
|
+
$('#jquery-overlay').fadeOut(function() {
|
438
|
+
$('#jquery-overlay').remove();
|
439
|
+
});
|
440
|
+
// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
|
441
|
+
$('embed, object, select').css({
|
442
|
+
'visibility' : 'visible'
|
443
|
+
});
|
444
|
+
}
|
445
|
+
|
446
|
+
/**
|
447
|
+
/ THIRD FUNCTION
|
448
|
+
* getPageSize() by quirksmode.com
|
449
|
+
*
|
450
|
+
* @return Array Return an array with page width, height and window width, height
|
451
|
+
*/
|
452
|
+
function ___getPageSize() {
|
453
|
+
var xScroll, yScroll;
|
454
|
+
if(window.innerHeight && window.scrollMaxY) {
|
455
|
+
xScroll = window.innerWidth + window.scrollMaxX;
|
456
|
+
yScroll = window.innerHeight + window.scrollMaxY;
|
457
|
+
} else if(document.body.scrollHeight > document.body.offsetHeight) {// all but Explorer Mac
|
458
|
+
xScroll = document.body.scrollWidth;
|
459
|
+
yScroll = document.body.scrollHeight;
|
460
|
+
} else {// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
|
461
|
+
xScroll = document.body.offsetWidth;
|
462
|
+
yScroll = document.body.offsetHeight;
|
463
|
+
}
|
464
|
+
var windowWidth, windowHeight;
|
465
|
+
if(self.innerHeight) {// all except Explorer
|
466
|
+
if(document.documentElement.clientWidth) {
|
467
|
+
windowWidth = document.documentElement.clientWidth;
|
468
|
+
} else {
|
469
|
+
windowWidth = self.innerWidth;
|
470
|
+
}
|
471
|
+
windowHeight = self.innerHeight;
|
472
|
+
} else if(document.documentElement && document.documentElement.clientHeight) {// Explorer 6 Strict Mode
|
473
|
+
windowWidth = document.documentElement.clientWidth;
|
474
|
+
windowHeight = document.documentElement.clientHeight;
|
475
|
+
} else if(document.body) {// other Explorers
|
476
|
+
windowWidth = document.body.clientWidth;
|
477
|
+
windowHeight = document.body.clientHeight;
|
478
|
+
}
|
479
|
+
// for small pages with total height less then height of the viewport
|
480
|
+
if(yScroll < windowHeight) {
|
481
|
+
pageHeight = windowHeight;
|
482
|
+
} else {
|
483
|
+
pageHeight = yScroll;
|
484
|
+
}
|
485
|
+
// for small pages with total width less then width of the viewport
|
486
|
+
if(xScroll < windowWidth) {
|
487
|
+
pageWidth = xScroll;
|
488
|
+
} else {
|
489
|
+
pageWidth = windowWidth;
|
490
|
+
}
|
491
|
+
arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
|
492
|
+
return arrayPageSize;
|
493
|
+
};
|
494
|
+
|
495
|
+
/**
|
496
|
+
/ THIRD FUNCTION
|
497
|
+
* getPageScroll() by quirksmode.com
|
498
|
+
*
|
499
|
+
* @return Array Return an array with x,y page scroll values.
|
500
|
+
*/
|
501
|
+
function ___getPageScroll() {
|
502
|
+
var xScroll, yScroll;
|
503
|
+
if(self.pageYOffset) {
|
504
|
+
yScroll = self.pageYOffset;
|
505
|
+
xScroll = self.pageXOffset;
|
506
|
+
} else if(document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
|
507
|
+
yScroll = document.documentElement.scrollTop;
|
508
|
+
xScroll = document.documentElement.scrollLeft;
|
509
|
+
} else if(document.body) {// all other Explorers
|
510
|
+
yScroll = document.body.scrollTop;
|
511
|
+
xScroll = document.body.scrollLeft;
|
512
|
+
}
|
513
|
+
arrayPageScroll = new Array(xScroll, yScroll);
|
514
|
+
return arrayPageScroll;
|
515
|
+
};
|
516
|
+
|
517
|
+
/**
|
518
|
+
* Stop the code execution from a escified time in milisecond
|
519
|
+
*
|
520
|
+
*/
|
521
|
+
function ___pause(ms) {
|
522
|
+
var date = new Date();
|
523
|
+
curDate = null;
|
524
|
+
do {
|
525
|
+
var curDate = new Date();
|
526
|
+
} while ( curDate - date < ms);
|
527
|
+
};
|
528
|
+
|
529
|
+
// Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
|
530
|
+
return this.unbind('click').click(_initialize);
|
531
|
+
};
|
532
|
+
})(jQuery);
|
533
|
+
// Call and execute the function immediately passing the jQuery object
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-documents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "V\xC3\xADctor S\xC3\xA1nchez Belmar"
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-10-
|
19
|
+
date: 2011-10-14 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 19
|
31
31
|
segments:
|
32
32
|
- 0
|
33
33
|
- 9
|
34
|
-
-
|
35
|
-
version: 0.9.
|
34
|
+
- 20
|
35
|
+
version: 0.9.20
|
36
36
|
name: social_stream-base
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -360,7 +360,7 @@ files:
|
|
360
360
|
- spec/support/devise.rb
|
361
361
|
- spec/support/mock.rb
|
362
362
|
- vendor/assets/javascripts/jquery.jplayer.js
|
363
|
-
- vendor/assets/javascripts/jquery.lightbox.
|
363
|
+
- vendor/assets/javascripts/jquery.lightbox-with-resize-plugin.js
|
364
364
|
- vendor/assets/stylesheets/jplayer.blue.monday.css
|
365
365
|
- vendor/assets/stylesheets/jplayer.blue.monday.jpg
|
366
366
|
- vendor/assets/stylesheets/jplayer.blue.monday.video.play.hover.png
|
@@ -1,42 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jQuery lightBox plugin
|
3
|
-
* This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
|
4
|
-
* and adapted to me for use like a plugin from jQuery.
|
5
|
-
* @name jquery-lightbox-0.5.js
|
6
|
-
* @author Leandro Vieira Pinho - http://leandrovieira.com
|
7
|
-
* @version 0.5
|
8
|
-
* @date April 11, 2008
|
9
|
-
* @category jQuery plugin
|
10
|
-
* @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
|
11
|
-
* @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
|
12
|
-
* @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
|
13
|
-
*/
|
14
|
-
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'images/lightbox-ico-loading.gif',imageBtnPrev:'images/lightbox-btn-prev.gif',imageBtnNext:'images/lightbox-btn-next.gif',imageBtnClose:'images/lightbox-btn-close.gif',imageBlank:'images/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
|
15
|
-
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
|
16
|
-
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
|
17
|
-
_set_image_to_view();}
|
18
|
-
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
|
19
|
-
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
|
20
|
-
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
|
21
|
-
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
|
22
|
-
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
|
23
|
-
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
|
24
|
-
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
|
25
|
-
_enable_keyboard_navigation();}
|
26
|
-
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
|
27
|
-
function _disable_keyboard_navigation(){$(document).unbind();}
|
28
|
-
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
|
29
|
-
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
|
30
|
-
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
|
31
|
-
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
|
32
|
-
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
|
33
|
-
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
|
34
|
-
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
|
35
|
-
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
|
36
|
-
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
|
37
|
-
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
|
38
|
-
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
|
39
|
-
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
|
40
|
-
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
|
41
|
-
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
|
42
|
-
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);
|