MCPcopy Create free account
hub / github.com/debbide/GeoFill / detectPageType

Function detectPageType

scripts/content.js:769–793  ·  view source on GitHub ↗

* 检测页面类型

(url, title, description)

Source from the content-addressed store, hash-verified

767 * 检测页面类型
768 */
769function detectPageType(url, title, description) {
770 const combined = `${url} ${title} ${description}`.toLowerCase();
771
772 // 按优先级检测
773 const patterns = [
774 { type: 'login', keywords: ['login', 'signin', 'sign in', 'log in', '登录', 'ログイン', '로그인'] },
775 { type: 'register', keywords: ['register', 'signup', 'sign up', 'create account', '注册', '新規登録', '会員登録', '가입'] },
776 { type: 'checkout', keywords: ['checkout', 'payment', 'order', 'cart', '结账', '支付', '购物车', '決済', 'お支払い'] },
777 { type: 'contact', keywords: ['contact', 'inquiry', 'message', '联系', '留言', 'お問い合わせ', '問い合わせ'] },
778 { type: 'survey', keywords: ['survey', 'questionnaire', 'feedback', '问卷', '调查', 'アンケート'] },
779 { type: 'profile', keywords: ['profile', 'account', 'settings', 'edit', '个人资料', '账户', 'プロフィール', '設定'] },
780 { type: 'application', keywords: ['apply', 'application', 'job', 'career', '申请', '应聘', '応募', '申込'] },
781 { type: 'subscription', keywords: ['subscribe', 'newsletter', 'mailing', '订阅', '购读'] }
782 ];
783
784 for (const { type, keywords } of patterns) {
785 for (const keyword of keywords) {
786 if (combined.includes(keyword)) {
787 return type;
788 }
789 }
790 }
791
792 return 'unknown';
793}
794
795/**
796 * 智能填写表单 (AI)

Callers 1

analyzePageContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected