window.siteConfig = {
    "banner_settings": {
        "enabled": true,
        "keywords": [
            "\u4f60\u6ca1\u770b\u8fc7\u7684\u706b\u5f71",
            "\u4f60\u6ca1\u770b\u8fc7\u7684\u96cf\u7530",
            "\u4f60\u6ca1\u770b\u8fc7\u7684\u67ef\u5357",
            "\u4f60\u6ca1\u73a9\u8fc7\u7684\u6e38\u620f",
            "\u4f60\u80fd\u7528\u7684\u4e0a",
            "\u5e94\u6709\u5c3d\u6709"
        ],
        "domain": "aao.netify.app",
        "positions": [
            {
                "top": "25%",
                "left": "13%"
            },
            {
                "top": "37%",
                "left": "13%"
            },
            {
                "top": "49%",
                "left": "13%"
            },
            {
                "top": "61%",
                "left": "13%"
            },
            {
                "top": "73%",
                "left": "13%"
            },
            {
                "top": "85%",
                "left": "13%"
            }
        ],
        "text_color": "#000000",
        "text_size": "11px",
        "font_weight": "bold"
    },
    "keywords": [
        {
            "text": "jm3",
            "weight": 30,
            "fixed": false,
            "color": "#ff0000"
        },
        {
            "text": "\u706b\u5f71\u540c\u4eba",
            "weight": 30,
            "fixed": false,
            "color": "#ff0000"
        },
        {
            "text": "\u56fd\u6f2b\u5973\u795e\u540c\u4eba",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u706b\u5f71\u5bfb\u4eba\u542f\u4e8b",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u706b\u5f71\u5fcd\u8005\u540c\u4eba",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u706b\u5f71\u540c\u4eba\u6e38\u620f",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u96f7\u5f71\u7684\u8001\u4f19\u8ba1",
            "weight": 32,
            "fixed": false,
            "color": "#ff0000"
        },
        {
            "text": "\u4e8c\u6b21\u5143\u706b\u5f71\u7f8e\u5973",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u67ef\u5357\u706b\u5f71\u5fcd\u8005\u540c\u4eba",
            "weight": 30,
            "fixed": false
        },
        {
            "text": "\u706b\u5f71\u5fcd\u8005",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u7eb2\u624b\u540c\u4eba\u52a8\u6f2b",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u9e23\u4eba\u96f7\u5f71\u7eb2\u624b",
            "weight": 25,
            "fixed": false
        },
        {
            "text": "\u540c\u4eba\u52a8\u6f2b",
            "weight": 13,
            "fixed": false
        },
        {
            "text": "\u706b\u5f71\u540c\u4eba\u65b0\u4f5c",
            "weight": 20,
            "fixed": true,
            "color": "#ff0000"
        },
        {
            "text": "\u540c\u4eba",
            "weight": 20,
            "fixed": false,
            "color": "#ff0000"
        }
    ],
    "keyword_settings": {
        "min_keywords": 4,
        "max_keywords": 6,
        "default_color": "#1798fc",
        "line_break_after": 3
    },
    "comments": [
        {
            "text": "\u90fd\u662f\u54e5\u4eec",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u6211\u7ad9\u5728\u539f\u5730\u7b49\u4f60",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u62b1\u6b49\u6211\u6765\u665a\u4e86",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u62b1\u6b49\u6211\u8fdf\u5230\u4e86",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u90fd\u662f\u4e00\u5bb6\u4eba",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u6211\u7b49\u4f60\u56de\u5bb6",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u89c1\u5916\u4e86\u5144\u5f1f",
            "weight": 20,
            "fixed": false
        },
        {
            "text": "\u62b1\u6b49!\u6765\u665a\u4e86",
            "weight": 20,
            "fixed": true
        }
    ],
    "comment_settings": {
        "display_count": 2,
        "domain": "aao.netify.app",
        "repeat_display": 2,
        "repeat_copy": 2,
        "separator": "<br>",
        "default_color": "#1798fc",
        "domain_positions": [
            "after",
            "after",
            "after",
            "after"
        ],
        "copy_as_text": false,
        "copy_separator": "\\n",
        "random_domains": [
            "火影区.art",
            "火影区.art",
            "火影区.art"
        ],
        "random_domain_count": 1,
        "enable_random_domains": true,
        "random_domain_position": false
    },
    "emoji_settings": {
        "enabled": true,
        "pool": [
            "[\u7cbe\u9009]",
            "[\u8272]"
        ],
        "positions": [
            "before",
            "before",
            "before",
            "after"
        ],
        "random_position": false,
        "repeat_with_comment": true
    }
};
window.keywordPool = [{"text":"jm3","weight":30,"fixed":false,"color":"#ff0000"},{"text":"\u706b\u5f71\u540c\u4eba","weight":30,"fixed":false,"color":"#ff0000"},{"text":"\u56fd\u6f2b\u5973\u795e\u540c\u4eba","weight":20,"fixed":false},{"text":"\u706b\u5f71\u5bfb\u4eba\u542f\u4e8b","weight":20,"fixed":false},{"text":"\u706b\u5f71\u5fcd\u8005\u540c\u4eba","weight":20,"fixed":false},{"text":"\u706b\u5f71\u540c\u4eba\u6e38\u620f","weight":20,"fixed":false},{"text":"\u96f7\u5f71\u7684\u8001\u4f19\u8ba1","weight":32,"fixed":false,"color":"#ff0000"},{"text":"\u4e8c\u6b21\u5143\u706b\u5f71\u7f8e\u5973","weight":20,"fixed":false},{"text":"\u67ef\u5357\u706b\u5f71\u5fcd\u8005\u540c\u4eba","weight":30,"fixed":false},{"text":"\u706b\u5f71\u5fcd\u8005","weight":20,"fixed":false},{"text":"\u7eb2\u624b\u540c\u4eba\u52a8\u6f2b","weight":20,"fixed":false},{"text":"\u9e23\u4eba\u96f7\u5f71\u7eb2\u624b","weight":25,"fixed":false},{"text":"\u540c\u4eba\u52a8\u6f2b","weight":13,"fixed":false},{"text":"\u706b\u5f71\u540c\u4eba\u65b0\u4f5c","weight":20,"fixed":true,"color":"#ff0000"},{"text":"\u540c\u4eba","weight":20,"fixed":false,"color":"#ff0000"}];
window.commentPool = [{"text":"\u90fd\u662f\u54e5\u4eec","weight":20,"fixed":false},{"text":"\u6211\u7ad9\u5728\u539f\u5730\u7b49\u4f60","weight":20,"fixed":false},{"text":"\u62b1\u6b49\u6211\u6765\u665a\u4e86","weight":20,"fixed":false},{"text":"\u62b1\u6b49\u6211\u8fdf\u5230\u4e86","weight":20,"fixed":false},{"text":"\u90fd\u662f\u4e00\u5bb6\u4eba","weight":20,"fixed":false},{"text":"\u6211\u7b49\u4f60\u56de\u5bb6","weight":20,"fixed":false},{"text":"\u89c1\u5916\u4e86\u5144\u5f1f","weight":20,"fixed":false},{"text":"\u62b1\u6b49!\u6765\u665a\u4e86","weight":20,"fixed":true}];
window.keywordSettings = {"min_keywords":4,"max_keywords":6,"default_color":"#1798fc","line_break_after":3};
window.commentSettings = {"display_count":2,"domain":"aao.netify.app","repeat_display":2,"repeat_copy":2,"separator":"<br>","default_color":"#1798fc","domain_positions":["after","after","after","after"],"copy_as_text":false,"copy_separator":"\\n","random_domains":["火影区.art","火影区.art","火影区.art"],"random_domain_count":1,"enable_random_domains":true,"random_domain_position":false};
window.bannerSettings = {"enabled":true,"keywords":["\u4f60\u6ca1\u770b\u8fc7\u7684\u706b\u5f71","\u4f60\u6ca1\u770b\u8fc7\u7684\u96cf\u7530","\u4f60\u6ca1\u770b\u8fc7\u7684\u67ef\u5357","\u4f60\u6ca1\u73a9\u8fc7\u7684\u6e38\u620f","\u4f60\u80fd\u7528\u7684\u4e0a","\u5e94\u6709\u5c3d\u6709"],"domain":"aao.netify.app","positions":[{"top":"25%","left":"13%"},{"top":"37%","left":"13%"},{"top":"49%","left":"13%"},{"top":"61%","left":"13%"},{"top":"73%","left":"13%"},{"top":"85%","left":"13%"}],"text_color":"#000000","text_size":"11px","font_weight":"bold"};
window.emojiSettings = {"enabled":true,"pool":["[\u7cbe\u9009]","[\u8272]"],"positions":["before","before","before","after"],"random_position":false,"repeat_with_comment":true};
// 生成单行评论词文本
function generateCommentLine(commentText, domain, position, index) {
    const settings = window.commentSettings || {};
    
    // 如果启用随机域名位置，则忽略传入的position参数
    if (settings.random_domain_position) {
        position = Math.random() > 0.5 ? 'before' : 'after';
    } else {
        // 使用配置的位置或默认位置
        const positions = settings.domain_positions || [];
        position = positions[index] || position || 'after';
    }
    
    return position === 'before' 
        ? domain + commentText
        : commentText + domain;
}

// 生成评论词显示文本
function generateCommentDisplay(commentText, settings) {
    let displayText = '';
    const domainPositions = settings.domain_positions || [];
    
    for (let i = 0; i < settings.repeat_display; i++) {
        if (i > 0) displayText += settings.separator;
        const lineText = generateCommentLine(commentText, settings.domain, domainPositions[i], i);
        displayText += lineText;
    }
    return displayText;
}

// 生成评论词复制文本
function generateCommentCopy(commentText, settings) {
    let copyText = '';
    const domainPositions = settings.domain_positions || [];
    
    for (let i = 0; i < settings.repeat_copy; i++) {
        if (i > 0) copyText += settings.copy_as_text ? settings.copy_separator : '\n';
        const lineText = generateCommentLine(commentText, settings.domain, domainPositions[i], i);
        copyText += lineText;
    }
    
    if (settings.copy_as_text) {
        return copyText.replace(/\n/g, settings.copy_separator);
    }
    
    return copyText;
}

// 获取评论词颜色
function getCommentColor(commentConfig, settings) {
    return commentConfig?.color || settings.default_color;
}

// 获取关键词颜色
function getKeywordColor(keywordConfig, settings) {
    return keywordConfig?.color || settings.default_color;
}

// 获取随机域名组合
function getRandomDomainCombination(commentText, settings) {
    if (!settings.enable_random_domains || !settings.random_domains || settings.random_domains.length === 0) {
        return commentText + settings.domain;
    }
    
    // 随机选择域名
    const shuffledDomains = [...settings.random_domains].sort(() => 0.5 - Math.random());
    const selectedDomains = shuffledDomains.slice(0, settings.random_domain_count);
    
    // 组合域名
    let domainCombination = '';
    selectedDomains.forEach((domain, index) => {
        if (index > 0) domainCombination += settings.random_domain_separator || ' | ';
        domainCombination += domain;
    });
    
    return commentText + domainCombination;
}

// 生成随机域名显示文本
function generateRandomCommentDisplay(commentText, settings) {
    let displayText = '';
    
    for (let i = 0; i < settings.repeat_display; i++) {
        if (i > 0) displayText += settings.separator;
        
        // 为每一行生成不同的随机域名组合
        const lineText = getRandomDomainCombination(commentText, settings);
        displayText += lineText;
    }
    return displayText;
}

// 生成随机域名复制文本
function generateRandomCommentCopy(commentText, settings) {
    let copyText = '';
    
    for (let i = 0; i < settings.repeat_copy; i++) {
        if (i > 0) copyText += settings.copy_as_text ? settings.copy_separator : '\n';
        
        // 为每一行生成不同的随机域名组合
        const lineText = getRandomDomainCombination(commentText, settings);
        copyText += lineText;
    }
    
    if (settings.copy_as_text) {
        return copyText.replace(/\n/g, settings.copy_separator);
    }
    
    return copyText;
}

// 初始化宣传图文字
function initBannerKeywords() {
    const settings = window.bannerSettings || {
        enabled: true,
        keywords: ["火影这一块", "柯南这一块", "拿走不用谢", "我在用", "桐人这一块", "你能开心就行"],
        domain: '347.bar',
        positions: [
            {top: '25%', left: '13%'},
            {top: '37%', left: '13%'},
            {top: '49%', left: '13%'},
            {top: '61%', left: '13%'},
            {top: '72%', left: '13%'},
            {top: '85%', left: '13%'}
        ],
        text_color: '#ffffff',
        text_size: '14px',
        font_weight: 'bold'
    };
    
    if (!settings.enabled) return;
    
    const overlay = document.getElementById('keywordOverlay');
    if (!overlay) return;
    
    // 处理关键词：如果指定了域名，就在每个关键词后面加上
    const keywords = settings.domain 
        ? settings.keywords.map(keyword => `${keyword}${settings.domain}`)
        : settings.keywords;
    
    keywords.forEach((keyword, index) => {
        if (index >= settings.positions.length) return;
        
        const position = settings.positions[index];
        const keywordElement = document.createElement('div');
        keywordElement.className = 'keyword-tag';
        <!-- keywordElement.textContent = keyword; -->
        keywordElement.style.top = position.top;
        keywordElement.style.left = position.left;
        keywordElement.style.color = settings.text_color;
        keywordElement.style.fontSize = settings.text_size;
        keywordElement.style.fontWeight = settings.font_weight;
        keywordElement.style.position = 'absolute';
        keywordElement.style.zIndex = '10';
        keywordElement.style.cursor = 'pointer';
        
        overlay.appendChild(keywordElement);
    });
}

// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
    initBannerKeywords();
});