custom.js 1.2 KB

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