delegate bookmark click event

This commit is contained in:
Thibault Duplessis 2013-05-28 00:51:38 +02:00
parent 3c2a7693b0
commit 589c1219c8
2 changed files with 8 additions and 16 deletions

View file

@ -491,20 +491,13 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
return false;
});
function bookmarks() {
$('span.bookmark a.icon:not(.jsed)').each(function() {
var t = $(this).addClass("jsed");
t.click(function() {
t.toggleClass("bookmarked");
$.post(t.attr("href"));
var count = (parseInt(t.html()) || 0) + (t.hasClass("bookmarked") ? 1 : -1);
t.html(count > 0 ? count : "");
return false;
});
});
}
bookmarks();
$('body').on('lichess.content_loaded', bookmarks);
$('#lichess').on('click', 'span.bookmark a.icon', function() {
var t = $(this).toggleClass("bookmarked");
$.post(t.attr("href"));
var count = (parseInt(t.html()) || 0) + (t.hasClass("bookmarked") ? 1 : -1);
t.html(count > 0 ? count : "");
return false;
});
if ($(window).width() < 1060) {
$("div.lichess_chat").addClass("small_chat");
@ -1574,7 +1567,7 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
});
} else {
$squares.removeClass('selected');
// first click must be on an own piece
// first click must be on an own piece
if (!$(this).find('.' + color).length) return;
$input.val(key);
}

1
todo
View file

@ -72,7 +72,6 @@ show teams in user mini
badges for top players in ELO and number of games
top menu is too long in french with long username
at least locally, the forum search user:mephostophilis returns no result
delegate js bookmark click function
DEPLOY p21
----------