edit.db.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. App.Actions.DB.update_db_username_hint = function(elm, hint) {
  2. if (hint.trim() == '') {
  3. $(elm).parent().find('.hint').html('');
  4. }
  5. if (hint.indexOf(GLOBAL.DB_USER_PREFIX) == 0) {
  6. hint = hint.slice(GLOBAL.DB_USER_PREFIX.length, hint.length);
  7. }
  8. $(elm).parent().find('.hint').html(GLOBAL.DB_USER_PREFIX + hint);
  9. }
  10. App.Actions.DB.update_db_databasename_hint = function(elm, hint) {
  11. if (hint.trim() == '') {
  12. $(elm).parent().find('.hint').html('');
  13. }
  14. if (hint.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) {
  15. hint = hint.slice(GLOBAL.DB_DBNAME_PREFIX.length, hint.length);
  16. }
  17. $(elm).parent().find('.hint').html(GLOBAL.DB_DBNAME_PREFIX + hint);
  18. }
  19. App.Listeners.DB.keypress_db_username = function() {
  20. $('input[name="v_dbuser"]').bind('keypress', function(evt) {
  21. clearTimeout(window.frp_usr_tmt);
  22. window.frp_usr_tmt = setTimeout(function() {
  23. var elm = $(evt.target);
  24. App.Actions.DB.update_db_username_hint(elm, $(elm).val());
  25. }, 100);
  26. });
  27. }
  28. App.Listeners.DB.keypress_db_databasename = function() {
  29. $('input[name="v_database"]').bind('keypress', function(evt) {
  30. clearTimeout(window.frp_dbn_tmt);
  31. window.frp_dbn_tmt = setTimeout(function() {
  32. var elm = $(evt.target);
  33. App.Actions.DB.update_db_databasename_hint(elm, $(elm).val());
  34. }, 100);
  35. });
  36. }
  37. //
  38. // Page entry point
  39. App.Listeners.DB.keypress_db_username();
  40. App.Listeners.DB.keypress_db_databasename();