Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fiat Tux
Hat softwares
Lutim
Commits
5ad1caea
Commit
5ad1caea
authored
Jan 16, 2018
by
Luc Didry
Browse files
Make gallery generation really sequential
parent
ef1297be
Changes
1
Hide whitespace changes
Inline
Side-by-side
themes/default/templates/partial/gallery.js.ep
View file @
5ad1caea
%
#
vim
:
set
sw
=
4
ts
=
4
sts
=
4
ft
=
javascript
expandtab
:
var
absUrl
=
'
<%= url_for(
'
/
'
) %>
'
;
var
initPhotoSwipeFromDOM
=
function
(
gallerySelector
)
{
// parse slide data (url, title, size ...) from DOM elements
...
...
@@ -201,9 +203,38 @@ var initPhotoSwipeFromDOM = function(gallerySelector) {
openPhotoSwipe
(
hashData
.
pid
,
galleryElements
[
hashData
.
gid
-
1
],
true
,
true
);
}
};
$
(
document
).
ready
(
function
()
{
var
absUrl
=
'
<%= url_for(
'
/
'
) %>
'
;
function
addElement
(
keys
)
{
element
=
keys
.
shift
();
if
(
!
element
.
match
(
'
xcf
'
))
{
$
.
ajax
({
url
:
'
<%= url_for(
'
about_img
'
) %>
'
+
'
/
'
+
element
,
method
:
'
GET
'
,
dataType
:
'
json
'
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
if
(
data
.
success
)
{
$
(
'
.gallery
'
).
append
(
[
'
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
'
,
'
<a href="
'
,
absUrl
+
element
,
'
" itemprop="contentUrl" data-size="
'
,
data
.
data
.
width
,
'
x
'
,
data
.
data
.
height
,
'
">
'
,
'
<img src="
'
,
absUrl
+
element
,
'
?width=275" itemprop="thumbnail" alt="" class="img-responsive"/>
'
,
'
</a>
'
,
'
</figure>
'
].
join
(
''
)
);
}
},
complete
:
function
()
{
if
(
keys
.
length
>
0
)
{
addElement
(
keys
);
}
else
{
initPhotoSwipeFromDOM
(
'
.gallery
'
);
}
}
});
}
}
$
(
document
).
ready
(
function
()
{
var
key
=
window
.
location
.
hash
.
substring
(
1
);
// Get key
// First, strip everything after the equal sign (=) which signals end of base64 string.
i
=
key
.
indexOf
(
'
=
'
);
if
(
i
>-
1
)
{
key
=
key
.
substring
(
0
,
i
+
1
);
}
...
...
@@ -214,32 +245,5 @@ $(document).ready(function() {
$
(
'
#download-all
'
).
attr
(
'
href
'
,
$
(
'
#download-all
'
).
attr
(
'
href
'
)
+
keys
.
join
(
'
&i=
'
));
var
items
=
[];
keys
.
forEach
(
function
(
element
,
index
,
array
)
{
if
(
!
element
.
match
(
'
xcf
'
))
{
$
.
ajax
({
url
:
'
<%= url_for(
'
about_img
'
) %>
'
+
'
/
'
+
element
,
method
:
'
GET
'
,
dataType
:
'
json
'
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
if
(
data
.
success
)
{
$
(
'
.gallery
'
).
append
(
[
'
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
'
,
'
<a href="
'
,
absUrl
+
element
,
'
" itemprop="contentUrl" data-size="
'
,
data
.
data
.
width
,
'
x
'
,
data
.
data
.
height
,
'
">
'
,
'
<img src="
'
,
absUrl
+
element
,
'
?width=275" itemprop="thumbnail" alt="" class="img-responsive"/>
'
,
'
</a>
'
,
'
</figure>
'
].
join
(
''
)
);
}
},
complete
:
function
()
{
if
(
index
+
1
===
keys
.
length
)
{
initPhotoSwipeFromDOM
(
'
.gallery
'
);
}
}
});
}
});
addElement
(
keys
);
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment