mirror of
https://github.com/friendica/friendica
synced 2025-04-25 08:30:11 +00:00
open friendica photos from the stream with colorbox
This commit is contained in:
parent
deaaeec047
commit
eb1e882d7c
2 changed files with 70 additions and 0 deletions
28
js/theme.js
28
js/theme.js
|
@ -73,6 +73,34 @@ $(document).ready(function(){
|
|||
});
|
||||
});
|
||||
|
||||
// Add Colorbox for viewing Network page images
|
||||
//var cBoxClasses = new Array();
|
||||
$(".wall-item-body a img").each(function(){
|
||||
var aElem = $(this).parent();
|
||||
var imgHref = aElem.attr("href");
|
||||
|
||||
// We need to make sure we only put a Colorbox on links to Friendica images
|
||||
// We'll try to do this by looking for links of the form
|
||||
// .../photo/ab803d8eg08daf85023adfec08 (with nothing more following), in hopes
|
||||
// that that will be unique enough
|
||||
if(imgHref.match(/\/photo\/[a-fA-F0-9]+(-[0-9]\.[\w]+?)?$/)) {
|
||||
|
||||
// Add a unique class to all the images of a certain post, to allow scrolling through
|
||||
var cBoxClass = $(this).closest(".wall-item-body").attr("id") + "-lightbox";
|
||||
$(this).addClass(cBoxClass);
|
||||
|
||||
// if( $.inArray(cBoxClass, cBoxClasses) < 0 ) {
|
||||
// cBoxClasses.push(cBoxClass);
|
||||
// }
|
||||
|
||||
aElem.colorbox({
|
||||
maxHeight: '90%',
|
||||
photo: true, // Colorbox doesn't recognize a URL that don't end in .jpg, etc. as a photo
|
||||
rel: cBoxClass //$(this).attr("class").match(/wall-item-body-[\d]+-lightbox/)[0]
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// overwrite Dialog.show from main js to load the filebrowser into a bs modal
|
||||
Dialog.show = function(url) {
|
||||
var modal = $('#modal').modal();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue