{"id":879,"date":"2026-04-08T09:22:55","date_gmt":"2026-04-08T01:22:55","guid":{"rendered":"http:\/\/47.100.88.125\/?page_id=879"},"modified":"2026-04-09T14:20:52","modified_gmt":"2026-04-09T06:20:52","slug":"%e6%96%87%e6%9c%ac%e6%95%8f%e6%84%9f%e8%af%8d%e6%a0%87%e8%ae%b0","status":"publish","type":"page","link":"https:\/\/www.05621997.xyz\/index.php\/tools\/%e6%96%87%e6%9c%ac%e6%95%8f%e6%84%9f%e8%af%8d%e6%a0%87%e8%ae%b0\/","title":{"rendered":"\u6587\u672c\u654f\u611f\u8bcd\u6807\u8bb0"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"879\" class=\"elementor elementor-879\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8280307 e-con-full e-flex e-con e-parent\" data-id=\"8280307\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3b8a96a elementor-widget elementor-widget-heading\" data-id=\"3b8a96a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">\u6587\u672c\u654f\u611f\u8bcd\u6807\u8bb0<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-1f4ef15 e-con-full e-flex e-con e-parent\" data-id=\"1f4ef15\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-0b95a72 elementor-widget elementor-widget-html\" data-id=\"0b95a72\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t    <div class=\"custom-swf-container\">\n        \n        <div class=\"custom-swf-input-box\">\n            <textarea id=\"custom-swf-origin-input\" class=\"custom-swf-input\" placeholder=\"\u8bf7\u7c98\u8d34\u6216\u8f93\u5165\u9700\u8981\u5904\u7406\u7684\u6587\u7ae0\u5185\u5bb9...\"><\/textarea>\n        <\/div>\n\n        \n        <div class=\"custom-swf-btn-group\">\n            <button id=\"custom-swf-highlight-btn\" class=\"custom-swf-btn custom-swf-btn-highlight\" disabled>\n                \ud83d\udd0d \u9ad8\u4eae\u663e\u793a\u654f\u611f\u8bcd\n            <\/button>\n            <button id=\"custom-swf-remove-btn\" class=\"custom-swf-btn custom-swf-btn-remove\" disabled>\n                \ud83d\uddd1\ufe0f \u4e00\u952e\u53bb\u9664\u654f\u611f\u8bcd\n            <\/button>\n        <\/div>\n\n        \n        <div class=\"custom-swf-preview-box\">\n            <div id=\"custom-swf-highlight-preview\" class=\"custom-swf-preview-content\">\n                \u654f\u611f\u8bcd\u9ad8\u4eae\u9884\u89c8\u533a\u57df\n            <\/div>\n        <\/div>\n\n        \n        <div class=\"custom-swf-result-box\">\n            <textarea id=\"custom-swf-result-output\" class=\"custom-swf-result-input\" readonly placeholder=\"\u53bb\u9664\u654f\u611f\u8bcd\u540e\u7684\u5185\u5bb9\u5c06\u663e\u793a\u5728\u8fd9\u91cc...\"><\/textarea>\n            <button id=\"custom-swf-copy-btn\" class=\"custom-swf-copy-btn\">\ud83d\udccb \u4e00\u952e\u590d\u5236<\/button>\n        <\/div>\n    <\/div>\n\n    <style>\n        \n        .custom-swf-container * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n            font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n        }\n        .custom-swf-container {\n            width: 900px;\n            max-width: 100%;\n            margin: 0 auto;\n            padding: 24px;\n            background: #f9fafb;\n            border-radius: 16px;\n            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);\n        }\n        .custom-swf-input-box {\n            margin-bottom: 20px;\n        }\n        .custom-swf-input {\n            width: 100%;\n            min-height: 180px;\n            padding: 16px;\n            border: 1px solid #e5e7eb;\n            border-radius: 12px;\n            font-size: 15px;\n            line-height: 1.6;\n            resize: vertical;\n            outline: none;\n            transition: border-color 0.2s ease;\n        }\n        .custom-swf-input:focus {\n            border-color: #4f46e5;\n        }\n        .custom-swf-btn-group {\n            display: flex;\n            gap: 16px;\n            margin-bottom: 20px;\n        }\n        .custom-swf-btn {\n            flex: 1;\n            padding: 14px 20px;\n            border: none;\n            border-radius: 12px;\n            font-size: 15px;\n            font-weight: 500;\n            cursor: pointer;\n            transition: all 0.2s ease;\n        }\n        .custom-swf-btn:disabled {\n            opacity: 0.5;\n            cursor: not-allowed;\n            transform: none;\n        }\n        .custom-swf-btn-highlight {\n            background: #8b5cf6;\n            color: #fff;\n        }\n        .custom-swf-btn-highlight:hover:not(:disabled) {\n            background: #7c3aed;\n        }\n        .custom-swf-btn-remove {\n            background: #ef4444;\n            color: #fff;\n        }\n        .custom-swf-btn-remove:hover:not(:disabled) {\n            background: #dc2626;\n        }\n        .custom-swf-preview-box {\n            margin-bottom: 20px;\n            padding: 16px;\n            min-height: 100px;\n            background: #fff;\n            border: 1px solid #e5e7eb;\n            border-radius: 12px;\n            line-height: 1.6;\n        }\n        .custom-swf-preview-content {\n            font-size: 15px;\n            color: #374151;\n            white-space: pre-wrap;\n            word-break: break-word;\n        }\n        .custom-swf-highlight-text {\n            background: #fef3c7;\n            color: #92400e;\n            padding: 2px 6px;\n            border-radius: 4px;\n            font-weight: 500;\n        }\n        .custom-swf-result-box {\n            position: relative;\n            margin-bottom: 8px;\n        }\n        .custom-swf-result-input {\n            width: 100%;\n            min-height: 180px;\n            padding: 16px;\n            padding-right: 100px;\n            border: 1px solid #e5e7eb;\n            border-radius: 12px;\n            font-size: 15px;\n            line-height: 1.6;\n            resize: vertical;\n            outline: none;\n            background: #fff;\n            color: #374151;\n        }\n        .custom-swf-copy-btn {\n            position: absolute;\n            bottom: 16px;\n            right: 16px;\n            padding: 8px 12px;\n            background: #10b981;\n            color: #fff;\n            border: none;\n            border-radius: 8px;\n            font-size: 13px;\n            cursor: pointer;\n            transition: background 0.2s ease;\n        }\n        .custom-swf-copy-btn:hover {\n            background: #059669;\n        }\n        .custom-swf-copy-btn:active {\n            transform: scale(0.98);\n        }\n        @media (max-width: 768px) {\n            .custom-swf-container {\n                padding: 16px;\n            }\n            .custom-swf-btn-group {\n                flex-direction: column;\n                gap: 12px;\n            }\n            .custom-swf-btn {\n                width: 100%;\n            }\n        }\n    <\/style>\n\n    <script>\n        \n        document.addEventListener('DOMContentLoaded', function() {\n            \n            const restApiUrl = 'https:\/\/www.05621997.xyz\/index.php\/wp-json\/custom-swf\/v1\/words';\n            \n            \n            const originInput = document.getElementById('custom-swf-origin-input');\n            const highlightBtn = document.getElementById('custom-swf-highlight-btn');\n            const removeBtn = document.getElementById('custom-swf-remove-btn');\n            const previewBox = document.getElementById('custom-swf-highlight-preview');\n            const resultOutput = document.getElementById('custom-swf-result-output');\n            const copyBtn = document.getElementById('custom-swf-copy-btn');\n            \n            \n            let currentSensitiveWords = [];\n            let isLexiconReady = false;\n            \n            \n            function escapeRegExp(str) {\n                if (!str) return '';\n                return str.replace(\/[.*+?^${}()|[\\]\\\\]\/g, '\\\\$&');\n            }\n            \n            \n            function escapeHtml(str) {\n                if (!str) return '';\n                return str.replace(\/[&<>]\/g, function(m) {\n                    if (m === '&') return '&amp;';\n                    if (m === '<') return '&lt;';\n                    if (m === '>') return '&gt;';\n                    return m;\n                });\n            }\n            \n            \n            function getSensitiveRegex() {\n                if (!currentSensitiveWords.length) {\n                    return \/(?!)\/g;\n                }\n                const escapedWords = currentSensitiveWords.map(w => escapeRegExp(w)).filter(w => w);\n                if (escapedWords.length === 0) return \/(?!)\/g;\n                return new RegExp(escapedWords.join('|'), 'gi');\n            }\n            \n            \n            function updateButtons() {\n                const enabled = isLexiconReady && currentSensitiveWords.length > 0;\n                highlightBtn.disabled = !enabled;\n                removeBtn.disabled = !enabled;\n            }\n            \n            \n            async function loadSensitiveWords() {\n                try {\n                    previewBox.innerHTML = '\u23f3 \u6b63\u5728\u52a0\u8f7d\u654f\u611f\u8bcd\u5e93...';\n                    const response = await fetch(restApiUrl, {\n                        method: 'GET',\n                        headers: { 'Content-Type': 'application\/json' }\n                    });\n                    if (!response.ok) throw new Error(`HTTP ${response.status}`);\n                    const words = await response.json();\n                    if (Array.isArray(words)) {\n                        currentSensitiveWords = words.filter(w => w && typeof w === 'string').map(w => w.trim());\n                        isLexiconReady = true;\n                        previewBox.innerHTML = `\u2705 \u654f\u611f\u8bcd\u5e93\u52a0\u8f7d\u6210\u529f\uff0c\u5171 ${currentSensitiveWords.length} \u4e2a\u8bcd\u3002\u73b0\u5728\u53ef\u4ee5\u8fdb\u884c\u9ad8\u4eae\u6216\u53bb\u9664\u64cd\u4f5c\u3002`;\n                    } else {\n                        throw new Error('\u8fd4\u56de\u6570\u636e\u683c\u5f0f\u9519\u8bef');\n                    }\n                } catch (err) {\n                    console.error('\u52a0\u8f7d\u654f\u611f\u8bcd\u5e93\u5931\u8d25:', err);\n                    previewBox.innerHTML = '\u274c \u654f\u611f\u8bcd\u5e93\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u786e\u4fddWordPress REST API\u53ef\u7528\uff0c\u5e76\u5728\u540e\u53f0\u8bbe\u7f6e\u4e2d\u6dfb\u52a0\u654f\u611f\u8bcd\u3002';\n                    isLexiconReady = false;\n                    currentSensitiveWords = [];\n                } finally {\n                    updateButtons();\n                }\n            }\n            \n            \n            function highlight() {\n                if (!isLexiconReady || currentSensitiveWords.length === 0) {\n                    previewBox.innerHTML = '\u26a0\ufe0f \u654f\u611f\u8bcd\u5e93\u672a\u5c31\u7eea\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\u3002';\n                    return;\n                }\n                const text = originInput.value;\n                if (!text.trim()) {\n                    previewBox.innerHTML = '\u8bf7\u5148\u5728\u8f93\u5165\u6846\u4e2d\u586b\u5199\u5185\u5bb9\u3002';\n                    return;\n                }\n                const regex = getSensitiveRegex();\n                const escapedText = escapeHtml(text);\n                const highlighted = escapedText.replace(regex, (match) => {\n                    return `<span class=\"custom-swf-highlight-text\">${escapeHtml(match)}<\/span>`;\n                });\n                previewBox.innerHTML = highlighted;\n            }\n            \n            \n            function remove() {\n                if (!isLexiconReady || currentSensitiveWords.length === 0) {\n                    resultOutput.value = '\u26a0\ufe0f \u654f\u611f\u8bcd\u5e93\u672a\u5c31\u7eea\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\u3002';\n                    return;\n                }\n                const text = originInput.value;\n                if (!text.trim()) {\n                    resultOutput.value = '\u8bf7\u5148\u5728\u8f93\u5165\u6846\u4e2d\u586b\u5199\u5185\u5bb9\u3002';\n                    return;\n                }\n                const regex = getSensitiveRegex();\n                const cleaned = text.replace(regex, '');\n                resultOutput.value = cleaned;\n            }\n            \n            \n            async function copyResult() {\n                const text = resultOutput.value;\n                if (!text || text.includes('\u26a0\ufe0f') || text.includes('\u8bf7\u5148')) {\n                    alert('\u6ca1\u6709\u53ef\u590d\u5236\u7684\u5185\u5bb9\uff0c\u8bf7\u5148\u8f93\u5165\u539f\u6587\u5e76\u6267\u884c\u53bb\u9664\u654f\u611f\u8bcd\u64cd\u4f5c');\n                    return;\n                }\n                try {\n                    if (navigator.clipboard && window.isSecureContext) {\n                        await navigator.clipboard.writeText(text);\n                        showCopySuccess();\n                    } else {\n                        resultOutput.select();\n                        const success = document.execCommand('copy');\n                        if (success) showCopySuccess();\n                        else alert('\u590d\u5236\u5931\u8d25\uff0c\u8bf7\u624b\u52a8\u590d\u5236');\n                        resultOutput.blur();\n                    }\n                } catch (err) {\n                    alert('\u590d\u5236\u5931\u8d25');\n                }\n            }\n            \n            function showCopySuccess() {\n                const original = copyBtn.textContent;\n                copyBtn.textContent = '\u2705 \u590d\u5236\u6210\u529f';\n                setTimeout(() => {\n                    copyBtn.textContent = original;\n                }, 1500);\n            }\n            \n            \n            highlightBtn.addEventListener('click', highlight);\n            removeBtn.addEventListener('click', remove);\n            copyBtn.addEventListener('click', copyResult);\n            \n            \n            loadSensitiveWords();\n        });\n    <\/script>\n    \t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u6587\u672c\u654f\u611f\u8bcd\u6807\u8bb0<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":19,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-879","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/pages\/879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=879"}],"version-history":[{"count":13,"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/pages\/879\/revisions"}],"predecessor-version":[{"id":1096,"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/pages\/879\/revisions\/1096"}],"up":[{"embeddable":true,"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/pages\/19"}],"wp:attachment":[{"href":"https:\/\/www.05621997.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}