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.

61 lines
1.0 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. // namespace
  2. var shape = {
  3. handler: {}
  4. };
  5. // ready event
  6. shape.ready = function() {
  7. // selector cache
  8. var
  9. $ui = $('.ui'),
  10. $swap = $('.swap.button'),
  11. $menu = $('.menu.button'),
  12. $demo = $('.demo'),
  13. // alias
  14. handler
  15. ;
  16. // event handlers
  17. handler = {
  18. swapStyle: function() {
  19. $('head link')
  20. .each(function() {
  21. var
  22. href = $(this).attr('href')
  23. ;
  24. console.log (href, href.search('flat') );
  25. if( href.search('flat') > -1 ) {
  26. console.log('zz');
  27. $(this).attr('href', href.replace('flat', 'shaded'));
  28. }
  29. else {
  30. console.log('aaa');
  31. $(this).attr('href', href.replace('shaded', 'flat'));
  32. }
  33. })
  34. ;
  35. }
  36. };
  37. // attach events
  38. $ui
  39. .state()
  40. ;
  41. $swap
  42. .on('click', handler.swapStyle)
  43. ;
  44. $menu
  45. .sidr({
  46. name: 'menu'
  47. })
  48. ;
  49. };
  50. // attach ready event
  51. $(document)
  52. .ready(shape.ready)
  53. ;