-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathpublication_effects.js
41 lines (38 loc) · 1.59 KB
/
publication_effects.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$('div.publication').hover(
function(inEvent){
var thisThumbnailPreHover=$(this).find('.project-thumbnail.pre-hover');
if (thisThumbnailPreHover.length != 0) {
var thisThumbnailPostHover=$(this).find('.project-thumbnail.post-hover');
// Make sure the alternative exists
if (thisThumbnailPostHover.length != 0) {
$(thisThumbnailPostHover[0]).show();
$(thisThumbnailPreHover[0]).stop().fadeOut(function(){$(thisThumbnailPreHover[0]).hide();});
}
}
},
function(outEvent){
var thisThumbnailPreHover=$(this).find('.project-thumbnail.pre-hover');
if (thisThumbnailPreHover.length != 0) {
var thisThumbnailPostHover=$(this).find('.project-thumbnail.post-hover');
// Make sure the alternative exists
if (thisThumbnailPostHover.length != 0) {
$(thisThumbnailPreHover[0]).stop().fadeIn(function(){$(thisThumbnailPostHover[0]).hide();});
}
}
});
$('button.copy-btn').click(function(){
var parent = $(this).parent();
var modal = $(parent).parent();
var bibTxt = $(modal).find('.bib-text');
if (bibTxt.length != 0) {
var bib = $(bibTxt[0]).text().trim();
navigator.clipboard.writeText(bib);
// Show success alert
$(parent).prepend('<div class="alert alert-success" role="alert">Successfully copied to clipboard!</div>');
var alert = $(parent).find('.alert');
// Remove after 3s
setTimeout(function() {
alert.remove();
}, 3000);
}
});