custom.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. $('#status .close').click(function() {
  30. $(this).parent().hide();
  31. });
  32. $('#statusbtn').click(function() {
  33. if($('#status-loading').is(':hidden')) {
  34. $('#status').hide();
  35. $('#status-loading').show();
  36. $.ajax({
  37. url: '?/status',
  38. }).done(function(data) {
  39. $('#status-loading').hide();
  40. $('#status-text').html('<ul>' + data + '</ul>');
  41. $('#status').show('slow');
  42. });
  43. }
  44. });
  45. });