// ==UserScript== // @name Chrome-Stats & Web Store 扩展助手 // @namespace https://workbuddy.app // @version 1.2.0 // @description 在 chrome-stats.com 与 Chrome 网上应用店扩展页提取扩展 ID,提供一键复制、直达下载与统计入口。 // @author WorkBuddy // @match https://chrome-stats.com/d/* // @match https://chrome.google.com/webstore/detail/* // @match https://chromewebstore.google.com/detail/* // @grant GM_setClipboard // @grant GM_addStyle // @run-at document-end // @license MIT // ==/UserScript== (function () { 'use strict'; function getExtensionId() { const u = location.href; // chrome-stats.com/d//... let m = u.match(/chrome-stats\.com\/d\/([a-p]{32})/); if (m) return m[1]; // webstore 新版/旧版: /detail// m = u.match(/[\?\/]detail\/[^/]+\/([a-p]{32})/); if (m) return m[1]; // 兜底: 任意 32 位小写字母 a-p m = u.match(/([a-p]{32})/); if (m) return m[1]; return null; } const id = getExtensionId(); if (!id) return; GM_addStyle(` #om-helper { position: fixed; right: 16px; bottom: 16px; z-index: 2147483647; font: 13px/1.4 system-ui, sans-serif; background: #fff; border: 1px solid #d0d7de; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.15); padding: 12px 14px; max-width: 260px; } #om-helper .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } #om-helper .hd b { color: #24292f; } #om-helper img { width: 28px; height: 28px; border-radius: 6px; } #om-helper .row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; } #om-helper code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; color: #cf222e; font-family: monospace; } #om-helper a, #om-helper button { text-decoration: none; font-size: 12px; background: #0969da; color: #fff; border: none; border-radius: 6px; padding: 5px 9px; cursor: pointer; } #om-helper a.sec { background: #6e7781; } `); const ICON = 'https://lh3.googleusercontent.com/KcVnsDFl2Ud1uOdpJ93CNxLKG7KfLE_FYBMm7sCxHZxNf_QCas_jPDaEGyXX8X0cm5kTm3mvIKTFMRSAR1ZTY_y3=rw-s96'; const panel = document.createElement('div'); panel.id = 'om-helper'; panel.innerHTML = `
icon扩展 ID 提取
${id}
下载页 统计
`; document.body.appendChild(panel); document.getElementById('om-copy').addEventListener('click', function () { GM_setClipboard(id); this.textContent = '已复制!'; const self = this; setTimeout(() => (self.textContent = '复制 ID'), 1500); }); })();