图搜图(淘宝\天猫\京东)

try to take over the world!

  1.  
  2. // ==UserScript==
  3. // @name 图搜图(淘宝\天猫\京东)
  4. // @namespace http://tampermonkey.net/
  5. // @version 2024-03-16——0.1
  6. // @description try to take over the world!
  7. // @author Song
  8. // @match https://detail.tmall.com/item.htm?*
  9. // @match https://item.taobao.com/item.htm?*
  10. // @match https://item.jd.com/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=taobao.com
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function () {
  17. 'use strict';
  18.  
  19. window.onload = function () {
  20. console.log('页面加载完成!挂载jQ');
  21. console.log(location.origin)
  22. //如果有jq就不挂载jquery了
  23. if (typeof jQuery == 'undefined') {
  24. console.log('没有jq,开始挂载');
  25. var script = document.createElement('script');
  26. script.src = 'https://code.jquery.com/jquery-latest.js';
  27. script.type = 'text/javascript';
  28. script.onload = function () {
  29. console.log('jq加载完成,开始执行');
  30. main();
  31. }
  32. document.body.appendChild(script);
  33. } else {
  34. console.log('有jq,不挂载');
  35. main();
  36. }
  37.  
  38. }
  39.  
  40. function main() {
  41. // 重新命名$
  42. function getImgUrl() {
  43. if(location.origin === 'https://item.jd.com') {
  44. const src = $('#spec-img').attr('src')
  45. return src ? 'https:' + (src.replace(/.avif/g, "")) : ''
  46. } else {
  47. const src = $('.PicGallery--mainPic--1eAqOie').attr('src')
  48. return src ? 'https:' + (src.replace(/_.webp/g, "")) : ''
  49. }
  50. }
  51. function openLink(url) {
  52. if (!getImgUrl()) {
  53. alert('商品图片不可是视频格式!')
  54. return false
  55. }
  56. window.open(url);
  57. }
  58. const zjf = 'https://search.zhaojiafang.com/search/index/searchbyimage?images='
  59. const zyt = 'https://zhaoyuantou.com/yiFang?img='
  60. const jf = 'https://detail.91jf.com/search/image?url='
  61. var zjfUrl = zjf + getImgUrl()
  62. var zytUrl = zyt + getImgUrl()
  63. var jfUrl = jf + getImgUrl()
  64. let JfButton = $("<button id='JfButton'></button>").text("找家纺").attr('target', '_blank').attr('href', zjfUrl);
  65. let ZytButton = $("<button id='ZytButton'></button>").text("找源头").attr('target', '_blank').attr('href', zytUrl);
  66. let jfButtom = $("<button id='jfButtom'></button>").text("91家纺").attr('target', '_blank').attr('href', jfUrl);
  67. let openAllButton = $("<button id='openAllButton'></button>").text("一键打开").attr('target', '_blank');
  68. let pluginBox = $("<div id='pluginBox'></div>");
  69. pluginBox.append(JfButton).append(ZytButton).append(jfButtom).append(openAllButton);
  70. // setTimeout(() => {
  71. $('body').append(pluginBox);
  72. // 找家纺
  73. $('#JfButton').click(function () {
  74. zjfUrl = zjf + getImgUrl()
  75. openLink(zjfUrl);
  76. })
  77. // 找源头
  78. $('#ZytButton').click(function () {
  79. zytUrl = zyt + getImgUrl()
  80. openLink(zytUrl);
  81. })
  82. // 91家纺
  83. $('#jfButtom').click(function () {
  84. jfUrl = jf + getImgUrl()
  85. openLink(jfUrl);
  86. })
  87. // 一键打开三个tab
  88.  
  89. $('#openAllButton').click(function () {
  90. if (!getImgUrl()) {
  91. alert('商品图片不可是视频格式!')
  92. return false
  93. }
  94. zjfUrl = zjf + getImgUrl()
  95. zytUrl = zyt + getImgUrl()
  96. jfUrl = jf + getImgUrl()
  97. openLink(zjfUrl);
  98. openLink(zytUrl);
  99. openLink(jfUrl);
  100. })
  101. // 按钮吸顶 固定在右下角
  102. // 美化按钮
  103. $('#pluginBox').css({
  104. 'position': 'fixed',
  105. 'bottom': '30%',
  106. 'left': '30px',
  107. 'display': 'flex',
  108. 'height': '35vh',
  109. 'align-items': 'center',
  110. 'justify-content': 'space-between',
  111. 'flex-direction': 'column',
  112. })
  113.  
  114. // 按钮样式
  115. const buttonStyle = {
  116. 'background-color': '#ff6600',
  117. 'color': '#fff',
  118. 'border': 'none',
  119. 'padding': '10px 20px',
  120. 'border-radius': '10px',
  121. 'font-size': '16px',
  122. 'cursor': 'pointer',
  123. 'box-shadow': '0 2px 4px rgba(0, 0, 0, 0.2)',
  124. 'transition': 'transform 0.3s ease-in-out',
  125. };
  126.  
  127. // Add animation on hover
  128. buttonStyle['transform'] = 'scale(1)';
  129. buttonStyle['transition'] = 'transform 0.3s ease-in-out';
  130. buttonStyle['will-change'] = 'transform';
  131.  
  132. $('#JfButton').hover(
  133. function () {
  134. $(this).css('transform', 'scale(1.1)');
  135. },
  136. function () {
  137. $(this).css('transform', 'scale(1)');
  138. }
  139. );
  140.  
  141. $('#ZytButton').hover(
  142. function () {
  143. $(this).css('transform', 'scale(1.1)');
  144. },
  145. function () {
  146. $(this).css('transform', 'scale(1)');
  147. }
  148. );
  149.  
  150. $('#jfButtom').hover(
  151. function () {
  152. $(this).css('transform', 'scale(1.1)');
  153. },
  154. function () {
  155. $(this).css('transform', 'scale(1)');
  156. }
  157. );
  158.  
  159. $('#openAllButton').hover(
  160. function () {
  161. $(this).css('transform', 'scale(1.1)');
  162. },
  163. function () {
  164. $(this).css('transform', 'scale(1)');
  165. }
  166. );
  167.  
  168. $('#JfButton').css(buttonStyle);
  169. $('#ZytButton').css(buttonStyle);
  170. $('#jfButtom').css(buttonStyle);
  171. $('#openAllButton').css({
  172. ...buttonStyle,
  173. 'margin-top': '5vh',
  174. });
  175. // }, 1000);
  176. }
  177. })();

QingJ © 2025

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