fc.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* vim: set ts=2: */
  2. function resizeElems() {
  3. var ubHeight = public ? -17 : $('.userBox').height();
  4. var height = $(window).height() - $('.header').height();
  5. $('#posts').height( height - ubHeight - 101 );
  6. $('#editor').height( height - 55 )
  7. }
  8. $( document ).ready( function() {
  9. var padVisible = bcVisible = true;
  10. var editor = $( '#editor' );
  11. var bc = $( '#sidebar' );
  12. if (mobile) {
  13. editor.toggle();
  14. bc.css( 'width', '100%' );
  15. $('#togglePad').hide();
  16. $('#toggleBC').hide();
  17. $('#epliframe').remove();
  18. } else {
  19. resizeElems();
  20. $(window).resize(resizeElems);
  21. }
  22. $( '#toggleBC' ).click( function() {
  23. if( padVisible ) {
  24. // hide pad and, if bc is visible, grow it
  25. editor.toggle();
  26. bc.css( 'width', '100%' );
  27. $('#togglePad').attr('disabled', true);
  28. padVisible = false;
  29. } else {
  30. editor.toggle();
  31. $('#togglePad').removeAttr('disabled');
  32. bc.css( 'width', '30%' );
  33. editor.css( 'width', '70%' );
  34. padVisible = true;
  35. }
  36. });
  37. $( '#togglePad' ).click( function() {
  38. if( bcVisible ) {
  39. bc.toggle();
  40. editor.css( 'width', '100%' );
  41. $('#toggleBC').attr('disabled', true);
  42. bcVisible = false;
  43. } else {
  44. bc.toggle();
  45. $('#toggleBC').removeAttr('disabled');
  46. editor.css( 'width', '70%' );
  47. bc.css( 'width', '30%' );
  48. bcVisible = true;
  49. }
  50. });
  51. });