search.js 573 B

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