You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gogs.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. function initInstall() {
  2. if ($('.install').length == 0) {
  3. return;
  4. }
  5. // Database type change detection.
  6. $("#db_type").change(function () {
  7. var db_type = $('#db_type').val();
  8. if (db_type === "SQLite3") {
  9. $('#sql_settings').hide();
  10. $('#pgsql_settings').hide();
  11. $('#sqlite_settings').show();
  12. return;
  13. }
  14. var mysql_default = '127.0.0.1:3306';
  15. var postgres_default = '127.0.0.1:5432';
  16. $('#sqlite_settings').hide();
  17. $('#sql_settings').show();
  18. if (db_type === "PostgreSQL") {
  19. $('#pgsql_settings').show();
  20. if ($('#db_host').val() == mysql_default) {
  21. $('#db_host').val(postgres_default);
  22. }
  23. } else {
  24. $('#pgsql_settings').hide();
  25. if ($('#db_host').val() == postgres_default) {
  26. $('#db_host').val(mysql_default);
  27. }
  28. }
  29. });
  30. };
  31. function initRepository(){
  32. if ($('.repository').length == 0) {
  33. return;
  34. }
  35. if ($('.labels').length == 0) {
  36. return;
  37. }
  38. $('.color-picker').each( function() {
  39. $(this).minicolors();
  40. });
  41. $('.precolors .color').click(function(){
  42. var color_hex = $(this).data('color-hex')
  43. $('.color-picker').val(color_hex);
  44. $('.minicolors-swatch-color').css("background-color", color_hex);
  45. });
  46. };
  47. $(document).ready(function () {
  48. // Semantic UI modules.
  49. $('.dropdown').dropdown();
  50. $('.jump.dropdown').dropdown({
  51. action: 'hide'
  52. });
  53. $('.slide.up.dropdown').dropdown({
  54. transition: 'slide up'
  55. });
  56. $('.ui.accordion').accordion();
  57. $('.ui.checkbox').checkbox();
  58. $('.poping.up').popup();
  59. initInstall();
  60. initRepository();
  61. });