├── .gitignore ├── LICENSE ├── README.md ├── icon.png ├── makeZip.sh ├── manifest.json ├── screenshot.png ├── screenshot2.png ├── searchBox.png └── xianyu.js /.gitignore: -------------------------------------------------------------------------------- 1 | xianyu.zip 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 FengFan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 闲鱼搜索 2 | ### 一个解锁闲鱼搜索框的Chrome插件! 3 | 4 | ### Update 2018.11.28 5 | 1. 适配最新版Web端闲鱼 6 | 7 | 8 | ![searchBox.png](https://github.com/oct16/xianyu_search/blob/master/searchBox.png) 9 | 10 | --------------------- 11 | 12 | ### 安装插件 13 | [闲鱼搜索](https://chrome.google.com/webstore/detail/%E9%97%B2%E9%B1%BC%E6%90%9C%E7%B4%A2/mnoondodamegeggegiadbdfpkekhimpk)(欲打开此链接需要科学上网) 14 | 15 | 16 | ![](https://github.com/oct16/xianyu_search/blob/master/screenshot2.png) 17 | ![](https://github.com/oct16/xianyu_search/blob/master/screenshot.png) 18 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oct16/xianyu/833cb360f5be86e67bce58219585ebbe6b571cff/icon.png -------------------------------------------------------------------------------- /makeZip.sh: -------------------------------------------------------------------------------- 1 | zip xianyu.zip ./* 2 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "闲鱼搜索", 3 | "description": "显示闲鱼搜索框", 4 | "version": "1.0.4", 5 | "browser_action": { 6 | "default_icon": "icon.png" 7 | }, 8 | "icons": { 9 | "16": "icon.png", 10 | "32": "icon.png", 11 | "64": "icon.png", 12 | "128": "icon.png" 13 | }, 14 | "content_scripts": [ 15 | { 16 | "matches": [ 17 | "https://s.2.taobao.com/*", 18 | "https://2.taobao.com/*" 19 | ], 20 | "js": ["xianyu.js"] 21 | } 22 | ], 23 | "manifest_version": 2 24 | } 25 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oct16/xianyu/833cb360f5be86e67bce58219585ebbe6b571cff/screenshot.png -------------------------------------------------------------------------------- /screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oct16/xianyu/833cb360f5be86e67bce58219585ebbe6b571cff/screenshot2.png -------------------------------------------------------------------------------- /searchBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oct16/xianyu/833cb360f5be86e67bce58219585ebbe6b571cff/searchBox.png -------------------------------------------------------------------------------- /xianyu.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | const TARGET_HOST = '2.taobao.com' 4 | const TARGET_PATH = '/' 5 | 6 | const { 7 | host, 8 | pathname 9 | } = location; 10 | 11 | const searchBox = document.createElement("div") 12 | searchBox.className = "idle-search" 13 | searchBox.innerHTML = '
' + 14 | '' + 15 | '' + 16 | '' + 17 | '
' 19 | const searchBoxStyle = ` 20 | .idle-search { 21 | position: absolute; 22 | left: 234px; 23 | top: -8px; 24 | width: 222px; 25 | height: 36px; 26 | background-color: #333 27 | } 28 | 29 | .tab-wrap { 30 | position: relative; 31 | } 32 | 33 | .input-search { 34 | width: 164px; 35 | height: 32px; 36 | padding: 0 10px; 37 | margin: 0; 38 | border: 0; 39 | outline: 0; 40 | position: absolute; 41 | left: 2px; 42 | top: 2px; 43 | font-size: 13px 44 | } 45 | 46 | .btn-search { 47 | display: block; 48 | width: 36px; 49 | height: 36px; 50 | position: absolute; 51 | top: 0; 52 | right: 0; 53 | color: #fff; 54 | background-color: #333; 55 | border: 0; 56 | margin: 0; 57 | padding: 0; 58 | cursor: pointer; 59 | outline: 0 60 | } 61 | 62 | .btn-search .iconfont { 63 | font-size: 18px 64 | } 65 | 66 | .btn-search .search-img { 67 | position: absolute; 68 | right: -65px; 69 | top: -13px; 70 | display: block; 71 | width: 79px; 72 | height: 60px; 73 | background: url(//gtms02.alicdn.com/tps/i2/TB1VqSxHVXXXXb.XVXXqw4SJXXX-79-60.png) no-repeat 0 0; 74 | _background: 0 0; 75 | _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/', sizingMethod='scale'); 76 | zoom:1 77 | } 78 | 79 | .iconfont { 80 | font-family: xy-iconfont; 81 | font-size: 14px; 82 | font-style: normal 83 | } 84 | 85 | @font-face { 86 | font-family: xy-iconfont; 87 | src: url(//at.alicdn.com/t/font_1432608908_2844584.eot); 88 | src: url(//at.alicdn.com/t/font_1432608908_2844584.eot?#iefix) format('embedded-opentype'),url(//at.alicdn.com/t/font_1432608908_2844584.woff) format('woff'),url(//at.alicdn.com/t/font_1432608908_2844584.ttf) format('truetype'),url(//at.alicdn.com/t/font_1432608908_2844584.svg#iconfont) format('svg') 89 | } 90 | ` 91 | 92 | if (host === TARGET_HOST && pathname === TARGET_PATH) { 93 | const domTarget = document.querySelector('.tab-wrap') 94 | domTarget.appendChild(searchBox) 95 | inserCss(searchBoxStyle) 96 | } else { 97 | const J_IdleHeader = document.getElementById("J_IdleHeader") 98 | J_IdleHeader.appendChild(searchBox) 99 | const keyWords = document.querySelector("#J_SearchFilterInput").value 100 | const searchInput = document.getElementById("J_HeaderSearchQuery") 101 | searchInput.value = keyWords 102 | const style = ` 103 | .download-layer { 104 | display: none; 105 | } 106 | ` 107 | inserCss(style) 108 | } 109 | 110 | function inserCss(style) { 111 | const css = document.createElement('style') 112 | css.type = 'text/css' 113 | css.appendChild(document.createTextNode(style)); 114 | document.getElementsByTagName("head")[0].appendChild(css); 115 | } 116 | })(); --------------------------------------------------------------------------------