/kai/public/javascripts/behavior.js

https://bitbucket.org/bbangert/kai/ · JavaScript · 45 lines · 43 code · 1 blank · 1 comment · 5 complexity · 71f5c8d35133a885b811df0672775c30 MD5 · raw file

  1. $(document).ready(function() {
  2. // Swap the layout toggle if they have wide-screen
  3. if ($.cookie('layout_style') == 'Stretch') {
  4. $('#doc4').attr('id', 'doc3');
  5. $('#layout-toggle').html('Stretch');
  6. };
  7. $('div.viewtoggle a').click(function() {
  8. $(this).toggleClass('down');
  9. $(this).parent().next().slideToggle();
  10. return false;
  11. });
  12. $('div.details a').click(function() {
  13. $.blockUI({ message: $('#buildinfo') });
  14. var url = '/buildbot/details/' + $(this).attr('class');
  15. $.ajax({
  16. url: url,
  17. cache: false,
  18. success: function(data, textStatus) {
  19. $.blockUI({ message: data,
  20. css: { width: '90%', top: '5%',
  21. bottom: '5%', left: '5%',
  22. overflow: 'auto', right: '5%',
  23. textAlign: 'left', cursor: 'default' } });
  24. $('div.close a').click(function() {
  25. $.unblockUI();
  26. return false;
  27. });
  28. }
  29. });
  30. return false;
  31. });
  32. $('#layout-toggle').click(function() {
  33. if ($('#layout-toggle').html() == 'Fixed-width') {
  34. $('#doc4').attr('id', 'doc3');
  35. $('#layout-toggle').html('Stretch');
  36. $.cookie('layout_style', 'Stretch', {path: '/', domain: '.pylonshq.com'});
  37. } else {
  38. $('#doc3').attr('id', 'doc4');
  39. $('#layout-toggle').html('Fixed-width');
  40. $.cookie('layout_style', null, {path: '/', domain: '.pylonshq.com'});
  41. }
  42. return false;
  43. });
  44. });