custom.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $(document).ready(function() {
  2. $('.btn-group').button();
  3. $('[data-toggle="tooltip"]').tooltip();
  4. $('.fileinput').click(function() {
  5. var realinputid = '#' + $(this).attr('id').replace(/_chooser.*/, '');
  6. $(realinputid).click();
  7. });
  8. $('input[type="file"]').change(function() {
  9. var choosertxtid = '#' + $(this).attr('id') + '_choosertxt';
  10. $(choosertxtid).val($(this).val().replace(/^.*[\/\\]/, ''));
  11. });
  12. $('.dropdown-menu li').click(function() {
  13. var menu = $(this).parent();
  14. var items = menu.children();
  15. var button = menu.prev();
  16. var input = button.prev();
  17. items.removeClass('active');
  18. $(this).addClass('active');
  19. button.text($(this).text());
  20. button.append(' <span class="caret"></span>');
  21. input.attr('value', $(this).text());
  22. });
  23. $('.switch').bootstrapToggle();
  24. $('#save').click(function() {
  25. $(this).prop('disabled', true);
  26. $('#save-loading').show();
  27. $('#form').submit();
  28. });
  29. $('#saveconfirm').click(function() {
  30. $(this).hide();
  31. $('#saveconfirmation').show();
  32. });
  33. $('#status .close').click(function() {
  34. $(this).parent().hide();
  35. });
  36. $('#statusbtn').click(function() {
  37. if($('#status-loading').is(':hidden')) {
  38. $('#status').hide();
  39. $('#status-loading').show();
  40. $.ajax({
  41. url: '?/status',
  42. }).done(function(data) {
  43. $('#status-loading').hide();
  44. $('#status-text').html('<ul>' + data + '</ul>');
  45. $('#status').show('slow');
  46. });
  47. }
  48. });
  49. });