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.

58 lines
960 B

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