// ==UserScript== // @name 咸鱼搜索 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 方便用户使用PC端直接搜索闲置物品 // @author Sin // @match https://2.taobao.com/* // @match https://*.2.taobao.com/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 顶部搜索栏 var s = document.createElement("div"); s.className = "idle-search"; s.innerHTML ='
'; document.getElementById("J_IdleHeader").appendChild(s); // 列表页搜索栏 var x = document.getElementsByClassName('search-filters-block search-filters'); if (x.length > 0) { x[0].style.display = "initial"; } // 列表图片下显示描述 function addTitle(){ var items = document.getElementsByClassName("item-pic"); for (var i = 0; i < items.length; i++) { var item = items[i]; var title = item.getElementsByTagName("a")[0].getAttribute("title"); if(item.getElementsByTagName("p").length===0){ var p = document.createElement("p"); p.innerHTML = "" + title + "
"; //item.insertBefore(p,item.firstChild); item.append(p); } } } addTitle(); document.body.onmousewheel = function(){ addTitle(); }; document.onkeyup = function(){ addTitle(); }; })();