You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
839 B

  1. semantic.button = {};
  2. // ready event
  3. semantic.button.ready = function() {
  4. // selector cache
  5. var
  6. $buttons = $('.main .ui.buttons .button'),
  7. $toggle = $('.main .ui.toggle.button'),
  8. $follow = $('.follow.example .button'),
  9. $button = $('.ui.button').not($buttons).not($toggle),
  10. // alias
  11. handler = {
  12. activate: function() {
  13. $(this)
  14. .addClass('active')
  15. .siblings()
  16. .removeClass('active')
  17. ;
  18. }
  19. }
  20. ;
  21. $buttons
  22. .on('click', handler.activate)
  23. ;
  24. $follow
  25. .state({
  26. text: {
  27. inactive : 'Follow',
  28. active : 'Following'
  29. }
  30. })
  31. ;
  32. $toggle
  33. .state({
  34. text: {
  35. inactive : 'Vote',
  36. active : 'Voted'
  37. }
  38. })
  39. ;
  40. };
  41. // attach ready event
  42. $(document)
  43. .ready(semantic.button.ready)
  44. ;