pchome_search_title_filter

pchome search title bar

  1. // ==UserScript==
  2. // @name pchome_search_title_filter
  3. // @namespace http://mesak.tw
  4. // @version 1.1
  5. // @description pchome search title bar
  6. // @author Mesak
  7. // @match https://ecshweb.pchome.com.tw/search/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=pchome.com.tw
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. $('#layoutBread').css({justifyContent:'space-between'});
  16. $('#layoutBread').append(`<div style="width:40%">標題搜尋:<input type="text" id="fix_title_filter" value="" style="border:1px #000 solid"></div>`).on('keypress blur','#fix_title_filter',(e)=>{
  17. let word = e.currentTarget.value
  18. let words = word.split(' ')
  19. let $productList = $('#ItemContainer > dl')
  20. if( word == '')
  21. {
  22. $productList.show();
  23. }else{
  24. $productList.hide();
  25. $productList.each((key,node)=>{
  26. let title = $('.prod_name',node).text()
  27. let resutls = []
  28. words.forEach( (value) => {
  29. resutls.push( title.toLowerCase().search(value.toLowerCase()) !== -1)
  30. })
  31. if( !resutls.includes(false) ){
  32. $(node).show();
  33. }
  34.  
  35.  
  36. })
  37. }
  38. })
  39.  
  40.  
  41. // Your code here...
  42. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址