mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
42 lines
1021 B
Plaintext
42 lines
1021 B
Plaintext
$(function(){
|
|
$('.expanding').each(function(){
|
|
var $this = $(this);
|
|
if ($this.height() > 300) {
|
|
$this.addClass('collapsed');
|
|
$this.find('.bottom-gradient').click(function(){
|
|
$this.removeClass('collapsed');
|
|
});
|
|
}
|
|
});
|
|
$('#like').click(function(){
|
|
var loggedIn = $('.user-handle').length > 0;
|
|
|
|
var $this = $(this);
|
|
|
|
if (loggedIn) {
|
|
var action = 'like';
|
|
if ($this.hasClass('fa-thumbs-up')) {
|
|
action = 'unlike';
|
|
}
|
|
|
|
$this.toggleClass('fa-thumbs-up');
|
|
$this.toggleClass('fa-thumbs-o-up');
|
|
|
|
$likes = $('#likes');
|
|
nLikes = parseInt($likes.text(), 10);
|
|
|
|
if (action == 'like') {
|
|
$this.attr('title','You liked this!');
|
|
$likes.text(nLikes + 1);
|
|
$.post("@{PackageLikeR pn}");
|
|
} else {
|
|
$this.attr('title','You disliked this.');
|
|
$likes.text(nLikes - 1);
|
|
$.post("@{PackageUnlikeR pn}");
|
|
}
|
|
} else {
|
|
window.location.href = '@{AuthR LoginR}';
|
|
}
|
|
});
|
|
});
|