// ==UserScript==
// @name 图搜图-2024/03/14
// @namespace http://tampermonkey.net/
// @version 2024-03-14_A
// @description try to take over the world!
// @author Song
// @match https://detail.tmall.com/item.htm?*
// @match https://item.taobao.com/item.htm?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=taobao.com
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// @license MIT
// ==/UserScript==
(function() {
'use strict';
window.onload = function() {
console.log('页面加载完成!挂载jQ');
function getImgUrl(){
const src = $('.PicGallery--mainPic--1eAqOie').attr('src')
return src?'https:'+(src.replace(/_.webp/g, "")):''
}
function openLink(url){
if(!getImgUrl()){
alert('请先选择sku!')
return false
}
window.open(url);
}
const zjf = 'https://search.zhaojiafang.com/search/index/searchbyimage?images='
const zyt = 'https://zhaoyuantou.com/yiFang?img='
const jf = 'https://detail.91jf.com/search/image?url='
var zjfUrl = zjf + getImgUrl()
var zytUrl = zyt + getImgUrl()
var jfUrl = jf + getImgUrl()
let JfButton=$("<button id='JfButton'></button>").text("找家纺").attr('target','_blank').attr('href',zjfUrl);
let ZytButton=$("<button id='ZytButton'></button>").text("找源头").attr('target','_blank').attr('href',zytUrl);
let jfButtom=$("<button id='jfButtom'></button>").text("91家纺").attr('target','_blank').attr('href',jfUrl);
let openAllButton=$("<button id='openAllButton'></button>").text("一键打开").attr('target','_blank');
$('.Price--priceWrap--PhF2HCi').append(openAllButton).append(jfButtom).append(ZytButton).append(JfButton);
// 找家纺
$('#JfButton').click(function(){
zjfUrl = zjf + getImgUrl()
openLink(zjfUrl);
})
// 找源头
$('#ZytButton').click(function(){
zytUrl = zyt + getImgUrl()
openLink(zytUrl);
})
// 91家纺
$('#jfButtom').click(function(){
jfUrl = jf + getImgUrl()
openLink(jfUrl);
})
// 一键打开三个tab
$('#openAllButton').click(function(){
if(!getImgUrl()){
alert('请先选择sku!')
return false
}
zjfUrl = zjf + getImgUrl()
zytUrl = zyt + getImgUrl()
jfUrl = jf + getImgUrl()
openLink(zjfUrl);
openLink(zytUrl);
openLink(jfUrl);
})
// 按钮吸顶 固定在右下角
$(window).scroll(function() {
if ($(window).scrollTop() > 200) {
$('#JfButton').css({
'position': 'fixed',
'bottom': '10px',
'z-index':'9999999',
'right': '30px'
})
$('#ZytButton').css({
'position': 'fixed',
'bottom': '10px',
'z-index':'9999999',
'right': '100px'
})
$('#jfButtom').css({
'position': 'fixed',
'bottom': '10px',
'z-index':'9999999',
'right': '170px'
})
$('#openAllButton').css({
'position': 'fixed',
'bottom': '10px',
'z-index':'9999999',
'right': '260px'
})
} else {
$('#JfButton').css({
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-30px'
})
$('#ZytButton').css({
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-100px'
})
$('#jfButtom').css({
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-170px'
})
$('#openAllButton').css({
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-260px'
})
}
});
// 美化按钮
$('#JfButton').css({
'background-color': '#ff6600',
'color': '#fff',
'border': 'none',
'padding': '5px 10px',
'border-radius': '5px',
'font-size': '14px',
'margin-left': '10px',
'cursor': 'pointer',
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-30px'
})
$('#ZytButton').css({
'background-color': '#ff6600',
'color': '#fff',
'border': 'none',
'padding': '5px 10px',
'border-radius': '5px',
'margin-left': '10px',
'font-size': '14px',
'cursor': 'pointer',
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-100px'
})
$('#jfButtom').css({
'background-color': '#ff6600',
'color': '#fff',
'border': 'none',
'padding': '5px 10px',
'border-radius': '5px',
'margin-left': '10px',
'font-size': '14px',
'cursor': 'pointer',
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-170px'
})
$('#openAllButton').css({
'background-color': '#ff6600',
'color': '#fff',
'border': 'none',
'padding': '5px 10px',
'border-radius': '5px',
'font-size': '14px',
'cursor': 'pointer',
'position': 'absolute',
'bottom': '0px',
'z-index':'9999999',
'right': '-260px'
})
}
})();