search.js 523 B

123456789101112131415161718192021
  1. class SearchModule {
  2. static init() {
  3. const searchInput = DOM.get('.search-input');
  4. searchInput.on('keypress', (e) => {
  5. const value = CDElement.get(e.target).getValue();
  6. if(e.key === 'Enter' && !isEmpty(value))
  7. ClassListModule.setQuery(value, true);
  8. });
  9. searchInput.on('input', (e) => {
  10. const value = CDElement.get(e.target).getValue();
  11. if(isEmpty(value))
  12. ClassListModule.setQuery(value, true);
  13. });
  14. }
  15. }
  16. window_.on('load', (e) => {
  17. SearchModule.init();
  18. });