Team:Lethbridge/notebook js
$(document).ready(function () {
/* Give random colors and textures to the notebook entries. These are done in 2 separate loops to guarantee that no two consecutive blocks are te same. The nonRedundantRandom will never produce the same random number twice in a row, but it can produce the same number every second time. The colors and textures each get their own loop to work around this. */ $('.notebook_entry').each(function() { $(this).find('.entry_day').css('background', randomColor()); }); /* Don't give a texture $('.notebook_entry').each(function() { $(this).find('.entry_day').find('div').css('background', randomTexture()); }); */
/* Handle the ellipsis click */ $('.entry_expand_button').css({display: 'block'}); $('.entry_data').css({display: 'none'}); $('.entry_expand_button').click(function() { // Get elements relative to the button var button = $(this); var entry = $(button).parent().parent(); var content = $(entry).find('.entry_data'); var speed = 100; // If the content was hidden when the button was clicked if ($(content).css('display') == 'none') { $(button).text('Less \u2191'); // Up arrow $(content).show(speed); } // If the content was already shown when the button was clicked else { $(button).text('More \u2193'); // Down arrow $(content).hide(speed); } });
});