edit.web.js 940 B

1234567891011121314151617181920212223242526272829
  1. App.Actions.WEB.update_ftp_username_hint = function(elm, hint) {
  2. if (hint.trim() == '') {
  3. $(elm).parent().find('.hint').html('');
  4. }
  5. if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) {
  6. hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length);
  7. }
  8. $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint);
  9. }
  10. App.Listeners.WEB.keypress_ftp_username = function() {
  11. var ref = $('input[name="v_ftp_user"]');
  12. var current_val = ref.val();
  13. if (current_val.trim() != '') {
  14. App.Actions.DB.update_ftp_username_hint(ref, current_val);
  15. }
  16. ref.bind('keypress', function(evt) {
  17. clearTimeout(window.frp_usr_tmt);
  18. window.frp_usr_tmt = setTimeout(function() {
  19. var elm = $(evt.target);
  20. App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val());
  21. }, 100);
  22. });
  23. }
  24. //
  25. // Page entry point
  26. App.Listeners.WEB.keypress_ftp_username();