// ==UserScript== // @name AI 编程订阅优惠助手(AI Coding Subscription Discount Helper) // @name:en AI 编程订阅优惠助手(AI Coding Subscription Discount Helper) // @namespace http://tampermonkey.net/ // @version 1.2.7 // @description 【第三方社区插件】在顶部提示可用优惠和活动规则([Third-party community script] Shows a top banner with available discounts and promo rules.) // @description:en 【第三方社区插件】在顶部提示可用优惠和活动规则([Third-party community script] Shows a top banner with available discounts and promo rules.) // @author YourName // @match *://*.bigmodel.cn/* // @match *://z.ai/* // @match *://platform.minimaxi.com/* // @match *://replit.com/* // @match *://*.qiniu.com/* // @match *://*.siliconflow.cn/* // @match *://*.volcengine.com/* // @match *://*.codebuddy.cn/* // @match *://*.xfyun.cn/* // @run-at document-start // @grant GM_addStyle // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/574541/AI%20%E7%BC%96%E7%A8%8B%E8%AE%A2%E9%98%85%E4%BC%98%E6%83%A0%E5%8A%A9%E6%89%8B%28AI%20Coding%20Subscription%20Discount%20Helper%29.user.js // @updateURL https://update.greasyfork.icu/scripts/574541/AI%20%E7%BC%96%E7%A8%8B%E8%AE%A2%E9%98%85%E4%BC%98%E6%83%A0%E5%8A%A9%E6%89%8B%28AI%20Coding%20Subscription%20Discount%20Helper%29.meta.js // ==/UserScript== (function () { 'use strict'; const I18N = { zh: { tooltip: '第三方社区脚本,与平台官方无关联', badge: '第三方', defaultDiscountText: '当前页面有可用优惠', guideLinkText: '[官方活动说明] →', guideLinkTitle: '查看平台活动规则', cta: '一键使用' }, en: { tooltip: 'Community script, not affiliated with the platform', badge: 'Third-party', defaultDiscountText: 'An offer is available on this page.', guideLinkText: '[Promo rules] →', guideLinkTitle: 'View the platform promotion rules', cta: 'Use now' } }; // ========================================== // 配置区域:在这里配置你的各平台邀请链接 // 可选字段: // - discountTextEn: 英文优惠文案 // - guideUrlEn: 英文规则页链接(未提供时回退到 guideUrl) // ========================================== const CONFIG = { // 1. 智谱 GLM (国内版) 'bigmodel.cn': { targetUrls: ['glm-coding', 'pay', 'pricing'], inviteLink: 'https://www.bigmodel.cn/glm-coding?ic=EVDHUUYDNB', discountText: '首次成功付费订阅且仅限于订阅【GLM Coding】服务时,可享受该订单金额5%的立减优惠', discountTextEn: 'First-time paid subscribers who subscribe to GLM Coding can receive an instant 5% discount on the order total.', buttonAction: 'url', guideUrl: 'https://docs.bigmodel.cn/cn/coding-plan/credit-campaign-rules' }, // 2. 智谱 Z.ai (国际版) 'z.ai': { targetUrls: ['pricing', 'subscribe', 'upgrade'], inviteLink: 'https://z.ai/subscribe?ic=TDAWEJFQ18', discountText: '成功支付首次订阅【GLM Coding】服务的受邀用户,将享受订单金额即时 10%的折扣!', discountTextEn: 'Invited users who complete their first GLM Coding subscription payment get an instant 10% discount on the order.', buttonAction: 'url', guideUrl: 'https://docs.z.ai/devpack/credit-campaign-rules', guideUrlEn: 'https://docs.z.ai/devpack/credit-campaign-rules' }, // 3. MiniMaxi Token Plan 'platform.minimaxi.com': { targetUrls: ['billing', 'pricing', 'subscription'], inviteLink: 'https://platform.minimaxi.com/subscribe/token-plan?code=IEQUPQdHDm&source=link', discountText: '通过邀请链接购买 Token Plan,可在结算时享受 9 折优惠', discountTextEn: 'Buy the Token Plan through the referral link to get 10% off at checkout.', buttonAction: 'url', guideUrl: 'https://platform.minimaxi.com/docs/token-plan/promotion', guideUrlEn: 'https://platform.minimaxi.com/docs/token-plan/promotion' }, // 4. Replit 'replit.com': { targetUrls: ['pricing', 'join', 'upgrade'], inviteLink: 'https://replit.com/join/jmuageupkm-maxusharmness', discountText: '订阅 Replit Core 计划,即刻获得 10 美元信用额度!', discountTextEn: 'Subscribe to Replit Core and receive $10 in credits instantly.', buttonAction: 'url', guideUrl: 'https://replit.com/refer', guideUrlEn: 'https://replit.com/refer' }, // 5. 七牛云 (DeepSeek API) 'qiniu.com': { targetUrls: ['topup', 'pricing', 'promotion'], inviteLink: 'https://s.qiniu.com/nmU7je', discountText: '完成首次体验及激活,即时获赠 1000 万 Token!', discountTextEn: 'Complete your first trial and activation to receive 10 million Tokens instantly.', buttonAction: 'url', guideUrl: 'https://www.qiniu.com/ai/promotion/invite' }, // 6. 硅基流动 (SiliconFlow) 'siliconflow.cn': { targetUrls: ['pricing', 'topup', 'billing'], inviteLink: 'https://cloud.siliconflow.cn/i/yUFjwvQd', discountText: '使用专属链接注册,获取全模型通用推理代金券!', discountTextEn: 'Register with the referral link to receive general-purpose inference coupons for all models.', buttonAction: 'url', guideUrl: 'https://cloud.siliconflow.cn/me/campaigns/inviter' }, // 7. 火山引擎(方舟 Coding Plan) 'www.volcengine.com': { targetUrls: ['codingplan', 'pricing', 'upgrade'], inviteLink: 'https://volcengine.com/L/glyaeiHZZH8/', discountText: '受邀下单享 9 折优惠', discountTextEn: 'Invited users get 10% off eligible Coding Plan orders.', buttonAction: 'url', guideUrl: 'https://www.volcengine.com/activity/codingplan' }, // 8. 腾讯云 AI 代码助手 (CodeBuddy) 'www.codebuddy.cn': { targetUrls: ['pricing', 'upgrade', 'profile'], inviteLink: 'https://www.codebuddy.cn/fission/?inviteCode=kjqyyg41iq121', discountText: '绑定推荐码,获赠高级模型对话次数或延长试用期!', discountTextEn: 'Bind the referral code to get extra premium-model chats or an extended trial period.', buttonAction: 'url', guideUrl: 'https://www.codebuddy.cn/fission/' }, // 9. 讯飞星辰 Coding Plan 'xfyun.cn': { targetUrls: ['packageSubscription', 'upgrade', 'profile'], inviteLink: 'https://maas.xfyun.cn/packageSubscription?inviteCode=MAAS-94E2A226', discountText: '¥19起,首月¥3.9最低门槛,被邀请人可获得支付金额等额礼品卡,可用于平台模型调用抵扣。', discountTextEn: 'Starting from ¥19/mo, first month as low as ¥3.9. Invitees receive a gift card equal to the payment amount, usable as credit for platform model API calls.', buttonAction: 'url', guideUrl: 'https://www.xfyun.cn/doc/spark/CodingPlanEvent.html#coding-plan-%E5%A5%BD%E5%8F%8B%E9%82%80%E8%AF%B7%E6%B4%BB%E5%8A%A8%E8%A7%84%E5%88%99' }, }; const currentHost = window.location.hostname; const currentHref = window.location.href; const preferredLocale = getPreferredLocale(); const i18n = I18N[preferredLocale]; function getPreferredLocale() { const languages = Array.isArray(navigator.languages) && navigator.languages.length ? navigator.languages : [navigator.language || '']; return languages.some((language) => typeof language === 'string' && language.toLowerCase().startsWith('zh')) ? 'zh' : 'en'; } function getLocalizedConfigValue(config, zhKey, enKey) { if (!config) return ''; if (preferredLocale === 'en' && config[enKey]) return config[enKey]; return config[zhKey] || config[enKey] || ''; } function matchesConfiguredDomain(host, domain) { const normalizedDomain = domain.replace(/^www\./, ''); return host === domain || host.endsWith(`.${domain}`) || host === normalizedDomain || host.endsWith(`.${normalizedDomain}`); } // ========================================== // 推广模块:灵动鸟 (Dynamic Island) 风格,极简优雅 // ========================================== window.addEventListener('DOMContentLoaded', () => { let matchedConfig = null; for (const [domain, config] of Object.entries(CONFIG)) { if (!matchesConfiguredDomain(currentHost, domain)) continue; matchedConfig = config; break; } if (!matchedConfig) return; if (sessionStorage.getItem('ai-discount-ignored')) return; const discountText = getLocalizedConfigValue(matchedConfig, 'discountText', 'discountTextEn') || i18n.defaultDiscountText; const guideUrl = getLocalizedConfigValue(matchedConfig, 'guideUrl', 'guideUrlEn'); const widgetHtml = `