search-init.js 810 B

12345678910111213141516171819202122
  1. define(['util', 'jquery'], function(util, $) {
  2. $(document).ready(function () {
  3. var searchQuery = '';
  4. searchQuery = util.getParameter('searchQuery');
  5. searchQuery = decodeURIComponent(searchQuery);
  6. searchQuery = searchQuery.replace(/\+/g, " ");
  7. if (searchQuery.trim() != '' && searchQuery !== undefined && searchQuery != 'undefined') {
  8. $('#textToSearch').val(searchQuery);
  9. $('#searchForm').submit();
  10. }
  11. $('#searchForm').on('submit', function(event){
  12. util.debug('submit form....');
  13. if ($('#textToSearch').val().trim()=='') {
  14. event.preventDefault();
  15. event.stopPropagation();
  16. return false;
  17. }
  18. });
  19. });
  20. });