gogs.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. $(document).ready(function () {
  32. // Semantic UI modules.
  33. $('.dropdown').dropdown();
  34. $('.link.dropdown').dropdown({
  35. action: 'hide'
  36. });
  37. $('.slide.up.dropdown').dropdown({
  38. transition: 'slide up'
  39. });
  40. $('.ui.accordion').accordion();
  41. $('.ui.checkbox').checkbox();
  42. $('.poping.up').popup();
  43. initInstall();
  44. });