// ==UserScript== // @name Shopee 悬浮按钮 // @namespace http://tampermonkey.net/ // @version 1.3.0.5 // @license GPL Rayu & Pixmi // @description 添加快捷入口并移除 Shopee 追踪器 // @author Rayu & Pixmi // @match https://seller.shopee.tw/* // @exclude https://seller.shopee.tw/webchat/conversations // @match *://shopee.tw/* // @match *://shopee.ph/* // @match *://shopee.sg/* // @match *://shopee.com.my/* // @icon https://icons.duckduckgo.com/ip2/shopee.com.ico // @grant none // @require http://code.jquery.com/jquery-3.6.0.min.js // @run-at document-body // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 代码1 - 悬浮按钮 const buttons = [ { id: 'button1', content: '待
出货', link: 'https://seller.shopee.tw/portal/sale/shipment?type=toship' }, { id: 'button2', content: '我的商品', link: 'https://seller.shopee.tw/portal/product/list/all?page=1&size=48' }, { id: 'button3', content: '商品分析', link: 'https://seller.shopee.tw/datacenter/product/overview' }, { id: 'button4', content: '我的广告', link: 'https://seller.shopee.tw/portal/marketing/pas/assembly' }, { id: 'button5', content: '行销活动', link: 'https://seller.shopee.tw/portal/marketing' }, { id: 'button6', content: '退貨退款', link: 'https://seller.shopee.tw/portal/sale/return' } ]; const floatingButtonsContainer = document.createElement('div'); floatingButtonsContainer.id = 'floating-buttons-container'; document.body.appendChild(floatingButtonsContainer); buttons.forEach(button => { const buttonElement = document.createElement('a'); buttonElement.id = button.id; buttonElement.className = 'floating-button'; buttonElement.href = button.link; buttonElement.target = button.id === 'button10' ? '_self' : '_blank'; buttonElement.innerHTML = button.content; floatingButtonsContainer.appendChild(buttonElement); }); const customStyle = document.createElement('style'); customStyle.innerHTML = ` #floating-buttons-container { display: flex; flex-direction: column; position: fixed; top: 50%; right: 5px; transform: translateY(-50%); z-index: 9999; } .floating-button { display: flex; align-items: center; justify-content: center; background-color: rgba(238, 77, 45); color: #ffffff; width: 50px; height: 50px; border-radius: 5px; font-weight: bold; font-size: 18px; margin-top: 10px; text-align: center; } /* 添加的样式 */ .route-portal-marketing-pas-assembly .ads-index, .route-portal-marketing-pas .ads-index { width: 1800px !important; } document.querySelector("#app > div.app-container > div > div > div > div > div.home-header-wrap") { max-width: 1800px; } /* 廣告顶栏 */ .home-header-wrap[data-v-36b8b927] { max-width: 1750px !important; } /* 公告栏 */ .to-do-list-container[data-v-03bbbee4] { width: 1750px !important; } /* 数据总览 */ .main-content .list-index .list-index-main[data-v-23cc6630]{ width: 1750px !important; } /* 详细数据 */ .shopee-table[data-v-4082dc0a]{ width: 1750px !important; } .route-portal-marketing-pas-assembly .page-container .page-content-wrapper, .route-portal-marketing-pas .page-container .page-content-wrapper{ width: 1800px !important; } .route-portal-marketing-pas-product .full-screen-container .current-shop-view, .route-portal-marketing-pas-product .full-screen-container .module-page-index{ width: 1800px!important; } .product-edit[data-v-c48fecda] .edit-main, .product-edit[data-v-c48fecda] .edit-row-right-full { width: 1100px !important; max-width: 1100px !important; } /* 在特定URL生效的样式 */ body.route-portal-marketing-pas-assembly #app > div.app-container > div > div { margin-left: 30px; } `; document.head.appendChild(customStyle); // 代码2 - 移除追踪器 const URL = window.location.href; const urlRegex = new RegExp(/\-i\.([\d]+)\.([\d]+)/); if (URL.match(urlRegex)) { let match = URL.match(urlRegex); window.location.replace(`${window.location.origin}/product/${match[1]}/${match[2]}`); } else { const rootmatch = document.evaluate('//div[@id="main"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); const rootnode = rootmatch.singleNodeValue; if (rootnode) { const callback = (mutationsList, observer) => { for (const mutation of mutationsList) { const target = mutation.target; if (target.nodeName !== 'DIV') continue; const links = target.querySelectorAll('a'); if (links.length) { for (const link of links) { let match = link.href.match(urlRegex); if (!match) continue; link.href = `${window.location.origin}/product/${match[1]}/${match[2]}`; } } else { const link = target.closest('a') || false; if (!link) continue; let match = link.href.match(urlRegex); if (!match) continue; link.href = `${window.location.origin}/product/${match[1]}/${match[2]}`; } } } const observer = new MutationObserver(callback); // start observe observer.observe(document.body, { attributes: true, childList: true, subtree: true }); } } })();