misago.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Register tooltips
  2. $(function() {
  3. $('.tooltip-top').tooltip({placement: 'top', container: 'body'});
  4. $('.tooltip-bottom').tooltip({placement: 'bottom', container: 'body'});
  5. $('.tooltip-left').tooltip({placement: 'left', container: 'body'});
  6. $('.tooltip-right').tooltip({placement: 'right', container: 'body'});
  7. });
  8. // Tables
  9. $(function() {
  10. $('.table tr').each(function() {
  11. var $row = $(this);
  12. var $checkbox = $row.find('input[type=checkbox]');
  13. var $label = $checkbox.parent();
  14. $label.addClass('ninja-label');
  15. $label.parent().append('<a href="#"><span class="fa fa-check"></span></a>');
  16. var $check = $label.parent().find('a');
  17. if ($checkbox.prop("checked")) {
  18. $check.toggleClass('active');
  19. $row.addClass('active');
  20. }
  21. $check.click(function() {
  22. $(this).toggleClass('active');
  23. if ($(this).hasClass('active')) {
  24. $(this).parent().find('input').prop("checked", true);
  25. $row.addClass('active');
  26. } else {
  27. $(this).parent().find('input').prop("checked", false);
  28. $row.removeClass('active');
  29. }
  30. return false;
  31. });
  32. });
  33. });