通用论坛屏蔽插件

通用的论坛贴子/用户屏蔽工具

  1. // ==UserScript==
  2. // @name 通用论坛屏蔽插件
  3. // @name:en Universal Forum Block
  4. // @namespace https://github.com/Heavrnl/UniversalForumBlock
  5. // @version 1.2.0
  6. // @description 通用的论坛贴子/用户屏蔽工具
  7. // @description:en Universal forum post/user blocking tool
  8. // @author Heavrnl
  9. // @match *://*/*
  10. // @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiB2aWV3Qm94PSIwIDAgMzIgMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogICAgPCEtLSBGaWx0ZXIgTGluZXMgLS0+DQogICAgPGcgc3Ryb2tlPSIjMjE5NmYzIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+DQogICAgICAgIDxsaW5lIHgxPSI4IiB5MT0iMTAiIHgyPSIyNCIgeTI9IjEwIiBvcGFjaXR5PSIwLjE1Ii8+DQogICAgICAgIDxsaW5lIHgxPSI2IiB5MT0iMTYiIHgyPSIyNiIgeTI9IjE2IiBvcGFjaXR5PSIwLjE1Ii8+DQogICAgICAgIDxsaW5lIHgxPSI4IiB5MT0iMjIiIHgyPSIyNCIgeTI9IjIyIiBvcGFjaXR5PSIwLjE1Ii8+DQogICAgPC9nPg0KICAgIA0KICAgIDwhLS0gQmxvY2sgU3ltYm9sIC0tPg0KICAgIDxnIHN0cm9rZT0iIzIxOTZmMyIgc3Ryb2tlLXdpZHRoPSIzIiBzdHJva2UtbGluZWNhcD0icm91bmQiPg0KICAgICAgICA8bGluZSB4MT0iMTAiIHkxPSIxNiIgeDI9IjIyIiB5Mj0iMTYiIHRyYW5zZm9ybT0icm90YXRlKDQ1IDE2IDE2KSIvPg0KICAgICAgICA8bGluZSB4MT0iMTAiIHkxPSIxNiIgeDI9IjIyIiB5Mj0iMTYiIHRyYW5zZm9ybT0icm90YXRlKC00NSAxNiAxNikiLz4NCiAgICA8L2c+DQo8L3N2Zz4g
  11. // @grant GM_addStyle
  12. // @grant GM_setValue
  13. // @grant GM_getValue
  14. // @grant GM_xmlhttpRequest
  15. // @grant GM_registerMenuCommand
  16. // @connect *
  17. // @license MIT
  18. // ==/UserScript==
  19. (function() {
  20. 'use strict';
  21. if (window.top !== window.self) {
  22. return;
  23. }
  24. let panelVisible = true;
  25. GM_registerMenuCommand("显示/隐藏面板", function() {
  26. panelVisible = !panelVisible;
  27. const panel = document.getElementById('forum-filter-panel');
  28. if (panel) {
  29. panel.style.display = panelVisible ? 'block' : 'none';
  30. }
  31. GM_setValue('panelVisible', panelVisible);
  32. });
  33. panelVisible = GM_getValue('panelVisible', true);
  34. GM_addStyle(` #forum-filter-panel { position: fixed; bottom: 0; z-index: 9999; background: #fff; border: 1px solid #ccc; border-radius: 4px; box-shadow: 0 0 10px rgba(0,0,0,0.1); font-family: Arial, sans-serif; transition: all 0.3s ease; width: 400px; user-select: none; transform: translateY(calc(100% - 25px)); } #forum-filter-panel:not(.click-mode):hover, #forum-filter-panel:not(.click-mode):focus-within { transform: translateY(0); width: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 290 : 400; max-width: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? Math.min(290, window.innerWidth * 0.9) : undefined; } #forum-filter-panel.click-mode.expanded { transform: translateY(0) !important; width: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 290 : 400; max-width: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? Math.min(290, window.innerWidth * 0.9) : undefined; } #forum-filter-panel.click-mode:not(.expanded), #forum-filter-panel:not(.click-mode):not(:hover):not(:focus-within) { width: 50px; max-width: 200px; min-width: 30px; } #forum-filter-panel:not(.click-mode):hover .panel-content, #forum-filter-panel:not(.click-mode):focus-within .panel-content, #forum-filter-panel.click-mode.expanded .panel-content { opacity: 1; visibility: visible; pointer-events: auto; } #forum-filter-panel:not(.click-mode):not(:hover):not(:focus-within) .panel-content, #forum-filter-panel.click-mode:not(.expanded) .panel-content { opacity: 0; visibility: hidden; pointer-events: none; } .panel-settings-btn { display: flex !important; align-items: center !important; justify-content: center !important; padding: 6px 10px !important; background: #2196F3 !important; color: white !important; border: none !important; border-radius: 4px !important; cursor: pointer !important; font-size: 13px !important; font-weight: 500 !important; transition: all 0.2s ease !important; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important; text-decoration: none !important; user-select: none !important; position: absolute !important; top: 10px !important; right: 10px !important; } .panel-settings-btn:hover { background: #1976D2 !important; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15) !important; transform: translateY(-1px) !important; } .panel-settings-btn:active { background: #1565C0 !important; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; transform: translateY(0) !important; } .panel-settings-btn::before { margin-right: 6px !important; font-size: 16px !important; } .panel-content { padding: 10px 15px; padding-top: 30px !important; max-height: 600px; overflow-y: auto; background: #fff; border-radius: 4px; transition: opacity 0.2s ease, visibility 0.2s ease; position: relative; } .array-editor-toggle { width: 100%; padding: 6px; background: white; border: none; border-radius: 3px; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; color: #000; font-weight: 600; font-size: 14px; font:bold 14px Arial, sans-serif !important; } .domain-enabled-label { font-size: 14px !important; color: #333 !important; display: flex !important; align-items: center !important; } .domain-enabled-label #domain-enabled { font-size: 14px !important; color: #333 !important; margin-right: 6px !important; } .array-editor-toggle:hover { background: #eee; } #forum-filter-panel .config-section-toggle.collapsed { margin: 3px; padding: 4px 8px; border: none; background: #f9f9f9; cursor: pointer; width: calc(100% - 6px); text-align: left; } #forum-filter-panel .config-section-toggle.collapsed:hover { background: #e5e5e5; } .panel-tab { box-sizing: content-box !important; padding: 3px; background: #f5f5f5; border-bottom: 1px solid #ddd; cursor: pointer; display: flex; justify-content: center; align-items: center; font-size: 14px; height: 14px; white-space: nowrap; overflow: hidden; } .panel-tab:hover { background: #e8e8e8; } #forum-filter-panel label { display: block; margin: 5px 0; } #forum-filter-settings { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 0 20px rgba(0,0,0,0.2); z-index: 10000; display: none; min-width: 300px; max-width: 90%; max-height: 90vh; overflow-y: auto; } #forum-filter-settings.visible { display: block; animation: fadeIn 0.3s ease; } @keyframes fadeIn { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } } #forum-filter-settings h3 { margin: 0 0 20px 0; padding-bottom: 15px; border-bottom: 2px solid #f0f0f0; color: #333; font-size: 18px; font-weight: 600; text-align: center; } #forum-filter-settings .setting-group { margin-bottom: 20px; padding: 15px; background: #f8f9fa; border-radius: 6px; transition: all 0.2s ease; } #forum-filter-settings .setting-group:hover { background: #f0f2f5; } #forum-filter-settings .setting-group label { display: block; margin-bottom: 8px; color: #444; font-weight: 600; font-size: 14px; } #forum-filter-settings select { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; color: #333; background: #fff; cursor: pointer; transition: all 0.2s ease; } #forum-filter-settings select:hover { border-color: #2196F3; } #forum-filter-settings select:focus { border-color: #2196F3; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1); outline: none; } #forum-filter-settings input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: #ddd; border-radius: 2px; outline: none; margin: 15px 0; padding: 0; position: relative; } #forum-filter-settings .position-value, #forum-filter-settings .collapsed-width-value, #forum-filter-settings .expanded-width-value { text-align: center; font-size: 13px; color: #666; margin-top: 5px; } #forum-filter-settings .buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; padding-top: 15px; border-top: 1px solid #eee; } #forum-filter-settings .buttons button { padding: 8px 20px; border: none; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; } #forum-filter-settings .buttons button#settings-cancel { background: #f5f5f5; color: #666; } #forum-filter-settings .buttons button#settings-cancel:hover { background: #e0e0e0; color: #333; } #forum-filter-settings .buttons button#settings-save { background: #2196F3; color: white; } #forum-filter-settings .buttons button#settings-save:hover { background: #1976D2; } #settings-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 9999; display: none; animation: fadeOverlay 0.3s ease; } @keyframes fadeOverlay { from { opacity: 0; } to { opacity: 1; } } #forum-filter-settings input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: #ddd; border-radius: 2px; outline: none; margin: 15px 0; } #forum-filter-settings input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: #2196F3; border-radius: 50%; cursor: pointer; transition: all 0.2s ease; margin-top: -7px; } #forum-filter-settings input[type="range"]::-webkit-slider-thumb:hover { background: #1976D2; transform: scale(1.1); } #forum-filter-settings input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; background: #2196F3; border: none; border-radius: 50%; cursor: pointer; transition: all 0.2s ease; } #forum-filter-settings input[type="range"]::-moz-range-thumb:hover { background: #1976D2; transform: scale(1.1); } #forum-filter-settings input[type="range"]::-ms-thumb { width: 18px; height: 18px; background: #2196F3; border: none; border-radius: 50%; cursor: pointer; transition: all 0.2s ease; margin-top: 0; } #forum-filter-settings input[type="range"]::-ms-thumb:hover { background: #1976D2; transform: scale(1.1); } #forum-filter-settings input[type="range"]::-webkit-slider-runnable-track { width: 100%; height: 4px; background: #ddd; border-radius: 2px; cursor: pointer; border: none; } #forum-filter-settings input[type="range"]::-moz-range-track { width: 100%; height: 4px; background: #ddd; border-radius: 2px; cursor: pointer; border: none; } #forum-filter-settings input[type="range"]::-ms-track { width: 100%; height: 4px; background: transparent; border-color: transparent; color: transparent; cursor: pointer; } #forum-filter-settings input[type="range"]::-ms-fill-lower { background: #2196F3; border-radius: 2px; border: none; } #forum-filter-settings input[type="range"]:hover::-webkit-slider-thumb { background: #1976D2; transform: scale(1.1); } #forum-filter-settings input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); } #forum-filter-settings input[type="range"]:hover::-moz-range-thumb { background: #1976D2; transform: scale(1.1); } #forum-filter-settings input[type="range"]:active::-moz-range-thumb { transform: scale(1.2); } #forum-filter-settings input[type="range"]:hover::-ms-thumb { background: #1976D2; transform: scale(1.1); } #forum-filter-settings input[type="range"]:active::-ms-thumb { transform: scale(1.2); } #forum-filter-settings input[type="range"]::-ms-fill-upper { background: #ddd; border-radius: 2px; border: none; } .domain-info { margin-bottom: 15px !important; padding: 12px !important; border-bottom: 1px solid #eee !important; background: #f8f9fa !important; border-radius: 4px !important; position: relative !important; text-align: left !important; } .domain-info h4 { margin: 0 0 8px 0 !important; color: #333 !important; font-size: 14px !important; font-weight: 600 !important; } .domain-info .page-type { margin-bottom: 10px !important; font-size: 13px !important; color: #666 !important; } .domain-info #page-type-value { font-weight: 600 !important; color: #2196F3 !important; } .domain-enable-row { display: flex !important; align-items: center !important; gap: 8px !important; padding: 8px 12px !important; background: #f8f9fa !important; border-radius: 4px !important; margin: 10px 0 !important; border: 1px solid #e0e0e0 !important; transition: all 0.2s ease !important; } .domain-enable-row:hover { background: #f0f2f5 !important; border-color: #2196F3 !important; } #domain-enabled { position: relative !important; width: 16px !important; height: 16px !important; margin: 0 !important; padding: 0 !important; cursor: pointer !important; -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important; border: 2px solid #ccc !important; border-radius: 3px !important; background: white !important; transition: all 0.2s ease-in-out !important; vertical-align: middle !important; } #domain-enabled:checked { background: #2196F3 !important; border-color: #2196F3 !important; } #domain-enabled:checked::after { content: '' !important; position: absolute !important; left: 4px !important; top: 1px !important; width: 4px !important; height: 8px !important; border: solid white !important; border-width: 0 2px 2px 0 !important; transform: rotate(45deg) !important; } #domain-enabled:hover { border-color: #2196F3 !important; } #domain-enabled:focus { outline: none !important; box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2) !important; } #domain-enabled + label { margin: 0 !important; padding: 0 !important; cursor: pointer !important; user-select: none !important; font-size: 14px !important; color: #333 !important; line-height: 16px !important; display: inline-flex !important; align-items: center !important; } .domain-info .domain-enable-row label { flex: 1 !important; display: flex !important; align-items: center !important; margin: 0 !important; font-size: 13px !important; color: #333 !important; cursor: pointer !important; user-select: none !important; position: relative !important; padding-left: 32px !important; min-height: 24px !important; line-height: 24px !important; font-weight: 600 !important; } .domain-info .domain-enable-row input[type="checkbox"] { position: absolute !important; opacity: 0 !important; cursor: pointer !important; height: 0 !important; width: 0 !important; } .domain-info .domain-enable-row label:before { content: '' !important; position: absolute !important; left: 0 !important; top: 50% !important; transform: translateY(-50%) !important; width: 22px !important; height: 22px !important; border: 2px solid #ccc !important; border-radius: 4px !important; background-color: #fff !important; transition: all 0.2s ease-in-out !important; box-sizing: border-box !important; } .domain-info .domain-enable-row label:after { content: '' !important; position: absolute !important; left: 7px !important; top: 50% !important; transform: translateY(-65%) rotate(45deg) !important; width: 8px !important; height: 12px !important; border: solid white !important; border-width: 0 2px 2px 0 !important; opacity: 0 !important; transition: all 0.2s ease-in-out !important; } .domain-info .domain-enable-row input[type="checkbox"]:checked + label:before { background-color: #4CAF50 !important; border-color: #4CAF50 !important; } .domain-info .domain-enable-row input[type="checkbox"]:checked + label:after { opacity: 1 !important; } .domain-info .domain-enable-row input[type="checkbox"]:focus + label:before { box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2) !important; } .domain-info .domain-enable-row label:hover:before { border-color: #4CAF50 !important; } .config-section,.config-section-toggle.collapsed { margin: 8px 0; padding: 6px; background: #f9f9f9; border-radius: 4px; border: 1px solid #eee; overflow: hidden !important; } .config-section > * { max-width: 100% !important; box-sizing: border-box !important; overflow-x: hidden !important; } .array-editor > * { max-width: 100% !important; box-sizing: border-box !important; overflow-x: hidden !important; } .button-group > * { max-width: 100% !important; box-sizing: border-box !important; overflow-x: hidden !important; } .config-section[data-section="global"] { border-left: 4px solid #2196F3; } .config-section[data-section="keywords"] { border-left: 4px solid #4CAF50; } .config-section[data-section="usernames"] { border-left: 4px solid #FF9800; } .config-section[data-section="url"] { border-left: 4px solid #9C27B0; } .config-section[data-section="xpath"] { border-left: 4px solid #E91E63; } .config-section[data-section="sync"] { border-left: 4px solid #00BCD4; } .config-section[data-section="global"] .array-item { border-left-color: #2196F3 !important; } .config-section[data-section="keywords"] .array-item { border-left-color: #4CAF50 !important; } .config-section[data-section="usernames"] .array-item { border-left-color: #FF9800 !important; } .config-section[data-section="url"] .array-item { border-left-color: #9C27B0 !important; } .config-section[data-section="global"] .array-editor-toggle { color: #1565C0; } .config-section[data-section="keywords"] .array-editor-toggle { color: #2E7D32; } .config-section[data-section="usernames"] .array-editor-toggle { color: #E65100; } .config-section[data-section="url"] .array-editor-toggle { color: #6A1B9A; } .config-section[data-section="xpath"] .array-editor-toggle { color: #C2185B; } .config-section[data-section="global"] .config-section-toggle { background: #E3F2FD; color: #1565C0; } .config-section[data-section="keywords"] .config-section-toggle { background: #E8F5E9; color: #2E7D32; } .config-section[data-section="usernames"] .config-section-toggle { background: #FFF3E0; color: #E65100; } .config-section[data-section="url"] .config-section-toggle { background: #F3E5F5; color: #6A1B9A; } .config-section[data-section="xpath"] .config-section-toggle { background: #FCE4EC; color: #C2185B; } .config-section[data-section="sync"] .config-section-toggle { background: #E0F7FA; color: #0097A7; } .config-section-content { max-width: 100% !important; transition: max-height 0.3s ease, opacity 0.3s ease; max-height: 300px; opacity: 1; overflow-y: auto; padding: 8px; margin-top: 5px; background: #fff; border-radius: 4px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); } .checkbox-row { display: flex !important; justify-content: space-between !important; margin-bottom: 8px !important; gap: 10px !important; } .checkbox-row label { flex: 1 !important; display: flex !important; align-items: center !important; margin: 0 !important; font-size: 13px !important; color: #333 !important; cursor: pointer !important; user-select: none !important; position: relative !important; padding-left: 28px !important; min-height: 20px !important; line-height: 20px !important; } .checkbox-row label,.domain-enabled-label{ font-weight: unset !important; } .domain-info input[type="checkbox"]{ visibility: visible !important; } .domain-info input[type="checkbox"]:checked::after{ content: '' !important; position: absolute !important; left: 5px !important; top: 1px !important; width: 4px !important; height: 8px !important; border: solid white !important; border-width: 0 2px 2px 0 !important; transform: rotate(45deg) !important; background-color: transparent !important; } .domain-info input[type="checkbox"]::after{ border: solid transparent !important; } .checkbox-row input[type="checkbox"] { padding: 0 !important; position: absolute !important; left: 0 !important; top: 50% !important; transform: translateY(-50%) !important; margin: 0 !important; width: 18px !important; height: 18px !important; cursor: pointer !important; opacity: 1 !important; z-index: 1 !important; border: 2px solid #ccc !important; border-radius: 3px !important; background-color: #fff !important; transition: all 0.2s ease-in-out !important; visibility: visible !important; } .checkbox-row input[type="checkbox"]::after { content: '' !important; border: solid transparent !important; } .checkbox-row input[type="checkbox"]:checked::after{ background-color: transparent !important; } .checkbox-row input[type="checkbox"]:hover { border-color: #2196F3 !important; } .checkbox-row input[type="checkbox"]:focus { box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2) !important; outline: none !important; } .checkbox-row label:before { content: '' !important; position: absolute !important; left: 0 !important; top: 50% !important; transform: translateY(-50%) !important; width: 18px !important; height: 18px !important; border: 2px solid #ccc !important; border-radius: 3px !important; background-color: #fff !important; transition: all 0.2s ease-in-out !important; box-sizing: border-box !important; } .checkbox-row label:after { content: '' !important; position: absolute !important; left: 6px !important; top: 50% !important; transform: translateY(-50%) rotate(45deg) !important; width: 6px !important; height: 10px !important; border: solid white !important; border-width: 0 2px 2px 0 !important; opacity: 0 !important; transition: all 0.2s ease-in-out !important; } .checkbox-row input[type="checkbox"]:checked + label:before { background-color: #2196F3 !important; border-color: #2196F3 !important; } .checkbox-row input[type="checkbox"]:checked + label:after { opacity: 1 !important; } .checkbox-row input[type="checkbox"]:focus + label:before { box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2) !important; } .checkbox-row label:hover:before { border-color: #2196F3 !important; } .config-section[data-section="global"] .checkbox-row input[type="checkbox"]:checked + label:before { background-color: #2196F3 !important; border-color: #2196F3 !important; } .config-section[data-section="keywords"] .checkbox-row input[type="checkbox"]:checked + label:before { background-color: #4CAF50 !important; border-color: #4CAF50 !important; } .config-section[data-section="usernames"] .checkbox-row input[type="checkbox"]:checked + label:before { background-color: #FF9800 !important; border-color: #FF9800 !important; } .config-section[data-section="url"] .checkbox-row input[type="checkbox"]:checked + label:before { background-color: #9C27B0 !important; border-color: #9C27B0 !important; } .config-section[data-section="xpath"] .checkbox-row input[type="checkbox"]:checked + label:before { background-color: #E91E63 !important; border-color: #E91E63 !important; } .button-group { margin-top: 15px !important; text-align: center !important; padding: 8px 0 !important; border-top: 1px solid #eee !important; display: flex !important; flex-direction: column !important; gap: 8px !important; width: 100% !important; } .button-group button { width: 100% !important; align-items: center !important; text-align: center !important; justify-content: center !important; padding: 8px 15px !important; font-size: 13px !important; border: none !important; border-radius: 4px !important; cursor: pointer !important; background: #f5f5f5 !important; transition: background 0.2s !important; } .button-group button:hover { background: #e0e0e0 !important; } .button-group button#save-domain-config { background: #4CAF50 !important; color: white !important; } .button-group button#save-domain-config:hover { background: #45a049 !important; } .button-group button#delete-domain-config { background: #ff4444 !important; color: white !important; } .button-group button#delete-domain-config:hover { background: #ff3333 !important; } .button-group button#export-config { background: #2196F3 !important; color: white !important; } .button-group button#export-config:hover { background: #1e88e5 !important; } .button-group button#import-config, .button-group button#import-domain-config { background: #FF9800 !important; color: white !important; } .button-group button#import-config:hover, .button-group button#import-domain-config:hover { background: #f57c00 !important; } .panel-content::-webkit-scrollbar { width: 8px; } .panel-content::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; } .panel-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; } .panel-content::-webkit-scrollbar-thumb:hover { background: #aaa; } .array-editor { margin: 4px 0; border: 1px solid #eee; border-radius: 4px; padding: 6px; background: #fff; } .config-section[data-section="global"] .array-editor { border-width: 2px; border-color: #2196F3; } .config-section[data-section="keywords"] .array-editor { border-width: 2px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .config-section[data-section="usernames"] .array-editor { border-width: 2px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .config-section[data-section="url"] .array-editor { border-width: 2px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .config-section[data-section="xpath"] .array-editor { border-width: 2px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } #add-global-url, #apply-global-apply { margin-top: 3px !important; height: 33px !important; background: white; color: #333; border: 1px solid #ddd; border-bottom-width: 3px; padding: 6px 12px; transition: all 0.2s ease; border-radius: 6px; font-size: 13px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: pointer; outline: none; border-bottom-color: #2196F3; line-height: 1.4 !important; font: 13px/1.4 Arial, sans-serif !important; } #add-global-url:hover, #apply-global-apply:hover { background: #f5f5f5; transform: translateY(-1px); } #add-global-url:active, #apply-global-apply:active { transform: translateY(1px); border-bottom-width: 2px; } .array-editor-header { display: flex !important; gap: 4px !important; margin-bottom: 6px !important; align-items: center !important; flex-wrap: wrap !important; } .array-editor-header input[type="text"] { min-width: 10px !important; padding: 6px 8px !important; border: 1px solid #ddd !important; border-radius: 3px !important; font-size: 13px !important; height: 28px !important; box-sizing: border-box !important; } .array-editor-search-input { width: 100% !important; margin: 4px 0 !important; background: #f5f5f5 !important; } .array-editor .button-group-inline button { background: white; color: #333; border: 1px solid #ddd; border-bottom-width: 3px; padding: 6px 12px; transition: all 0.2s ease; border-radius: 6px; font-size: 13px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: pointer; outline: none; white-space: normal; word-break: break-word; line-height: 1.4 !important; font: 13px/1.4 Arial, sans-serif !important; } .config-section[data-section="global"] .array-editor .button-group-inline button { border-bottom-color: #42A5F5; } .config-section[data-section="global"] .array-editor .button-group-inline button:hover { border-bottom-color: #1E88E5; } .config-section[data-section="keywords"] .array-editor .button-group-inline button { border-bottom-color: #66BB6A; } .config-section[data-section="keywords"] .array-editor .button-group-inline button:hover { border-bottom-color: #43A047; } .config-section[data-section="usernames"] .array-editor .button-group-inline button { border-bottom-color: #FB8C00; } .config-section[data-section="usernames"] .array-editor .button-group-inline button:hover { border-bottom-color: #F57C00; } .config-section[data-section="url"] .array-editor .button-group-inline button { border-bottom-color: #AB47BC; } .config-section[data-section="url"] .array-editor .button-group-inline button:hover { border-bottom-color: #8E24AA; } .config-section[data-section="xpath"] .array-editor .button-group-inline button { border-bottom-color: #EC407A; } .config-section[data-section="xpath"] .array-editor .button-group-inline button:hover { border-bottom-color: #D81B60; } .array-editor .button-group-inline button:hover { background: #f5f5f5; transform: translateY(-1px); } .array-editor .button-group-inline button:active { transform: translateY(1px); border-bottom-width: 2px; } .array-editor-list { max-height: 200px; overflow-y: auto; border: 1px solid #eee; border-radius: 3px; background: #fff; margin: 4px 0; padding: 4px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); } .array-editor-list:empty { padding: 8px; text-align: center; color: #999; } .array-editor-list:empty::after { font-size: 12px; content: attr(data-empty); } .array-item:hover { background: #f1f3f5 !important; } .array-item span { flex: 1 !important; font-size: 13px !important; color: #495057 !important; line-height: 1.4 !important; margin-right: 8px !important; word-break: break-all !important; user-select: text !important; cursor: text !important; } .array-item button { width: 18px !important; height: 18px !important; min-width: 18px !important; padding: 0 !important; border: none !important; border-radius: 3px !important; background: transparent !important; color: #adb5bd !important; font-size: 14px !important; display: flex !important; align-items: center !important; justify-content: center !important; cursor: pointer !important; transition: all 0.2s !important; opacity: 0 !important; user-select: none !important; } .array-item:hover button { opacity: 1 !important; color: #495057 !important; } .array-item button:hover { background: #e9ecef !important; color: #212529 !important; } mark { background: #e9ecef; color: #495057; padding: 0 2px; border-radius: 2px; font-weight: 500; } .array-editor-list::-webkit-scrollbar { width: 6px; height: 6px; } .array-editor-list::-webkit-scrollbar-track { background: #f8f9fa; border-radius: 3px; } .array-editor-list::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 3px; transition: background 0.2s; } .array-editor-list::-webkit-scrollbar-thumb:hover { background: #adb5bd; } .array-editor-list::-webkit-scrollbar-corner { background: #f8f9fa; } .array-editor-count { background: #999; color: white; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: normal; line-height: 1.4 !important; } .array-editor-content { display: none; } .array-editor-content.expanded { display: block; } .array-editor .array-item { display: flex !important; align-items: center !important; padding: 8px !important; margin: 2px 0 !important; background: #f5f5f5 !important; border-radius: 3px !important; width: auto !important; border-left: 4px solid transparent !important; } .array-editor .array-item span { flex: 1 !important; margin-right: 10px !important; word-break: break-all !important; padding-right: 10px !important; line-height: 1.4 !important; text-align: left !important; } .array-editor .array-item button { padding: 0 !important; width: 20px !important; height: 20px !important; line-height: 1 !important; background: rgba(0, 0, 0, 0.6) !important; color: white !important; border: none !important; border-radius: 50% !important; cursor: pointer !important; font-size: 14px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; min-width: 20px !important; max-width: 20px !important; margin: 0 !important; flex-shrink: 0 !important; float: none !important; line-height: 0 !important; padding-bottom: 2px !important; } .array-editor .array-item button:hover { background: #000000 !important; } .checkbox-row { display: flex; justify-content: space-between; margin-bottom: 5px; } .checkbox-row label { flex: 1; margin-right: 10px; white-space: nowrap; } .checkbox-row label:last-child { margin-right: 0; } .config-group { margin: 5px 0; padding: 0; } .config-section-toggle { width: 100%; padding: 8px 12px; background: #f5f5f5; border: none; border-radius: 4px; text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; color: #333; font-size: 14px; font: bold 14px/1.4 Arial, sans-serif !important; } .config-section-toggle:hover { background: #e8e8e8; } .config-section-indicator { transition: transform 0.3s ease; } .config-section-toggle.collapsed .config-section-indicator { transform: rotate(-90deg); } .config-section-content { max-width: 100% !important; transition: max-height 0.3s ease, opacity 0.3s ease; max-height: 300px; opacity: 1; overflow-y: auto; padding-right: 8px; } .config-section-content::-webkit-scrollbar { width: 6px; } .config-section-content::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; } .config-section-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; } .config-section-content::-webkit-scrollbar-thumb:hover { background: #aaa; } .config-section-toggle.collapsed + .config-section-content { max-width: 100% !important; max-height: 0; opacity: 0; margin: 0; padding: 0; overflow: hidden; } #save-domain-config { background: #4CAF50 !important; color: white !important; border: none !important; border-radius: 3px !important; } #save-domain-config:hover { background: #45a049 !important; } .array-editor { margin: 4px 0; border: 1px solid #ddd; border-radius: 4px; padding: 6px; background: #fff; } .array-editor-search-input { width: 100% !important; flex: 1 1 auto !important; text-align: center !important; margin: 5px 0 !important; } .array-editor-search-input::placeholder { text-align: center !important; } .array-editor-linkimport-input { flex: 1 1 50px !important; min-width: 10px !important; margin: 4px !important; padding: 6px 12px !important; border: 1px solid #e0e0e0 !important; border-radius: 4px !important; height: 32px !important; font-size: 14px !important; box-sizing: border-box !important; transition: all 0.2s ease !important; background-color: #fafafa !important; color: #333 !important; } .array-editor-linkimport-input:hover { border-color: #bdbdbd !important; background-color: #fff !important; } .array-editor-linkimport-input:focus { border-color: #2196F3 !important; background-color: #fff !important; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important; outline: none !important; } .array-editor-additem-input,.global-url-input-row input,.array-editor-additem-input-regex { flex: 1 1 50px !important; min-width: 10px !important; margin: 4px !important; padding: 6px 12px !important; border: 1px solid #e0e0e0 !important; border-radius: 4px !important; height: 32px !important; font-size: 14px !important; box-sizing: border-box !important; transition: all 0.2s ease !important; background-color: #fafafa !important; color: #333 !important; } .array-editor-additem-input:hover ,.global-url-input-row input:hover ,.array-editor-additem-input-regex:hover{ border-color: #bdbdbd !important; background-color: #fff !important; } .array-editor-additem-input:focus ,.global-url-input-row input:focus ,.array-editor-additem-input-regex:focus { border-color: #2196F3 !important; background-color: #fff !important; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important; outline: none !important; } .array-editor-search-input { flex: 1 1 50px !important; min-width: 10px !important; margin: 4px !important; padding: 6px 12px !important; border: 1px solid #e0e0e0 !important; border-radius: 4px !important; height: 25px !important; font-size: 14px !important; box-sizing: border-box !important; transition: all 0.2s ease !important; background-color: #fafafa !important; color: #333 !important; align-items: center !important; } .array-editor-search-input:hover { border-color: #bdbdbd !important; background-color: #fff !important; } .array-editor-search-input:focus { border-color: #2196F3 !important; background-color: #fff !important; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important; outline: none !important; } .button-group-inline { display: flex !important; flex-wrap: wrap !important; gap: 2px !important; margin-left: auto !important; } .checkbox-row label:hover:before { border-color: #2196F3 !important; } .global-url-section { margin-top: 10px !important; background: #f8f9fa !important; border-radius: 4px !important; padding: 8px !important; } .global-url-input-row { display: flex !important; gap: 8px !important; margin-bottom: 8px !important; } .global-url-input-row input { flex: 1 !important; padding: 6px 12px !important; border: 1px solid #ddd !important; border-radius: 4px !important; font-size: 13px !important; } .global-url-input-row input:hover { border-color: #bdbdbd !important; background-color: #fff !important; } .global-url-input-row input:focus { border-color: #2196F3 !important; background-color: #fff !important; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important; outline: none !important; } .global-url-list { max-height: 200px !important; overflow-y: auto !important; margin-top: 8px !important; } .global-url-item { display: flex !important; align-items: center !important; justify-content: space-between !important; padding: 6px 8px !important; background: white !important; border-radius: 4px !important; margin-bottom: 4px !important; border: 1px solid #eee !important; } .global-url-item span { flex: 1 !important; margin-right: 8px !important; font-size: 13px !important; word-break: break-all !important; } .global-url-item button { width: 20px !important; height: 20px !important; min-width: 20px !important; padding: 0 !important; background: rgba(0, 0, 0, 0.6) !important; color: white !important; border: none !important; border-radius: 50% !important; cursor: pointer !important; font-size: 14px !important; display: flex !important; align-items: center !important; justify-content: center !important; transition: background 0.2s !important; } .global-url-item button:hover { background: rgba(0, 0, 0, 0.8) !important; } #time-interval { padding: 6px 8px !important; border: 1px solid #e0e0e0 !important; border-radius: 4px !important; height: 32px !important; font-size: 14px !important; background-color: #fafafa !important; color: #333 !important; cursor: pointer !important; transition: all 0.2s ease !important; box-sizing: border-box !important; display: inline-flex !important; align-items: center !important; vertical-align: middle !important; margin: 0 !important; min-width: 70px !important; width: auto !important; } #time-interval:hover { border-color: #bdbdbd !important; background-color: #fff !important; } #time-interval:focus { border-color: #2196F3 !important; background-color: #fff !important; box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important; outline: none !important; } .global-url-input-row { display: flex !important; gap: 8px !important; margin-bottom: 8px !important; align-items: center !important; } .global-url-input-row input, .global-url-input-row select, .global-url-input-row button { margin: 0 !important; height: 32px !important; box-sizing: border-box !important; } .external-links{ align-items: flex-start !important; } .global-url-input-row button{ white-space: nowrap !important; } .config-section[data-section="sync"] input { display: block !important; width: 100% !important; margin-bottom: 8px !important; padding: 6px 12px !important; border: 1px solid #ddd !important; border-radius: 4px !important; height: 32px !important; box-sizing: border-box !important; } .config-section[data-section="sync"] .config-section-content button { display: block !important; width: 100% !important; margin-bottom: 8px !important; padding: 6px 12px !important; border: 1px solid #ddd !important; border-radius: 4px !important; background-color: #fff !important; cursor: pointer !important; transition: all 0.2s !important; } .config-section[data-section="sync"] button:hover { background-color: #f5f5f5 !important; } #sync-delete { color: #ff4444 !important; border-color: #ff4444 !important; } #sync-delete:hover { background-color: #fff5f5 !important; } #sync-status { margin-top: 8px !important; padding: 8px !important; border-radius: 4px !important; background-color: #f5f5f5 !important; min-height: 20px !important; } `);
  35. const LANGUAGE_TEMPLATES = { 'zh-CN': { 'settings_title': '面板设置', 'settings_language': '语言', 'settings_expand_mode': '展开方式', 'settings_expand_hover': '悬停展开', 'settings_expand_click': '点击展开', 'settings_block_button_mode': '屏蔽按钮显示方式', 'settings_block_hover': '悬停显示', 'settings_block_always': '总是显示', 'settings_horizontal_position': '水平位置', 'settings_collapsed_width': '收起宽度', 'settings_expanded_width': '展开宽度', 'settings_cancel': '取消', 'settings_save': '保存', 'panel_top_title': '通用论坛屏蔽', 'panel_top_current_domain': '当前域名:', 'panel_top_page_type': '当前页面类型:', 'panel_top_page_type_main': '主页', 'panel_top_page_type_sub': '分页', 'panel_top_page_type_content': '内容页', 'panel_top_page_type_unknown': '未匹配页面类型', 'panel_top_enable_domain': '启用此域名配置', 'panel_top_settings': '设置', 'panel_top_settings_title': '面板设置', 'panel_top_settings_button': '⚙ 设置', 'global_config_title': '全局配置', 'global_config_keywords': '全局关键词', 'global_config_usernames': '全局用户名', 'global_config_share_keywords': '主页/内容页共享关键词', 'global_config_share_usernames': '主页/内容页共享用户名', 'global_config_linkimport_input_placeholder': '输入配置链接', 'global_config_add_global_url': '添加', 'global_config_apply_global_apply': '应用', 'keywords_config_title': '关键词配置', 'keywords_config_keywords_list_title': '关键词列表', 'keywords_config_keywords_regex_title': '关键词正则表达式', 'usernames_config_title': '用户名配置', 'usernames_config_usernames_list_title': '用户名列表', 'usernames_config_usernames_regex_title': '用户名正则表达式', 'url_patterns_title': 'URL 匹配模式', 'url_patterns_main_page_url_patterns_title': '主页URL模式', 'url_patterns_sub_page_url_patterns_title': '分页URL模式', 'url_patterns_content_page_url_patterns_title': '内容页URL模式', 'xpath_config_title': 'XPath 配置', 'xpath_config_main_and_sub_page_keywords_title': '主页/分页标题XPath', 'xpath_config_main_and_sub_page_usernames_title': '主页/分页用户XPath', 'xpath_config_content_page_keywords_title': '内容页关键词XPath', 'xpath_config_content_page_usernames_title': '内容页用户XPath', 'sync_config_title': '云端同步', 'sync_config_server_url': '服务器地址', 'sync_config_user_key': '用户密钥', 'sync_config_apply': '同步', 'sync_config_delete': '删除云端配置', 'sync_panel_status_connect_failed': '连接失败: ', 'sync_panel_status_connect_error': '连接错误: ', 'sync_panel_status_connect_success': '连接成功', 'sync_panel_status_sync_failed': '同步失败: ', 'sync_panel_status_input_error': '请先设置服务器地址和用户密钥', 'sync_panel_status_delete_success': '删除云端配置成功', 'sync_panel_status_delete_failed': '删除云端配置失败: ', 'sync_panel_status_delete_confirm': '确定要删除云端配置吗?此操作不可恢复。', 'sync_panel_status_connect_server_success': '已连接到云端', 'sync_panel_status_client_to_server_success': '本地配置已保存至云端!', 'sync_panel_status_config_updated': '已同步云端配置', 'sync_panel_status_config_conflict_1': '检测到配置冲突!', 'sync_panel_status_config_conflict_2': '云端配置时间: ', 'sync_panel_status_config_conflict_3': '本地配置时间: ', 'sync_panel_status_config_conflict_4': '是否使用云端配置? (点击确定使用云端配置,点击取消使用本地配置)', 'sync_panel_status_config_conflict_cloud_newer': '云端配置较新', 'sync_panel_status_config_conflict_local_newer': '本地配置较新', 'sync_panel_status_disconnect': '连接已断开,尝试重新连接...', 'array_editor_add_item_input_placeholder': '请输入', 'array_editor_add_item_input_placeholder_regex': '请输入正则表达式', 'array_editor_add_item': '添加', 'array_editor_add_item_title': '添加新项目', 'array_editor_clear_allitem': '清空', 'array_editor_clear_allitem_title': '清空列表', 'array_editor_search_input_placeholder': '搜索...', 'array_editor_list_empty_placeholder': '暂无数据', 'array_editor_linkimport_input_placeholder': '请输入链接', 'array_editor_linkimport_input_button': '链接导入', 'array_editor_linkimport_input_button_title': '从链接导入列表', 'array_editor_fileimport_input_button': '文件导入', 'array_editor_fileimport_input_button_title': '从文件导入列表', 'array_editor_export_button': '导出', 'array_editor_export_button_title': '导出列表到文件', 'panel_bottom_export_button': '导出配置', 'panel_bottom_export_button': '导出配置', 'panel_bottom_import_button': '导入配置', 'panel_bottom_delete_button': '删除当前域名配置', 'panel_bottom_save_button': '保存', 'alert_delete_confirm': '确定要删除吗?此操作不可恢复。', 'alert_clear_confirm': '确定要清空整个列表吗?此操作不可恢复。', 'alert_invalid_file': '请选择有效的配置文件', 'alert_import_error': '导入配置失败', 'alert_list_empty': '列表已经是空的了', 'alert_url_exists': '该URL已存在!', 'alert_enter_url': '请输入有效的链接', 'block_button_title': '屏蔽用户: ' }, 'en-US': { 'settings_title': 'Panel Settings', 'settings_language': 'Language', 'settings_expand_mode': 'Expand Mode', 'settings_expand_hover': 'Expand on Hover', 'settings_expand_click': 'Expand on Click', 'settings_block_button_mode': 'Block Button Display Mode', 'settings_block_hover': 'Show on Hover', 'settings_block_always': 'Always Show', 'settings_horizontal_position': 'Horizontal Position', 'settings_collapsed_width': 'Collapsed Width', 'settings_expanded_width': 'Expanded Width', 'settings_cancel': 'Cancel', 'settings_save': 'Save', 'panel_top_title': 'Universal Forum Filter', 'panel_top_current_domain': 'Current Domain: ', 'panel_top_page_type': 'Current Page Type: ', 'panel_top_page_type_main': 'Main Page', 'panel_top_page_type_sub': 'Sub Page', 'panel_top_page_type_content': 'Content Page', 'panel_top_page_type_unknown': 'Unknown Page Type', 'panel_top_enable_domain': 'Enable Domain Config', 'panel_top_settings': 'Settings', 'panel_top_settings_title': 'Panel Settings', 'panel_top_settings_button': '⚙ Settings', 'global_config_title': 'Global Configuration', 'global_config_keywords': 'Global Keywords', 'global_config_usernames': 'Global Usernames', 'global_config_share_keywords': 'Main/Content Page Shared Keywords', 'global_config_share_usernames': 'Main/Content Page Shared Usernames', 'global_config_linkimport_input_placeholder': 'Enter config link', 'global_config_add_global_url': 'Add', 'global_config_apply_global_apply': 'Apply', 'keywords_config_title': 'Keywords Configuration', 'keywords_config_keywords_list_title': 'Keywords List', 'keywords_config_keywords_regex_title': 'Keywords Regex', 'usernames_config_title': 'Usernames Configuration', 'usernames_config_usernames_list_title': 'Usernames List', 'usernames_config_usernames_regex_title': 'Usernames Regex', 'url_patterns_title': 'URL Patterns', 'url_patterns_main_page_url_patterns_title': 'Main Page URL Patterns', 'url_patterns_sub_page_url_patterns_title': 'Sub Page URL Patterns', 'url_patterns_content_page_url_patterns_title': 'Content Page URL Patterns', 'xpath_config_title': 'XPath Configuration', 'xpath_config_main_and_sub_page_keywords_title': 'Main/Sub Page Title XPath', 'xpath_config_main_and_sub_page_usernames_title': 'Main/Sub Page User XPath', 'xpath_config_content_page_keywords_title': 'Content Page Keywords XPath', 'xpath_config_content_page_usernames_title': 'Content Page User XPath', 'sync_config_title': 'Cloud Sync', 'sync_config_server_url': 'Server URL', 'sync_config_user_key': 'User Key', 'sync_config_apply': 'Sync', 'sync_config_delete': 'Delete Cloud Config', 'sync_panel_status_connect_failed': 'Connection Failed: ', 'sync_panel_status_connect_error': 'Connection Error: ', 'sync_panel_status_connect_success': 'Connected Successfully', 'sync_panel_status_sync_failed': 'Sync Failed: ', 'sync_panel_status_input_error': 'Please set server URL and user key first', 'sync_panel_status_delete_success': 'Cloud config deleted successfully', 'sync_panel_status_delete_failed': 'Failed to delete cloud config: ', 'sync_panel_status_delete_confirm': 'Are you sure you want to delete cloud config? This action cannot be undone.', 'sync_panel_status_connect_server_success': 'Connected to cloud', 'sync_panel_status_client_to_server_success': 'Local config saved to cloud!', 'sync_panel_status_config_updated': 'Cloud config synced', 'sync_panel_status_config_conflict_1': 'Config conflict detected!', 'sync_panel_status_config_conflict_2': 'Cloud config time: ', 'sync_panel_status_config_conflict_3': 'Local config time: ', 'sync_panel_status_config_conflict_4': 'Use cloud config? (Click OK to use cloud config, Cancel to use local config)', 'sync_panel_status_config_conflict_cloud_newer': 'Cloud config is newer', 'sync_panel_status_config_conflict_local_newer': 'Local config is newer', 'sync_panel_status_disconnect': 'Disconnected, attempting to reconnect...', 'array_editor_add_item_input_placeholder': 'Please enter', 'array_editor_add_item_input_placeholder_regex': 'Please enter regex', 'array_editor_add_item': 'Add', 'array_editor_add_item_title': 'Add New Item', 'array_editor_clear_allitem': 'Clear All', 'array_editor_clear_allitem_title': 'Clear List', 'array_editor_search_input_placeholder': 'Search...', 'array_editor_list_empty_placeholder': 'No Data', 'array_editor_linkimport_input_placeholder': 'Enter link', 'array_editor_linkimport_input_button': 'Import from Link', 'array_editor_linkimport_input_button_title': 'Import from Link', 'array_editor_fileimport_input_button': 'Import from File', 'array_editor_fileimport_input_button_title': 'Import from File', 'array_editor_export_button': 'Export', 'array_editor_export_button_title': 'Export List to File', 'panel_bottom_export_button': 'Export Config', 'panel_bottom_import_button': 'Import Config', 'panel_bottom_delete_button': 'Delete Current Domain Config', 'panel_bottom_save_button': 'Save', 'alert_delete_confirm': 'Are you sure you want to delete? This action cannot be undone.', 'alert_clear_confirm': 'Are you sure you want to clear the entire list? This action cannot be undone.', 'alert_invalid_file': 'Please select a valid configuration file', 'alert_import_error': 'Failed to import configuration', 'alert_list_empty': 'The list is already empty', 'alert_url_exists': 'This URL already exists!', 'alert_enter_url': 'Please enter a valid link', 'block_button_title': 'Block User: ' }, 'ja-JP': { 'settings_title': 'パネル設定', 'settings_language': '言語', 'settings_expand_mode': '展開モード', 'settings_expand_hover': 'ホバーで展開', 'settings_expand_click': 'クリックで展開', 'settings_block_button_mode': 'ブロックボタン表示モード', 'settings_block_hover': 'ホバーで表示', 'settings_block_always': '常に表示', 'settings_horizontal_position': '水平位置', 'settings_collapsed_width': '折りたたみ幅', 'settings_expanded_width': '展開幅', 'settings_cancel': 'キャンセル', 'settings_save': '保存', 'panel_top_title': '汎用フォーラムフィルター', 'panel_top_current_domain': '現在のドメイン:', 'panel_top_page_type': '現在のページタイプ:', 'panel_top_page_type_main': 'メインページ', 'panel_top_page_type_sub': 'サブページ', 'panel_top_page_type_content': 'コンテンツページ', 'panel_top_page_type_unknown': '不明なページタイプ', 'panel_top_enable_domain': 'このドメイン設定を有効にする', 'panel_top_settings': '設定', 'panel_top_settings_title': 'パネル設定', 'panel_top_settings_button': '⚙ 設定', 'global_config_title': 'グローバル設定', 'global_config_keywords': 'グローバルキーワード', 'global_config_usernames': 'グローバルユーザー名', 'global_config_share_keywords': 'メイン/コンテンツページ共有キーワード', 'global_config_share_usernames': 'メイン/コンテンツページ共有ユーザー名', 'global_config_linkimport_input_placeholder': '設定リンクを入力', 'global_config_add_global_url': '追加', 'global_config_apply_global_apply': '適用', 'keywords_config_title': 'キーワード設定', 'keywords_config_keywords_list_title': 'キーワードリスト', 'keywords_config_keywords_regex_title': 'キーワード正規表現', 'usernames_config_title': 'ユーザー名設定', 'usernames_config_usernames_list_title': 'ユーザー名リスト', 'usernames_config_usernames_regex_title': 'ユーザー名正規表現', 'url_patterns_title': 'URLパターン', 'url_patterns_main_page_url_patterns_title': 'メインページURLパターン', 'url_patterns_sub_page_url_patterns_title': 'サブページURLパターン', 'url_patterns_content_page_url_patterns_title': 'コンテンツページURLパターン', 'xpath_config_title': 'XPath設定', 'xpath_config_main_and_sub_page_keywords_title': 'メイン/サブページタイトルXPath', 'xpath_config_main_and_sub_page_usernames_title': 'メイン/サブページユーザーXPath', 'xpath_config_content_page_keywords_title': 'コンテンツページキーワードXPath', 'xpath_config_content_page_usernames_title': 'コンテンツページユーザーXPath', 'sync_config_title': 'クラウド同期', 'sync_config_server_url': 'サーバーアドレス', 'sync_config_user_key': 'ユーザーキー', 'sync_config_apply': '同期', 'sync_config_delete': 'クラウド設定を削除', 'sync_panel_status_connect_failed': '接続失敗: ', 'sync_panel_status_connect_error': '接続エラー: ', 'sync_panel_status_connect_success': '接続成功', 'sync_panel_status_sync_failed': '同期失敗: ', 'sync_panel_status_input_error': 'サーバーアドレスとユーザーキーを設定してください', 'sync_panel_status_delete_success': 'クラウド設定の削除に成功しました', 'sync_panel_status_delete_failed': 'クラウド設定の削除に失敗しました: ', 'sync_panel_status_delete_confirm': 'クラウド設定を削除してもよろしいですか?この操作は元に戻せません。', 'sync_panel_status_connect_server_success': 'クラウドに接続しました', 'sync_panel_status_client_to_server_success': 'ローカル設定をクラウドに保存しました!', 'sync_panel_status_config_updated': 'クラウド設定を同期しました', 'sync_panel_status_config_conflict_1': '設定の競合を検出しました!', 'sync_panel_status_config_conflict_2': 'クラウド設定の時刻: ', 'sync_panel_status_config_conflict_3': 'ローカル設定の時刻: ', 'sync_panel_status_config_conflict_4': 'クラウド設定を使用しますか?(OKでクラウド設定を使用、キャンセルでローカル設定を使用)', 'sync_panel_status_config_conflict_cloud_newer': 'クラウド設定の方が新しいです', 'sync_panel_status_config_conflict_local_newer': 'ローカル設定の方が新しいです', 'sync_panel_status_disconnect': '接続が切断されました。再接続を試みています...', 'array_editor_add_item_input_placeholder': '入力してください', 'array_editor_add_item_input_placeholder_regex': '正規表現を入力', 'array_editor_add_item': '追加', 'array_editor_add_item_title': '新規項目追加', 'array_editor_clear_allitem': 'すべてクリア', 'array_editor_clear_allitem_title': 'リストをクリア', 'array_editor_search_input_placeholder': '検索...', 'array_editor_list_empty_placeholder': 'データなし', 'array_editor_linkimport_input_placeholder': 'リンクを入力', 'array_editor_linkimport_input_button': 'リンクからインポート', 'array_editor_linkimport_input_button_title': 'リンクからインポート', 'array_editor_fileimport_input_button': 'ファイルからインポート', 'array_editor_fileimport_input_button_title': 'ファイルからインポート', 'array_editor_export_button': 'エクスポート', 'array_editor_export_button_title': 'リストをファイルにエクスポート', 'panel_bottom_export_button': '設定をエクスポート', 'panel_bottom_import_button': '設定をインポート', 'panel_bottom_delete_button': '現在のドメイン設定を削除', 'panel_bottom_save_button': '保存', 'alert_delete_confirm': '本当に削除しますか?この操作は元に戻せません。', 'alert_clear_confirm': '本当にリスト全体をクリアしますか?この操作は元に戻せません。', 'alert_invalid_file': '有効な設定ファイルを選択してください', 'alert_import_error': '設定のインポートに失敗しました', 'alert_list_empty': 'リストは既に空です', 'alert_url_exists': 'このURLは既に存在します!', 'alert_enter_url': '有効なリンクを入力してください', 'block_button_title': 'ユーザーをブロック: ' }, 'ko-KR': { 'settings_title': '패널 설정', 'settings_language': '언어', 'settings_expand_mode': '확장 모드', 'settings_expand_hover': '호버 시 확장', 'settings_expand_click': '클릭 시 확장', 'settings_block_button_mode': '차단 버튼 표시 모드', 'settings_block_hover': '호버 시 표시', 'settings_block_always': '항상 표시', 'settings_horizontal_position': '수평 위치', 'settings_collapsed_width': '축소 너비', 'settings_expanded_width': '확장 너비', 'settings_cancel': '취소', 'settings_save': '저장', 'panel_top_title': '범용 포럼 필터', 'panel_top_current_domain': '현재 도메인: ', 'panel_top_page_type': '현재 페이지 유형: ', 'panel_top_page_type_main': '메인 페이지', 'panel_top_page_type_sub': '서브 페이지', 'panel_top_page_type_content': '콘텐츠 페이지', 'panel_top_page_type_unknown': '알 수 없는 페이지 유형', 'panel_top_enable_domain': '이 도메인 설정 활성화', 'panel_top_settings': '설정', 'panel_top_settings_title': '패널 설정', 'panel_top_settings_button': '⚙ 설정', 'global_config_title': '전역 설정', 'global_config_keywords': '전역 키워드', 'global_config_usernames': '전역 사용자 이름', 'global_config_share_keywords': '메인/콘텐츠 페이지 공유 키워드', 'global_config_share_usernames': '메인/콘텐츠 페이지 공유 사용자 이름', 'global_config_linkimport_input_placeholder': '설정 링크 입력', 'global_config_add_global_url': '추가', 'global_config_apply_global_apply': '적용', 'keywords_config_title': '키워드 설정', 'keywords_config_keywords_list_title': '키워드 목록', 'keywords_config_keywords_regex_title': '키워드 정규식', 'usernames_config_title': '사용자 이름 설정', 'usernames_config_usernames_list_title': '사용자 이름 목록', 'usernames_config_usernames_regex_title': '사용자 이름 정규식', 'url_patterns_title': 'URL 패턴', 'url_patterns_main_page_url_patterns_title': '메인 페이지 URL 패턴', 'url_patterns_sub_page_url_patterns_title': '서브 페이지 URL 패턴', 'url_patterns_content_page_url_patterns_title': '콘텐츠 페이지 URL 패턴', 'xpath_config_title': 'XPath 설정', 'xpath_config_main_and_sub_page_keywords_title': '메인/서브 페이지 제목 XPath', 'xpath_config_main_and_sub_page_usernames_title': '메인/서브 페이지 사용자 XPath', 'xpath_config_content_page_keywords_title': '콘텐츠 페이지 키워드 XPath', 'xpath_config_content_page_usernames_title': '콘텐츠 페이지 사용자 XPath', 'sync_config_title': '클라우드 동기화', 'sync_config_server_url': '서버 주소', 'sync_config_user_key': '사용자 키', 'sync_config_apply': '동기화', 'sync_config_delete': '클라우드 설정 삭제', 'sync_panel_status_connect_failed': '연결 실패: ', 'sync_panel_status_connect_error': '연결 오류: ', 'sync_panel_status_connect_success': '연결 성공', 'sync_panel_status_sync_failed': '동기화 실패: ', 'sync_panel_status_input_error': '서버 주소와 사용자 키를 먼저 설정하세요', 'sync_panel_status_delete_success': '클라우드 설정 삭제 성공', 'sync_panel_status_delete_failed': '클라우드 설정 삭제 실패: ', 'sync_panel_status_delete_confirm': '클라우드 설정을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.', 'sync_panel_status_connect_server_success': '클라우드에 연결됨', 'sync_panel_status_client_to_server_success': '로컬 설정이 클라우드에 저장되었습니다!', 'sync_panel_status_config_updated': '클라우드 설정이 동기화되었습니다', 'sync_panel_status_config_conflict_1': '설정 충돌이 감지되었습니다!', 'sync_panel_status_config_conflict_2': '클라우드 설정 시간: ', 'sync_panel_status_config_conflict_3': '로컬 설정 시간: ', 'sync_panel_status_config_conflict_4': '클라우드 설정을 사용하시겠습니까? (확인을 클릭하여 클라우드 설정 사용, 취소를 클릭하여 로컬 설정 사용)', 'sync_panel_status_config_conflict_cloud_newer': '클라우드 설정이 더 최신입니다', 'sync_panel_status_config_conflict_local_newer': '로컬 설정이 더 최신입니다', 'sync_panel_status_disconnect': '연결이 끊어졌습니다. 다시 연결을 시도합니다...', 'array_editor_add_item_input_placeholder': '입력하세요', 'array_editor_add_item_input_placeholder_regex': '정규식 입력', 'array_editor_add_item': '추가', 'array_editor_add_item_title': '새 항목 추가', 'array_editor_clear_allitem': '모두 지우기', 'array_editor_clear_allitem_title': '목록 지우기', 'array_editor_search_input_placeholder': '검색...', 'array_editor_list_empty_placeholder': '데이터 없음', 'array_editor_linkimport_input_placeholder': '링크 입력', 'array_editor_linkimport_input_button': '링크에서 가져오기', 'array_editor_linkimport_input_button_title': '링크에서 가져오기', 'array_editor_fileimport_input_button': '파일에서 가져오기', 'array_editor_fileimport_input_button_title': '파일에서 가져오기', 'array_editor_export_button': '내보내기', 'array_editor_export_button_title': '목록을 파일로 내보내기', 'panel_bottom_export_button': '설정 내보내기', 'panel_bottom_import_button': '설정 가져오기', 'panel_bottom_delete_button': '현재 도메인 설정 삭제', 'panel_bottom_save_button': '저장', 'alert_delete_confirm': '정말로 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.', 'alert_clear_confirm': '정말로 전체 목록을 지우시겠습니까? 이 작업은 되돌릴 수 없습니다.', 'alert_invalid_file': '유효한 설정 파일을 선택하세요', 'alert_import_error': '설정 가져오기 실패', 'alert_list_empty': '목록이 이미 비어 있습니다', 'alert_url_exists': '이 URL이 이미 존재합니다!', 'alert_enter_url': '유효한 링크를 입력하세요', 'block_button_title': '사용자 차단: ' }, 'ru-RU': { 'settings_title': 'Настройки панели', 'settings_language': 'Язык', 'settings_expand_mode': 'Режим развертывания', 'settings_expand_hover': 'Развернуть при наведении', 'settings_expand_click': 'Развернуть при клике', 'settings_block_button_mode': 'Режим отображения кнопки блокировки', 'settings_block_hover': 'Показать при наведении', 'settings_block_always': 'Показывать всегда', 'settings_horizontal_position': 'Горизонтальное положение', 'settings_collapsed_width': 'Ширина в свернутом виде', 'settings_expanded_width': 'Ширина в развернутом виде', 'settings_cancel': 'Отмена', 'settings_save': 'Сохранить', 'panel_top_title': 'Универсальный фильтр форума', 'panel_top_current_domain': 'Текущий домен: ', 'panel_top_page_type': 'Тип текущей страницы: ', 'panel_top_page_type_main': 'Главная страница', 'panel_top_page_type_sub': 'Подстраница', 'panel_top_page_type_content': 'Страница контента', 'panel_top_page_type_unknown': 'Неизвестный тип страницы', 'panel_top_enable_domain': 'Включить настройки домена', 'panel_top_settings': 'Настройки', 'panel_top_settings_title': 'Настройки панели', 'panel_top_settings_button': '⚙ Настройки', 'global_config_title': 'Глобальные настройки', 'global_config_keywords': 'Глобальные ключевые слова', 'global_config_usernames': 'Глобальные имена пользователей', 'global_config_share_keywords': 'Общие ключевые слова главной/контентной страницы', 'global_config_share_usernames': 'Общие имена пользователей главной/контентной страницы', 'global_config_linkimport_input_placeholder': 'Введите ссылку конфигурации', 'global_config_add_global_url': 'Добавить', 'global_config_apply_global_apply': 'Применить', 'keywords_config_title': 'Настройки ключевых слов', 'keywords_config_keywords_list_title': 'Список ключевых слов', 'keywords_config_keywords_regex_title': 'Регулярные выражения ключевых слов', 'usernames_config_title': 'Настройки имен пользователей', 'usernames_config_usernames_list_title': 'Список имен пользователей', 'usernames_config_usernames_regex_title': 'Регулярные выражения имен пользователей', 'url_patterns_title': 'Шаблоны URL', 'url_patterns_main_page_url_patterns_title': 'Шаблоны URL главной страницы', 'url_patterns_sub_page_url_patterns_title': 'Шаблоны URL подстраниц', 'url_patterns_content_page_url_patterns_title': 'Шаблоны URL страниц контента', 'xpath_config_title': 'Настройки XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath заголовков главной/подстраниц', 'xpath_config_main_and_sub_page_usernames_title': 'XPath пользователей главной/подстраниц', 'xpath_config_content_page_keywords_title': 'XPath ключевых слов страницы контента', 'xpath_config_content_page_usernames_title': 'XPath пользователей страницы контента', 'sync_config_title': 'Облачная синхронизация', 'sync_config_server_url': 'Адрес сервера', 'sync_config_user_key': 'Ключ пользователя', 'sync_config_apply': 'Синхронизировать', 'sync_config_delete': 'Удалить облачную конфигурацию', 'sync_panel_status_connect_failed': 'Ошибка подключения: ', 'sync_panel_status_connect_error': 'Ошибка соединения: ', 'sync_panel_status_connect_success': 'Подключение успешно', 'sync_panel_status_sync_failed': 'Ошибка синхронизации: ', 'sync_panel_status_input_error': 'Пожалуйста, сначала установите адрес сервера и ключ пользователя', 'sync_panel_status_delete_success': 'Облачная конфигурация успешно удалена', 'sync_panel_status_delete_failed': 'Не удалось удалить облачную конфигурацию: ', 'sync_panel_status_delete_confirm': 'Вы уверены, что хотите удалить облачную конфигурацию? Это действие нельзя отменить.', 'sync_panel_status_connect_server_success': 'Подключено к облаку', 'sync_panel_status_client_to_server_success': 'Локальная конфигурация сохранена в облаке!', 'sync_panel_status_config_updated': 'Облачная конфигурация синхронизирована', 'sync_panel_status_config_conflict_1': 'Обнаружен конфликт конфигурации!', 'sync_panel_status_config_conflict_2': 'Время облачной конфигурации: ', 'sync_panel_status_config_conflict_3': 'Время локальной конфигурации: ', 'sync_panel_status_config_conflict_4': 'Использовать облачную конфигурацию? (Нажмите OK для использования облачной конфигурации, Отмена для использования локальной)', 'sync_panel_status_config_conflict_cloud_newer': 'Облачная конфигурация новее', 'sync_panel_status_config_conflict_local_newer': 'Локальная конфигурация новее', 'sync_panel_status_disconnect': 'Соединение потеряно, попытка переподключения...', 'array_editor_add_item_input_placeholder': 'Введите значение', 'array_editor_add_item_input_placeholder_regex': 'Введите регулярное выражение', 'array_editor_add_item': 'Добавить', 'array_editor_add_item_title': 'Добавить новый элемент', 'array_editor_clear_allitem': 'Очистить все', 'array_editor_clear_allitem_title': 'Очистить список', 'array_editor_search_input_placeholder': 'Поиск...', 'array_editor_list_empty_placeholder': 'Нет данных', 'array_editor_linkimport_input_placeholder': 'Введите ссылку', 'array_editor_linkimport_input_button': 'Импорт из ссылки', 'array_editor_linkimport_input_button_title': 'Импорт из ссылки', 'array_editor_fileimport_input_button': 'Импорт из файла', 'array_editor_fileimport_input_button_title': 'Импорт из файла', 'array_editor_export_button': 'Экспорт', 'array_editor_export_button_title': 'Экспорт списка в файл', 'panel_bottom_export_button': 'Экспорт настроек', 'panel_bottom_import_button': 'Импорт настроек', 'panel_bottom_delete_button': 'Удалить настройки текущего домена', 'panel_bottom_save_button': 'Сохранить', 'alert_delete_confirm': 'Вы уверены, что хотите удалить? Это действие нельзя отменить.', 'alert_clear_confirm': 'Вы уверены, что хотите очистить весь список? Это действие нельзя отменить.', 'alert_invalid_file': 'Пожалуйста, выберите действительный файл конфигурации', 'alert_import_error': 'Не удалось импортировать настройки', 'alert_list_empty': 'Список уже пуст', 'alert_url_exists': 'Этот URL уже существует!', 'alert_enter_url': 'Пожалуйста, введите действительную ссылку', 'block_button_title': 'Заблокировать пользователя: ' }, 'fr-FR': { 'settings_title': 'Paramètres du panneau', 'settings_language': 'Langue', 'settings_expand_mode': "Mode d'expansion", 'settings_expand_hover': 'Développer au survol', 'settings_expand_click': 'Développer au clic', 'settings_block_button_mode': 'Mode du bouton de blocage', 'settings_block_hover': 'Afficher au survol', 'settings_block_always': 'Toujours afficher', 'settings_horizontal_position': 'Position horizontale', 'settings_collapsed_width': 'Largeur réduite', 'settings_expanded_width': 'Largeur développée', 'settings_cancel': 'Annuler', 'settings_save': 'Enregistrer', 'panel_top_title': 'Filtre de forum universel', 'panel_top_current_domain': 'Domaine actuel : ', 'panel_top_page_type': 'Type de page actuel : ', 'panel_top_page_type_main': 'Page principale', 'panel_top_page_type_sub': 'Sous-page', 'panel_top_page_type_content': 'Page de contenu', 'panel_top_page_type_unknown': 'Type de page inconnu', 'panel_top_enable_domain': 'Activer la configuration du domaine', 'panel_top_settings': 'Paramètres', 'panel_top_settings_title': 'Paramètres du panneau', 'panel_top_settings_button': '⚙ Paramètres', 'global_config_title': 'Configuration globale', 'global_config_keywords': 'Mots-clés globaux', 'global_config_usernames': "Noms d'utilisateur globaux", 'global_config_share_keywords': 'Mots-clés partagés principale/contenu', 'global_config_share_usernames': "Noms d'utilisateur partagés principale/contenu", 'global_config_linkimport_input_placeholder': 'Entrez le lien de configuration', 'global_config_add_global_url': 'Ajouter', 'global_config_apply_global_apply': 'Appliquer', 'keywords_config_title': 'Configuration des mots-clés', 'keywords_config_keywords_list_title': 'Liste des mots-clés', 'keywords_config_keywords_regex_title': 'Expressions régulières des mots-clés', 'usernames_config_title': "Configuration des noms d'utilisateur", 'usernames_config_usernames_list_title': "Liste des noms d'utilisateur", 'usernames_config_usernames_regex_title': "Expressions régulières des noms d'utilisateur", 'url_patterns_title': 'Modèles URL', 'url_patterns_main_page_url_patterns_title': 'Modèles URL page principale', 'url_patterns_sub_page_url_patterns_title': 'Modèles URL sous-pages', 'url_patterns_content_page_url_patterns_title': 'Modèles URL pages de contenu', 'xpath_config_title': 'Configuration XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath titre principale/sous-pages', 'xpath_config_main_and_sub_page_usernames_title': 'XPath utilisateur principale/sous-pages', 'xpath_config_content_page_keywords_title': 'XPath mots-clés page de contenu', 'xpath_config_content_page_usernames_title': 'XPath utilisateur page de contenu', 'sync_config_title': 'Synchronisation cloud', 'sync_config_server_url': 'Adresse du serveur', 'sync_config_user_key': 'Clé utilisateur', 'sync_config_apply': 'Synchroniser', 'sync_config_delete': 'Supprimer la configuration cloud', 'sync_panel_status_connect_failed': 'Échec de la connexion : ', 'sync_panel_status_connect_error': 'Erreur de connexion : ', 'sync_panel_status_connect_success': 'Connexion réussie', 'sync_panel_status_sync_failed': 'Échec de la synchronisation : ', 'sync_panel_status_input_error': "Veuillez d'abord configurer l'adresse du serveur et la clé utilisateur", 'sync_panel_status_delete_success': 'Configuration cloud supprimée avec succès', 'sync_panel_status_delete_failed': 'Échec de la suppression de la configuration cloud : ', 'sync_panel_status_delete_confirm': 'Êtes-vous sûr de vouloir supprimer la configuration cloud ? Cette action est irréversible.', 'sync_panel_status_connect_server_success': 'Connecté au cloud', 'sync_panel_status_client_to_server_success': 'Configuration locale sauvegardée dans le cloud !', 'sync_panel_status_config_updated': 'Configuration cloud synchronisée', 'sync_panel_status_config_conflict_1': 'Conflit de configuration détecté !', 'sync_panel_status_config_conflict_2': 'Date de la configuration cloud : ', 'sync_panel_status_config_conflict_3': 'Date de la configuration locale : ', 'sync_panel_status_config_conflict_4': 'Utiliser la configuration cloud ? (Cliquez OK pour utiliser la configuration cloud, Annuler pour utiliser la configuration locale)', 'sync_panel_status_config_conflict_cloud_newer': 'La configuration cloud est plus récente', 'sync_panel_status_config_conflict_local_newer': 'La configuration locale est plus récente', 'sync_panel_status_disconnect': 'Connexion perdue, tentative de reconnexion...', 'array_editor_add_item_input_placeholder': 'Entrez une valeur', 'array_editor_add_item_input_placeholder_regex': 'Entrez une expression régulière', 'array_editor_add_item': 'Ajouter', 'array_editor_add_item_title': 'Ajouter un nouvel élément', 'array_editor_clear_allitem': 'Tout effacer', 'array_editor_clear_allitem_title': 'Effacer la liste', 'array_editor_search_input_placeholder': 'Rechercher...', 'array_editor_list_empty_placeholder': 'Aucune donnée', 'array_editor_linkimport_input_placeholder': 'Entrez un lien', 'array_editor_linkimport_input_button': 'Importer depuis un lien', 'array_editor_linkimport_input_button_title': 'Importer depuis un lien', 'array_editor_fileimport_input_button': 'Importer depuis un fichier', 'array_editor_fileimport_input_button_title': 'Importer depuis un fichier', 'array_editor_export_button': 'Exporter', 'array_editor_export_button_title': 'Exporter la liste vers un fichier', 'panel_bottom_export_button': 'Exporter la configuration', 'panel_bottom_import_button': 'Importer la configuration', 'panel_bottom_delete_button': 'Supprimer la configuration du domaine', 'panel_bottom_save_button': 'Enregistrer', 'alert_delete_confirm': 'Êtes-vous sûr de vouloir supprimer ? Cette action est irréversible.', 'alert_clear_confirm': 'Êtes-vous sûr de vouloir effacer toute la liste ? Cette action est irréversible.', 'alert_invalid_file': 'Veuillez sélectionner un fichier de configuration valide', 'alert_import_error': "Échec de l'importation de la configuration", 'alert_list_empty': 'La liste est déjà vide', 'alert_url_exists': 'Cette URL existe déjà !', 'alert_enter_url': 'Veuillez entrer un lien valide', 'block_button_title': 'Bloquer l\'utilisateur: ' }, 'de-DE': { 'settings_title': 'Panel-Einstellungen', 'settings_language': 'Sprache', 'settings_expand_mode': 'Erweiterungsmodus', 'settings_expand_hover': 'Beim Hover erweitern', 'settings_expand_click': 'Beim Klick erweitern', 'settings_block_button_mode': 'Blockierknopf-Anzeigemodus', 'settings_block_hover': 'Beim Hover anzeigen', 'settings_block_always': 'Immer anzeigen', 'settings_horizontal_position': 'Horizontale Position', 'settings_collapsed_width': 'Eingeklappte Breite', 'settings_expanded_width': 'Ausgeklappte Breite', 'settings_cancel': 'Abbrechen', 'settings_save': 'Speichern', 'panel_top_title': 'Universeller Forum-Filter', 'panel_top_current_domain': 'Aktuelle Domain: ', 'panel_top_page_type': 'Aktueller Seitentyp: ', 'panel_top_page_type_main': 'Hauptseite', 'panel_top_page_type_sub': 'Unterseite', 'panel_top_page_type_content': 'Inhaltsseite', 'panel_top_page_type_unknown': 'Unbekannter Seitentyp', 'panel_top_enable_domain': 'Domain-Konfiguration aktivieren', 'panel_top_settings': 'Einstellungen', 'panel_top_settings_title': 'Panel-Einstellungen', 'panel_top_settings_button': '⚙ Einstellungen', 'global_config_title': 'Globale Konfiguration', 'global_config_keywords': 'Globale Schlüsselwörter', 'global_config_usernames': 'Globale Benutzernamen', 'global_config_share_keywords': 'Geteilte Schlüsselwörter Haupt/Inhalt', 'global_config_share_usernames': 'Geteilte Benutzernamen Haupt/Inhalt', 'global_config_linkimport_input_placeholder': 'Konfigurationslink eingeben', 'global_config_add_global_url': 'Hinzufügen', 'global_config_apply_global_apply': 'Anwenden', 'keywords_config_title': 'Schlüsselwort-Konfiguration', 'keywords_config_keywords_list_title': 'Schlüsselwörterliste', 'keywords_config_keywords_regex_title': 'Schlüsselwörter-Regex', 'usernames_config_title': 'Benutzernamen-Konfiguration', 'usernames_config_usernames_list_title': 'Benutzernamen-Liste', 'usernames_config_usernames_regex_title': 'Benutzernamen-Regex', 'url_patterns_title': 'URL-Muster', 'url_patterns_main_page_url_patterns_title': 'Hauptseiten-URL-Muster', 'url_patterns_sub_page_url_patterns_title': 'Unterseiten-URL-Muster', 'url_patterns_content_page_url_patterns_title': 'Inhaltsseiten-URL-Muster', 'xpath_config_title': 'XPath-Konfiguration', 'xpath_config_main_and_sub_page_keywords_title': 'Haupt/Unterseiten-Titel-XPath', 'xpath_config_main_and_sub_page_usernames_title': 'Haupt/Unterseiten-Benutzer-XPath', 'xpath_config_content_page_keywords_title': 'Inhaltsseiten-Schlüsselwörter-XPath', 'xpath_config_content_page_usernames_title': 'Inhaltsseiten-Benutzer-XPath', 'sync_config_title': 'Cloud-Synchronisation', 'sync_config_server_url': 'Server-Adresse', 'sync_config_user_key': 'Benutzerschlüssel', 'sync_config_apply': 'Synchronisieren', 'sync_config_delete': 'Cloud-Konfiguration löschen', 'sync_panel_status_connect_failed': 'Verbindung fehlgeschlagen: ', 'sync_panel_status_connect_error': 'Verbindungsfehler: ', 'sync_panel_status_connect_success': 'Verbindung erfolgreich', 'sync_panel_status_sync_failed': 'Synchronisation fehlgeschlagen: ', 'sync_panel_status_input_error': 'Bitte geben Sie zuerst Server-Adresse und Benutzerschlüssel ein', 'sync_panel_status_delete_success': 'Cloud-Konfiguration erfolgreich gelöscht', 'sync_panel_status_delete_failed': 'Löschen der Cloud-Konfiguration fehlgeschlagen: ', 'sync_panel_status_delete_confirm': 'Sind Sie sicher, dass Sie die Cloud-Konfiguration löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.', 'sync_panel_status_connect_server_success': 'Mit Cloud verbunden', 'sync_panel_status_client_to_server_success': 'Lokale Konfiguration wurde in der Cloud gespeichert!', 'sync_panel_status_config_updated': 'Cloud-Konfiguration synchronisiert', 'sync_panel_status_config_conflict_1': 'Konfigurationskonflikt erkannt!', 'sync_panel_status_config_conflict_2': 'Cloud-Konfiguration Zeit: ', 'sync_panel_status_config_conflict_3': 'Lokale Konfiguration Zeit: ', 'sync_panel_status_config_conflict_4': 'Cloud-Konfiguration verwenden? (OK für Cloud-Konfiguration, Abbrechen für lokale Konfiguration)', 'sync_panel_status_config_conflict_cloud_newer': 'Cloud-Konfiguration ist neuer', 'sync_panel_status_config_conflict_local_newer': 'Lokale Konfiguration ist neuer', 'sync_panel_status_disconnect': 'Verbindung getrennt, versuche neu zu verbinden...', 'array_editor_add_item_input_placeholder': 'Wert eingeben', 'array_editor_add_item_input_placeholder_regex': 'Regulären Ausdruck eingeben', 'array_editor_add_item': 'Hinzufügen', 'array_editor_add_item_title': 'Neues Element hinzufügen', 'array_editor_clear_allitem': 'Alles löschen', 'array_editor_clear_allitem_title': 'Liste löschen', 'array_editor_search_input_placeholder': 'Suchen...', 'array_editor_list_empty_placeholder': 'Keine Daten', 'array_editor_linkimport_input_placeholder': 'Link eingeben', 'array_editor_linkimport_input_button': 'Von Link importieren', 'array_editor_linkimport_input_button_title': 'Von Link importieren', 'array_editor_fileimport_input_button': 'Aus Datei importieren', 'array_editor_fileimport_input_button_title': 'Aus Datei importieren', 'array_editor_export_button': 'Exportieren', 'array_editor_export_button_title': 'Liste in Datei exportieren', 'panel_bottom_export_button': 'Konfiguration exportieren', 'panel_bottom_import_button': 'Konfiguration importieren', 'panel_bottom_delete_button': 'Aktuelle Domain-Konfiguration löschen', 'panel_bottom_save_button': 'Speichern', 'alert_delete_confirm': 'Sind Sie sicher, dass Sie löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.', 'alert_clear_confirm': 'Sind Sie sicher, dass Sie die gesamte Liste löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.', 'alert_invalid_file': 'Bitte wählen Sie eine gültige Konfigurationsdatei', 'alert_import_error': 'Fehler beim Importieren der Konfiguration', 'alert_list_empty': 'Die Liste ist bereits leer', 'alert_url_exists': 'Diese URL existiert bereits!', 'alert_enter_url': 'Bitte geben Sie einen gültigen Link ein', 'block_button_title': 'Benutzer blockieren: ' }, 'it-IT': { 'settings_title': 'Impostazioni pannello', 'settings_language': 'Lingua', 'settings_expand_mode': 'Modalità espansione', 'settings_expand_hover': 'Espandi al passaggio', 'settings_expand_click': 'Espandi al clic', 'settings_block_button_mode': 'Modalità pulsante blocco', 'settings_block_hover': 'Mostra al passaggio', 'settings_block_always': 'Mostra sempre', 'settings_horizontal_position': 'Posizione orizzontale', 'settings_collapsed_width': 'Larghezza chiusa', 'settings_expanded_width': 'Larghezza aperta', 'settings_cancel': 'Annulla', 'settings_save': 'Salva', 'panel_top_title': 'Filtro forum universale', 'panel_top_current_domain': 'Dominio attuale: ', 'panel_top_page_type': 'Tipo pagina attuale: ', 'panel_top_page_type_main': 'Pagina principale', 'panel_top_page_type_sub': 'Sottopagina', 'panel_top_page_type_content': 'Pagina contenuto', 'panel_top_page_type_unknown': 'Tipo pagina sconosciuto', 'panel_top_enable_domain': 'Attiva configurazione dominio', 'panel_top_settings': 'Impostazioni', 'panel_top_settings_title': 'Impostazioni pannello', 'panel_top_settings_button': '⚙ Impostazioni', 'global_config_title': 'Configurazione globale', 'global_config_keywords': 'Parole chiave globali', 'global_config_usernames': 'Nomi utente globali', 'global_config_share_keywords': 'Parole chiave condivise principale/contenuto', 'global_config_share_usernames': 'Nomi utente condivisi principale/contenuto', 'global_config_linkimport_input_placeholder': 'Inserisci link configurazione', 'global_config_add_global_url': 'Aggiungi', 'global_config_apply_global_apply': 'Applica', 'keywords_config_title': 'Configurazione parole chiave', 'keywords_config_keywords_list_title': 'Lista parole chiave', 'keywords_config_keywords_regex_title': 'Regex parole chiave', 'usernames_config_title': 'Configurazione nomi utente', 'usernames_config_usernames_list_title': 'Lista nomi utente', 'usernames_config_usernames_regex_title': 'Regex nomi utente', 'url_patterns_title': 'Pattern URL', 'url_patterns_main_page_url_patterns_title': 'Pattern URL pagina principale', 'url_patterns_sub_page_url_patterns_title': 'Pattern URL sottopagine', 'url_patterns_content_page_url_patterns_title': 'Pattern URL pagine contenuto', 'xpath_config_title': 'Configurazione XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath titolo principale/sottopagine', 'xpath_config_main_and_sub_page_usernames_title': 'XPath utente principale/sottopagine', 'xpath_config_content_page_keywords_title': 'XPath parole chiave pagina contenuto', 'xpath_config_content_page_usernames_title': 'XPath utente pagina contenuto', 'sync_config_title': 'Sincronizzazione cloud', 'sync_config_server_url': 'Indirizzo server', 'sync_config_user_key': 'Chiave utente', 'sync_config_apply': 'Sincronizza', 'sync_config_delete': 'Elimina configurazione cloud', 'sync_panel_status_connect_failed': 'Connessione fallita: ', 'sync_panel_status_connect_error': 'Errore di connessione: ', 'sync_panel_status_connect_success': 'Connessione riuscita', 'sync_panel_status_sync_failed': 'Sincronizzazione fallita: ', 'sync_panel_status_input_error': 'Inserisci prima indirizzo server e chiave utente', 'sync_panel_status_delete_success': 'Configurazione cloud eliminata con successo', 'sync_panel_status_delete_failed': 'Eliminazione configurazione cloud fallita: ', 'sync_panel_status_delete_confirm': 'Sei sicuro di voler eliminare la configurazione cloud? Questa azione non può essere annullata.', 'sync_panel_status_connect_server_success': 'Connesso al cloud', 'sync_panel_status_client_to_server_success': 'Configurazione locale salvata nel cloud!', 'sync_panel_status_config_updated': 'Configurazione cloud sincronizzata', 'sync_panel_status_config_conflict_1': 'Rilevato conflitto di configurazione!', 'sync_panel_status_config_conflict_2': 'Data configurazione cloud: ', 'sync_panel_status_config_conflict_3': 'Data configurazione locale: ', 'sync_panel_status_config_conflict_4': 'Usare la configurazione cloud? (OK per usare cloud, Annulla per usare locale)', 'sync_panel_status_config_conflict_cloud_newer': 'La configurazione cloud è più recente', 'sync_panel_status_config_conflict_local_newer': 'La configurazione locale è più recente', 'sync_panel_status_disconnect': 'Connessione persa, tentativo di riconnessione...', 'array_editor_add_item_input_placeholder': 'Inserisci valore', 'array_editor_add_item_input_placeholder_regex': 'Inserisci espressione regolare', 'array_editor_add_item': 'Aggiungi', 'array_editor_add_item_title': 'Aggiungi nuovo elemento', 'array_editor_clear_allitem': 'Cancella tutto', 'array_editor_clear_allitem_title': 'Cancella lista', 'array_editor_search_input_placeholder': 'Cerca...', 'array_editor_list_empty_placeholder': 'Nessun dato', 'array_editor_linkimport_input_placeholder': 'Inserisci link', 'array_editor_linkimport_input_button': 'Importa da link', 'array_editor_linkimport_input_button_title': 'Importa da link', 'array_editor_fileimport_input_button': 'Importa da file', 'array_editor_fileimport_input_button_title': 'Importa da file', 'array_editor_export_button': 'Esporta', 'array_editor_export_button_title': 'Esporta lista in file', 'panel_bottom_export_button': 'Esporta configurazione', 'panel_bottom_import_button': 'Importa configurazione', 'panel_bottom_delete_button': 'Elimina configurazione dominio attuale', 'panel_bottom_save_button': 'Salva', 'alert_delete_confirm': 'Sei sicuro di voler eliminare? Questa azione non può essere annullata.', 'alert_clear_confirm': 'Sei sicuro di voler cancellare tutta la lista? Questa azione non può essere annullata.', 'alert_invalid_file': 'Seleziona un file di configurazione valido', 'alert_import_error': 'Impossibile importare la configurazione', 'alert_list_empty': 'La lista è già vuota', 'alert_url_exists': 'Questo URL esiste già!', 'alert_enter_url': 'Inserisci un link valido', 'block_button_title': 'Blocca utente: ' }, 'th-TH': { 'settings_title': 'ตั้งค่าแผง', 'settings_language': 'ภาษา', 'settings_expand_mode': 'โหมดขยาย', 'settings_expand_hover': 'ขยายเมื่อชี้', 'settings_expand_click': 'ขยายเมื่อคลิก', 'settings_block_button_mode': 'โหมดแสดงปุ่มบล็อก', 'settings_block_hover': 'แสดงเมื่อชี้', 'settings_block_always': 'แสดงตลอด', 'settings_horizontal_position': 'ตำแหน่งแนวนอน', 'settings_collapsed_width': 'ความกว้างเมื่อยุบ', 'settings_expanded_width': 'ความกว้างเมื่อขยาย', 'settings_cancel': 'ยกเลิก', 'settings_save': 'บันทึก', 'panel_top_title': 'ตัวกรองฟอรัมสากล', 'panel_top_current_domain': 'โดเมนปัจจุบัน: ', 'panel_top_page_type': 'ประเภทหน้าปัจจุบัน: ', 'panel_top_page_type_main': 'หน้าหลัก', 'panel_top_page_type_sub': 'หน้าย่อย', 'panel_top_page_type_content': 'หน้าเนื้อหา', 'panel_top_page_type_unknown': 'ไม่ทราบประเภทหน้า', 'panel_top_enable_domain': 'เปิดใช้งานการตั้งค่าโดเมนนี้', 'panel_top_settings': 'ตั้งค่า', 'panel_top_settings_title': 'ตั้งค่าแผง', 'panel_top_settings_button': '⚙ ตั้งค่า', 'global_config_title': 'การตั้งค่าทั่วไป', 'global_config_keywords': 'คำสำคัญทั่วไป', 'global_config_usernames': 'ชื่อผู้ใช้ทั่วไป', 'global_config_share_keywords': 'คำสำคัญร่วมหน้าหลัก/เนื้อหา', 'global_config_share_usernames': 'ชื่อผู้ใช้ร่วมหน้าหลัก/เนื้อหา', 'global_config_linkimport_input_placeholder': 'ป้อนลิงก์การตั้งค่า', 'global_config_add_global_url': 'เพิ่ม', 'global_config_apply_global_apply': 'นำไปใช้', 'keywords_config_title': 'การตั้งค่าคำสำคัญ', 'keywords_config_keywords_list_title': 'รายการคำสำคัญ', 'keywords_config_keywords_regex_title': 'Regex คำสำคัญ', 'usernames_config_title': 'การตั้งค่าชื่อผู้ใช้', 'usernames_config_usernames_list_title': 'รายการชื่อผู้ใช้', 'usernames_config_usernames_regex_title': 'Regex ชื่อผู้ใช้', 'url_patterns_title': 'รูปแบบ URL', 'url_patterns_main_page_url_patterns_title': 'รูปแบบ URL หน้าหลัก', 'url_patterns_sub_page_url_patterns_title': 'รูปแบบ URL หน้าย่อย', 'url_patterns_content_page_url_patterns_title': 'รูปแบบ URL หน้าเนื้อหา', 'xpath_config_title': 'การตั้งค่า XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath หัวข้อหน้าหลัก/ย่อย', 'xpath_config_main_and_sub_page_usernames_title': 'XPath ผู้ใช้หน้าหลัก/ย่อย', 'xpath_config_content_page_keywords_title': 'XPath คำสำคัญหน้าเนื้อหา', 'xpath_config_content_page_usernames_title': 'XPath ผู้ใช้หน้าเนื้อหา', 'sync_config_title': 'การซิงค์คลาวด์', 'sync_config_server_url': 'ที่อยู่เซิร์ฟเวอร์', 'sync_config_user_key': 'คีย์ผู้ใช้', 'sync_config_apply': 'ซิงค์', 'sync_config_delete': 'ลบการตั้งค่าคลาวด์', 'sync_panel_status_connect_failed': 'การเชื่อมต่อล้มเหลว: ', 'sync_panel_status_connect_error': 'ข้อผิดพลาดในการเชื่อมต่อ: ', 'sync_panel_status_connect_success': 'เชื่อมต่อสำเร็จ', 'sync_panel_status_sync_failed': 'การซิงค์ล้มเหลว: ', 'sync_panel_status_input_error': 'กรุณาตั้งค่าที่อยู่เซิร์ฟเวอร์และคีย์ผู้ใช้ก่อน', 'sync_panel_status_delete_success': 'ลบการตั้งค่าคลาวด์สำเร็จ', 'sync_panel_status_delete_failed': 'ลบการตั้งค่าคลาวด์ล้มเหลว: ', 'sync_panel_status_delete_confirm': 'คุณแน่ใจหรือไม่ที่จะลบการตั้งค่าคลาวด์? การดำเนินการนี้ไม่สามารถย้อนกลับได้', 'sync_panel_status_connect_server_success': 'เชื่อมต่อกับคลาวด์แล้ว', 'sync_panel_status_client_to_server_success': 'บันทึกการตั้งค่าในเครื่องไปยังคลาวด์แล้ว!', 'sync_panel_status_config_updated': 'ซิงค์การตั้งค่าคลาวด์แล้ว', 'sync_panel_status_config_conflict_1': 'ตรวจพบการตั้งค่าที่ขัดแย้ง!', 'sync_panel_status_config_conflict_2': 'เวลาการตั้งค่าคลาวด์: ', 'sync_panel_status_config_conflict_3': 'เวลาการตั้งค่าในเครื่อง: ', 'sync_panel_status_config_conflict_4': 'ต้องการใช้การตั้งค่าคลาวด์หรือไม่? (กด OK เพื่อใช้การตั้งค่าคลาวด์, กด Cancel เพื่อใช้การตั้งค่าในเครื่อง)', 'sync_panel_status_config_conflict_cloud_newer': 'การตั้งค่าคลาวด์ใหม่กว่า', 'sync_panel_status_config_conflict_local_newer': 'การตั้งค่าในเครื่องใหม่กว่า', 'sync_panel_status_disconnect': 'การเชื่อมต่อขาดหาย กำลังพยายามเชื่อมต่อใหม่...', 'array_editor_add_item_input_placeholder': 'กรุณาป้อน', 'array_editor_add_item_input_placeholder_regex': 'กรุณาป้อน regex', 'array_editor_add_item': 'เพิ่ม', 'array_editor_add_item_title': 'เพิ่มรายการใหม่', 'array_editor_clear_allitem': 'ล้าง', 'array_editor_clear_allitem_title': 'ล้างรายการ', 'array_editor_search_input_placeholder': 'ค้นหา...', 'array_editor_list_empty_placeholder': 'ไม่มีข้อมูล', 'array_editor_linkimport_input_placeholder': 'กรุณาป้อนลิงก์', 'array_editor_linkimport_input_button': 'นำเข้าจากลิงก์', 'array_editor_linkimport_input_button_title': 'นำเข้ารายการจากลิงก์', 'array_editor_fileimport_input_button': 'นำเข้าจากไฟล์', 'array_editor_fileimport_input_button_title': 'นำเข้ารายการจากไฟล์', 'array_editor_export_button': 'ส่งออก', 'array_editor_export_button_title': 'ส่งออกรายการไปยังไฟล์', 'panel_bottom_export_button': 'ส่งออกการตั้งค่า', 'panel_bottom_import_button': 'นำเข้าการตั้งค่า', 'panel_bottom_delete_button': 'ลบการตั้งค่าโดเมนปัจจุบัน', 'panel_bottom_save_button': 'บันทึก', 'alert_delete_confirm': 'คุณแน่ใจหรือไม่ที่จะลบ? การดำเนินการนี้ไม่สามารถย้อนกลับได้', 'alert_clear_confirm': 'คุณแน่ใจหรือไม่ที่จะล้างรายการทั้งหมด? การดำเนินการนี้ไม่สามารถย้อนกลับได้', 'alert_invalid_file': 'กรุณาเลือกไฟล์การตั้งค่าที่ถูกต้อง', 'alert_import_error': 'นำเข้าการตั้งค่าล้มเหลว', 'alert_list_empty': 'รายการว่างเปล่าแล้ว', 'alert_url_exists': 'URL นี้มีอยู่แล้ว!', 'alert_enter_url': 'กรุณาป้อนลิงก์ที่ถูกต้อง', 'block_button_title': 'บล็อกผู้ใช้: ' }, 'es-ES': { 'settings_title': 'Configuración del Panel', 'settings_language': 'Idioma', 'settings_expand_mode': 'Modo de Expansión', 'settings_expand_hover': 'Expandir al Pasar', 'settings_expand_click': 'Expandir al Hacer Clic', 'settings_block_button_mode': 'Modo de Visualización del Botón de Bloqueo', 'settings_block_hover': 'Mostrar al Pasar', 'settings_block_always': 'Mostrar Siempre', 'settings_horizontal_position': 'Posición Horizontal', 'settings_collapsed_width': 'Ancho Contraído', 'settings_expanded_width': 'Ancho Expandido', 'settings_cancel': 'Cancelar', 'settings_save': 'Guardar', 'panel_top_title': 'Filtro Universal de Foros', 'panel_top_current_domain': 'Dominio Actual: ', 'panel_top_page_type': 'Tipo de Página Actual: ', 'panel_top_page_type_main': 'Página Principal', 'panel_top_page_type_sub': 'Subpágina', 'panel_top_page_type_content': 'Página de Contenido', 'panel_top_page_type_unknown': 'Tipo de Página Desconocido', 'panel_top_enable_domain': 'Habilitar Configuración de Dominio', 'panel_top_settings': 'Configuración', 'panel_top_settings_title': 'Configuración del Panel', 'panel_top_settings_button': '⚙ Configuración', 'global_config_title': 'Configuración Global', 'global_config_keywords': 'Palabras Clave Globales', 'global_config_usernames': 'Nombres de Usuario Globales', 'global_config_share_keywords': 'Palabras Clave Compartidas Principal/Contenido', 'global_config_share_usernames': 'Nombres de Usuario Compartidos Principal/Contenido', 'global_config_linkimport_input_placeholder': 'Introducir enlace de configuración', 'global_config_add_global_url': 'Añadir', 'global_config_apply_global_apply': 'Aplicar', 'keywords_config_title': 'Configuración de Palabras Clave', 'keywords_config_keywords_list_title': 'Lista de Palabras Clave', 'keywords_config_keywords_regex_title': 'Regex de Palabras Clave', 'usernames_config_title': 'Configuración de Nombres de Usuario', 'usernames_config_usernames_list_title': 'Lista de Nombres de Usuario', 'usernames_config_usernames_regex_title': 'Regex de Nombres de Usuario', 'url_patterns_title': 'Patrones de URL', 'url_patterns_main_page_url_patterns_title': 'Patrones URL de Página Principal', 'url_patterns_sub_page_url_patterns_title': 'Patrones URL de Subpágina', 'url_patterns_content_page_url_patterns_title': 'Patrones URL de Página de Contenido', 'xpath_config_title': 'Configuración XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath de Título Principal/Subpágina', 'xpath_config_main_and_sub_page_usernames_title': 'XPath de Usuario Principal/Subpágina', 'xpath_config_content_page_keywords_title': 'XPath de Palabras Clave de Contenido', 'xpath_config_content_page_usernames_title': 'XPath de Usuario de Contenido', 'sync_config_title': 'Sincronización en la Nube', 'sync_config_server_url': 'Dirección del Servidor', 'sync_config_user_key': 'Clave de Usuario', 'sync_config_apply': 'Sincronizar', 'sync_config_delete': 'Eliminar Configuración en la Nube', 'sync_panel_status_connect_failed': 'Error de conexión: ', 'sync_panel_status_connect_error': 'Error de conexión: ', 'sync_panel_status_connect_success': 'Conexión exitosa', 'sync_panel_status_sync_failed': 'Error de sincronización: ', 'sync_panel_status_input_error': 'Por favor, configure primero la dirección del servidor y la clave de usuario', 'sync_panel_status_delete_success': 'Configuración en la nube eliminada con éxito', 'sync_panel_status_delete_failed': 'Error al eliminar la configuración en la nube: ', 'sync_panel_status_delete_confirm': '¿Está seguro de que desea eliminar la configuración en la nube? Esta acción no se puede deshacer.', 'sync_panel_status_connect_server_success': 'Conectado a la nube', 'sync_panel_status_client_to_server_success': '¡Configuración local guardada en la nube!', 'sync_panel_status_config_updated': 'Configuración en la nube sincronizada', 'sync_panel_status_config_conflict_1': '¡Se detectó un conflicto de configuración!', 'sync_panel_status_config_conflict_2': 'Hora de configuración en la nube: ', 'sync_panel_status_config_conflict_3': 'Hora de configuración local: ', 'sync_panel_status_config_conflict_4': '¿Usar configuración en la nube? (Aceptar para usar la configuración en la nube, Cancelar para usar la configuración local)', 'sync_panel_status_config_conflict_cloud_newer': 'La configuración en la nube es más reciente', 'sync_panel_status_config_conflict_local_newer': 'La configuración local es más reciente', 'sync_panel_status_disconnect': 'Conexión perdida, intentando reconectar...', 'array_editor_add_item_input_placeholder': 'Por favor, introduce', 'array_editor_add_item_input_placeholder_regex': 'Por favor, introduce regex', 'array_editor_add_item': 'Añadir', 'array_editor_add_item_title': 'Añadir Nuevo Elemento', 'array_editor_clear_allitem': 'Limpiar', 'array_editor_clear_allitem_title': 'Limpiar Lista', 'array_editor_search_input_placeholder': 'Buscar...', 'array_editor_list_empty_placeholder': 'Sin Datos', 'array_editor_linkimport_input_placeholder': 'Por favor, introduce el enlace', 'array_editor_linkimport_input_button': 'Importar desde Enlace', 'array_editor_linkimport_input_button_title': 'Importar Lista desde Enlace', 'array_editor_fileimport_input_button': 'Importar desde Archivo', 'array_editor_fileimport_input_button_title': 'Importar Lista desde Archivo', 'array_editor_export_button': 'Exportar', 'array_editor_export_button_title': 'Exportar Lista a Archivo', 'panel_bottom_export_button': 'Exportar Configuración', 'panel_bottom_import_button': 'Importar Configuración', 'panel_bottom_delete_button': 'Eliminar Configuración de Dominio Actual', 'panel_bottom_save_button': 'Guardar', 'alert_delete_confirm': '¿Estás seguro de que quieres eliminar? Esta acción no se puede deshacer.', 'alert_clear_confirm': '¿Estás seguro de que quieres limpiar toda la lista? Esta acción no se puede deshacer.', 'alert_invalid_file': 'Por favor, selecciona un archivo de configuración válido', 'alert_import_error': 'Error al importar configuración', 'alert_list_empty': 'La lista ya está vacía', 'alert_url_exists': '¡Esta URL ya existe!', 'alert_enter_url': 'Por favor, introduce un enlace válido', 'block_button_title': 'Bloquear Usuario: ' }, 'pt-PT': { 'settings_title': 'Configurações do Painel', 'settings_language': 'Idioma', 'settings_expand_mode': 'Modo de Expansão', 'settings_expand_hover': 'Expandir ao Passar', 'settings_expand_click': 'Expandir ao Clicar', 'settings_block_button_mode': 'Modo de Exibição do Botão de Bloqueio', 'settings_block_hover': 'Mostrar ao Passar', 'settings_block_always': 'Mostrar Sempre', 'settings_horizontal_position': 'Posição Horizontal', 'settings_collapsed_width': 'Largura Recolhida', 'settings_expanded_width': 'Largura Expandida', 'settings_cancel': 'Cancelar', 'settings_save': 'Salvar', 'panel_top_title': 'Filtro Universal de Fóruns', 'panel_top_current_domain': 'Domínio Atual: ', 'panel_top_page_type': 'Tipo de Página Atual: ', 'panel_top_page_type_main': 'Página Principal', 'panel_top_page_type_sub': 'Subpágina', 'panel_top_page_type_content': 'Página de Conteúdo', 'panel_top_page_type_unknown': 'Tipo de Página Desconhecido', 'panel_top_enable_domain': 'Ativar Configuração do Domínio', 'panel_top_settings': 'Configurações', 'panel_top_settings_title': 'Configurações do Painel', 'panel_top_settings_button': '⚙ Configurações', 'global_config_title': 'Configuração Global', 'global_config_keywords': 'Palavras-chave Globais', 'global_config_usernames': 'Nomes de Usuário Globais', 'global_config_share_keywords': 'Palavras-chave Compartilhadas Principal/Conteúdo', 'global_config_share_usernames': 'Nomes de Usuário Compartilhados Principal/Conteúdo', 'global_config_linkimport_input_placeholder': 'Inserir link de configuração', 'global_config_add_global_url': 'Adicionar', 'global_config_apply_global_apply': 'Aplicar', 'keywords_config_title': 'Configuração de Palavras-chave', 'keywords_config_keywords_list_title': 'Lista de Palavras-chave', 'keywords_config_keywords_regex_title': 'Regex de Palavras-chave', 'usernames_config_title': 'Configuração de Nomes de Usuário', 'usernames_config_usernames_list_title': 'Lista de Nomes de Usuário', 'usernames_config_usernames_regex_title': 'Regex de Nomes de Usuário', 'url_patterns_title': 'Padrões de URL', 'url_patterns_main_page_url_patterns_title': 'Padrões URL da Página Principal', 'url_patterns_sub_page_url_patterns_title': 'Padrões URL da Subpágina', 'url_patterns_content_page_url_patterns_title': 'Padrões URL da Página de Conteúdo', 'xpath_config_title': 'Configuração XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath do Título Principal/Subpágina', 'xpath_config_main_and_sub_page_usernames_title': 'XPath do Usuário Principal/Subpágina', 'xpath_config_content_page_keywords_title': 'XPath de Palavras-chave do Conteúdo', 'xpath_config_content_page_usernames_title': 'XPath do Usuário do Conteúdo', 'sync_config_title': 'Sincronização na Nuvem', 'sync_config_server_url': 'Endereço do Servidor', 'sync_config_user_key': 'Chave do Usuário', 'sync_config_apply': 'Sincronizar', 'sync_config_delete': 'Excluir Configuração da Nuvem', 'sync_panel_status_connect_failed': 'Falha na conexão: ', 'sync_panel_status_connect_error': 'Erro de conexão: ', 'sync_panel_status_connect_success': 'Conexão bem-sucedida', 'sync_panel_status_sync_failed': 'Falha na sincronização: ', 'sync_panel_status_input_error': 'Por favor, defina primeiro o endereço do servidor e a chave do usuário', 'sync_panel_status_delete_success': 'Configuração da nuvem excluída com sucesso', 'sync_panel_status_delete_failed': 'Falha ao excluir configuração da nuvem: ', 'sync_panel_status_delete_confirm': 'Tem certeza que deseja excluir a configuração da nuvem? Esta ação não pode ser desfeita.', 'sync_panel_status_connect_server_success': 'Conectado à nuvem', 'sync_panel_status_client_to_server_success': 'Configuração local salva na nuvem!', 'sync_panel_status_config_updated': 'Configuração da nuvem sincronizada', 'sync_panel_status_config_conflict_1': 'Detectado conflito de configuração!', 'sync_panel_status_config_conflict_2': 'Hora da configuração na nuvem: ', 'sync_panel_status_config_conflict_3': 'Hora da configuração local: ', 'sync_panel_status_config_conflict_4': 'Usar configuração da nuvem? (OK para usar configuração da nuvem, Cancelar para usar configuração local)', 'sync_panel_status_config_conflict_cloud_newer': 'Configuração da nuvem é mais recente', 'sync_panel_status_config_conflict_local_newer': 'Configuração local é mais recente', 'sync_panel_status_disconnect': 'Conexão perdida, tentando reconectar...', 'array_editor_add_item_input_placeholder': 'Por favor, insira', 'array_editor_add_item_input_placeholder_regex': 'Por favor, insira regex', 'array_editor_add_item': 'Adicionar', 'array_editor_add_item_title': 'Adicionar Novo Item', 'array_editor_clear_allitem': 'Limpar', 'array_editor_clear_allitem_title': 'Limpar Lista', 'array_editor_search_input_placeholder': 'Pesquisar...', 'array_editor_list_empty_placeholder': 'Sem Dados', 'array_editor_linkimport_input_placeholder': 'Por favor, insira o link', 'array_editor_linkimport_input_button': 'Importar do Link', 'array_editor_linkimport_input_button_title': 'Importar Lista do Link', 'array_editor_fileimport_input_button': 'Importar do Arquivo', 'array_editor_fileimport_input_button_title': 'Importar Lista do Arquivo', 'array_editor_export_button': 'Exportar', 'array_editor_export_button_title': 'Exportar Lista para Arquivo', 'panel_bottom_export_button': 'Exportar Configuração', 'panel_bottom_import_button': 'Importar Configuração', 'panel_bottom_delete_button': 'Excluir Configuração do Domínio Atual', 'panel_bottom_save_button': 'Salvar', 'alert_delete_confirm': 'Tem certeza que deseja excluir? Esta ação não pode ser desfeita.', 'alert_clear_confirm': 'Tem certeza que deseja limpar toda a lista? Esta ação não pode ser desfeita.', 'alert_invalid_file': 'Por favor, selecione um arquivo de configuração válido', 'alert_import_error': 'Falha ao importar configuração', 'alert_list_empty': 'A lista já está vazia', 'alert_url_exists': 'Esta URL já existe!', 'alert_enter_url': 'Por favor, insira um link válido', 'block_button_title': 'Bloquear Usuário: ' }, 'hi-IN': { 'settings_title': 'पैनल सेटिंग्स', 'settings_language': 'भाषा', 'settings_expand_mode': 'विस्तार मोड', 'settings_expand_hover': 'होवर पर विस्तार', 'settings_expand_click': 'क्लिक पर विस्तार', 'settings_block_button_mode': 'ब्लॉक बटन प्रदर्शन मोड', 'settings_block_hover': 'होवर पर दिखाएं', 'settings_block_always': 'हमेशा दिखाएं', 'settings_horizontal_position': 'क्षैतिज स्थिति', 'settings_collapsed_width': 'संकुचित चौड़ाई', 'settings_expanded_width': 'विस्तारित चौड़ाई', 'settings_cancel': 'रद्द करें', 'settings_save': 'सहेजें', 'panel_top_title': 'यूनिवर्सल फोरम फिल्टर', 'panel_top_current_domain': 'वर्तमान डोमेन: ', 'panel_top_page_type': 'वर्तमान पृष्ठ प्रकार: ', 'panel_top_page_type_main': 'मुख्य पृष्ठ', 'panel_top_page_type_sub': 'उप पृष्ठ', 'panel_top_page_type_content': 'सामग्री पृष्ठ', 'panel_top_page_type_unknown': 'अज्ञात पृष्ठ प्रकार', 'panel_top_enable_domain': 'डोमेन कॉन्फ़िगरेशन सक्षम करें', 'panel_top_settings': 'सेटिंग्स', 'panel_top_settings_title': 'पैनल सेटिंग्स', 'panel_top_settings_button': '⚙ सेटिंग्स', 'global_config_title': 'वैश्विक कॉन्फ़िगरेशन', 'global_config_keywords': 'वैश्विक कीवर्ड', 'global_config_usernames': 'वैश्विक उपयोगकर्ता नाम', 'global_config_share_keywords': 'मुख्य/सामग्री पृष्ठ साझा कीवर्ड', 'global_config_share_usernames': 'मुख्य/सामग्री पृष्ठ साझा उपयोगकर्ता नाम', 'global_config_linkimport_input_placeholder': 'कॉन्फ़िग लिंक दर्ज करें', 'global_config_add_global_url': 'जोड़ें', 'global_config_apply_global_apply': 'लागू करें', 'keywords_config_title': 'कीवर्ड कॉन्फ़िगरेशन', 'keywords_config_keywords_list_title': 'कीवर्ड सूची', 'keywords_config_keywords_regex_title': 'कीवर्ड रेगेक्स', 'usernames_config_title': 'उपयोगकर्ता नाम कॉन्फ़िगरेशन', 'usernames_config_usernames_list_title': 'उपयोगकर्ता नाम सूची', 'usernames_config_usernames_regex_title': 'उपयोगकर्ता नाम रेगेक्स', 'url_patterns_title': 'URL पैटर्न', 'url_patterns_main_page_url_patterns_title': 'मुख्य पृष्ठ URL पैटर्न', 'url_patterns_sub_page_url_patterns_title': 'उप पृष्ठ URL पैटर्न', 'url_patterns_content_page_url_patterns_title': 'सामग्री पृष्ठ URL पैटर्न', 'xpath_config_title': 'XPath कॉन्फ़िगरेशन', 'xpath_config_main_and_sub_page_keywords_title': 'मुख्य/उप पृष्ठ शीर्षक XPath', 'xpath_config_main_and_sub_page_usernames_title': 'मुख्य/उप पृष्ठ उपयोगकर्ता XPath', 'xpath_config_content_page_keywords_title': 'सामग्री पृष्ठ कीवर्ड XPath', 'xpath_config_content_page_usernames_title': 'सामग्री पृष्ठ उपयोगकर्ता XPath', 'sync_config_title': 'क्लाउड सिंक', 'sync_config_server_url': 'सर्वर पता', 'sync_config_user_key': 'उपयोगकर्ता कुंजी', 'sync_config_apply': 'सिंक करें', 'sync_config_delete': 'क्लाउड कॉन्फ़िग हटाएं', 'sync_panel_status_connect_failed': 'कनेक्शन विफल: ', 'sync_panel_status_connect_error': 'कनेक्शन त्रुटि: ', 'sync_panel_status_connect_success': 'कनेक्शन सफल', 'sync_panel_status_sync_failed': 'सिंक विफल: ', 'sync_panel_status_input_error': 'कृपया पहले सर्वर पता और उपयोगकर्ता कुंजी सेट करें', 'sync_panel_status_delete_success': 'क्लाउड कॉन्फ़िग सफलतापूर्वक हटाया गया', 'sync_panel_status_delete_failed': 'क्लाउड कॉन्फ़िग हटाने में विफल: ', 'sync_panel_status_delete_confirm': 'क्या आप वाकई क्लाउड कॉन्फ़िग हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।', 'sync_panel_status_connect_server_success': 'क्लाउड से कनेक्ट हो गया', 'sync_panel_status_client_to_server_success': 'स्थानीय कॉन्फ़िग क्लाउड में सहेजा गया!', 'sync_panel_status_config_updated': 'क्लाउड कॉन्फ़िग सिंक हो गया', 'sync_panel_status_config_conflict_1': 'कॉन्फ़िग विरोध का पता चला!', 'sync_panel_status_config_conflict_2': 'क्लाउड कॉन्फ़िग समय: ', 'sync_panel_status_config_conflict_3': 'स्थानीय कॉन्फ़िग समय: ', 'sync_panel_status_config_conflict_4': 'क्या क्लाउड कॉन्फ़िग का उपयोग करें? (क्लाउड कॉन्फ़िग के लिए OK, स्थानीय कॉन्फ़िग के लिए रद्द करें)', 'sync_panel_status_config_conflict_cloud_newer': 'क्लाउड कॉन्फ़िग नया है', 'sync_panel_status_config_conflict_local_newer': 'स्थानीय कॉन्फ़िग नया है', 'sync_panel_status_disconnect': 'कनेक्शन टूट गया, पुनः कनेक्ट करने का प्रयास कर रहा है...', 'array_editor_add_item_input_placeholder': 'कृपया दर्ज करें', 'array_editor_add_item_input_placeholder_regex': 'कृपया रेगेक्स दर्ज करें', 'array_editor_add_item': 'जोड़ें', 'array_editor_add_item_title': 'नई आइटम जोड़ें', 'array_editor_clear_allitem': 'साफ़ करें', 'array_editor_clear_allitem_title': 'सूची साफ़ करें', 'array_editor_search_input_placeholder': 'खोजें...', 'array_editor_list_empty_placeholder': 'कोई डेटा नहीं', 'array_editor_linkimport_input_placeholder': 'लिंक दर्ज करें', 'array_editor_linkimport_input_button': 'लिंक से आयात', 'array_editor_linkimport_input_button_title': 'लिंक से सूची आयात करें', 'array_editor_fileimport_input_button': 'फ़ाइल से आयात', 'array_editor_fileimport_input_button_title': 'फ़ाइल से सूची आयात करें', 'array_editor_export_button': 'निर्यात', 'array_editor_export_button_title': 'सूची को फ़ाइल में निर्यात करें', 'panel_bottom_export_button': 'कॉन्फ़िग निर्यात करें', 'panel_bottom_import_button': 'कॉन्फ़िग आयात करें', 'panel_bottom_delete_button': 'वर्तमान डोमेन कॉन्फ़िग हटाएं', 'panel_bottom_save_button': 'सहेजें', 'alert_delete_confirm': 'क्या आप वाकई हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।', 'alert_clear_confirm': 'क्या आप वाकई पूरी सूची साफ़ करना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।', 'alert_invalid_file': 'कृपया वैध कॉन्फ़िग फ़ाइल चुनें', 'alert_import_error': 'कॉन्फ़िग आयात विफल', 'alert_list_empty': 'सूची पहले से ही खाली है', 'alert_url_exists': 'यह URL पहले से मौजूद है!', 'alert_enter_url': 'कृपया वैध लिंक दर्ज करें', 'block_button_title': 'उपयोगकर्ता को ब्लॉक करें: ' }, 'id-ID': { 'settings_title': 'Pengaturan Panel', 'settings_language': 'Bahasa', 'settings_expand_mode': 'Mode Ekspansi', 'settings_expand_hover': 'Ekspansi saat Hover', 'settings_expand_click': 'Ekspansi saat Klik', 'settings_block_button_mode': 'Mode Tampilan Tombol Blokir', 'settings_block_hover': 'Tampilkan saat Hover', 'settings_block_always': 'Selalu Tampilkan', 'settings_horizontal_position': 'Posisi Horizontal', 'settings_collapsed_width': 'Lebar Terlipat', 'settings_expanded_width': 'Lebar Terekspansi', 'settings_cancel': 'Batal', 'settings_save': 'Simpan', 'panel_top_title': 'Filter Forum Universal', 'panel_top_current_domain': 'Domain Saat Ini: ', 'panel_top_page_type': 'Tipe Halaman Saat Ini: ', 'panel_top_page_type_main': 'Halaman Utama', 'panel_top_page_type_sub': 'Halaman Sub', 'panel_top_page_type_content': 'Halaman Konten', 'panel_top_page_type_unknown': 'Tipe Halaman Tidak Dikenal', 'panel_top_enable_domain': 'Aktifkan Konfigurasi Domain', 'panel_top_settings': 'Pengaturan', 'panel_top_settings_title': 'Pengaturan Panel', 'panel_top_settings_button': '⚙ Pengaturan', 'global_config_title': 'Konfigurasi Global', 'global_config_keywords': 'Kata Kunci Global', 'global_config_usernames': 'Nama Pengguna Global', 'global_config_share_keywords': 'Kata Kunci Bersama Halaman Utama/Konten', 'global_config_share_usernames': 'Nama Pengguna Bersama Halaman Utama/Konten', 'global_config_linkimport_input_placeholder': 'Masukkan tautan konfigurasi', 'global_config_add_global_url': 'Tambah', 'global_config_apply_global_apply': 'Terapkan', 'keywords_config_title': 'Konfigurasi Kata Kunci', 'keywords_config_keywords_list_title': 'Daftar Kata Kunci', 'keywords_config_keywords_regex_title': 'Regex Kata Kunci', 'usernames_config_title': 'Konfigurasi Nama Pengguna', 'usernames_config_usernames_list_title': 'Daftar Nama Pengguna', 'usernames_config_usernames_regex_title': 'Regex Nama Pengguna', 'url_patterns_title': 'Pola URL', 'url_patterns_main_page_url_patterns_title': 'Pola URL Halaman Utama', 'url_patterns_sub_page_url_patterns_title': 'Pola URL Halaman Sub', 'url_patterns_content_page_url_patterns_title': 'Pola URL Halaman Konten', 'xpath_config_title': 'Konfigurasi XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath Judul Halaman Utama/Sub', 'xpath_config_main_and_sub_page_usernames_title': 'XPath Pengguna Halaman Utama/Sub', 'xpath_config_content_page_keywords_title': 'XPath Kata Kunci Halaman Konten', 'xpath_config_content_page_usernames_title': 'XPath Pengguna Halaman Konten', 'sync_config_title': 'Sinkronisasi Cloud', 'sync_config_server_url': 'Alamat Server', 'sync_config_user_key': 'Kunci Pengguna', 'sync_config_apply': 'Sinkronkan', 'sync_config_delete': 'Hapus Konfigurasi Cloud', 'sync_panel_status_connect_failed': 'Gagal terhubung: ', 'sync_panel_status_connect_error': 'Error koneksi: ', 'sync_panel_status_connect_success': 'Berhasil terhubung', 'sync_panel_status_sync_failed': 'Sinkronisasi gagal: ', 'sync_panel_status_input_error': 'Harap atur alamat server dan kunci pengguna terlebih dahulu', 'sync_panel_status_delete_success': 'Berhasil menghapus konfigurasi cloud', 'sync_panel_status_delete_failed': 'Gagal menghapus konfigurasi cloud: ', 'sync_panel_status_delete_confirm': 'Apakah Anda yakin ingin menghapus konfigurasi cloud? Tindakan ini tidak dapat dibatalkan.', 'sync_panel_status_connect_server_success': 'Terhubung ke cloud', 'sync_panel_status_client_to_server_success': 'Konfigurasi lokal telah disimpan ke cloud!', 'sync_panel_status_config_updated': 'Konfigurasi cloud telah disinkronkan', 'sync_panel_status_config_conflict_1': 'Terdeteksi konflik konfigurasi!', 'sync_panel_status_config_conflict_2': 'Waktu konfigurasi cloud: ', 'sync_panel_status_config_conflict_3': 'Waktu konfigurasi lokal: ', 'sync_panel_status_config_conflict_4': 'Gunakan konfigurasi cloud? (Klik OK untuk menggunakan konfigurasi cloud, Batal untuk menggunakan konfigurasi lokal)', 'sync_panel_status_config_conflict_cloud_newer': 'Konfigurasi cloud lebih baru', 'sync_panel_status_config_conflict_local_newer': 'Konfigurasi lokal lebih baru', 'sync_panel_status_disconnect': 'Koneksi terputus, mencoba menghubungkan kembali...', 'array_editor_add_item_input_placeholder': 'Silakan masukkan', 'array_editor_add_item_input_placeholder_regex': 'Silakan masukkan regex', 'array_editor_add_item': 'Tambah', 'array_editor_add_item_title': 'Tambah Item Baru', 'array_editor_clear_allitem': 'Bersihkan', 'array_editor_clear_allitem_title': 'Bersihkan Daftar', 'array_editor_search_input_placeholder': 'Cari...', 'array_editor_list_empty_placeholder': 'Tidak Ada Data', 'array_editor_linkimport_input_placeholder': 'Masukkan tautan', 'array_editor_linkimport_input_button': 'Impor dari Tautan', 'array_editor_linkimport_input_button_title': 'Impor Daftar dari Tautan', 'array_editor_fileimport_input_button': 'Impor dari File', 'array_editor_fileimport_input_button_title': 'Impor Daftar dari File', 'array_editor_export_button': 'Ekspor', 'array_editor_export_button_title': 'Ekspor Daftar ke File', 'panel_bottom_export_button': 'Ekspor Konfigurasi', 'panel_bottom_import_button': 'Impor Konfigurasi', 'panel_bottom_delete_button': 'Hapus Konfigurasi Domain Saat Ini', 'panel_bottom_save_button': 'Simpan', 'alert_delete_confirm': 'Anda yakin ingin menghapus? Tindakan ini tidak dapat dibatalkan.', 'alert_clear_confirm': 'Anda yakin ingin membersihkan seluruh daftar? Tindakan ini tidak dapat dibatalkan.', 'alert_invalid_file': 'Silakan pilih file konfigurasi yang valid', 'alert_import_error': 'Gagal mengimpor konfigurasi', 'alert_list_empty': 'Daftar sudah kosong', 'alert_url_exists': 'URL ini sudah ada!', 'alert_enter_url': 'Silakan masukkan tautan yang valid', 'block_button_title': 'Blokir Pengguna: ' }, 'vi-VN': { 'settings_title': 'Cài đặt Panel', 'settings_language': 'Ngôn ngữ', 'settings_expand_mode': 'Chế độ Mở rộng', 'settings_expand_hover': 'Mở rộng khi Di chuột', 'settings_expand_click': 'Mở rộng khi Nhấp chuột', 'settings_block_button_mode': 'Chế độ Hiển thị Nút Chặn', 'settings_block_hover': 'Hiển thị khi Di chuột', 'settings_block_always': 'Luôn Hiển thị', 'settings_horizontal_position': 'Vị trí Ngang', 'settings_collapsed_width': 'Độ rộng Thu gọn', 'settings_expanded_width': 'Độ rộng Mở rộng', 'settings_cancel': 'Hủy', 'settings_save': 'Lưu', 'panel_top_title': 'Bộ lọc Diễn đàn Phổ thông', 'panel_top_current_domain': 'Tên miền Hiện tại: ', 'panel_top_page_type': 'Loại Trang Hiện tại: ', 'panel_top_page_type_main': 'Trang Chính', 'panel_top_page_type_sub': 'Trang Phụ', 'panel_top_page_type_content': 'Trang Nội dung', 'panel_top_page_type_unknown': 'Loại Trang Không xác định', 'panel_top_enable_domain': 'Bật Cấu hình Tên miền', 'panel_top_settings': 'Cài đặt', 'panel_top_settings_title': 'Cài đặt Panel', 'panel_top_settings_button': '⚙ Cài đặt', 'global_config_title': 'Cấu hình Toàn cục', 'global_config_keywords': 'Từ khóa Toàn cục', 'global_config_usernames': 'Tên người dùng Toàn cục', 'global_config_share_keywords': 'Từ khóa Chung Trang Chính/Nội dung', 'global_config_share_usernames': 'Tên người dùng Chung Trang Chính/Nội dung', 'global_config_linkimport_input_placeholder': 'Nhập liên kết cấu hình', 'global_config_add_global_url': 'Thêm', 'global_config_apply_global_apply': 'Áp dụng', 'keywords_config_title': 'Cấu hình Từ khóa', 'keywords_config_keywords_list_title': 'Danh sách Từ khóa', 'keywords_config_keywords_regex_title': 'Regex Từ khóa', 'usernames_config_title': 'Cấu hình Tên người dùng', 'usernames_config_usernames_list_title': 'Danh sách Tên người dùng', 'usernames_config_usernames_regex_title': 'Regex Tên người dùng', 'url_patterns_title': 'Mẫu URL', 'url_patterns_main_page_url_patterns_title': 'Mẫu URL Trang Chính', 'url_patterns_sub_page_url_patterns_title': 'Mẫu URL Trang Phụ', 'url_patterns_content_page_url_patterns_title': 'Mẫu URL Trang Nội dung', 'xpath_config_title': 'Cấu hình XPath', 'xpath_config_main_and_sub_page_keywords_title': 'XPath Tiêu đề Trang Chính/Phụ', 'xpath_config_main_and_sub_page_usernames_title': 'XPath Người dùng Trang Chính/Phụ', 'xpath_config_content_page_keywords_title': 'XPath Từ khóa Trang Nội dung', 'xpath_config_content_page_usernames_title': 'XPath Người dùng Trang Nội dung', 'sync_config_title': 'Đồng bộ hóa Đám mây', 'sync_config_server_url': 'Địa chỉ Máy chủ', 'sync_config_user_key': 'Khóa Người dùng', 'sync_config_apply': 'Đồng bộ', 'sync_config_delete': 'Xóa Cấu hình Đám mây', 'sync_panel_status_connect_failed': 'Kết nối thất bại: ', 'sync_panel_status_connect_error': 'Lỗi kết nối: ', 'sync_panel_status_connect_success': 'Kết nối thành công', 'sync_panel_status_sync_failed': 'Đồng bộ thất bại: ', 'sync_panel_status_input_error': 'Vui lòng thiết lập địa chỉ máy chủ và khóa người dùng trước', 'sync_panel_status_delete_success': 'Xóa cấu hình đám mây thành công', 'sync_panel_status_delete_failed': 'Xóa cấu hình đám mây thất bại: ', 'sync_panel_status_delete_confirm': 'Bạn có chắc muốn xóa cấu hình đám mây? Hành động này không thể hoàn tác.', 'sync_panel_status_connect_server_success': 'Đã kết nối tới đám mây', 'sync_panel_status_client_to_server_success': 'Cấu hình cục bộ đã được lưu lên đám mây!', 'sync_panel_status_config_updated': 'Đã đồng bộ cấu hình đám mây', 'sync_panel_status_config_conflict_1': 'Phát hiện xung đột cấu hình!', 'sync_panel_status_config_conflict_2': 'Thời gian cấu hình đám mây: ', 'sync_panel_status_config_conflict_3': 'Thời gian cấu hình cục bộ: ', 'sync_panel_status_config_conflict_4': 'Sử dụng cấu hình đám mây? (Nhấn OK để dùng cấu hình đám mây, Hủy để dùng cấu hình cục bộ)', 'sync_panel_status_config_conflict_cloud_newer': 'Cấu hình đám mây mới hơn', 'sync_panel_status_config_conflict_local_newer': 'Cấu hình cục bộ mới hơn', 'sync_panel_status_disconnect': 'Mất kết nối, đang thử kết nối lại...', 'array_editor_add_item_input_placeholder': 'Vui lòng nhập', 'array_editor_add_item_input_placeholder_regex': 'Vui lòng nhập regex', 'array_editor_add_item': 'Thêm', 'array_editor_add_item_title': 'Thêm Mục mới', 'array_editor_clear_allitem': 'Xóa tất cả', 'array_editor_clear_allitem_title': 'Xóa Danh sách', 'array_editor_search_input_placeholder': 'Tìm kiếm...', 'array_editor_list_empty_placeholder': 'Không có Dữ liệu', 'array_editor_linkimport_input_placeholder': 'Nhập liên kết', 'array_editor_linkimport_input_button': 'Nhập từ Liên kết', 'array_editor_linkimport_input_button_title': 'Nhập Danh sách từ Liên kết', 'array_editor_fileimport_input_button': 'Nhập từ Tệp', 'array_editor_fileimport_input_button_title': 'Nhập Danh sách từ Tệp', 'array_editor_export_button': 'Xuất', 'array_editor_export_button_title': 'Xuất Danh sách ra Tệp', 'panel_bottom_export_button': 'Xuất Cấu hình', 'panel_bottom_import_button': 'Nhập Cấu hình', 'panel_bottom_delete_button': 'Xóa Cấu hình Tên miền Hiện tại', 'panel_bottom_save_button': 'Lưu', 'alert_delete_confirm': 'Bạn có chắc muốn xóa? Hành động này không thể hoàn tác.', 'alert_clear_confirm': 'Bạn có chắc muốn xóa toàn bộ danh sách? Hành động này không thể hoàn tác.', 'alert_invalid_file': 'Vui lòng chọn tệp cấu hình hợp lệ', 'alert_import_error': 'Nhập cấu hình thất bại', 'alert_list_empty': 'Danh sách đã trống', 'alert_url_exists': 'URL này đã tồn tại!', 'alert_enter_url': 'Vui lòng nhập liên kết hợp lệ', 'block_button_title': 'Chặn Người dùng: ' } }
  36. let GLOBAL_CONFIG = {
  37. "GLOBAL_KEYWORDS": false,
  38. "GLOBAL_USERNAMES": false,
  39. "SHOW_BLOCK_BUTTON": "hover",
  40. "TIME_INTERVAL": 30,
  41. "LANGUAGE": navigator.language,
  42. "SHOW_WORD_SEGMENTATION": false,
  43. "GLOBAL_CONFIG_URL": [],
  44. "CONFIG_SECTION_COLLAPSED":{
  45. "global_SECTION_COLLAPSED": true,
  46. "keywords_SECTION_COLLAPSED": true,
  47. "usernames_SECTION_COLLAPSED": true,
  48. "url_SECTION_COLLAPSED": true,
  49. "xpath_SECTION_COLLAPSED": true,
  50. "sync_SECTION_COLLAPSED": true,
  51. },
  52. "EDITOR_STATES": {
  53. "keywords": false,
  54. "keywords_regex": false,
  55. "usernames": false,
  56. "usernames_regex": false,
  57. "mainpage_url_patterns": false,
  58. "subpage_url_patterns": false,
  59. "contentpage_url_patterns": false,
  60. "main_and_sub_page_title_xpath": false,
  61. "main_and_sub_page_user_xpath": false,
  62. "contentpage_title_xpath": false,
  63. "contentpage_user_xpath": false
  64. },
  65. "SYNC_CONFIG": {
  66. "server_url": "",
  67. "user_key": "",
  68. "lastSyncTime": 0
  69. }
  70. }
  71. const SAMPLE_TEMPLATE = {
  72. "domain": "",
  73. "enabled": true,
  74. "compatibilityMode": false,
  75. "mainPageUrlPatterns": [],
  76. "subPageUrlPatterns": [],
  77. "contentPageUrlPatterns": [],
  78. "shareKeywordsAcrossPages": false,
  79. "shareUsernamesAcrossPages": true,
  80. "mainAndSubPageKeywords": {
  81. "whitelistMode": false,
  82. "xpath": [],
  83. "keywords": [],
  84. "regexPatterns": []
  85. },
  86. "mainAndSubPageUserKeywords": {
  87. "whitelistMode": false,
  88. "xpath": [],
  89. "keywords": [],
  90. "regexPatterns": []
  91. },
  92. "contentPageKeywords": {
  93. "whitelistMode": false,
  94. "xpath": [],
  95. "keywords": [],
  96. "regexPatterns": []
  97. },
  98. "contentPageUserKeywords": {
  99. "whitelistMode": false,
  100. "xpath": [],
  101. "keywords": [],
  102. "regexPatterns": []
  103. }
  104. }
  105. const FORUM_TEMPLATES = {
  106. discuz: {
  107. detect: () => {
  108. return document.querySelector('meta[name="generator"][content*="Discuz"]') !== null ||
  109. document.querySelector('script[src*="discuz"]') !== null ||
  110. document.querySelector('a[href*="discuz.vip"]') !== null;
  111. },
  112. config: {
  113. "mainPageUrlPatterns": ['/forum-.*$','/forum\\.php\\?mod=forumdisplay.*'],
  114. "contentPageUrlPatterns": ['/thread-.*$','/forum\\.php\\?mod=viewthread.*'],
  115. "mainAndSubPageKeywords": {
  116. "xpath": ['//tbody//a[@class="s xst"]/text()','//li/a/text()']
  117. },
  118. "mainAndSubPageUserKeywords": {
  119. "xpath": ['//tbody//td[@class="by"]//a/text()','//li//span[@class="by"]/text()']
  120. },
  121. "contentPageKeywords": {
  122. "xpath": ['//div[@id]//td[@class="t_f"]/text()','//div[@class="plc cl"]//div[@class="message"]/text()']
  123. },
  124. "contentPageUserKeywords": {
  125. "xpath": ['//div[@id]//tbody//a[@class="xw1"]/text()','//div[@class="plc cl"]//a[@class="blue"]/text()']
  126. }
  127. }
  128. },
  129. discourse: {
  130. detect: () => {
  131. return document.querySelector('meta[name="generator"][content*="Discourse"]') !== null ||
  132. document.querySelector('script[src*="discourse"]') !== null ||
  133. document.querySelector('a[href*="discourse.org"]') !== null ||
  134. document.body.classList.contains('discourse');
  135. },
  136. config: {
  137. "mainPageUrlPatterns": ['^/$','/c/','/hot','^/top(?!\\w)','/latest','/tags',],
  138. "contentPageUrlPatterns": ['/t'],
  139. "mainAndSubPageKeywords": {
  140. "xpath": ['//tr[@data-topic-id]//a[@role="heading"]//span/text()']
  141. },
  142. "mainAndSubPageUserKeywords": {
  143. "xpath": ['//tr[@data-topic-id]//td[@class="posters topic-list-data"]//a[@data-user-card]/@data-user-card']
  144. },
  145. "contentPageKeywords": {
  146. "xpath": ['//div//article[@role="region"]//p[@dir="auto"]/text()']
  147. },
  148. "contentPageUserKeywords": {
  149. "xpath": ['//div//article[@role="region"]//div[@role="heading"]//a[@data-user-card]/@data-user-card']
  150. }
  151. }
  152. }
  153. };
  154. const DEFAULT_CONFIG = [
  155. {
  156. "domain": "nodeseek.com",
  157. "mainPageUrlPatterns": ['^/$','^/categories/[^/]+/?$','^/search.*','^/\\?sortBy.*','^/award.*'],
  158. "subPageUrlPatterns": ['/page*'],
  159. "contentPageUrlPatterns": ['/post*'],
  160. "mainAndSubPageKeywords": {
  161. "xpath": ['//li[@class="post-list-item"]//div[@class="post-title"]//a/text()']
  162. },
  163. "mainAndSubPageUserKeywords": {
  164. "xpath": ['//li[@class="post-list-item"]//div[@class="post-info"]//a/text()']
  165. },
  166. "contentPageKeywords": {
  167. "xpath": ['//li[@class="content-item"]//article[@class="post-content"]//p/text()']
  168. },
  169. "contentPageUserKeywords": {
  170. "xpath": ['//li[@class="content-item"]//a[@class="author-name"]/text()']
  171. }
  172. },
  173. {
  174. "domain": "nodeloc.com",
  175. "mainPageUrlPatterns": ['^/$','^/t/.*'],
  176. "subPageUrlPatterns": [],
  177. "contentPageUrlPatterns": ['^/d/.*'],
  178. "mainAndSubPageKeywords": {
  179. "xpath": ['//li//h2[@class="DiscussionListItem-title"]/text()']
  180. },
  181. "mainAndSubPageUserKeywords": {
  182. "xpath": ['//li//a[@class="DiscussionListItem-author"]/split(" ",0,data-original-title)']
  183. },
  184. "contentPageKeywords": {
  185. "xpath": ['//div[@class="PostStream-item"]//div[@class="Post-body"]//p/text()']
  186. },
  187. "contentPageUserKeywords": {
  188. "xpath": ['//div[@class="PostStream-item"]//li[@class="item-user"]//span/text()']
  189. }
  190. },
  191. {
  192. "domain": "bbs.nga.cn",
  193. "mainPageUrlPatterns": ['^/thread.*'],
  194. "subPageUrlPatterns": [],
  195. "contentPageUrlPatterns": ['^/read.*'],
  196. "mainAndSubPageKeywords": {
  197. "xpath": ['//tbody//a[@class="topic"]/text()']
  198. },
  199. "mainAndSubPageUserKeywords": {
  200. "xpath": ['//tbody//a[@class="author"]/split(" ",1,title)']
  201. },
  202. "contentPageKeywords": {
  203. "xpath": ['//tbody//span[contains(@class,"postcontent")]/text()']
  204. },
  205. "contentPageUserKeywords": {
  206. "xpath": ['//tbody//a[contains(@class,"userlink")]/split(=,-1,href)']
  207. }
  208. },
  209. {
  210. "domain": "tieba.baidu.com",
  211. "mainPageUrlPatterns": ['^/f\\?kw=.*'],
  212. "subPageUrlPatterns": [],
  213. "contentPageUrlPatterns": ['^/p/.*'],
  214. "mainAndSubPageKeywords": {
  215. "xpath": ['//li//div[@class="threadlist_title pull_left j_th_tit "]//a[@class="j_th_tit "]/text()']
  216. },
  217. "mainAndSubPageUserKeywords": {
  218. "xpath": ['//li//span[@class="frs-author-name-wrap"]//a[contains(@class,"frs-author-name")]/text()']
  219. },
  220. "contentPageKeywords": {
  221. "xpath": ['//div//div[@class="d_post_content_main "]//div[@class="d_post_content j_d_post_content "]/text()',
  222. '//li//span[@class="lzl_content_main"]/text()']
  223. },
  224. "contentPageUserKeywords": {
  225. "xpath": ['//div//div[@class="d_author"]//a[@alog-group="p_author"]/text()',
  226. '//li//a[@alog-group="p_author"]/text()']
  227. }
  228. },
  229. {
  230. "domain": "v2ex.com",
  231. "mainPageUrlPatterns": ['^/$','^/\\?tab=.*','^/recent.*'],
  232. "subPageUrlPatterns": [],
  233. "contentPageUrlPatterns": ['^/t/.*'],
  234. "mainAndSubPageKeywords": {
  235. "xpath": ['//div[@class="cell item"]//span[@class="item_title"]/a/text()']
  236. },
  237. "mainAndSubPageUserKeywords": {
  238. "xpath": ['//div[@class="cell item"]//span[@class="topic_info"]//strong//a/text()','//div[@class="cell item"]//strong/a/text()']
  239. },
  240. "contentPageKeywords": {
  241. "xpath": ['//div[@class="cell"]//div[@class="reply_content"]/text()']
  242. },
  243. "contentPageUserKeywords": {
  244. "xpath": ['//div[@class="cell"]//strong/a/text()']
  245. }
  246. },
  247. {
  248. "domain": "zhihu.com",
  249. "mainPageUrlPatterns": ['^/$','^/hot.*','^/follow.*','^/zvideo.*'],
  250. "subPageUrlPatterns": [],
  251. "contentPageUrlPatterns": ['^/question/.*'],
  252. "mainAndSubPageKeywords": {
  253. "xpath": ['//div[@class="Card TopstoryItem TopstoryItem-isRecommend"]//a[@data-za-detail-view-element_name="Title"]/text()',
  254. '//section[@class="HotItem"]//h2[@class="HotItem-title"]/text()']
  255. },
  256. "mainAndSubPageUserKeywords": {
  257. "xpath": ['//div[@class="Card TopstoryItem TopstoryItem-isRecommend"]//a[@class="UserLink-link"]/text()']
  258. },
  259. "contentPageKeywords": {
  260. "xpath": ['//div[@class="List-item"]//div[@class="RichContent-inner"]//span/p/text()']
  261. },
  262. "contentPageUserKeywords": {
  263. "xpath": ['//div[@class="List-item"]//a[@class="UserLink-link"]/text()']
  264. }
  265. },
  266. {
  267. "domain": "douban.com",
  268. "mainPageUrlPatterns": ['^/group/explore.*','^/group/\\d+/.*'],
  269. "subPageUrlPatterns": [],
  270. "contentPageUrlPatterns": ['^/group/topic/.*'],
  271. "mainAndSubPageKeywords": {
  272. "xpath": ['//div[@class="channel-item"]//div[@class="bd"]//h3//a/text()',
  273. '//tr//td[@class="title"]//a/text()']
  274. },
  275. "mainAndSubPageUserKeywords": {
  276. "xpath": ['//tr//td[@nowrap]//a/text()']
  277. },
  278. "contentPageKeywords": {
  279. "xpath": ['//li//div[@class="reply-content"]//p/text()']
  280. },
  281. "contentPageUserKeywords": {
  282. "xpath": ['//li//h4//a/text()']
  283. }
  284. },
  285. {
  286. "domain": "lowendtalk.com",
  287. "mainPageUrlPatterns": ['^/$','^/categories/[^/]+/$'],
  288. "subPageUrlPatterns": ['/discussions/p*','^/categories/[^/]+/?$'],
  289. "contentPageUrlPatterns": ['^/discussion/\\d+/.*'],
  290. "mainAndSubPageKeywords": {
  291. "xpath": ['//li//div[@class="Title"]//a/text()']
  292. },
  293. "mainAndSubPageUserKeywords": {
  294. "xpath": ['//li//span[contains(@class,"DiscussionAuthor")]//a/text()']
  295. },
  296. "contentPageKeywords": {
  297. "xpath": ['//li//div[@class="Item-Body"]//p/text()']
  298. },
  299. "contentPageUserKeywords": {
  300. "xpath": ['//li//a[@class="Username"]/text()']
  301. }
  302. },
  303. {
  304. "domain": "reddit.com",
  305. "mainPageUrlPatterns": ['^/$','feed=home','^/r/[^/]+/$'],
  306. "subPageUrlPatterns": [],
  307. "contentPageUrlPatterns": ['^/r/.*/comments/.*'],
  308. "mainAndSubPageKeywords": {
  309. "xpath": ['//article[@aria-label]/@aria-label']
  310. },
  311. "mainAndSubPageUserKeywords": {
  312. "xpath": []
  313. },
  314. "contentPageKeywords": {
  315. "xpath": ['//shreddit-comment//div[@slot="comment"]//p/text()']
  316. },
  317. "contentPageUserKeywords": {
  318. "xpath": ['//shreddit-comment//faceplate-tracker[@source="post_detail"]//a/text()']
  319. }
  320. }
  321. ]
  322. let wsConnection = null;
  323. function loadUserConfig() {
  324. try {
  325. let userConfig = GM_getValue('userConfig');
  326. let globalConfig = GM_getValue('globalConfig');
  327. if(globalConfig){
  328. const parsedConfig = JSON.parse(globalConfig);
  329. for (const key in parsedConfig) {
  330. if (key in GLOBAL_CONFIG) {
  331. GLOBAL_CONFIG[key] = parsedConfig[key];
  332. }
  333. }
  334. }else{
  335. GM_setValue('globalConfig', JSON.stringify(GLOBAL_CONFIG));
  336. }
  337. if (userConfig) {
  338. userConfig = JSON.parse(userConfig);
  339. }
  340. if (!userConfig || !Array.isArray(userConfig)) {
  341. userConfig = [];
  342. }
  343. let isNewConfig = false;
  344. DEFAULT_CONFIG.forEach(defaultItem => {
  345. if (defaultItem.domain === 'hostloc.com') {
  346. }
  347. const existingConfig = userConfig.find(config => config.domain === defaultItem.domain);
  348. if (!existingConfig) {
  349. const newConfig = structuredClone(SAMPLE_TEMPLATE);
  350. Object.assign(newConfig, defaultItem);
  351. userConfig.push(newConfig);
  352. isNewConfig = true;
  353. if (defaultItem.domain === 'hostloc.com') {
  354. }
  355. }
  356. });
  357. if (isNewConfig) {
  358. saveUserConfig(userConfig);
  359. }
  360. return userConfig;
  361. } catch (error) {
  362. console.error('加载配置失败:', error);
  363. return DEFAULT_CONFIG;
  364. }
  365. }
  366. let isFirstLoad = true;
  367. let userConfig = loadUserConfig();
  368. function saveUserConfig(config) {
  369. try {
  370. GM_setValue('userConfig', JSON.stringify(config));
  371. if(isFirstLoad){
  372. isFirstLoad = false;
  373. }else{
  374. updateUserConfig();
  375. }
  376. } catch (error) {
  377. console.error('保存配置失败:', error);
  378. }
  379. }
  380. function saveGlobalConfig() {
  381. try {
  382. GM_setValue('globalConfig', JSON.stringify(GLOBAL_CONFIG));
  383. } catch (error) {
  384. console.error('保存全局配置失败:', error);
  385. }
  386. }
  387. function updateUserConfig(){
  388. userConfig = loadUserConfig();
  389. }
  390. function getDomainConfig(domain) {
  391. const config = userConfig.find(c => c.domain === domain);
  392. if (!config) {
  393. for (const [framework, template] of Object.entries(FORUM_TEMPLATES)) {
  394. if (template.detect()) {
  395. const newConfig = structuredClone(SAMPLE_TEMPLATE);
  396. Object.assign(newConfig, template.config);
  397. newConfig.domain = domain;
  398. newConfig.enabled = true;
  399. userConfig.push(newConfig);
  400. saveUserConfig(userConfig);
  401. return newConfig;
  402. }
  403. }
  404. }
  405. return config;
  406. }
  407. function addDomainConfig(configData) {
  408. if (!configData || !configData.domain) {
  409. console.error('添加配置失败: domain 是必填字段');
  410. return {
  411. success: false,
  412. message: 'domain 是必填字段'
  413. };
  414. }
  415. const existingConfig = getDomainConfig(configData.domain);
  416. if (existingConfig) {
  417. console.error('添加配置失败: 已存在相同domain的配置');
  418. return {
  419. success: false,
  420. message: '已存在相同domain的配置'
  421. };
  422. }
  423. const newConfig = JSON.parse(JSON.stringify(SAMPLE_TEMPLATE));
  424. Object.assign(newConfig, configData);
  425. userConfig.push(newConfig);
  426. saveUserConfig(userConfig);
  427. return {
  428. success: true,
  429. message: '配置添加成功',
  430. config: newConfig
  431. };
  432. }
  433. function removeDomainConfig(domain){
  434. userConfig = userConfig.filter(config => config.domain !== domain);
  435. saveUserConfig(userConfig);
  436. return {
  437. success: true,
  438. message: '配置删除成功',
  439. config: userConfig
  440. };
  441. }
  442. function updateDomainConfigOverride(domain, configData){
  443. const index = userConfig.findIndex(config => config.domain === domain);
  444. if (index !== -1) {
  445. userConfig[index] = configData;
  446. saveUserConfig(userConfig);
  447. return {
  448. success: true,
  449. message: '配置更新成功',
  450. config: userConfig[index]
  451. };
  452. }
  453. }
  454. function updateDomainConfig(domain, configData) {
  455. const index = userConfig.findIndex(config => config.domain === domain);
  456. if (index !== -1) {
  457. const existingConfig = JSON.parse(JSON.stringify(userConfig[index]));
  458. for (const key in configData) {
  459. if (Array.isArray(configData[key])) {
  460. existingConfig[key] = [...new Set([
  461. ...(existingConfig[key] || []),
  462. ...configData[key]
  463. ])];
  464. } else if (typeof configData[key] === 'object' && configData[key] !== null) {
  465. existingConfig[key] = existingConfig[key] || {};
  466. for (const subKey in configData[key]) {
  467. if (Array.isArray(configData[key][subKey])) {
  468. existingConfig[key][subKey] = [...new Set([
  469. ...(existingConfig[key][subKey] || []),
  470. ...configData[key][subKey]
  471. ])];
  472. } else {
  473. existingConfig[key][subKey] = configData[key][subKey];
  474. }
  475. }
  476. } else {
  477. existingConfig[key] = configData[key];
  478. }
  479. }
  480. userConfig[index] = existingConfig;
  481. saveUserConfig(userConfig);
  482. return {
  483. success: true,
  484. message: '配置更新成功',
  485. config: userConfig[index]
  486. };
  487. }
  488. return {
  489. success: false,
  490. message: '未找到指定域名的配置',
  491. config: null
  492. };
  493. }
  494. function validateXPathRelationship(parentXPath, childXPath) {
  495. const cleanChildXPath = childXPath.replace(/^\/+/, '');
  496. const cleanParentXPath = parentXPath.replace(/\/+$/, '');
  497. const combinedXPath = `${cleanParentXPath}//${cleanChildXPath}`;
  498. const result = document.evaluate(
  499. combinedXPath,
  500. document,
  501. null,
  502. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
  503. null
  504. );
  505. const matchCount = result.snapshotLength;
  506. return {
  507. isValid: matchCount > 0,
  508. matchCount: matchCount,
  509. elements: Array.from({length: matchCount}, (_, i) => result.snapshotItem(i)),
  510. combinedXPath: combinedXPath
  511. };
  512. }
  513. //获取数组中的元素,支持负索引。
  514. function getArrayElement(array, index) {
  515. if (!Array.isArray(array)) {
  516. throw new Error("第一个参数必须是数组。");
  517. }
  518. const numericIndex = Number(index);
  519. if (isNaN(numericIndex)) {
  520. throw new Error("索引必须是有效的数字或数字字符串。");
  521. }
  522. const adjustedIndex = numericIndex < 0 ? array.length + numericIndex : numericIndex;
  523. if (adjustedIndex < 0 || adjustedIndex >= array.length) {
  524. throw new RangeError("索引超出范围。");
  525. }
  526. return array[adjustedIndex];
  527. }
  528. function getElementsByText(xpath, searchText, useRegex = false, whitelistMode = false) {
  529. let isSplit = false;
  530. let split_char;
  531. let split_get_target_char_index;
  532. let isAttrSplit = false;
  533. let attrSplitAttr_attrname;
  534. //如果有自定义方法split,则使用自定义方法split
  535. if(xpath.includes('/split')){
  536. const args_str = xpath.split('/split')[1];
  537. xpath = xpath.split('/split')[0];
  538. const regex = /\(([^)]+)\)/;
  539. const match = args_str.match(regex);
  540. if (match) {
  541. const params = match[1].split(',').map(param => param.trim().replace(/^['"]|['"]$/g, ''));
  542. if(params.length == 3){
  543. split_char = params[0];
  544. split_get_target_char_index = params[1];
  545. attrSplitAttr_attrname = params[2];
  546. isAttrSplit = true;
  547. isSplit = true;
  548. }
  549. }
  550. }
  551. const result = document.evaluate(
  552. xpath,
  553. document,
  554. null,
  555. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
  556. null
  557. );
  558. if (result.snapshotLength === 0) {
  559. return [];
  560. }
  561. const elements = [];
  562. const searchPattern = useRegex ? new RegExp(searchText, 'i') : (searchText ? searchText.toLowerCase() : null);
  563. for (let i = 0; i < result.snapshotLength; i++) {
  564. const element = result.snapshotItem(i);
  565. if (!searchText) {
  566. elements.push(element);
  567. continue;
  568. }
  569. let elementText;
  570. let isMatch;
  571. if(isSplit){
  572. if(isAttrSplit){
  573. let args_array = element.getAttribute(attrSplitAttr_attrname).split(split_char);
  574. //支持负索引
  575. elementText = getArrayElement(args_array, split_get_target_char_index);
  576. isMatch = useRegex ?
  577. searchPattern.test(elementText) :
  578. elementText.toLowerCase().includes(searchPattern);
  579. }
  580. }
  581. else{
  582. elementText = element.textContent.trim();
  583. isMatch = useRegex ?
  584. searchPattern.test(elementText) :
  585. elementText.toLowerCase().includes(searchPattern);
  586. }
  587. if (whitelistMode ? !isMatch : isMatch) {
  588. elements.push(element);
  589. }
  590. }
  591. return elements;
  592. }
  593. function extractStrings(input) {
  594. const result = [];
  595. let temp = '';
  596. for (let i = 0; i < input.length; i++) {
  597. if (input[i] === '/') {
  598. if (temp) {
  599. result.push(temp);
  600. temp = '';
  601. }
  602. continue;
  603. }
  604. temp += input[i];
  605. }
  606. if (temp) result.push(temp);
  607. return result;
  608. }
  609. function findTargetAncestor(xpath, element) {
  610. let cleanXPath = xpath;
  611. if (!xpath.endsWith('/text()')) {
  612. cleanXPath = xpath.replace(/\/text\(\)$/, '');
  613. }
  614. if (cleanXPath.includes('/@')) {
  615. cleanXPath = cleanXPath.split('/@')[0];
  616. }
  617. const xpathParts = extractStrings(cleanXPath);
  618. if (xpathParts.length > 2) {
  619. let elementNode = element;
  620. if (element.nodeType === Node.TEXT_NODE) {
  621. elementNode = element.parentElement;
  622. } else if (element.nodeType === Node.ATTRIBUTE_NODE) {
  623. elementNode = element.ownerElement;
  624. }
  625. const intermediateSelector = parseXPathPart(xpathParts[1]);
  626. const intermediateElement = elementNode.closest(intermediateSelector);
  627. if (intermediateElement) {
  628. const rootSelector = parseXPathPart(xpathParts[0]);
  629. let targetElement = intermediateElement.closest(rootSelector);
  630. if (targetElement === intermediateElement) {
  631. targetElement = intermediateElement.parentElement.closest(rootSelector);
  632. }
  633. return {
  634. targetElement,
  635. firstElementInXPath: xpathParts[0]
  636. };
  637. }
  638. }
  639. const firstElementMatch = xpath.match(/\/+([a-zA-Z0-9_-]+(?:\[[^\]]+\])?)/)?.[1];
  640. if (!firstElementMatch) {
  641. return {
  642. targetElement: element,
  643. firstElementInXPath: null
  644. };
  645. }
  646. let [elementType, attributeSelector] = firstElementMatch.includes('[') ?
  647. firstElementMatch.split('[') :
  648. [firstElementMatch, null];
  649. const cleanAttributeSelector = attributeSelector?.replace(']', '');
  650. let elementNode = element;
  651. if (element.nodeType === Node.TEXT_NODE) {
  652. elementNode = element.parentElement;
  653. } else if (element.nodeType === Node.ATTRIBUTE_NODE) {
  654. elementNode = element.ownerElement;
  655. }
  656. const cssSelector = cleanAttributeSelector ?
  657. `${elementType}[${cleanAttributeSelector.replace('@', '')}]` :
  658. elementType;
  659. const targetElement = elementType && elementNode ?
  660. elementNode.closest(cssSelector) :
  661. elementNode;
  662. return {
  663. targetElement,
  664. firstElementInXPath: firstElementMatch
  665. };
  666. }
  667. function parseXPathPart(xpathPart) {
  668. const elementMatch = xpathPart.match(/([a-zA-Z0-9_-]+)(?:\[(.*?)\])?/);
  669. if (!elementMatch) return xpathPart;
  670. const [, tag, attribute] = elementMatch;
  671. if (!attribute) return tag;
  672. const attrMatch = attribute.match(/@([a-zA-Z0-9_-]+)(?:=['"]([^'"]+)['"])?/);
  673. if (!attrMatch) return tag;
  674. const [, attrName, attrValue] = attrMatch;
  675. return attrValue ?
  676. `${tag}[${attrName}="${attrValue}"]` :
  677. `${tag}[${attrName}]`;
  678. }
  679. function compatibilityRemovalHandler(element) {
  680. //TODO:通用兼容模式,未完成
  681. const clearNodes = (node) => {
  682. if (node.nodeType === Node.TEXT_NODE) {
  683. node.textContent = '';
  684. return;
  685. }
  686. if (node.nodeType === Node.ELEMENT_NODE) {
  687. if (node !== element && node.nodeName === element.nodeName) {
  688. return;
  689. }
  690. const urlAttributes = ['href', 'src', 'data-src', 'data-original', 'background', 'poster'];
  691. urlAttributes.forEach(attr => {
  692. if (node.hasAttribute(attr)) {
  693. node.removeAttribute(attr);
  694. }
  695. });
  696. if (node.nodeName === 'IMG') {
  697. while (node.attributes.length > 0) {
  698. node.removeAttribute(node.attributes[0].name);
  699. }
  700. }
  701. }
  702. Array.from(node.childNodes).forEach(child => {
  703. clearNodes(child);
  704. });
  705. };
  706. clearNodes(element);
  707. }
  708. function removeElementsByText(xpath, searchText, useRegex = false, whitelistMode = false) {
  709. let xpath_before = xpath;
  710. if (xpath.endsWith('text()')) {
  711. xpath = xpath.replace(/\/text\(\)$/, '');
  712. }
  713. const elements = getElementsByText(xpath, searchText, useRegex, whitelistMode);
  714. if (elements.length === 0) {
  715. return;
  716. }
  717. elements.forEach((element, index) => {
  718. const { targetElement, firstElementInXPath } = findTargetAncestor(xpath, element);
  719. const currentConfig = getDomainConfig(getCurrentDomain());
  720. const isContentPage = currentConfig.contentPageUrlPatterns
  721. .some(pattern => new RegExp(pattern).test(getSplitUrl()));
  722. if(isContentPage && getCurrentDomain().includes('reddit.com')){
  723. compatibilityRemovalHandler(targetElement);
  724. }
  725. else{
  726. targetElement.parentNode?.removeChild(targetElement);
  727. }
  728. });
  729. }
  730. function removeOverflowHidden(element) {
  731. let currentElement = element;
  732. let upCount = 0;
  733. while (currentElement && upCount < 3) {
  734. const computedStyle = window.getComputedStyle(currentElement);
  735. if (computedStyle.overflow === 'hidden') {
  736. currentElement.style.overflow = 'visible';
  737. } else {
  738. }
  739. currentElement = currentElement.parentElement;
  740. upCount++;
  741. }
  742. function processChildren(el, depth) {
  743. if (!el || depth > 3) return;
  744. const children = el.children;
  745. for (const child of children) {
  746. const computedStyle = window.getComputedStyle(child);
  747. if (computedStyle.overflow === 'hidden') {
  748. child.style.overflow = 'visible';
  749. } else {
  750. }
  751. processChildren(child, depth + 1);
  752. }
  753. }
  754. processChildren(element, 1);
  755. }
  756. let PANEL_SETTINGS = GM_getValue('panelSettings', {
  757. offset: 2,
  758. expandMode: 'click',
  759. collapsedWidth: 70,
  760. expandedWidth: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 290 : 400,
  761. showBlockButton: 'hover'
  762. });
  763. function addBlockButtonsToUsernames(xpath, isContentPage) {
  764. if (!xpath) return;
  765. let attributeXpath = xpath;
  766. let attributeElements;
  767. let attr;
  768. let isAttribute = false;
  769. let isSplit = false;
  770. let split_Xpath;
  771. let split_char;
  772. let split_get_target_char_index;
  773. let attrSplitElements;
  774. let attrSplitAttr_attrname;
  775. let isAttrSplit = false;
  776. let textSplitElements;
  777. let isTextSplit = false;
  778. //两种情况,第一种是用户名在属性里,例如:username="用户名 2024-01-01"
  779. //第二种是用户名在文本里,例如:<div>用户名 2024-01-01</div>
  780. //自定义split方法处理这两种情况
  781. //两种参数的情况就是用户名在文本里,第一个参数是分隔符,第二个参数是目标字符的索引,还没实现
  782. //三种参数的情况就是用户名在属性里,第一个参数是分隔符,第二个参数是目标字符的索引,第三个参数是属性名
  783. if (xpath.includes('/split')) {
  784. isSplit = true;
  785. const args_str = xpath.split('/split')[1];
  786. const regex = /\(([^)]+)\)/;
  787. const match = args_str.match(regex);
  788. if (match) {
  789. isSplit = true;
  790. split_Xpath = xpath.split('/split')[0];
  791. const params = match[1].split(',').map(param => param.trim().replace(/^['"]|['"]$/g, ''));
  792. if(params.length >= 2){
  793. split_char = params[0];
  794. split_get_target_char_index = params[1];
  795. if(params.length == 2){
  796. //TODO: 处理两个参数的情况
  797. isTextSplit = true;
  798. }
  799. if(params.length == 3){
  800. attrSplitAttr_attrname = params[2];
  801. attrSplitElements = document.evaluate(split_Xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  802. isAttrSplit = true;
  803. xpath = split_Xpath;
  804. }
  805. }
  806. }
  807. }
  808. if (attributeXpath.includes('/@') && isSplit == false) {
  809. attr = attributeXpath.split('/@')[1];
  810. attributeXpath = attributeXpath.split('/@')[0];
  811. attributeElements = document.evaluate(attributeXpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  812. isAttribute = true;
  813. }
  814. const elements = document.evaluate(
  815. xpath,
  816. document,
  817. null,
  818. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
  819. null
  820. );
  821. const elementsArray = [];
  822. if (isAttribute && isSplit == false) {
  823. for (let i = 0; i < attributeElements.snapshotLength; i++) {
  824. elementsArray.push(attributeElements.snapshotItem(i));
  825. }
  826. }
  827. else if(isAttrSplit){
  828. for (let i = 0; i < attrSplitElements.snapshotLength; i++) {
  829. elementsArray.push(attrSplitElements.snapshotItem(i));
  830. }
  831. }
  832. else{
  833. for (let i = 0; i < elements.snapshotLength; i++) {
  834. elementsArray.push(elements.snapshotItem(i));
  835. }
  836. }
  837. elementsArray.forEach((element, index) => {
  838. let username;
  839. if(isAttribute && isSplit == false){
  840. username = element.getAttribute(attr);
  841. }
  842. else if(isAttrSplit){
  843. let args_array = element.getAttribute(attrSplitAttr_attrname).split(split_char);
  844. username = getArrayElement(args_array, split_get_target_char_index);
  845. }
  846. else{
  847. username = element.textContent.trim();
  848. }
  849. const { targetElement } = findTargetAncestor(xpath, element);
  850. if (targetElement) {
  851. removeOverflowHidden(element.parentNode);
  852. const existingButton = targetElement.querySelector('.block-user-btn');
  853. if (existingButton) {
  854. return;
  855. }
  856. try {
  857. const blockButton = document.createElement('div');
  858. blockButton.className = 'block-user-btn';
  859. blockButton.setAttribute('data-username', username);
  860. blockButton.textContent = '×';
  861. blockButton.title = setTextfromTemplate('block_button_title') + `${username}`;
  862. blockButton.style.cssText = `
  863. display: ${PANEL_SETTINGS.showBlockButton === 'always' ? 'inline-flex' : 'none'};
  864. align-items: center !important;
  865. justify-content: center !important;
  866. margin-left: 5px !important;
  867. padding: 0 !important;
  868. width: 1.2em !important;
  869. height: 1.2em !important;
  870. background: rgba(0, 0, 0, 0.6) !important;
  871. color: #fff !important;
  872. border-radius: 4px !important;
  873. cursor: pointer !important;
  874. z-index: 9999 !important;
  875. transition: all 0.3s !important;
  876. user-select: none !important;
  877. font-size: inherit !important;
  878. line-height: 1 !important;
  879. vertical-align: middle !important;
  880. text-align: center !important;
  881. position: relative !important;
  882. `;
  883. const wrapper = document.createElement('span');
  884. wrapper.style.cssText = `
  885. display: inline-flex;
  886. align-items: center;
  887. position: relative;
  888. `;
  889. if (element.parentNode) {
  890. element.parentNode.insertBefore(wrapper, element);
  891. wrapper.appendChild(element);
  892. wrapper.appendChild(blockButton);
  893. blockButton.addEventListener('click', (e) => {
  894. e.preventDefault();
  895. e.stopPropagation();
  896. const username = blockButton.getAttribute('data-username');
  897. const currentConfig = getDomainConfig(getCurrentDomain());
  898. if (currentConfig) {
  899. const configKey = isContentPage ? 'contentPageUserKeywords' : 'mainAndSubPageUserKeywords';
  900. if (!currentConfig[configKey].keywords) {
  901. currentConfig[configKey].keywords = [];
  902. }
  903. if (!currentConfig[configKey].keywords.includes(username)) {
  904. currentConfig[configKey].keywords.push(username);
  905. updateDomainConfig(getCurrentDomain(), currentConfig);
  906. debouncedHandleElements();
  907. updatePanelContent();
  908. } else {
  909. }
  910. }
  911. });
  912. const textSpan = document.createElement('span');
  913. textSpan.textContent = '×';
  914. textSpan.style.cssText = `
  915. position: absolute;
  916. top: 50%;
  917. left: 50%;
  918. transform: translate(-50%, -50%);
  919. line-height: 0;
  920. `;
  921. blockButton.textContent = '';
  922. blockButton.appendChild(textSpan);
  923. if (PANEL_SETTINGS.showBlockButton === 'hover') {
  924. wrapper.addEventListener('mouseenter', () => {
  925. blockButton.style.display = 'inline-flex';
  926. });
  927. wrapper.addEventListener('mouseleave', () => {
  928. blockButton.style.display = 'none';
  929. });
  930. }
  931. blockButton.addEventListener('mouseenter', () => {
  932. blockButton.style.background = 'rgba(0, 0, 0, 0.8)';
  933. });
  934. blockButton.addEventListener('mouseleave', () => {
  935. blockButton.style.background = 'rgba(0, 0, 0, 0.6)';
  936. });
  937. } else {
  938. console.warn(`无法为用户名 ${username} 添加屏蔽按钮:父元素不存在`);
  939. }
  940. } catch (error) {
  941. console.warn(`为用户名 ${username} 添加屏蔽按钮时发生错误:`, error);
  942. }
  943. }
  944. });
  945. }
  946. function getCurrentDomain(){
  947. const currentUrl = new URL(window.location.href);
  948. const baseDomain = currentUrl.hostname.replace(/^www\./, '');
  949. return baseDomain;
  950. }
  951. function removeCSS(cssSelector, attribute = null, value = null) {
  952. try {
  953. if (typeof cssSelector !== 'string') {
  954. console.error('cssSelector必须是字符串格式');
  955. return;
  956. }
  957. const elements = document.querySelectorAll(cssSelector);
  958. if (elements.length === 0) {
  959. return;
  960. }
  961. elements.forEach(element => {
  962. if (attribute) {
  963. if (value) {
  964. if (element.style[attribute] === value) {
  965. element.style[attribute] = '';
  966. }
  967. } else {
  968. element.style[attribute] = '';
  969. }
  970. } else {
  971. element.removeAttribute('style');
  972. if (cssSelector.startsWith('.')) {
  973. const className = cssSelector.substring(1);
  974. element.classList.remove(className);
  975. }
  976. }
  977. });
  978. Array.from(document.styleSheets).forEach(styleSheet => {
  979. try {
  980. const rules = styleSheet.cssRules || styleSheet.rules;
  981. for (let i = rules.length - 1; i >= 0; i--) {
  982. if (rules[i].selectorText === cssSelector) {
  983. styleSheet.deleteRule(i);
  984. }
  985. }
  986. } catch (e) {
  987. }
  988. });
  989. } catch (error) {
  990. console.error('移除CSS时发生错误:', error);
  991. }
  992. }
  993. function removeWebsiteCSS() {
  994. if(getCurrentDomain().includes('v2ex.com')){
  995. removeCSS('.collapsed', 'display', 'none');
  996. }
  997. }
  998. function handleElements() {
  999. debouncedRemoveWebsiteCSS();
  1000. const currentConfig = getDomainConfig(getCurrentDomain());
  1001. if (currentConfig && currentConfig.enabled) {
  1002. const isMainOrSubPage = [...currentConfig.mainPageUrlPatterns, ...currentConfig.subPageUrlPatterns]
  1003. .some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1004. const isContentPage = currentConfig.contentPageUrlPatterns
  1005. .some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1006. let keywords = [];
  1007. let keywords_regex = [];
  1008. let usernames = [];
  1009. let usernames_regex = [];
  1010. if (GLOBAL_CONFIG.GLOBAL_KEYWORDS) {
  1011. keywords = [...new Set(
  1012. userConfig.reduce((acc, config) => [
  1013. ...acc,
  1014. ...(config.mainAndSubPageKeywords?.keywords || []),
  1015. ...(config.contentPageKeywords?.keywords || [])
  1016. ], [])
  1017. )];
  1018. keywords_regex = [...new Set(
  1019. userConfig.reduce((acc, config) => [
  1020. ...acc,
  1021. ...(config.mainAndSubPageKeywords?.regexPatterns || []),
  1022. ...(config.contentPageKeywords?.regexPatterns || [])
  1023. ], [])
  1024. )];
  1025. } else if (currentConfig.shareKeywordsAcrossPages) {
  1026. keywords = [...new Set([
  1027. ...(currentConfig.mainAndSubPageKeywords?.keywords || []),
  1028. ...(currentConfig.contentPageKeywords?.keywords || [])
  1029. ])];
  1030. keywords_regex = [...new Set([
  1031. ...(currentConfig.mainAndSubPageKeywords?.regexPatterns || []),
  1032. ...(currentConfig.contentPageKeywords?.regexPatterns || [])
  1033. ])];
  1034. } else {
  1035. if (isMainOrSubPage) {
  1036. keywords = currentConfig.mainAndSubPageKeywords?.keywords || [];
  1037. keywords_regex = currentConfig.mainAndSubPageKeywords?.regexPatterns || [];
  1038. } else if (isContentPage) {
  1039. keywords = currentConfig.contentPageKeywords?.keywords || [];
  1040. keywords_regex = currentConfig.contentPageKeywords?.regexPatterns || [];
  1041. }
  1042. }
  1043. if (GLOBAL_CONFIG.GLOBAL_USERNAMES) {
  1044. usernames = [...new Set(
  1045. userConfig.reduce((acc, config) => [
  1046. ...acc,
  1047. ...(config.mainAndSubPageUserKeywords?.keywords || []),
  1048. ...(config.contentPageUserKeywords?.keywords || [])
  1049. ], [])
  1050. )];
  1051. usernames_regex = [...new Set(
  1052. userConfig.reduce((acc, config) => [
  1053. ...acc,
  1054. ...(config.mainAndSubPageUserKeywords?.regexPatterns || []),
  1055. ...(config.contentPageUserKeywords?.regexPatterns || [])
  1056. ], [])
  1057. )];
  1058. } else if (currentConfig.shareUsernamesAcrossPages) {
  1059. usernames = [...new Set([
  1060. ...(currentConfig.mainAndSubPageUserKeywords?.keywords || []),
  1061. ...(currentConfig.contentPageUserKeywords?.keywords || [])
  1062. ])];
  1063. usernames_regex = [...new Set([
  1064. ...(currentConfig.mainAndSubPageUserKeywords?.regexPatterns || []),
  1065. ...(currentConfig.contentPageUserKeywords?.regexPatterns || [])
  1066. ])];
  1067. } else {
  1068. if (isMainOrSubPage) {
  1069. usernames = currentConfig.mainAndSubPageUserKeywords?.keywords || [];
  1070. usernames_regex = currentConfig.mainAndSubPageUserKeywords?.regexPatterns || [];
  1071. } else if (isContentPage) {
  1072. usernames = currentConfig.contentPageUserKeywords?.keywords || [];
  1073. usernames_regex = currentConfig.contentPageUserKeywords?.regexPatterns || [];
  1074. }
  1075. }
  1076. if (isMainOrSubPage) {
  1077. if (currentConfig.mainAndSubPageKeywords?.xpath?.length > 0) {
  1078. currentConfig.mainAndSubPageKeywords.xpath.forEach(xpath => {
  1079. if (keywords?.length > 0) {
  1080. keywords.forEach(keyword => {
  1081. removeElementsByText(xpath, keyword, false);
  1082. });
  1083. }
  1084. if (keywords_regex?.length > 0) {
  1085. keywords_regex.forEach(pattern => {
  1086. removeElementsByText(xpath, pattern, true);
  1087. });
  1088. }
  1089. });
  1090. }
  1091. if (currentConfig.mainAndSubPageUserKeywords?.xpath?.length > 0) {
  1092. currentConfig.mainAndSubPageUserKeywords.xpath.forEach(xpath => {
  1093. addBlockButtonsToUsernames(xpath, false);
  1094. if (usernames?.length > 0) {
  1095. usernames.forEach(keyword => {
  1096. removeElementsByText(xpath, keyword, false);
  1097. });
  1098. }
  1099. if (usernames_regex?.length > 0) {
  1100. usernames_regex.forEach(pattern => {
  1101. removeElementsByText(xpath, pattern, true);
  1102. });
  1103. }
  1104. });
  1105. }
  1106. }
  1107. if (isContentPage) {
  1108. if (currentConfig.contentPageKeywords?.xpath?.length > 0) {
  1109. currentConfig.contentPageKeywords.xpath.forEach(xpath => {
  1110. if (keywords?.length > 0) {
  1111. keywords.forEach(keyword => {
  1112. removeElementsByText(xpath, keyword, false);
  1113. });
  1114. }
  1115. if (keywords_regex?.length > 0) {
  1116. keywords_regex.forEach(pattern => {
  1117. removeElementsByText(xpath, pattern, true);
  1118. });
  1119. }
  1120. });
  1121. }
  1122. if (currentConfig.contentPageUserKeywords?.xpath?.length > 0) {
  1123. currentConfig.contentPageUserKeywords.xpath.forEach(xpath => {
  1124. addBlockButtonsToUsernames(xpath, true);
  1125. if (usernames?.length > 0) {
  1126. usernames.forEach(keyword => {
  1127. removeElementsByText(xpath, keyword, false);
  1128. });
  1129. }
  1130. if (usernames_regex?.length > 0) {
  1131. usernames_regex.forEach(pattern => {
  1132. removeElementsByText(xpath, pattern, true);
  1133. });
  1134. }
  1135. });
  1136. }
  1137. }
  1138. }
  1139. }
  1140. function debounce(func, wait) {
  1141. let timeout;
  1142. return function executedFunction(...args) {
  1143. const later = () => {
  1144. clearTimeout(timeout);
  1145. func(...args);
  1146. };
  1147. clearTimeout(timeout);
  1148. timeout = setTimeout(later, wait);
  1149. };
  1150. }
  1151. const debouncedHandleElements = debounce(handleElements, 100);
  1152. const debouncedRemoveWebsiteCSS = debounce(removeWebsiteCSS, 100);
  1153. function getPageType() {
  1154. const currentConfig = getDomainConfig(getCurrentDomain());
  1155. if (!currentConfig) return 'unknown';
  1156. const isMainPage = currentConfig.mainPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1157. const isSubPage = currentConfig.subPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1158. const isContentPage = currentConfig.contentPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1159. if (isMainPage) return 'main';
  1160. if (isSubPage) return 'sub';
  1161. if (isContentPage) return 'content';
  1162. return 'unknown';
  1163. }
  1164. function updatePanelContent() {
  1165. const panel = document.getElementById('forum-filter-panel');
  1166. if (!panel) return;
  1167. const currentConfig = getDomainConfig(getCurrentDomain()) || SAMPLE_TEMPLATE;
  1168. const isMainPage = currentConfig.mainPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1169. const isSubPage = currentConfig.subPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1170. const isContentPage = currentConfig.contentPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  1171. let pageType = setTextfromTemplate('panel_top_page_type_unknown');
  1172. if (isMainPage) pageType = setTextfromTemplate('panel_top_page_type_main');
  1173. else if (isSubPage) pageType = setTextfromTemplate('panel_top_page_type_sub');
  1174. else if (isContentPage) pageType = setTextfromTemplate('panel_top_page_type_content');
  1175. panel.querySelector('#page-type-value').textContent = pageType;
  1176. panel.querySelector('#domain-info-text').textContent = setTextfromTemplate('panel_top_current_domain');
  1177. panel.querySelector('#domain-info-value').textContent = getCurrentDomain();
  1178. panel.querySelector('#domain-enabled').checked = currentConfig.enabled;
  1179. panel.querySelector('#global-keywords').checked = GLOBAL_CONFIG.GLOBAL_KEYWORDS;
  1180. panel.querySelector('#global-usernames').checked = GLOBAL_CONFIG.GLOBAL_USERNAMES;
  1181. panel.querySelector('#share-keywords').checked = currentConfig.shareKeywordsAcrossPages;
  1182. panel.querySelector('#share-usernames').checked = currentConfig.shareUsernamesAcrossPages;
  1183. const mainPatternsEditor = createArrayEditor(
  1184. setTextfromTemplate('url_patterns_main_page_url_patterns_title'),
  1185. currentConfig.mainPageUrlPatterns || [],
  1186. (item) => {
  1187. if (!currentConfig.mainPageUrlPatterns) {
  1188. currentConfig.mainPageUrlPatterns = [];
  1189. }
  1190. currentConfig.mainPageUrlPatterns.push(item);
  1191. saveUserConfig(userConfig);
  1192. debouncedHandleElements();
  1193. },
  1194. (index) => {
  1195. currentConfig.mainPageUrlPatterns.splice(index, 1);
  1196. saveUserConfig(userConfig);
  1197. debouncedHandleElements();
  1198. },
  1199. 'main-patterns-editor',
  1200. true
  1201. );
  1202. const subPatternsEditor = createArrayEditor(
  1203. setTextfromTemplate('url_patterns_sub_page_url_patterns_title'),
  1204. currentConfig.subPageUrlPatterns || [],
  1205. (item) => {
  1206. if (!currentConfig.subPageUrlPatterns) {
  1207. currentConfig.subPageUrlPatterns = [];
  1208. }
  1209. currentConfig.subPageUrlPatterns.push(item);
  1210. saveUserConfig(userConfig);
  1211. debouncedHandleElements();
  1212. },
  1213. (index) => {
  1214. currentConfig.subPageUrlPatterns.splice(index, 1);
  1215. saveUserConfig(userConfig);
  1216. debouncedHandleElements();
  1217. },
  1218. 'sub-patterns-editor',
  1219. true
  1220. );
  1221. const contentPatternsEditor = createArrayEditor(
  1222. setTextfromTemplate('url_patterns_content_page_url_patterns_title'),
  1223. currentConfig.contentPageUrlPatterns || [],
  1224. (item) => {
  1225. if (!currentConfig.contentPageUrlPatterns) {
  1226. currentConfig.contentPageUrlPatterns = [];
  1227. }
  1228. currentConfig.contentPageUrlPatterns.push(item);
  1229. saveUserConfig(userConfig);
  1230. debouncedHandleElements();
  1231. },
  1232. (index) => {
  1233. currentConfig.contentPageUrlPatterns.splice(index, 1);
  1234. saveUserConfig(userConfig);
  1235. debouncedHandleElements();
  1236. },
  1237. 'content-patterns-editor',
  1238. true
  1239. );
  1240. const mainPatternsContainer = panel.querySelector('#main-patterns-editor');
  1241. const subPatternsContainer = panel.querySelector('#sub-patterns-editor');
  1242. const contentPatternsContainer = panel.querySelector('#content-patterns-editor');
  1243. mainPatternsContainer.innerHTML = '';
  1244. subPatternsContainer.innerHTML = '';
  1245. contentPatternsContainer.innerHTML = '';
  1246. mainPatternsContainer.appendChild(mainPatternsEditor);
  1247. subPatternsContainer.appendChild(subPatternsEditor);
  1248. contentPatternsContainer.appendChild(contentPatternsEditor);
  1249. const mainTitleXPathEditor = createArrayEditor(
  1250. setTextfromTemplate('xpath_config_main_and_sub_page_keywords_title'),
  1251. currentConfig.mainAndSubPageKeywords?.xpath || [],
  1252. (item) => {
  1253. if (!currentConfig.mainAndSubPageKeywords) {
  1254. currentConfig.mainAndSubPageKeywords = { xpath: [] };
  1255. }
  1256. if (!currentConfig.mainAndSubPageKeywords.xpath) {
  1257. currentConfig.mainAndSubPageKeywords.xpath = [];
  1258. }
  1259. currentConfig.mainAndSubPageKeywords.xpath.push(item);
  1260. saveUserConfig(userConfig);
  1261. debouncedHandleElements();
  1262. },
  1263. (index) => {
  1264. currentConfig.mainAndSubPageKeywords.xpath.splice(index, 1);
  1265. saveUserConfig(userConfig);
  1266. debouncedHandleElements();
  1267. },
  1268. 'title-xpath-editor'
  1269. );
  1270. const mainUserXPathEditor = createArrayEditor(
  1271. setTextfromTemplate('xpath_config_main_and_sub_page_usernames_title'),
  1272. currentConfig.mainAndSubPageUserKeywords?.xpath || [],
  1273. (item) => {
  1274. if (!currentConfig.mainAndSubPageUserKeywords) {
  1275. currentConfig.mainAndSubPageUserKeywords = { xpath: [] };
  1276. }
  1277. if (!currentConfig.mainAndSubPageUserKeywords.xpath) {
  1278. currentConfig.mainAndSubPageUserKeywords.xpath = [];
  1279. }
  1280. currentConfig.mainAndSubPageUserKeywords.xpath.push(item);
  1281. saveUserConfig(userConfig);
  1282. debouncedHandleElements();
  1283. },
  1284. (index) => {
  1285. currentConfig.mainAndSubPageUserKeywords.xpath.splice(index, 1);
  1286. saveUserConfig(userConfig);
  1287. debouncedHandleElements();
  1288. },
  1289. 'user-xpath-editor'
  1290. );
  1291. const contentTitleXPathEditor = createArrayEditor(
  1292. setTextfromTemplate('xpath_config_content_page_keywords_title'),
  1293. currentConfig.contentPageKeywords?.xpath || [],
  1294. (item) => {
  1295. if (!currentConfig.contentPageKeywords) {
  1296. currentConfig.contentPageKeywords = { xpath: [] };
  1297. }
  1298. if (!currentConfig.contentPageKeywords.xpath) {
  1299. currentConfig.contentPageKeywords.xpath = [];
  1300. }
  1301. currentConfig.contentPageKeywords.xpath.push(item);
  1302. saveUserConfig(userConfig);
  1303. debouncedHandleElements();
  1304. },
  1305. (index) => {
  1306. currentConfig.contentPageKeywords.xpath.splice(index, 1);
  1307. saveUserConfig(userConfig);
  1308. debouncedHandleElements();
  1309. },
  1310. 'content-title-xpath-editor'
  1311. );
  1312. const contentUserXPathEditor = createArrayEditor(
  1313. setTextfromTemplate('xpath_config_content_page_usernames_title'),
  1314. currentConfig.contentPageUserKeywords?.xpath || [],
  1315. (item) => {
  1316. if (!currentConfig.contentPageUserKeywords) {
  1317. currentConfig.contentPageUserKeywords = { xpath: [] };
  1318. }
  1319. if (!currentConfig.contentPageUserKeywords.xpath) {
  1320. currentConfig.contentPageUserKeywords.xpath = [];
  1321. }
  1322. currentConfig.contentPageUserKeywords.xpath.push(item);
  1323. saveUserConfig(userConfig);
  1324. debouncedHandleElements();
  1325. },
  1326. (index) => {
  1327. currentConfig.contentPageUserKeywords.xpath.splice(index, 1);
  1328. saveUserConfig(userConfig);
  1329. debouncedHandleElements();
  1330. },
  1331. 'content-user-xpath-editor'
  1332. );
  1333. const mainTitleXPathContainer = panel.querySelector('#main-title-xpath-editor');
  1334. const mainUserXPathContainer = panel.querySelector('#main-user-xpath-editor');
  1335. const contentTitleXPathContainer = panel.querySelector('#content-title-xpath-editor');
  1336. const contentUserXPathContainer = panel.querySelector('#content-user-xpath-editor');
  1337. mainTitleXPathContainer.innerHTML = '';
  1338. mainUserXPathContainer.innerHTML = '';
  1339. contentTitleXPathContainer.innerHTML = '';
  1340. contentUserXPathContainer.innerHTML = '';
  1341. mainTitleXPathContainer.appendChild(mainTitleXPathEditor);
  1342. mainUserXPathContainer.appendChild(mainUserXPathEditor);
  1343. contentTitleXPathContainer.appendChild(contentTitleXPathEditor);
  1344. contentUserXPathContainer.appendChild(contentUserXPathEditor);
  1345. const keywordsContainer = panel.querySelector('#keywords-container');
  1346. const usernamesContainer = panel.querySelector('#usernames-container');
  1347. keywordsContainer.innerHTML = '';
  1348. usernamesContainer.innerHTML = '';
  1349. if (isMainPage || isSubPage) {
  1350. if (currentConfig.mainAndSubPageKeywords) {
  1351. const mainPageKeywords = createArrayEditor(
  1352. setTextfromTemplate('keywords_config_keywords_list_title'),
  1353. currentConfig.mainAndSubPageKeywords.keywords || [],
  1354. (item) => {
  1355. if (!currentConfig.mainAndSubPageKeywords.keywords) {
  1356. currentConfig.mainAndSubPageKeywords.keywords = [];
  1357. }
  1358. currentConfig.mainAndSubPageKeywords.keywords.push(item);
  1359. saveUserConfig(userConfig);
  1360. debouncedHandleElements();
  1361. },
  1362. (index) => {
  1363. currentConfig.mainAndSubPageKeywords.keywords.splice(index, 1);
  1364. saveUserConfig(userConfig);
  1365. debouncedHandleElements();
  1366. },
  1367. 'array-editor-keywords-list'
  1368. );
  1369. keywordsContainer.appendChild(mainPageKeywords);
  1370. const mainPageKeywordsRegex = createArrayEditor(
  1371. setTextfromTemplate('keywords_config_keywords_regex_title'),
  1372. currentConfig.mainAndSubPageKeywords.regexPatterns || [],
  1373. (item) => {
  1374. if (!currentConfig.mainAndSubPageKeywords.regexPatterns) {
  1375. currentConfig.mainAndSubPageKeywords.regexPatterns = [];
  1376. }
  1377. currentConfig.mainAndSubPageKeywords.regexPatterns.push(item);
  1378. saveUserConfig(userConfig);
  1379. debouncedHandleElements();
  1380. },
  1381. (index) => {
  1382. currentConfig.mainAndSubPageKeywords.regexPatterns.splice(index, 1);
  1383. saveUserConfig(userConfig);
  1384. debouncedHandleElements();
  1385. },
  1386. 'array-editor-keywords-regex',
  1387. true
  1388. );
  1389. keywordsContainer.appendChild(mainPageKeywordsRegex);
  1390. }
  1391. if (currentConfig.mainAndSubPageUserKeywords) {
  1392. const mainPageUsernames = createArrayEditor(
  1393. setTextfromTemplate('usernames_config_usernames_list_title'),
  1394. currentConfig.mainAndSubPageUserKeywords.keywords || [],
  1395. (item) => {
  1396. if (!currentConfig.mainAndSubPageUserKeywords.keywords) {
  1397. currentConfig.mainAndSubPageUserKeywords.keywords = [];
  1398. }
  1399. currentConfig.mainAndSubPageUserKeywords.keywords.push(item);
  1400. saveUserConfig(userConfig);
  1401. debouncedHandleElements();
  1402. },
  1403. (index) => {
  1404. currentConfig.mainAndSubPageUserKeywords.keywords.splice(index, 1);
  1405. saveUserConfig(userConfig);
  1406. debouncedHandleElements();
  1407. },
  1408. 'array-editor-usernames-list'
  1409. );
  1410. usernamesContainer.appendChild(mainPageUsernames);
  1411. const mainPageUsernamesRegex = createArrayEditor(
  1412. setTextfromTemplate('usernames_config_usernames_regex_title'),
  1413. currentConfig.mainAndSubPageUserKeywords.regexPatterns || [],
  1414. (item) => {
  1415. if (!currentConfig.mainAndSubPageUserKeywords.regexPatterns) {
  1416. currentConfig.mainAndSubPageUserKeywords.regexPatterns = [];
  1417. }
  1418. currentConfig.mainAndSubPageUserKeywords.regexPatterns.push(item);
  1419. saveUserConfig(userConfig);
  1420. debouncedHandleElements();
  1421. },
  1422. (index) => {
  1423. currentConfig.mainAndSubPageUserKeywords.regexPatterns.splice(index, 1);
  1424. saveUserConfig(userConfig);
  1425. debouncedHandleElements();
  1426. },
  1427. 'array-editor-usernames-regex',
  1428. true
  1429. );
  1430. usernamesContainer.appendChild(mainPageUsernamesRegex);
  1431. }
  1432. } else if (isContentPage) {
  1433. if (currentConfig.contentPageKeywords) {
  1434. const contentPageKeywords = createArrayEditor(
  1435. setTextfromTemplate('keywords_config_keywords_list_title'),
  1436. currentConfig.contentPageKeywords.keywords || [],
  1437. (item) => {
  1438. if (!currentConfig.contentPageKeywords.keywords) {
  1439. currentConfig.contentPageKeywords.keywords = [];
  1440. }
  1441. currentConfig.contentPageKeywords.keywords.push(item);
  1442. saveUserConfig(userConfig);
  1443. debouncedHandleElements();
  1444. },
  1445. (index) => {
  1446. currentConfig.contentPageKeywords.keywords.splice(index, 1);
  1447. saveUserConfig(userConfig);
  1448. debouncedHandleElements();
  1449. },
  1450. 'array-editor-keywords-list'
  1451. );
  1452. keywordsContainer.appendChild(contentPageKeywords);
  1453. const contentPageKeywordsRegex = createArrayEditor(
  1454. setTextfromTemplate('keywords_config_keywords_regex_title'),
  1455. currentConfig.contentPageKeywords.regexPatterns || [],
  1456. (item) => {
  1457. if (!currentConfig.contentPageKeywords.regexPatterns) {
  1458. currentConfig.contentPageKeywords.regexPatterns = [];
  1459. }
  1460. currentConfig.contentPageKeywords.regexPatterns.push(item);
  1461. saveUserConfig(userConfig);
  1462. debouncedHandleElements();
  1463. },
  1464. (index) => {
  1465. currentConfig.contentPageKeywords.regexPatterns.splice(index, 1);
  1466. saveUserConfig(userConfig);
  1467. debouncedHandleElements();
  1468. },
  1469. 'array-editor-keywords-regex',
  1470. true
  1471. );
  1472. keywordsContainer.appendChild(contentPageKeywordsRegex);
  1473. }
  1474. if (currentConfig.contentPageUserKeywords) {
  1475. const contentPageUsernames = createArrayEditor(
  1476. setTextfromTemplate('usernames_config_usernames_list_title'),
  1477. currentConfig.contentPageUserKeywords.keywords || [],
  1478. (item) => {
  1479. if (!currentConfig.contentPageUserKeywords.keywords) {
  1480. currentConfig.contentPageUserKeywords.keywords = [];
  1481. }
  1482. currentConfig.contentPageUserKeywords.keywords.push(item);
  1483. saveUserConfig(userConfig);
  1484. debouncedHandleElements();
  1485. },
  1486. (index) => {
  1487. currentConfig.contentPageUserKeywords.keywords.splice(index, 1);
  1488. saveUserConfig(userConfig);
  1489. debouncedHandleElements();
  1490. },
  1491. 'array-editor-usernames-list'
  1492. );
  1493. usernamesContainer.appendChild(contentPageUsernames);
  1494. const contentPageUsernamesRegex = createArrayEditor(
  1495. setTextfromTemplate('usernames_config_usernames_regex_title'),
  1496. currentConfig.contentPageUserKeywords.regexPatterns || [],
  1497. (item) => {
  1498. if (!currentConfig.contentPageUserKeywords.regexPatterns) {
  1499. currentConfig.contentPageUserKeywords.regexPatterns = [];
  1500. }
  1501. currentConfig.contentPageUserKeywords.regexPatterns.push(item);
  1502. saveUserConfig(userConfig);
  1503. debouncedHandleElements();
  1504. },
  1505. (index) => {
  1506. currentConfig.contentPageUserKeywords.regexPatterns.splice(index, 1);
  1507. saveUserConfig(userConfig);
  1508. debouncedHandleElements();
  1509. },
  1510. 'array-editor-usernames-regex',
  1511. true
  1512. );
  1513. usernamesContainer.appendChild(contentPageUsernamesRegex);
  1514. }
  1515. } else {
  1516. keywordsContainer.innerHTML = '<div style="padding: 10px; color: #666;">请先配置并匹配页面类型</div>';
  1517. usernamesContainer.innerHTML = '<div style="padding: 10px; color: #666;">请先配置并匹配页面类型</div>';
  1518. }
  1519. ['global', 'keywords', 'usernames', 'url', 'xpath', 'sync'].forEach(section => {
  1520. const toggle = panel.querySelector(`[data-section="${section}"]`);
  1521. const isCollapsed = GLOBAL_CONFIG.CONFIG_SECTION_COLLAPSED[`${section}_SECTION_COLLAPSED`];
  1522. toggle.classList[isCollapsed ? 'add' : 'remove']('collapsed');
  1523. });
  1524. function updateGlobalUrlList() {
  1525. const listContainer = panel.querySelector('.global-url-list');
  1526. listContainer.innerHTML = '';
  1527. GLOBAL_CONFIG.GLOBAL_CONFIG_URL.forEach((url, index) => {
  1528. const item = document.createElement('div');
  1529. item.className = 'global-url-item';
  1530. item.innerHTML = `
  1531. <span>${url}</span>
  1532. <button title="删除">×</button>
  1533. `;
  1534. item.querySelector('button').addEventListener('click', () => {
  1535. GLOBAL_CONFIG.GLOBAL_CONFIG_URL.splice(index, 1);
  1536. updateGlobalUrlList();
  1537. });
  1538. listContainer.appendChild(item);
  1539. saveGlobalConfig();
  1540. });
  1541. }
  1542. panel.querySelector('#add-global-url').addEventListener('click', function() {
  1543. const input = panel.querySelector('#global-url-input');
  1544. const url = input.value.trim();
  1545. if (url) {
  1546. if (!GLOBAL_CONFIG.GLOBAL_CONFIG_URL.includes(url)) {
  1547. GLOBAL_CONFIG.GLOBAL_CONFIG_URL.push(url);
  1548. input.value = '';
  1549. updateGlobalUrlList();
  1550. } else {
  1551. alert(setTextfromTemplate('alert_url_exists'));
  1552. }
  1553. }
  1554. });
  1555. panel.querySelector('#apply-global-apply').addEventListener('click', function() {
  1556. downloadAndApplyConfig();
  1557. });
  1558. panel.querySelector('#global-url-input').addEventListener('keypress', function(e) {
  1559. if (e.key === 'Enter') {
  1560. panel.querySelector('#add-global-url').click();
  1561. }
  1562. });
  1563. updateGlobalUrlList();
  1564. const timeIntervalSelect = panel.querySelector('#time-interval');
  1565. timeIntervalSelect.value = GLOBAL_CONFIG.TIME_INTERVAL || '30';
  1566. timeIntervalSelect.addEventListener('change', function() {
  1567. const oldInterval = GLOBAL_CONFIG.TIME_INTERVAL;
  1568. GLOBAL_CONFIG.TIME_INTERVAL = parseInt(this.value);
  1569. GM_setValue('LAST_UPDATE_TIME', Date.now());
  1570. saveConfig();
  1571. });
  1572. }
  1573. function listenUrlChange(callback) {
  1574. let lastUrl = window.location.href;
  1575. const handleUrlChange = (type) => {
  1576. const currentUrl = window.location.href;
  1577. if (currentUrl !== lastUrl) {
  1578. lastUrl = currentUrl;
  1579. callback();
  1580. updatePanelContent();
  1581. }
  1582. };
  1583. window.addEventListener('popstate', () => {
  1584. handleUrlChange('popstate');
  1585. });
  1586. const originalPushState = history.pushState;
  1587. const originalReplaceState = history.replaceState;
  1588. history.pushState = function() {
  1589. originalPushState.apply(this, arguments);
  1590. handleUrlChange('pushState');
  1591. };
  1592. history.replaceState = function() {
  1593. originalReplaceState.apply(this, arguments);
  1594. handleUrlChange('replaceState');
  1595. };
  1596. }
  1597. if (document.readyState === 'loading') {
  1598. document.addEventListener('DOMContentLoaded', function() {
  1599. handleElements();
  1600. listenUrlChange(debouncedHandleElements);
  1601. });
  1602. } else {
  1603. handleElements();
  1604. listenUrlChange(debouncedHandleElements);
  1605. }
  1606. const observer = new MutationObserver((mutations) => {
  1607. debouncedHandleElements();
  1608. });
  1609. observer.observe(document.body, {
  1610. childList: true,
  1611. subtree: true
  1612. });
  1613. function exportDomainConfig(domain){
  1614. const configResult = getDomainConfig(domain);
  1615. if (!configResult.success) {
  1616. return configResult;
  1617. }
  1618. try {
  1619. const exportData = {
  1620. exportTime: new Date().toISOString(),
  1621. version: GM_info.script.version,
  1622. config: configResult.config
  1623. };
  1624. const jsonString = JSON.stringify(exportData, null, 2);
  1625. const blob = new Blob([jsonString], { type: 'application/json' });
  1626. const downloadUrl = URL.createObjectURL(blob);
  1627. const downloadLink = document.createElement('a');
  1628. downloadLink.href = downloadUrl;
  1629. downloadLink.download = `${domain}.json`;
  1630. document.body.appendChild(downloadLink);
  1631. downloadLink.click();
  1632. document.body.removeChild(downloadLink);
  1633. URL.revokeObjectURL(downloadUrl);
  1634. return {
  1635. success: true,
  1636. message: '配置导出成功',
  1637. config: configResult.config
  1638. };
  1639. } catch (error) {
  1640. console.error('导出配置失败:', error);
  1641. return {
  1642. success: false,
  1643. message: `导出配置失败: ${error.message}`,
  1644. config: null
  1645. };
  1646. }
  1647. }
  1648. function importDomainConfig(file) {
  1649. return new Promise((resolve, reject) => {
  1650. if (!file || !(file instanceof File)) {
  1651. resolve({
  1652. success: false,
  1653. message: '请选择有效的配置文件',
  1654. config: null
  1655. });
  1656. return;
  1657. }
  1658. const reader = new FileReader();
  1659. reader.onload = async (event) => {
  1660. try {
  1661. const importData = JSON.parse(event.target.result);
  1662. if (!importData.config || !importData.config.domain) {
  1663. resolve({
  1664. success: false,
  1665. message: '无效的配置文件格式',
  1666. config: null
  1667. });
  1668. return;
  1669. }
  1670. const existingConfig = getDomainConfig(importData.config.domain);
  1671. if (existingConfig) {
  1672. const updateResult = updateDomainConfig(importData.config.domain, importData.config);
  1673. resolve({
  1674. success: true,
  1675. message: '配置已更新',
  1676. config: updateResult.config
  1677. });
  1678. } else {
  1679. const addResult = addDomainConfig(importData.config);
  1680. resolve({
  1681. success: true,
  1682. message: '配置已导入',
  1683. config: addResult.config
  1684. });
  1685. }
  1686. } catch (error) {
  1687. console.error('导入配置失败:', error);
  1688. resolve({
  1689. success: false,
  1690. message: `导入配置失败: ${error.message}`,
  1691. config: null
  1692. });
  1693. }
  1694. };
  1695. reader.onerror = () => {
  1696. resolve({
  1697. success: false,
  1698. message: '读取文件失败',
  1699. config: null
  1700. });
  1701. };
  1702. reader.readAsText(file);
  1703. });
  1704. }
  1705. function importDomainConfigFromFile() {
  1706. return new Promise((resolve) => {
  1707. const input = document.createElement('input');
  1708. input.type = 'file';
  1709. input.accept = '.json';
  1710. input.onchange = async (event) => {
  1711. const file = event.target.files[0];
  1712. const result = await importDomainConfig(file);
  1713. resolve(result);
  1714. };
  1715. input.click();
  1716. });
  1717. }
  1718. function exportUserConfig() {
  1719. try {
  1720. const exportData = {
  1721. globalConfig: GLOBAL_CONFIG,
  1722. userConfig: userConfig
  1723. };
  1724. const jsonString = JSON.stringify(exportData, null, 2);
  1725. const blob = new Blob([jsonString], { type: 'application/json' });
  1726. const downloadUrl = URL.createObjectURL(blob);
  1727. const downloadLink = document.createElement('a');
  1728. downloadLink.href = downloadUrl;
  1729. downloadLink.download = `universal-forum-block-config-${new Date().toISOString().split('T')[0]}.json`;
  1730. document.body.appendChild(downloadLink);
  1731. downloadLink.click();
  1732. document.body.removeChild(downloadLink);
  1733. URL.revokeObjectURL(downloadUrl);
  1734. return {
  1735. success: true,
  1736. message: '配置导出成功',
  1737. config: exportData
  1738. };
  1739. } catch (error) {
  1740. console.error('导出配置失败:', error);
  1741. return {
  1742. success: false,
  1743. message: `导出配置失败: ${error.message}`,
  1744. config: null
  1745. };
  1746. }
  1747. }
  1748. function importUserConfig(file) {
  1749. return new Promise((resolve, reject) => {
  1750. if (!file || !(file instanceof File)) {
  1751. resolve({
  1752. success: false,
  1753. message: '请选择有效的配置文件',
  1754. config: null
  1755. });
  1756. return;
  1757. }
  1758. const reader = new FileReader();
  1759. reader.onload = async (event) => {
  1760. try {
  1761. const importData = JSON.parse(event.target.result);
  1762. const configCopy = JSON.parse(JSON.stringify(importData));
  1763. saveConfig(configCopy);
  1764. } catch (error) {
  1765. console.error('导入配置失败:', error);
  1766. resolve({
  1767. success: false,
  1768. message: `导入配置失败: ${error.message}`,
  1769. config: null
  1770. });
  1771. }
  1772. };
  1773. reader.onerror = () => {
  1774. resolve({
  1775. success: false,
  1776. message: '读取文件失败',
  1777. config: null
  1778. });
  1779. };
  1780. reader.readAsText(file);
  1781. });
  1782. }
  1783. function importUserConfigFromFile() {
  1784. return new Promise((resolve) => {
  1785. const input = document.createElement('input');
  1786. input.type = 'file';
  1787. input.accept = '.json';
  1788. input.onchange = async (event) => {
  1789. const file = event.target.files[0];
  1790. const result = await importUserConfig(file);
  1791. resolve(result);
  1792. };
  1793. input.click();
  1794. });
  1795. }
  1796. function savePanelSettings() {
  1797. GM_setValue('panelSettings', PANEL_SETTINGS);
  1798. applyPanelSettings();
  1799. debouncedHandleElements();
  1800. }
  1801. function applyPanelSettings() {
  1802. const panel = document.getElementById('forum-filter-panel');
  1803. if (!panel) return;
  1804. panel.style.left = PANEL_SETTINGS.offset + '%';
  1805. if (PANEL_SETTINGS.expandMode === 'click') {
  1806. panel.classList.add('click-mode');
  1807. } else {
  1808. panel.classList.remove('click-mode');
  1809. panel.classList.remove('expanded');
  1810. }
  1811. const currentConfig = getDomainConfig(getCurrentDomain());
  1812. const isContentPage = currentConfig?.contentPageUrlPatterns?.some(pattern =>
  1813. new RegExp(pattern).test(getSplitUrl())
  1814. );
  1815. const blockButtons = document.querySelectorAll('.block-user-btn');
  1816. blockButtons.forEach(button => {
  1817. const wrapper = button.parentElement;
  1818. const newWrapper = wrapper.cloneNode(true);
  1819. wrapper.parentNode.replaceChild(newWrapper, wrapper);
  1820. const newButton = newWrapper.querySelector('.block-user-btn');
  1821. newButton.style.display = PANEL_SETTINGS.showBlockButton === 'always' ? 'inline-flex' : 'none';
  1822. newButton.addEventListener('click', (e) => {
  1823. e.preventDefault();
  1824. e.stopPropagation();
  1825. const username = newButton.getAttribute('data-username');
  1826. const currentConfig = getDomainConfig(getCurrentDomain());
  1827. if (currentConfig) {
  1828. const configKey = isContentPage ? 'contentPageUserKeywords' : 'mainAndSubPageUserKeywords';
  1829. if (!currentConfig[configKey].keywords) {
  1830. currentConfig[configKey].keywords = [];
  1831. }
  1832. if (!currentConfig[configKey].keywords.includes(username)) {
  1833. currentConfig[configKey].keywords.push(username);
  1834. updateDomainConfig(getCurrentDomain(), currentConfig);
  1835. debouncedHandleElements();
  1836. updatePanelContent();
  1837. }
  1838. }
  1839. });
  1840. if (PANEL_SETTINGS.showBlockButton === 'hover') {
  1841. newWrapper.addEventListener('mouseenter', () => {
  1842. newButton.style.display = 'inline-flex';
  1843. });
  1844. newWrapper.addEventListener('mouseleave', () => {
  1845. newButton.style.display = 'none';
  1846. });
  1847. }
  1848. newButton.addEventListener('mouseenter', () => {
  1849. newButton.style.background = 'rgba(0, 0, 0, 0.8)';
  1850. });
  1851. newButton.addEventListener('mouseleave', () => {
  1852. newButton.style.background = 'rgba(0, 0, 0, 0.6)';
  1853. });
  1854. });
  1855. const style = document.createElement('style');
  1856. style.id = 'forum-filter-dynamic-style';
  1857. style.textContent = `
  1858. #forum-filter-panel.click-mode:not(.expanded),
  1859. #forum-filter-panel:not(.click-mode):not(:hover):not(:focus-within) {
  1860. width: ${PANEL_SETTINGS.collapsedWidth}px;
  1861. }
  1862. #forum-filter-panel:not(.click-mode):hover,
  1863. #forum-filter-panel:not(.click-mode):focus-within,
  1864. #forum-filter-panel.click-mode.expanded {
  1865. width: ${PANEL_SETTINGS.expandedWidth}px !important;
  1866. }
  1867. `;
  1868. const oldStyle = document.getElementById('forum-filter-dynamic-style');
  1869. if (oldStyle) {
  1870. oldStyle.remove();
  1871. }
  1872. document.head.appendChild(style);
  1873. }
  1874. function createSettingsPanel() {
  1875. const settingsPanel = document.createElement('div');
  1876. settingsPanel.id = 'forum-filter-settings';
  1877. settingsPanel.innerHTML = `
  1878. <h3 id="js-settings-title">面板设置</h3>
  1879. <!-- 添加语言选择下拉框 -->
  1880. <div class="setting-group">
  1881. <label for="language-select">语言</label>
  1882. <select id="language-select">
  1883. <option value="zh-CN">简体中文</option>
  1884. <option value="en-US">English</option>
  1885. <option value="ja-JP">日本語</option>
  1886. <option value="ko-KR">한국어</option>
  1887. <option value="ru-RU">Русский</option>
  1888. <option value="fr-FR">Français</option>
  1889. <option value="de-DE">Deutsch</option>
  1890. <option value="it-IT">Italiano</option>
  1891. <option value="hi-IN">हिन्दी</option>
  1892. <option value="id-ID">Bahasa Indonesia</option>
  1893. <option value="vi-VN">Tiếng Vit</option>
  1894. <option value="th-TH">ไทย</option>
  1895. <option value="es-ES">Español</option>
  1896. <option value="pt-PT">Português</option>
  1897. </select>
  1898. </div>
  1899. <div class="setting-group">
  1900. <label>展开方式</label>
  1901. <select id="expand-mode">
  1902. <option value="hover" ${PANEL_SETTINGS.expandMode === 'hover' ? 'selected' : ''}>悬停展开</option>
  1903. <option value="click" ${PANEL_SETTINGS.expandMode === 'click' ? 'selected' : ''}>点击展开</option>
  1904. </select>
  1905. </div>
  1906. <div class="setting-group">
  1907. <label>屏蔽按钮显示方式</label>
  1908. <select id="show-block-button">
  1909. <option value="hover" ${PANEL_SETTINGS.showBlockButton === 'hover' ? 'selected' : ''}>悬停显示</option>
  1910. <option value="always" ${PANEL_SETTINGS.showBlockButton === 'always' ? 'selected' : ''}>总是显示</option>
  1911. </select>
  1912. </div>
  1913. <div class="setting-group">
  1914. <label>水平位置</label>
  1915. <input type="range" id="position-offset" min="0" max="90" value="${PANEL_SETTINGS.offset}">
  1916. <div class="position-value">${PANEL_SETTINGS.offset}%</div>
  1917. </div>
  1918. <div class="setting-group">
  1919. <label>收起宽度</label>
  1920. <input type="range" id="collapsed-width" min="30" max="200" step="10" value="${PANEL_SETTINGS.collapsedWidth}">
  1921. <div class="collapsed-width-value">${PANEL_SETTINGS.collapsedWidth}px</div>
  1922. </div>
  1923. <div class="setting-group">
  1924. <label>展开宽度</label>
  1925. <input type="range" id="expanded-width" min="100" max="${/Mobile|Android|iPhone/i.test(navigator.userAgent) ? 400 : 1000}" step="10" value="${PANEL_SETTINGS.expandedWidth}">
  1926. <div class="expanded-width-value">${PANEL_SETTINGS.expandedWidth}px</div>
  1927. </div>
  1928. <div class="buttons">
  1929. <button id="settings-cancel">取消</button>
  1930. <button id="settings-save">保存</button>
  1931. </div>
  1932. `;
  1933. settingsPanel.querySelector('#js-settings-title').textContent = setTextfromTemplate('settings_title');
  1934. settingsPanel.querySelector('label[for="language-select"]').textContent = setTextfromTemplate('settings_language');
  1935. const expandModeLabel = settingsPanel.querySelector('#expand-mode').previousElementSibling;
  1936. expandModeLabel.textContent = setTextfromTemplate('settings_expand_mode');
  1937. const expandModeOptions = settingsPanel.querySelectorAll('#expand-mode option');
  1938. expandModeOptions[0].textContent = setTextfromTemplate('settings_expand_hover');
  1939. expandModeOptions[1].textContent = setTextfromTemplate('settings_expand_click');
  1940. const blockButtonLabel = settingsPanel.querySelector('#show-block-button').previousElementSibling;
  1941. blockButtonLabel.textContent = setTextfromTemplate('settings_block_button_mode');
  1942. const blockButtonOptions = settingsPanel.querySelectorAll('#show-block-button option');
  1943. blockButtonOptions[0].textContent = setTextfromTemplate('settings_block_hover');
  1944. blockButtonOptions[1].textContent = setTextfromTemplate('settings_block_always');
  1945. const horizontalPositionLabel = settingsPanel.querySelector('#position-offset').previousElementSibling;
  1946. horizontalPositionLabel.textContent = setTextfromTemplate('settings_horizontal_position');
  1947. const collapsedWidthLabel = settingsPanel.querySelector('#collapsed-width').previousElementSibling;
  1948. collapsedWidthLabel.textContent = setTextfromTemplate('settings_collapsed_width');
  1949. const expandedWidthLabel = settingsPanel.querySelector('#expanded-width').previousElementSibling;
  1950. expandedWidthLabel.textContent = setTextfromTemplate('settings_expanded_width');
  1951. settingsPanel.querySelector('#settings-cancel').textContent = setTextfromTemplate('settings_cancel');
  1952. settingsPanel.querySelector('#settings-save').textContent = setTextfromTemplate('settings_save');
  1953. const overlay = document.createElement('div');
  1954. overlay.id = 'settings-overlay';
  1955. overlay.style.cssText = `
  1956. position: fixed;
  1957. top: 0;
  1958. left: 0;
  1959. right: 0;
  1960. bottom: 0;
  1961. background: rgba(0, 0, 0, 0.5);
  1962. z-index: 9999;
  1963. display: none;
  1964. `;
  1965. document.body.appendChild(overlay);
  1966. overlay.addEventListener('click', function() {
  1967. settingsPanel.classList.remove('visible');
  1968. overlay.style.display = 'none';
  1969. });
  1970. document.body.appendChild(settingsPanel);
  1971. const previewSettings = () => {
  1972. const tempSettings = {
  1973. expandMode: document.getElementById('expand-mode').value,
  1974. showBlockButton: document.getElementById('show-block-button').value,
  1975. offset: parseInt(document.getElementById('position-offset').value),
  1976. collapsedWidth: parseInt(document.getElementById('collapsed-width').value),
  1977. expandedWidth: parseInt(document.getElementById('expanded-width').value)
  1978. };
  1979. Object.assign(PANEL_SETTINGS, tempSettings);
  1980. applyPanelSettings();
  1981. };
  1982. document.getElementById('expand-mode').addEventListener('change', previewSettings);
  1983. document.getElementById('show-block-button').addEventListener('change', previewSettings);
  1984. document.getElementById('position-offset').addEventListener('input', function(e) {
  1985. document.querySelector('.position-value').textContent = e.target.value + '%';
  1986. previewSettings();
  1987. });
  1988. document.getElementById('collapsed-width').addEventListener('input', function(e) {
  1989. document.querySelector('.collapsed-width-value').textContent = e.target.value + 'px';
  1990. previewSettings();
  1991. });
  1992. document.getElementById('expanded-width').addEventListener('input', function(e) {
  1993. document.querySelector('.expanded-width-value').textContent = e.target.value + 'px';
  1994. previewSettings();
  1995. });
  1996. document.getElementById('settings-save').addEventListener('click', function() {
  1997. savePanelSettings();
  1998. settingsPanel.classList.remove('visible');
  1999. overlay.style.display = 'none';
  2000. });
  2001. document.getElementById('settings-cancel').addEventListener('click', function() {
  2002. PANEL_SETTINGS = GM_getValue('panelSettings', {
  2003. offset: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 0 : 10,
  2004. expandMode: 'hover',
  2005. collapsedWidth: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 30 : 70,
  2006. expandedWidth: /Mobile|Android|iPhone/i.test(navigator.userAgent) ? 290 : 400
  2007. });
  2008. applyPanelSettings();
  2009. settingsPanel.classList.remove('visible');
  2010. overlay.style.display = 'none';
  2011. });
  2012. const languageSelect = document.getElementById('language-select');
  2013. languageSelect.value = GLOBAL_CONFIG.LANGUAGE || 'zh-CN';
  2014. languageSelect.addEventListener('change', function(e) {
  2015. const newLanguage = e.target.value;
  2016. setLanguage(newLanguage);
  2017. });
  2018. return settingsPanel;
  2019. }
  2020. function encodeHTML(str) {
  2021. if (!str) return '';
  2022. return str.replace(/&/g, '&amp;')
  2023. .replace(/</g, '&lt;')
  2024. .replace(/>/g, '&gt;')
  2025. .replace(/"/g, '&quot;')
  2026. .replace(/'/g, '&#39;');
  2027. }
  2028. function createControlPanel() {
  2029. const panel = document.createElement('div');
  2030. panel.id = 'forum-filter-panel';
  2031. panel.style.display = panelVisible ? 'block' : 'none';
  2032. panel.innerHTML = `
  2033. <div class="panel-tab">⚙</div>
  2034. <div class="panel-content">
  2035. <div class="external-links" style="position: absolute; top: 10px; left: 18px; display: flex; gap: 8px;">
  2036. </div>
  2037. <div class="external-links" style="position: absolute; top: 10px; right: 18px; display: flex; gap: 8px;">
  2038. <a href="https://ko-fi.com/0heavrnl" class="external-link" title="Ko-fi" target="_blank" style="color: #333 !important; text-decoration: none !important; display: flex; align-items: center;">
  2039. <svg width="14" height="14" viewBox="0 0 24 24" style="vertical-align: text-bottom;">
  2040. <path fill="currentColor" d="M23.881 8.948c-.773-4.085-4.859-4.593-4.859-4.593H.723c-.604 0-.679.798-.679.798s-.082 7.324-.022 11.822c.164 2.424 2.586 2.672 2.586 2.672s8.267-.023 11.966-.049c2.438-.426 2.683-2.566 2.658-3.734 4.352.24 7.422-2.831 6.649-6.916zm-11.062 3.511c-1.246 1.453-4.011 3.976-4.011 3.976s-.121.119-.31.023c-.076-.057-.108-.09-.108-.09-.443-.441-3.368-3.049-4.034-3.954-.709-.965-1.041-2.7-.091-3.71.951-1.01 3.005-1.086 4.363.407 0 0 1.565-1.782 3.468-.963 1.904.82 1.832 3.011.723 4.311zm6.173.478c-.928.116-1.682.028-1.682.028V7.284h1.77s1.971.551 1.971 2.638c0 1.913-.985 2.667-2.059 3.015z"/>
  2041. </svg>
  2042. </a>
  2043. <a href="https://github.com/Heavrnl/UniversalForumBlock" class="external-link" title="GitHub" target="_blank" style="color: #333 !important; text-decoration: none !important; display: flex; align-items: center;">
  2044. <svg height="14" width="14" viewBox="0 0 16 16" style="vertical-align: text-bottom;">
  2045. <path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
  2046. </svg>
  2047. </a>
  2048. <a href="https://gf.qytechs.cn/scripts/522871-%E9%80%9A%E7%94%A8%E8%AE%BA%E5%9D%9B%E5%B1%8F%E8%94%BD%E6%8F%92%E4%BB%B6" class="external-link" title="GreasyFork" target="_blank" style="color: #333 !important; text-decoration: none !important; display: flex; align-items: center;">
  2049. <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABOUlEQVR4AYTRAaaEUBgF4MmMCqVSiiAE2kO0sUCbCBiBdtAOWsAADFGqUCQlYdB5lSlv3qvm53Bzu191uuyMPsWd8pzyemdeu8vel7mbpgmapjGtj3LfPUkQxGO+wTAMZFmG2+12hjz+PXkKoigCRVHQdX0HOX4T3bIsaJoGRVEQx/GGpGn6DVk6cQVBQFVVUFUVsiwjSRJcr1c4joOiKECS5BHgXt4Ng2XZDRFFEXmeY50gCI6A+ezym7AiZVnCtm38Hs/zjoDXB7AibdtiHMcNmFGGYQ6B598NjuMQhiF830dd1wvWNA3mrvY+wT1pGTzPo+/7Bem6brkmCOKjRH0KziJJEoZh2JCfIXlHGSUh4cAgG8GGfP78GRwmxcXFWJP0BUzNmGFTVlYGSlwYSRndJURnJoqzMwAArDfg4/66PAAAAABJRU5ErkJggg==" height="14" width="14" style="vertical-align: text-bottom;">
  2050. </a>
  2051. <a class="external-link" style="color: #333 !important; text-decoration: none !important; display: flex; align-items: center;">
  2052. <span style="margin-left: 3px; font-size: 12px;">v1.2.0</span>
  2053. </a>
  2054. </div>
  2055. <div class="domain-info">
  2056. <h4><span id="domain-info-text">当前域名: </span><span id="domain-info-value"></span></h4>
  2057. <div class="page-type"><span id="page-type-text">当前页面类型: </span><span id="page-type-value"></span></div>
  2058. <button class="panel-settings-btn" title="面板设置">⚙ 设置</button>
  2059. <label class="domain-enabled-label">
  2060. <input type="checkbox" id="domain-enabled">
  2061. <span id="domain-enabled-text">启用此域名配置</span>
  2062. </label>
  2063. </div>
  2064. <div class="config-section" data-section="global">
  2065. <button class="config-section-toggle" data-section="global">
  2066. <span id="global-config-title">全局配置</span>
  2067. <span class="config-section-indicator">▼</span>
  2068. </button>
  2069. <div class="config-section-content">
  2070. <div class="config-group">
  2071. <div class="checkbox-row">
  2072. <label>
  2073. <input type="checkbox" id="global-keywords">
  2074. 全局关键词
  2075. </label>
  2076. <label>
  2077. <input type="checkbox" id="global-usernames">
  2078. 全局用户名
  2079. </label>
  2080. </div>
  2081. <div class="checkbox-row">
  2082. <label>
  2083. <input type="checkbox" id="share-keywords">
  2084. 主页/内容页共享关键词
  2085. </label>
  2086. <label>
  2087. <input type="checkbox" id="share-usernames">
  2088. 主页/内容页共享用户名
  2089. </label>
  2090. </div>
  2091. <div class="global-url-section">
  2092. <div class="global-url-input-row">
  2093. <select id="time-interval" style="margin-right: 8px;">
  2094. <option value="1">1m</option>
  2095. <option value="5">5m</option>
  2096. <option value="10">10m</option>
  2097. <option value="30">30m</option>
  2098. <option value="60">1h</option>
  2099. <option value="120">2h</option>
  2100. <option value="300">5h</option>
  2101. <option value="720">12h</option>
  2102. <option value="1440">24h</option>
  2103. </select>
  2104. <input type="text" id="global-url-input" placeholder="输入配置链接">
  2105. <button id="add-global-url">添加</button>
  2106. <button id="apply-global-apply">应用</button>
  2107. </div>
  2108. <div class="global-url-list"></div>
  2109. </div>
  2110. </div>
  2111. </div>
  2112. </div>
  2113. <div class="config-section" data-section="keywords">
  2114. <button class="config-section-toggle" data-section="keywords">
  2115. <span id="keywords-config-title">关键词配置</span>
  2116. <span class="config-section-indicator">▼</span>
  2117. </button>
  2118. <div class="config-section-content">
  2119. <div id="keywords-container"></div>
  2120. </div>
  2121. </div>
  2122. <div class="config-section" data-section="usernames">
  2123. <button class="config-section-toggle" data-section="usernames">
  2124. <span id="usernames-config-title">用户名配置</span>
  2125. <span class="config-section-indicator">▼</span>
  2126. </button>
  2127. <div class="config-section-content">
  2128. <div id="usernames-container"></div>
  2129. </div>
  2130. </div>
  2131. <div class="config-section" data-section="url">
  2132. <button class="config-section-toggle" data-section="url">
  2133. <span id="url-config-title">URL 匹配模式</span>
  2134. <span class="config-section-indicator">▼</span>
  2135. </button>
  2136. <div class="config-section-content">
  2137. <div class="pattern-group">
  2138. <div id="main-patterns-editor"></div>
  2139. </div>
  2140. <div class="pattern-group">
  2141. <div id="sub-patterns-editor"></div>
  2142. </div>
  2143. <div class="pattern-group">
  2144. <div id="content-patterns-editor"></div>
  2145. </div>
  2146. </div>
  2147. </div>
  2148. <div class="config-section" data-section="xpath">
  2149. <button class="config-section-toggle" data-section="xpath">
  2150. <span id="xpath-config-title">XPath 配置</span>
  2151. <span class="config-section-indicator">▼</span>
  2152. </button>
  2153. <div class="config-section-content">
  2154. <div class="xpath-group">
  2155. <div id="main-title-xpath-editor"></div>
  2156. </div>
  2157. <div class="xpath-group">
  2158. <div id="main-user-xpath-editor"></div>
  2159. </div>
  2160. <div class="xpath-group">
  2161. <div id="content-title-xpath-editor"></div>
  2162. </div>
  2163. <div class="xpath-group">
  2164. <div id="content-user-xpath-editor"></div>
  2165. </div>
  2166. </div>
  2167. </div>
  2168. <div class="config-section" data-section="sync">
  2169. <button class="config-section-toggle" data-section="sync">
  2170. <span id="sync-config-title">云端同步</span>
  2171. <span class="config-section-indicator">▼</span>
  2172. </button>
  2173. <div class="config-section-content">
  2174. <input type="text" id="sync-server-url" placeholder="输入服务器地址">
  2175. <input type="text" id="sync-user-key" placeholder="输入用户密钥">
  2176. <button id="sync-apply">同步</button>
  2177. <button id="sync-delete">删除云端配置</button>
  2178. <div id="sync-status"></div>
  2179. </div>
  2180. </div>
  2181. <div class="button-group">
  2182. <button id="export-config">导出配置</button>
  2183. <button id="import-domain-config" style="display: none;">导入当前域名配置</button>
  2184. <button id="import-config">导入配置</button>
  2185. <button id="delete-domain-config" style="background: #ff4444 !important; color: white !important;">删除当前域名配置</button>
  2186. <button id="save-domain-config">保存</button>
  2187. </div>
  2188. </div>
  2189. `;
  2190. panel.querySelector('#page-type-text').textContent = setTextfromTemplate('panel_top_page_type');
  2191. panel.querySelector('.panel-settings-btn').textContent = setTextfromTemplate('panel_top_settings_button');
  2192. panel.querySelector('.panel-settings-btn').title = setTextfromTemplate('panel_top_settings_title');
  2193. panel.querySelector('#domain-enabled-text').textContent = setTextfromTemplate('panel_top_enable_domain');
  2194. panel.querySelector('#global-keywords').nextSibling.textContent = setTextfromTemplate('global_config_keywords');
  2195. panel.querySelector('#global-usernames').nextSibling.textContent = setTextfromTemplate('global_config_usernames');
  2196. panel.querySelector('#share-keywords').nextSibling.textContent = setTextfromTemplate('global_config_share_keywords');
  2197. panel.querySelector('#share-usernames').nextSibling.textContent = setTextfromTemplate('global_config_share_usernames');
  2198. panel.querySelector('#global-url-input').placeholder = setTextfromTemplate('global_config_linkimport_input_placeholder');
  2199. panel.querySelector('#add-global-url').textContent = setTextfromTemplate('global_config_add_global_url');
  2200. panel.querySelector('#apply-global-apply').textContent = setTextfromTemplate('global_config_apply_global_apply');
  2201. panel.querySelector('#global-config-title').textContent = setTextfromTemplate('global_config_title');
  2202. panel.querySelector('#keywords-config-title').textContent = setTextfromTemplate('keywords_config_title');
  2203. panel.querySelector('#usernames-config-title').textContent = setTextfromTemplate('usernames_config_title');
  2204. panel.querySelector('#url-config-title').textContent = setTextfromTemplate('url_patterns_title');
  2205. panel.querySelector('#xpath-config-title').textContent = setTextfromTemplate('xpath_config_title');
  2206. panel.querySelector('#export-config').textContent = setTextfromTemplate('panel_bottom_export_button');
  2207. panel.querySelector('#import-config').textContent = setTextfromTemplate('panel_bottom_import_button');
  2208. panel.querySelector('#delete-domain-config').textContent = setTextfromTemplate('panel_bottom_delete_button');
  2209. panel.querySelector('#save-domain-config').textContent = setTextfromTemplate('panel_bottom_save_button');
  2210. panel.querySelector('#sync-config-title').textContent = setTextfromTemplate('sync_config_title');
  2211. panel.querySelector('#sync-server-url').placeholder = setTextfromTemplate('sync_config_server_url');
  2212. panel.querySelector('#sync-user-key').placeholder = setTextfromTemplate('sync_config_user_key');
  2213. panel.querySelector('#sync-apply').textContent = setTextfromTemplate('sync_config_apply');
  2214. panel.querySelector('#sync-delete').textContent = setTextfromTemplate('sync_config_delete');
  2215. ['global', 'keywords', 'usernames', 'url', 'xpath', 'sync'].forEach(section => {
  2216. const toggle = panel.querySelector(`[data-section="${section}"]`);
  2217. const isCollapsed = GLOBAL_CONFIG.CONFIG_SECTION_COLLAPSED[`${section}_SECTION_COLLAPSED`];
  2218. toggle.classList[isCollapsed ? 'add' : 'remove']('collapsed');
  2219. });
  2220. panel.querySelector('#export-config').addEventListener('click', exportUserConfig);
  2221. panel.querySelector('#import-config').addEventListener('click', importUserConfigFromFile);
  2222. panel.querySelector('#import-domain-config').addEventListener('click', importCurrentDomainConfigFromFile);
  2223. panel.querySelector('#sync-apply').addEventListener('click', handleSyncInput);
  2224. panel.querySelector('#sync-delete').addEventListener('click', deleteCloudConfig);
  2225. panel.querySelector('#sync-server-url').value = GLOBAL_CONFIG.SYNC_CONFIG.server_url || '';
  2226. panel.querySelector('#sync-user-key').value = GLOBAL_CONFIG.SYNC_CONFIG.user_key || '';
  2227. panel.querySelectorAll('.config-section-toggle').forEach(toggle => {
  2228. toggle.addEventListener('click', function() {
  2229. this.classList.toggle('collapsed');
  2230. const content = this.nextElementSibling;
  2231. if (content && content.classList.contains('config-section-content')) {
  2232. if (this.classList.contains('collapsed')) {
  2233. content.style.maxHeight = '0';
  2234. content.style.opacity = '0';
  2235. content.style.margin = '0';
  2236. content.style.padding = '0';
  2237. } else {
  2238. content.style.maxHeight = '500px';
  2239. content.style.opacity = '1';
  2240. content.style.margin = '';
  2241. content.style.padding = '';
  2242. }
  2243. }
  2244. const section = this.getAttribute('data-section');
  2245. GLOBAL_CONFIG.CONFIG_SECTION_COLLAPSED[`${section}_SECTION_COLLAPSED`] = this.classList.contains('collapsed');
  2246. saveGlobalConfig();
  2247. });
  2248. });
  2249. function restoreConfigSections() {
  2250. panel.querySelectorAll('.config-section-toggle').forEach(toggle => {
  2251. const section = toggle.getAttribute('data-section');
  2252. const isCollapsed = GLOBAL_CONFIG.CONFIG_SECTION_COLLAPSED[`${section}_SECTION_COLLAPSED`];
  2253. if (isCollapsed) {
  2254. toggle.classList.add('collapsed');
  2255. const content = toggle.nextElementSibling;
  2256. if (content && content.classList.contains('config-section-content')) {
  2257. content.style.maxHeight = '0';
  2258. content.style.opacity = '0';
  2259. content.style.margin = '0';
  2260. content.style.padding = '0';
  2261. }
  2262. }
  2263. });
  2264. }
  2265. document.body.appendChild(panel);
  2266. applyPanelSettings();
  2267. updatePanelContent();
  2268. restoreConfigSections();
  2269. panel.querySelector('.panel-settings-btn').addEventListener('click', function() {
  2270. const settingsPanel = document.getElementById('forum-filter-settings');
  2271. const overlay = document.getElementById('settings-overlay');
  2272. if (settingsPanel && overlay) {
  2273. settingsPanel.classList.add('visible');
  2274. overlay.style.display = 'block';
  2275. }
  2276. });
  2277. panel.querySelector('.panel-tab').addEventListener('click', function() {
  2278. if (panel.classList.contains('click-mode')) {
  2279. panel.classList.toggle('expanded');
  2280. }
  2281. });
  2282. panel.querySelector('#save-domain-config').addEventListener('click', function() {
  2283. saveConfig();
  2284. });
  2285. const globalConfigCheckboxes = [
  2286. '#global-keywords',
  2287. '#global-usernames',
  2288. '#share-keywords',
  2289. '#share-usernames',
  2290. '#domain-enabled'
  2291. ];
  2292. globalConfigCheckboxes.forEach(selector => {
  2293. panel.querySelector(selector).addEventListener('change', function() {
  2294. GLOBAL_CONFIG.GLOBAL_KEYWORDS = panel.querySelector('#global-keywords').checked;
  2295. GLOBAL_CONFIG.GLOBAL_USERNAMES = panel.querySelector('#global-usernames').checked;
  2296. const currentConfig = getDomainConfig(getCurrentDomain());
  2297. if (currentConfig) {
  2298. currentConfig.shareKeywordsAcrossPages = panel.querySelector('#share-keywords').checked;
  2299. currentConfig.shareUsernamesAcrossPages = panel.querySelector('#share-usernames').checked;
  2300. }
  2301. saveConfig();
  2302. });
  2303. });
  2304. panel.querySelector('#delete-domain-config').addEventListener('click', function() {
  2305. if (confirm(`确定要删除 ${getCurrentDomain()} 的配置吗?此操作不可恢复。`)) {
  2306. removeDomainConfig(getCurrentDomain());
  2307. updatePanelContent();
  2308. debouncedHandleElements();
  2309. alert('配置已删除!');
  2310. }
  2311. });
  2312. return panel;
  2313. }
  2314. if (document.readyState === 'loading') {
  2315. document.addEventListener('DOMContentLoaded', function() {
  2316. createSettingsPanel();
  2317. createControlPanel();
  2318. initCloudSync();
  2319. });
  2320. } else {
  2321. createSettingsPanel();
  2322. createControlPanel();
  2323. initCloudSync();
  2324. }
  2325. function getSplitUrl(){
  2326. const currentUrl = new URL(window.location.href);
  2327. return currentUrl.pathname + (currentUrl.search ? currentUrl.search : '');
  2328. }
  2329. function createArrayEditor(title, items, onAdd, onDelete,className = null,isRegex = false) {
  2330. const container = document.createElement('div');
  2331. container.className = 'array-editor';
  2332. if (!Array.isArray(items)) {
  2333. items = [];
  2334. }
  2335. const toggleButton = document.createElement('button');
  2336. toggleButton.className = 'array-editor-toggle';
  2337. const titleSpan = document.createElement('span');
  2338. titleSpan.textContent = title;
  2339. if(className){
  2340. titleSpan.className = className;
  2341. }
  2342. const countSpan = document.createElement('span');
  2343. countSpan.className = 'array-editor-count';
  2344. countSpan.textContent = `${items.length}`;
  2345. toggleButton.appendChild(titleSpan);
  2346. toggleButton.appendChild(countSpan);
  2347. const content = document.createElement('div');
  2348. content.className = 'array-editor-content';
  2349. let editorType;
  2350. const currentLanguage = GLOBAL_CONFIG.LANGUAGE || 'zh-CN';
  2351. const templates = LANGUAGE_TEMPLATES[currentLanguage];
  2352. if (title === templates.url_patterns_main_page_url_patterns_title) {
  2353. editorType = 'mainpage_url_patterns';
  2354. } else if (title === templates.url_patterns_sub_page_url_patterns_title) {
  2355. editorType = 'subpage_url_patterns';
  2356. } else if (title === templates.url_patterns_content_page_url_patterns_title) {
  2357. editorType = 'contentpage_url_patterns';
  2358. } else if (title === templates.xpath_config_main_and_sub_page_usernames_title) {
  2359. editorType = 'main_and_sub_page_user_xpath';
  2360. } else if (title === templates.xpath_config_main_and_sub_page_keywords_title) {
  2361. editorType = 'main_and_sub_page_title_xpath';
  2362. } else if (title === templates.xpath_config_content_page_usernames_title) {
  2363. editorType = 'contentpage_user_xpath';
  2364. } else if (title === templates.xpath_config_content_page_keywords_title) {
  2365. editorType = 'contentpage_title_xpath';
  2366. } else if (title === templates.keywords_config_keywords_regex_title) {
  2367. editorType = 'keywords_regex';
  2368. } else if (title === templates.usernames_config_usernames_regex_title) {
  2369. editorType = 'usernames_regex';
  2370. } else if (title === templates.usernames_config_usernames_list_title) {
  2371. editorType = 'usernames';
  2372. } else if (title === templates.keywords_config_keywords_list_title) {
  2373. editorType = 'keywords';
  2374. }
  2375. if (GLOBAL_CONFIG.EDITOR_STATES[editorType]) {
  2376. content.classList.add('expanded');
  2377. }
  2378. const header = document.createElement('div');
  2379. const header2 = document.createElement('div');
  2380. const header3 = document.createElement('div');
  2381. header.className = 'array-editor-header';
  2382. header2.className = 'array-editor-header';
  2383. header3.className = 'array-editor-header';
  2384. const buttonGroup1 = document.createElement('div');
  2385. buttonGroup1.className = 'button-group-inline';
  2386. const input = document.createElement('input');
  2387. input.type = 'text';
  2388. if(isRegex){
  2389. input.placeholder = setTextfromTemplate('array_editor_add_item_input_placeholder_regex');
  2390. input.className = 'array-editor-additem-input-regex';
  2391. }else{
  2392. input.placeholder = setTextfromTemplate('array_editor_add_item_input_placeholder');
  2393. input.className = 'array-editor-additem-input';
  2394. }
  2395. const addButton = document.createElement('button');
  2396. addButton.textContent = setTextfromTemplate('array_editor_add_item');
  2397. addButton.title = setTextfromTemplate('array_editor_add_item_title');
  2398. addButton.className = 'array-editor-add-button';
  2399. const deleteAllButton = document.createElement('button');
  2400. deleteAllButton.textContent = setTextfromTemplate('array_editor_clear_allitem');
  2401. deleteAllButton.title = setTextfromTemplate('array_editor_clear_allitem_title');
  2402. deleteAllButton.className = 'array-editor-delete-all-button';
  2403. const buttonGroup2 = document.createElement('div');
  2404. buttonGroup2.className = 'button-group-inline';
  2405. const exportButton = document.createElement('button');
  2406. exportButton.textContent = setTextfromTemplate('array_editor_export_button');
  2407. exportButton.title = setTextfromTemplate('array_editor_export_button_title');
  2408. exportButton.className = 'array-editor-export-button';
  2409. const importButton = document.createElement('button');
  2410. importButton.textContent = setTextfromTemplate('array_editor_fileimport_input_button');
  2411. importButton.title = setTextfromTemplate('array_editor_fileimport_input_button_title');
  2412. importButton.className = 'array-editor-import-button';
  2413. const linkimportbutton = document.createElement('button');
  2414. linkimportbutton.textContent = setTextfromTemplate('array_editor_linkimport_input_button');
  2415. linkimportbutton.title = setTextfromTemplate('array_editor_linkimport_input_button_title');
  2416. linkimportbutton.className = 'array-editor-linkimport-button';
  2417. const linkimportinput = document.createElement('input');
  2418. linkimportinput.type = 'text';
  2419. linkimportinput.placeholder = setTextfromTemplate('array_editor_linkimport_input_placeholder');
  2420. linkimportinput.className = 'array-editor-linkimport-input';
  2421. const fileInput = document.createElement('input');
  2422. fileInput.type = 'file';
  2423. fileInput.accept = '.txt';
  2424. fileInput.style.display = 'none';
  2425. const searchinput = document.createElement('input');
  2426. searchinput.type = 'text';
  2427. searchinput.placeholder = setTextfromTemplate('array_editor_search_input_placeholder');
  2428. searchinput.className = 'array-editor-search-input';
  2429. buttonGroup1.appendChild(addButton);
  2430. buttonGroup1.appendChild(deleteAllButton);
  2431. buttonGroup2.appendChild(linkimportbutton);
  2432. buttonGroup2.appendChild(importButton);
  2433. buttonGroup2.appendChild(exportButton);
  2434. header.appendChild(input);
  2435. header.appendChild(buttonGroup1);
  2436. header2.appendChild(linkimportinput);
  2437. header2.appendChild(buttonGroup2);
  2438. header2.appendChild(fileInput);
  2439. header3.appendChild(searchinput);
  2440. const list = document.createElement('div');
  2441. list.className = 'array-editor-list';
  2442. list.dataset.empty = setTextfromTemplate('array_editor_list_empty_placeholder');
  2443. const updateList = (searchText = '') => {
  2444. list.innerHTML = '';
  2445. const filteredItems = searchText.trim()
  2446. ? items.filter(item => item.toLowerCase().includes(searchText.toLowerCase()))
  2447. : items;
  2448. filteredItems.forEach((item, index) => {
  2449. const itemElement = document.createElement('div');
  2450. itemElement.className = 'array-item';
  2451. let displayText = item;
  2452. if (searchText.trim()) {
  2453. const regex = new RegExp(`(${searchText})`, 'gi');
  2454. displayText = item.replace(regex, '<mark>$1</mark>');
  2455. }
  2456. itemElement.innerHTML = `
  2457. <span>${displayText}</span>
  2458. <button>×</button>
  2459. `;
  2460. const originalIndex = items.indexOf(item);
  2461. itemElement.querySelector('button').onclick = () => {
  2462. onDelete(originalIndex);
  2463. updateList(searchText);
  2464. countSpan.textContent = `${items.length}`;
  2465. document.querySelector('#save-domain-config').click();
  2466. };
  2467. list.appendChild(itemElement);
  2468. });
  2469. countSpan.textContent = `${items.length} ${searchText ? ` (${filteredItems.length})` : ''}`;
  2470. };
  2471. searchinput.addEventListener('input', (e) => {
  2472. updateList(e.target.value);
  2473. });
  2474. searchinput.addEventListener('keydown', (e) => {
  2475. if (e.key === 'Escape') {
  2476. searchinput.value = '';
  2477. updateList('');
  2478. }
  2479. });
  2480. const addNewItem = (value) => {
  2481. if (value.trim()) {
  2482. const newItem = value.trim();
  2483. const isDuplicate = items.some(item =>
  2484. item.toLowerCase() === newItem.toLowerCase()
  2485. );
  2486. if (isDuplicate) {
  2487. return true;
  2488. }
  2489. onAdd(newItem);
  2490. updateList();
  2491. countSpan.textContent = `${items.length}`;
  2492. document.querySelector('#save-domain-config').click();
  2493. return true;
  2494. }
  2495. return false;
  2496. };
  2497. input.addEventListener('keypress', (e) => {
  2498. if (e.key === 'Enter' && input.value.trim()) {
  2499. if (addNewItem(input.value)) {
  2500. input.value = '';
  2501. }
  2502. }
  2503. });
  2504. addButton.onclick = () => {
  2505. if (input.value.trim()) {
  2506. if (addNewItem(input.value)) {
  2507. input.value = '';
  2508. }
  2509. }
  2510. };
  2511. deleteAllButton.onclick = () => {
  2512. if (items.length === 0) {
  2513. alert(setTextfromTemplate('alert_list_empty'));
  2514. return;
  2515. }
  2516. if (confirm(setTextfromTemplate('alert_clear_confirm'))) {
  2517. const currentConfig = getDomainConfig(getCurrentDomain());
  2518. const isMainOrSubPage = currentConfig.mainPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl())) ||
  2519. currentConfig.subPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  2520. const isContentPage = currentConfig.contentPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  2521. let targetConfig;
  2522. if (title === setTextfromTemplate('url_patterns_main_page_url_patterns_title')) {
  2523. currentConfig.mainPageUrlPatterns = [];
  2524. updateDomainConfig(getCurrentDomain(), currentConfig);
  2525. updatePanelContent();
  2526. debouncedHandleElements();
  2527. return;
  2528. } else if (title === setTextfromTemplate('url_patterns_sub_page_url_patterns_title')) {
  2529. currentConfig.subPageUrlPatterns = [];
  2530. updateDomainConfig(getCurrentDomain(), currentConfig);
  2531. updatePanelContent();
  2532. debouncedHandleElements();
  2533. return;
  2534. } else if (title === setTextfromTemplate('url_patterns_content_page_url_patterns_title')) {
  2535. currentConfig.contentPageUrlPatterns = [];
  2536. updateDomainConfig(getCurrentDomain(), currentConfig);
  2537. updatePanelContent();
  2538. debouncedHandleElements();
  2539. return;
  2540. }
  2541. if (title === setTextfromTemplate('xpath_config_main_and_sub_page_keywords_title')) {
  2542. if (!currentConfig.mainAndSubPageKeywords) {
  2543. currentConfig.mainAndSubPageKeywords = {};
  2544. }
  2545. currentConfig.mainAndSubPageKeywords.xpath = [];
  2546. updateDomainConfig(getCurrentDomain(), currentConfig);
  2547. updatePanelContent();
  2548. debouncedHandleElements();
  2549. return;
  2550. } else if (title === setTextfromTemplate('xpath_config_main_and_sub_page_usernames_title')) {
  2551. if (!currentConfig.mainAndSubPageUserKeywords) {
  2552. currentConfig.mainAndSubPageUserKeywords = {};
  2553. }
  2554. currentConfig.mainAndSubPageUserKeywords.xpath = [];
  2555. updateDomainConfig(getCurrentDomain(), currentConfig);
  2556. updatePanelContent();
  2557. debouncedHandleElements();
  2558. return;
  2559. } else if (title === setTextfromTemplate('xpath_config_content_page_keywords_title')) {
  2560. if (!currentConfig.contentPageKeywords) {
  2561. currentConfig.contentPageKeywords = {};
  2562. }
  2563. currentConfig.contentPageKeywords.xpath = [];
  2564. updateDomainConfig(getCurrentDomain(), currentConfig);
  2565. updatePanelContent();
  2566. debouncedHandleElements();
  2567. return;
  2568. } else if (title === setTextfromTemplate('xpath_config_content_page_usernames_title')) {
  2569. if (!currentConfig.contentPageUserKeywords) {
  2570. currentConfig.contentPageUserKeywords = {};
  2571. }
  2572. currentConfig.contentPageUserKeywords.xpath = [];
  2573. updateDomainConfig(getCurrentDomain(), currentConfig);
  2574. updatePanelContent();
  2575. debouncedHandleElements();
  2576. return;
  2577. }
  2578. if (title === setTextfromTemplate('keywords_config_keywords_list_title')) {
  2579. if (isMainOrSubPage) {
  2580. if (!currentConfig.mainAndSubPageKeywords) {
  2581. currentConfig.mainAndSubPageKeywords = { keywords: [], regexPatterns: [] };
  2582. }
  2583. currentConfig.mainAndSubPageKeywords.keywords = [];
  2584. } else if (isContentPage) {
  2585. if (!currentConfig.contentPageKeywords) {
  2586. currentConfig.contentPageKeywords = { keywords: [], regexPatterns: [] };
  2587. }
  2588. currentConfig.contentPageKeywords.keywords = [];
  2589. }
  2590. updateDomainConfig(getCurrentDomain(), currentConfig);
  2591. updatePanelContent();
  2592. debouncedHandleElements();
  2593. return;
  2594. } else if (title === setTextfromTemplate('keywords_config_keywords_regex_title')) {
  2595. if (isMainOrSubPage) {
  2596. if (!currentConfig.mainAndSubPageKeywords) {
  2597. currentConfig.mainAndSubPageKeywords = { keywords: [], regexPatterns: [] };
  2598. }
  2599. currentConfig.mainAndSubPageKeywords.regexPatterns = [];
  2600. } else if (isContentPage) {
  2601. if (!currentConfig.contentPageKeywords) {
  2602. currentConfig.contentPageKeywords = { keywords: [], regexPatterns: [] };
  2603. }
  2604. currentConfig.contentPageKeywords.regexPatterns = [];
  2605. }
  2606. updateDomainConfig(getCurrentDomain(), currentConfig);
  2607. updatePanelContent();
  2608. debouncedHandleElements();
  2609. return;
  2610. }
  2611. if (title === setTextfromTemplate('usernames_config_usernames_list_title')) {
  2612. if (isMainOrSubPage) {
  2613. if (!currentConfig.mainAndSubPageUserKeywords) {
  2614. currentConfig.mainAndSubPageUserKeywords = { keywords: [], regexPatterns: [] };
  2615. }
  2616. currentConfig.mainAndSubPageUserKeywords.keywords = [];
  2617. } else if (isContentPage) {
  2618. if (!currentConfig.contentPageUserKeywords) {
  2619. currentConfig.contentPageUserKeywords = { keywords: [], regexPatterns: [] };
  2620. }
  2621. currentConfig.contentPageUserKeywords.keywords = [];
  2622. }
  2623. updateDomainConfig(getCurrentDomain(), currentConfig);
  2624. updatePanelContent();
  2625. debouncedHandleElements();
  2626. return;
  2627. } else if (title === setTextfromTemplate('usernames_config_usernames_regex_title')) {
  2628. if (isMainOrSubPage) {
  2629. if (!currentConfig.mainAndSubPageUserKeywords) {
  2630. currentConfig.mainAndSubPageUserKeywords = { keywords: [], regexPatterns: [] };
  2631. }
  2632. currentConfig.mainAndSubPageUserKeywords.regexPatterns = [];
  2633. } else if (isContentPage) {
  2634. if (!currentConfig.contentPageUserKeywords) {
  2635. currentConfig.contentPageUserKeywords = { keywords: [], regexPatterns: [] };
  2636. }
  2637. currentConfig.contentPageUserKeywords.regexPatterns = [];
  2638. }
  2639. updateDomainConfig(getCurrentDomain(), currentConfig);
  2640. updatePanelContent();
  2641. debouncedHandleElements();
  2642. return;
  2643. }
  2644. }
  2645. };
  2646. exportButton.onclick = () => {
  2647. const blob = new Blob([items.join('\n')], { type: 'text/plain' });
  2648. const url = URL.createObjectURL(blob);
  2649. const a = document.createElement('a');
  2650. a.href = url;
  2651. a.download = `${title.replace(/[^a-zA-Z0-9]/g, '_')}_${new Date().toISOString().split('T')[0]}.txt`;
  2652. document.body.appendChild(a);
  2653. a.click();
  2654. document.body.removeChild(a);
  2655. URL.revokeObjectURL(url);
  2656. };
  2657. importButton.onclick = () => {
  2658. fileInput.click();
  2659. };
  2660. linkimportbutton.onclick = async () => {
  2661. const url = linkimportinput.value.trim();
  2662. if (!url) {
  2663. alert(setTextfromTemplate('alert_enter_url'));
  2664. return;
  2665. }
  2666. try {
  2667. const response = await fetch(url);
  2668. if (!response.ok) {
  2669. throw new Error(`HTTP error! status: ${response.status}`);
  2670. }
  2671. const text = await response.text();
  2672. const blob = new Blob([text], { type: 'text/plain' });
  2673. const file = new File([blob], 'imported.txt', { type: 'text/plain' });
  2674. const event = new Event('change');
  2675. Object.defineProperty(event, 'target', {
  2676. value: { files: [file] },
  2677. enumerable: true
  2678. });
  2679. fileInput.dispatchEvent(event);
  2680. linkimportinput.value = '';
  2681. } catch (error) {
  2682. console.error('导入失败:', error);
  2683. }
  2684. };
  2685. linkimportinput.addEventListener('keypress', (e) => {
  2686. if (e.key === 'Enter') {
  2687. linkimportbutton.click();
  2688. }
  2689. });
  2690. fileInput.onchange = (e) => {
  2691. const file = e.target.files[0];
  2692. if (file) {
  2693. const reader = new FileReader();
  2694. reader.onload = (event) => {
  2695. const content = event.target.result;
  2696. const newItems = content.split(/\r?\n/)
  2697. .map(item => item.trim())
  2698. .filter(item => item);
  2699. const currentConfig = getDomainConfig(getCurrentDomain());
  2700. let addedCount = 0;
  2701. let duplicateCount = 0;
  2702. if (title === setTextfromTemplate('url_patterns_main_page_url_patterns_title')) {
  2703. newItems.forEach(item => {
  2704. if (!currentConfig.mainPageUrlPatterns.includes(item)) {
  2705. currentConfig.mainPageUrlPatterns.push(item);
  2706. addedCount++;
  2707. } else {
  2708. duplicateCount++;
  2709. }
  2710. });
  2711. updateDomainConfig(getCurrentDomain(), currentConfig);
  2712. updatePanelContent();
  2713. debouncedHandleElements();
  2714. showImportResult(addedCount, duplicateCount);
  2715. return;
  2716. } else if (title === setTextfromTemplate('url_patterns_sub_page_url_patterns_title')) {
  2717. newItems.forEach(item => {
  2718. if (!currentConfig.subPageUrlPatterns.includes(item)) {
  2719. currentConfig.subPageUrlPatterns.push(item);
  2720. addedCount++;
  2721. } else {
  2722. duplicateCount++;
  2723. }
  2724. });
  2725. updateDomainConfig(getCurrentDomain(), currentConfig);
  2726. updatePanelContent();
  2727. debouncedHandleElements();
  2728. showImportResult(addedCount, duplicateCount);
  2729. return;
  2730. } else if (title === setTextfromTemplate('url_patterns_content_page_url_patterns_title')) {
  2731. newItems.forEach(item => {
  2732. if (!currentConfig.contentPageUrlPatterns.includes(item)) {
  2733. currentConfig.contentPageUrlPatterns.push(item);
  2734. addedCount++;
  2735. } else {
  2736. duplicateCount++;
  2737. }
  2738. });
  2739. updateDomainConfig(getCurrentDomain(), currentConfig);
  2740. updatePanelContent();
  2741. debouncedHandleElements();
  2742. showImportResult(addedCount, duplicateCount);
  2743. return;
  2744. }
  2745. if (title === setTextfromTemplate('xpath_config_main_and_sub_page_keywords_title')) {
  2746. if (!currentConfig.mainAndSubPageKeywords) {
  2747. currentConfig.mainAndSubPageKeywords = { xpath: [] };
  2748. }
  2749. newItems.forEach(item => {
  2750. if (!currentConfig.mainAndSubPageKeywords.xpath.includes(item)) {
  2751. currentConfig.mainAndSubPageKeywords.xpath.push(item);
  2752. addedCount++;
  2753. } else {
  2754. duplicateCount++;
  2755. }
  2756. });
  2757. updateDomainConfig(getCurrentDomain(), currentConfig);
  2758. updatePanelContent();
  2759. debouncedHandleElements();
  2760. showImportResult(addedCount, duplicateCount);
  2761. return;
  2762. } else if (title === setTextfromTemplate('xpath_config_main_and_sub_page_usernames_title')) {
  2763. if (!currentConfig.mainAndSubPageUserKeywords) {
  2764. currentConfig.mainAndSubPageUserKeywords = { xpath: [] };
  2765. }
  2766. newItems.forEach(item => {
  2767. if (!currentConfig.mainAndSubPageUserKeywords.xpath.includes(item)) {
  2768. currentConfig.mainAndSubPageUserKeywords.xpath.push(item);
  2769. addedCount++;
  2770. } else {
  2771. duplicateCount++;
  2772. }
  2773. });
  2774. updateDomainConfig(getCurrentDomain(), currentConfig);
  2775. updatePanelContent();
  2776. debouncedHandleElements();
  2777. showImportResult(addedCount, duplicateCount);
  2778. return;
  2779. } else if (title === setTextfromTemplate('xpath_config_content_page_keywords_title')) {
  2780. if (!currentConfig.contentPageKeywords) {
  2781. currentConfig.contentPageKeywords = { xpath: [] };
  2782. }
  2783. newItems.forEach(item => {
  2784. if (!currentConfig.contentPageKeywords.xpath.includes(item)) {
  2785. currentConfig.contentPageKeywords.xpath.push(item);
  2786. addedCount++;
  2787. } else {
  2788. duplicateCount++;
  2789. }
  2790. });
  2791. updateDomainConfig(getCurrentDomain(), currentConfig);
  2792. updatePanelContent();
  2793. debouncedHandleElements();
  2794. showImportResult(addedCount, duplicateCount);
  2795. return;
  2796. } else if (title === setTextfromTemplate('xpath_config_content_page_usernames_title')) {
  2797. if (!currentConfig.contentPageUserKeywords) {
  2798. currentConfig.contentPageUserKeywords = { xpath: [] };
  2799. }
  2800. newItems.forEach(item => {
  2801. if (!currentConfig.contentPageUserKeywords.xpath.includes(item)) {
  2802. currentConfig.contentPageUserKeywords.xpath.push(item);
  2803. addedCount++;
  2804. } else {
  2805. duplicateCount++;
  2806. }
  2807. });
  2808. updateDomainConfig(getCurrentDomain(), currentConfig);
  2809. updatePanelContent();
  2810. debouncedHandleElements();
  2811. showImportResult(addedCount, duplicateCount);
  2812. return;
  2813. }
  2814. const isMainOrSubPage = currentConfig.mainPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl())) ||
  2815. currentConfig.subPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  2816. const isContentPage = currentConfig.contentPageUrlPatterns?.some(pattern => new RegExp(pattern).test(getSplitUrl()));
  2817. if (title === setTextfromTemplate('keywords_config_keywords_list_title')) {
  2818. if (isMainOrSubPage) {
  2819. if (!currentConfig.mainAndSubPageKeywords) {
  2820. currentConfig.mainAndSubPageKeywords = { keywords: [], regexPatterns: [] };
  2821. }
  2822. newItems.forEach(item => {
  2823. if (!currentConfig.mainAndSubPageKeywords.keywords.includes(item)) {
  2824. currentConfig.mainAndSubPageKeywords.keywords.push(item);
  2825. addedCount++;
  2826. } else {
  2827. duplicateCount++;
  2828. }
  2829. });
  2830. } else if (isContentPage) {
  2831. if (!currentConfig.contentPageKeywords) {
  2832. currentConfig.contentPageKeywords = { keywords: [], regexPatterns: [] };
  2833. }
  2834. newItems.forEach(item => {
  2835. if (!currentConfig.contentPageKeywords.keywords.includes(item)) {
  2836. currentConfig.contentPageKeywords.keywords.push(item);
  2837. addedCount++;
  2838. } else {
  2839. duplicateCount++;
  2840. }
  2841. });
  2842. }
  2843. updateDomainConfig(getCurrentDomain(), currentConfig);
  2844. updatePanelContent();
  2845. debouncedHandleElements();
  2846. showImportResult(addedCount, duplicateCount);
  2847. return;
  2848. } else if (title === setTextfromTemplate('keywords_config_keywords_regex_title')) {
  2849. if (isMainOrSubPage) {
  2850. if (!currentConfig.mainAndSubPageKeywords) {
  2851. currentConfig.mainAndSubPageKeywords = { keywords: [], regexPatterns: [] };
  2852. }
  2853. newItems.forEach(item => {
  2854. if (!currentConfig.mainAndSubPageKeywords.regexPatterns.includes(item)) {
  2855. currentConfig.mainAndSubPageKeywords.regexPatterns.push(item);
  2856. addedCount++;
  2857. } else {
  2858. duplicateCount++;
  2859. }
  2860. });
  2861. } else if (isContentPage) {
  2862. if (!currentConfig.contentPageKeywords) {
  2863. currentConfig.contentPageKeywords = { keywords: [], regexPatterns: [] };
  2864. }
  2865. newItems.forEach(item => {
  2866. if (!currentConfig.contentPageKeywords.regexPatterns.includes(item)) {
  2867. currentConfig.contentPageKeywords.regexPatterns.push(item);
  2868. addedCount++;
  2869. } else {
  2870. duplicateCount++;
  2871. }
  2872. });
  2873. }
  2874. updateDomainConfig(getCurrentDomain(), currentConfig);
  2875. updatePanelContent();
  2876. debouncedHandleElements();
  2877. showImportResult(addedCount, duplicateCount);
  2878. return;
  2879. }
  2880. if (title === setTextfromTemplate('usernames_config_usernames_list_title')) {
  2881. if (isMainOrSubPage) {
  2882. if (!currentConfig.mainAndSubPageUserKeywords) {
  2883. currentConfig.mainAndSubPageUserKeywords = { keywords: [], regexPatterns: [] };
  2884. }
  2885. newItems.forEach(item => {
  2886. if (!currentConfig.mainAndSubPageUserKeywords.keywords.includes(item)) {
  2887. currentConfig.mainAndSubPageUserKeywords.keywords.push(item);
  2888. addedCount++;
  2889. } else {
  2890. duplicateCount++;
  2891. }
  2892. });
  2893. } else if (isContentPage) {
  2894. if (!currentConfig.contentPageUserKeywords) {
  2895. currentConfig.contentPageUserKeywords = { keywords: [], regexPatterns: [] };
  2896. }
  2897. newItems.forEach(item => {
  2898. if (!currentConfig.contentPageUserKeywords.keywords.includes(item)) {
  2899. currentConfig.contentPageUserKeywords.keywords.push(item);
  2900. addedCount++;
  2901. } else {
  2902. duplicateCount++;
  2903. }
  2904. });
  2905. }
  2906. updateDomainConfig(getCurrentDomain(), currentConfig);
  2907. updatePanelContent();
  2908. debouncedHandleElements();
  2909. showImportResult(addedCount, duplicateCount);
  2910. return;
  2911. } else if (title === setTextfromTemplate('usernames_config_usernames_regex_title')) {
  2912. if (isMainOrSubPage) {
  2913. if (!currentConfig.mainAndSubPageUserKeywords) {
  2914. currentConfig.mainAndSubPageUserKeywords = { keywords: [], regexPatterns: [] };
  2915. }
  2916. newItems.forEach(item => {
  2917. if (!currentConfig.mainAndSubPageUserKeywords.regexPatterns.includes(item)) {
  2918. currentConfig.mainAndSubPageUserKeywords.regexPatterns.push(item);
  2919. addedCount++;
  2920. } else {
  2921. duplicateCount++;
  2922. }
  2923. });
  2924. } else if (isContentPage) {
  2925. if (!currentConfig.contentPageUserKeywords) {
  2926. currentConfig.contentPageUserKeywords = { keywords: [], regexPatterns: [] };
  2927. }
  2928. newItems.forEach(item => {
  2929. if (!currentConfig.contentPageUserKeywords.regexPatterns.includes(item)) {
  2930. currentConfig.contentPageUserKeywords.regexPatterns.push(item);
  2931. addedCount++;
  2932. } else {
  2933. duplicateCount++;
  2934. }
  2935. });
  2936. }
  2937. updateDomainConfig(getCurrentDomain(), currentConfig);
  2938. updatePanelContent();
  2939. debouncedHandleElements();
  2940. showImportResult(addedCount, duplicateCount);
  2941. return;
  2942. }
  2943. };
  2944. reader.readAsText(file);
  2945. fileInput.value = '';
  2946. }
  2947. };
  2948. function showImportResult(addedCount, duplicateCount) {
  2949. const messages = {
  2950. 'zh-CN': `导入完成:\n成功导入 ${addedCount} \n重复项 ${duplicateCount} 项`,
  2951. 'en-US': `Import completed:\n${addedCount} items imported successfully\n${duplicateCount} duplicate items`,
  2952. 'ja-JP': `インポート完了:\n${addedCount} 件追加\n${duplicateCount} 件重複`,
  2953. 'ko-KR': `가져오기 완료:\n${addedCount}개 항목 추가됨\n${duplicateCount}개 중복 항목`,
  2954. 'ru-RU': `Импорт завершен:\n${addedCount} элементов импортировано\n${duplicateCount} повторяющихся элементов`,
  2955. 'fr-FR': `Importation terminée :\n${addedCount} éléments importés\n${duplicateCount} éléments en double`,
  2956. 'de-DE': `Import abgeschlossen:\n${addedCount} Elemente importiert\n${duplicateCount} doppelte Elemente`,
  2957. 'it-IT': `Importazione completata:\n${addedCount} elementi importati\n${duplicateCount} elementi duplicati`,
  2958. 'hi-IN': `आयात पूर्ण:\n${addedCount} आइटम सफलतापूर्वक आयात किए गए\n${duplicateCount} डुप्लिकेट आइटम`,
  2959. 'id-ID': `Impor selesai:\n${addedCount} item berhasil diimpor\n${duplicateCount} item duplikat`,
  2960. 'vi-VN': `Nhp hoàn tt:\n${addedCount} mc đã được nhp thành công\n${duplicateCount} mc trùng lp`,
  2961. 'th-TH': `การนำเข้าเสร็จสิ้น:\n${addedCount} รายการนำเข้าสำเร็จ\n${duplicateCount} รายการซ้ำ`,
  2962. 'es-ES': `Importación completada:\n${addedCount} elementos importados\n${duplicateCount} elementos duplicados`,
  2963. 'pt-PT': `Importação concluída:\n${addedCount} itens importados\n${duplicateCount} itens duplicados`
  2964. };
  2965. alert(messages[GLOBAL_CONFIG.LANGUAGE] || messages['zh-CN']);
  2966. }
  2967. toggleButton.onclick = () => {
  2968. content.classList.toggle('expanded');
  2969. GLOBAL_CONFIG.EDITOR_STATES[editorType] = content.classList.contains('expanded');
  2970. saveGlobalConfig();
  2971. };
  2972. content.appendChild(header);
  2973. content.appendChild(header3);
  2974. content.appendChild(list);
  2975. content.appendChild(header2);
  2976. container.appendChild(toggleButton);
  2977. container.appendChild(content);
  2978. updateList();
  2979. return container;
  2980. }
  2981. function importCurrentDomainConfig(file) {
  2982. return new Promise((resolve, reject) => {
  2983. if (!file || !(file instanceof File)) {
  2984. resolve({
  2985. success: false,
  2986. message: '请选择有效的配置文件',
  2987. config: null
  2988. });
  2989. return;
  2990. }
  2991. const reader = new FileReader();
  2992. reader.onload = async (event) => {
  2993. try {
  2994. const importData = JSON.parse(event.target.result);
  2995. const currentUrl = new URL(window.location.href);
  2996. const currentDomain = currentUrl.hostname
  2997. let domainConfig = null;
  2998. if (importData.userConfig) {
  2999. domainConfig = importData.userConfig.find(config => config.domain === currentDomain);
  3000. } else if (importData.config && importData.config.domain === currentDomain) {
  3001. domainConfig = importData.config;
  3002. }
  3003. if (!domainConfig) {
  3004. resolve({
  3005. success: false,
  3006. message: '配置文件中未找到当前域名的配置',
  3007. config: null
  3008. });
  3009. return;
  3010. }
  3011. const existingConfig = getDomainConfig(currentDomain);
  3012. if (existingConfig) {
  3013. const updateResult = updateDomainConfig(currentDomain, domainConfig);
  3014. resolve({
  3015. success: true,
  3016. message: '当前域名配置已更新',
  3017. config: updateResult.config
  3018. });
  3019. } else {
  3020. const addResult = addDomainConfig(domainConfig);
  3021. resolve({
  3022. success: true,
  3023. message: '当前域名配置已导入',
  3024. config: addResult.config
  3025. });
  3026. }
  3027. updatePanelContent();
  3028. } catch (error) {
  3029. console.error('导入配置失败:', error);
  3030. resolve({
  3031. success: false,
  3032. message: `导入配置失败: ${error.message}`,
  3033. config: null
  3034. });
  3035. }
  3036. };
  3037. reader.onerror = () => {
  3038. resolve({
  3039. success: false,
  3040. message: '读取文件失败',
  3041. config: null
  3042. });
  3043. };
  3044. reader.readAsText(file);
  3045. });
  3046. }
  3047. function importCurrentDomainConfigFromFile() {
  3048. return new Promise((resolve) => {
  3049. const input = document.createElement('input');
  3050. input.type = 'file';
  3051. input.accept = '.json';
  3052. input.onchange = async (event) => {
  3053. const file = event.target.files[0];
  3054. const result = await importCurrentDomainConfig(file);
  3055. if (!result.success) {
  3056. } else {
  3057. }
  3058. resolve(result);
  3059. };
  3060. input.click();
  3061. });
  3062. }
  3063. function checkUpdateTime() {
  3064. const now = Date.now();
  3065. const lastUpdate = GM_getValue('LAST_UPDATE_TIME', 0);
  3066. const interval = (GLOBAL_CONFIG.TIME_INTERVAL || 30) * 60 * 1000;
  3067. const timeSinceLastUpdate = now - lastUpdate;
  3068. const timeUntilNextUpdate = interval - timeSinceLastUpdate;
  3069. console.log(`
  3070. 当前时间: ${new Date(now).toLocaleString()}
  3071. 上次更新: ${new Date(lastUpdate).toLocaleString()}
  3072. 更新间隔: ${GLOBAL_CONFIG.TIME_INTERVAL} 分钟
  3073. 距离上次更新: ${Math.floor(timeSinceLastUpdate / 1000)}
  3074. 距离下次更新: ${Math.floor(timeUntilNextUpdate / 1000)}
  3075. `);
  3076. if (timeSinceLastUpdate >= interval) {
  3077. downloadAndApplyConfig();
  3078. GM_setValue('LAST_UPDATE_TIME', now);
  3079. }
  3080. }
  3081. function setTextfromTemplate(args){
  3082. const currentLanguage = GLOBAL_CONFIG.LANGUAGE || 'zh';
  3083. return LANGUAGE_TEMPLATES[currentLanguage][args] || args;
  3084. }
  3085. function setLanguage(language) {
  3086. if (!LANGUAGE_TEMPLATES[language]) {
  3087. console.error(`Language ${language} not found in templates`);
  3088. return;
  3089. }
  3090. GLOBAL_CONFIG.LANGUAGE = language;
  3091. saveGlobalConfig();
  3092. const templates = LANGUAGE_TEMPLATES[language];
  3093. document.querySelector('#domain-info-text').textContent = templates.panel_top_current_domain;
  3094. document.querySelector('#domain-info-value').textContent = getCurrentDomain();
  3095. document.querySelector('#page-type-text').textContent = templates.panel_top_page_type;
  3096. if(getPageType() === 'main'){
  3097. document.querySelector('#page-type-value').textContent = templates.panel_top_page_type_main;
  3098. }else if(getPageType() === 'sub'){
  3099. document.querySelector('#page-type-value').textContent = templates.panel_top_page_type_sub;
  3100. }else if(getPageType() === 'content'){
  3101. document.querySelector('#page-type-value').textContent = templates.panel_top_page_type_content;
  3102. }else{
  3103. document.querySelector('#page-type-value').textContent = templates.panel_top_page_type_unknown;
  3104. }
  3105. document.querySelector('.panel-settings-btn').title = templates.panel_top_settings_title;
  3106. document.querySelector('.panel-settings-btn').textContent = templates.panel_top_settings_button;
  3107. document.querySelector('#domain-enabled-text').textContent = templates.panel_top_enable_domain;
  3108. document.querySelectorAll('.config-section-toggle').forEach(toggle => {
  3109. const section = toggle.getAttribute('data-section');
  3110. const titleSpan = toggle.querySelector('span:first-child');
  3111. switch (section) {
  3112. case 'global':
  3113. titleSpan.textContent = templates.global_config_title;
  3114. break;
  3115. case 'keywords':
  3116. titleSpan.textContent = templates.keywords_config_title;
  3117. break;
  3118. case 'usernames':
  3119. titleSpan.textContent = templates.usernames_config_title;
  3120. break;
  3121. case 'url':
  3122. titleSpan.textContent = templates.url_patterns_title;
  3123. break;
  3124. case 'xpath':
  3125. titleSpan.textContent = templates.xpath_config_title;
  3126. break;
  3127. case 'sync':
  3128. titleSpan.textContent = templates.sync_config_title;
  3129. break;
  3130. }
  3131. });
  3132. const globalCheckboxes = document.querySelectorAll('.checkbox-row label');
  3133. globalCheckboxes[0].textContent = templates.global_config_keywords;
  3134. globalCheckboxes[1].textContent = templates.global_config_usernames;
  3135. globalCheckboxes[2].textContent = templates.global_config_share_keywords;
  3136. globalCheckboxes[3].textContent = templates.global_config_share_usernames;
  3137. document.querySelector('#global-url-input').placeholder = templates.global_config_linkimport_input_placeholder;
  3138. document.querySelector('#add-global-url').textContent = templates.global_config_add_global_url;
  3139. document.querySelector('#apply-global-apply').textContent = templates.global_config_apply_global_apply;
  3140. document.querySelectorAll('.array-editor').forEach(editor => {
  3141. const addItemInput = editor.querySelector('.array-editor-additem-input');
  3142. if (addItemInput) {
  3143. addItemInput.placeholder = templates.array_editor_add_item_input_placeholder;
  3144. }
  3145. const addItemInputRegex = editor.querySelector('.array-editor-additem-input-regex');
  3146. if (addItemInputRegex) {
  3147. addItemInputRegex.placeholder = templates.array_editor_add_item_input_placeholder_regex;
  3148. }
  3149. const searchInput = editor.querySelector('.array-editor-search-input');
  3150. if (searchInput) {
  3151. searchInput.placeholder = templates.array_editor_search_input_placeholder;
  3152. }
  3153. const linkImportInput = editor.querySelector('.array-editor-linkimport-input');
  3154. if (linkImportInput) {
  3155. linkImportInput.placeholder = templates.array_editor_linkimport_input_placeholder;
  3156. }
  3157. const list = editor.querySelector('.array-editor-list');
  3158. if (list) {
  3159. list.dataset.empty = templates.array_editor_list_empty_placeholder;
  3160. }
  3161. const keywords_config_keywords_list_title = editor.querySelector('.array-editor-keywords-list');
  3162. if (keywords_config_keywords_list_title) {
  3163. keywords_config_keywords_list_title.textContent = templates.keywords_config_keywords_list_title;
  3164. }
  3165. const keywords_config_keywords_regex_title = editor.querySelector('.array-editor-keywords-regex');
  3166. if (keywords_config_keywords_regex_title) {
  3167. keywords_config_keywords_regex_title.textContent = templates.keywords_config_keywords_regex_title;
  3168. }
  3169. const usernames_config_usernames_list_title = editor.querySelector('.array-editor-usernames-list');
  3170. if (usernames_config_usernames_list_title) {
  3171. usernames_config_usernames_list_title.textContent = templates.usernames_config_usernames_list_title;
  3172. }
  3173. const usernames_config_usernames_regex_title = editor.querySelector('.array-editor-usernames-regex');
  3174. if (usernames_config_usernames_regex_title) {
  3175. usernames_config_usernames_regex_title.textContent = templates.usernames_config_usernames_regex_title;
  3176. }
  3177. const url_patterns_main_page_url_patterns_title = editor.querySelector('.main-patterns-editor');
  3178. if (url_patterns_main_page_url_patterns_title) {
  3179. url_patterns_main_page_url_patterns_title.textContent = templates.url_patterns_main_page_url_patterns_title;
  3180. }
  3181. const url_patterns_sub_page_url_patterns_title = editor.querySelector('.sub-patterns-editor');
  3182. if (url_patterns_sub_page_url_patterns_title) {
  3183. url_patterns_sub_page_url_patterns_title.textContent = templates.url_patterns_sub_page_url_patterns_title;
  3184. }
  3185. const url_patterns_content_page_url_patterns_title = editor.querySelector('.content-patterns-editor');
  3186. if (url_patterns_content_page_url_patterns_title) {
  3187. url_patterns_content_page_url_patterns_title.textContent = templates.url_patterns_content_page_url_patterns_title;
  3188. }
  3189. const xpath_config_main_and_sub_page_keywords_title = editor.querySelector('.title-xpath-editor');
  3190. if (xpath_config_main_and_sub_page_keywords_title) {
  3191. xpath_config_main_and_sub_page_keywords_title.textContent = templates.xpath_config_main_and_sub_page_keywords_title;
  3192. }
  3193. const xpath_config_main_and_sub_page_usernames_title = editor.querySelector('.user-xpath-editor');
  3194. if (xpath_config_main_and_sub_page_usernames_title) {
  3195. xpath_config_main_and_sub_page_usernames_title.textContent = templates.xpath_config_main_and_sub_page_usernames_title;
  3196. }
  3197. const xpath_config_content_page_keywords_title = editor.querySelector('.content-title-xpath-editor');
  3198. if (xpath_config_content_page_keywords_title) {
  3199. xpath_config_content_page_keywords_title.textContent = templates.xpath_config_content_page_keywords_title;
  3200. }
  3201. const xpath_config_content_page_usernames_title = editor.querySelector('.content-user-xpath-editor');
  3202. if (xpath_config_content_page_usernames_title) {
  3203. xpath_config_content_page_usernames_title.textContent = templates.xpath_config_content_page_usernames_title;
  3204. }
  3205. const buttons = editor.querySelectorAll('.button-group-inline button');
  3206. buttons.forEach(button => {
  3207. if (button.className === 'array-editor-add-button') {
  3208. button.textContent = templates.array_editor_add_item;
  3209. } else if (button.className === 'array-editor-delete-all-button') {
  3210. button.textContent = templates.array_editor_clear_allitem;
  3211. } else if (button.className === 'array-editor-linkimport-button') {
  3212. button.textContent = templates.array_editor_linkimport_input_button;
  3213. } else if (button.className === 'array-editor-import-button') {
  3214. button.textContent = templates.array_editor_fileimport_input_button;
  3215. } else if (button.className === 'array-editor-export-button') {
  3216. button.textContent = templates.array_editor_export_button;
  3217. }
  3218. });
  3219. });
  3220. document.querySelector('#export-config').textContent = templates.panel_bottom_export_button;
  3221. document.querySelector('#import-config').textContent = templates.panel_bottom_import_button;
  3222. document.querySelector('#delete-domain-config').textContent = templates.panel_bottom_delete_button;
  3223. document.querySelector('#save-domain-config').textContent = templates.panel_bottom_save_button;
  3224. document.querySelector('#sync-server-url').placeholder = setTextfromTemplate('sync_config_server_url');
  3225. document.querySelector('#sync-user-key').placeholder = setTextfromTemplate('sync_config_user_key');
  3226. document.querySelector('#sync-apply').textContent = setTextfromTemplate('sync_config_apply');
  3227. document.querySelector('#sync-delete').textContent = setTextfromTemplate('sync_config_delete');
  3228.  
  3229. document.querySelector('#js-settings-title').textContent = setTextfromTemplate('settings_title');
  3230. document.querySelector('label[for="language-select"]').textContent = setTextfromTemplate('settings_language');
  3231. const expandModeLabel = document.querySelector('#expand-mode').previousElementSibling;
  3232. expandModeLabel.textContent = setTextfromTemplate('settings_expand_mode');
  3233. const expandModeOptions = document.querySelectorAll('#expand-mode option');
  3234. expandModeOptions[0].textContent = setTextfromTemplate('settings_expand_hover');
  3235. expandModeOptions[1].textContent = setTextfromTemplate('settings_expand_click');
  3236. const blockButtonLabel = document.querySelector('#show-block-button').previousElementSibling;
  3237. blockButtonLabel.textContent = setTextfromTemplate('settings_block_button_mode');
  3238. const blockButtonOptions = document.querySelectorAll('#show-block-button option');
  3239. blockButtonOptions[0].textContent = setTextfromTemplate('settings_block_hover');
  3240. blockButtonOptions[1].textContent = setTextfromTemplate('settings_block_always');
  3241. const horizontalPositionLabel = document.querySelector('#position-offset').previousElementSibling;
  3242. horizontalPositionLabel.textContent = setTextfromTemplate('settings_horizontal_position');
  3243. const collapsedWidthLabel = document.querySelector('#collapsed-width').previousElementSibling;
  3244. collapsedWidthLabel.textContent = setTextfromTemplate('settings_collapsed_width');
  3245. const expandedWidthLabel = document.querySelector('#expanded-width').previousElementSibling;
  3246. expandedWidthLabel.textContent = setTextfromTemplate('settings_expanded_width');
  3247. document.querySelector('#settings-cancel').textContent = setTextfromTemplate('settings_cancel');
  3248. document.querySelector('#settings-save').textContent = setTextfromTemplate('settings_save');
  3249. }
  3250. function gmFetch(url, options = {}) {
  3251. return new Promise((resolve, reject) => {
  3252. GM_xmlhttpRequest({
  3253. url,
  3254. method: options.method || 'GET',
  3255. headers: options.headers || {},
  3256. data: options.body,
  3257. responseType: 'json',
  3258. onload: function(response) {
  3259. resolve({
  3260. ok: response.status >= 200 && response.status < 300,
  3261. status: response.status,
  3262. statusText: response.statusText,
  3263. json: () => Promise.resolve(response.response),
  3264. text: () => Promise.resolve(response.responseText)
  3265. });
  3266. },
  3267. onerror: function(error) {
  3268. reject(new Error('Network error'));
  3269. }
  3270. });
  3271. });
  3272. }
  3273. function checkSyncInput(){
  3274. const sync_server_url = document.getElementById('sync-server-url').value;
  3275. const sync_user_key = document.getElementById('sync-user-key').value;
  3276. if(!sync_server_url || !sync_user_key){
  3277. updateSyncStatus(setTextfromTemplate('sync_panel_status_input_error'), 'error');
  3278. return false;
  3279. }
  3280. GLOBAL_CONFIG.SYNC_CONFIG.server_url = sync_server_url;
  3281. GLOBAL_CONFIG.SYNC_CONFIG.user_key = sync_user_key;
  3282. saveGlobalConfig();
  3283. return true;
  3284. }
  3285. async function getConfigFromServer() {
  3286. const response = await gmFetch(`${GLOBAL_CONFIG.SYNC_CONFIG.server_url}/config`, {
  3287. method: 'GET',
  3288. headers: {
  3289. 'X-API-Key': GLOBAL_CONFIG.SYNC_CONFIG.user_key
  3290. }
  3291. });
  3292. if (!response.ok) {
  3293. throw new Error(await response.text());
  3294. }
  3295. return await response.json();
  3296. }
  3297. async function handleSyncInput() {
  3298. let sync_server_url = document.querySelector('#sync-server-url').value
  3299. if(sync_server_url.startsWith('http')){
  3300. sync_server_url = sync_server_url.replace(/^https?/, 'wss');
  3301. }else{
  3302. sync_server_url = 'wss://' + sync_server_url;
  3303. }
  3304. const sync_user_key = document.querySelector('#sync-user-key').value;
  3305. if(!sync_server_url || !sync_user_key){
  3306. updateSyncStatus(setTextfromTemplate('sync_panel_status_input_error'), 'error');
  3307. return false;
  3308. }
  3309. const response = await testConnection(sync_server_url , sync_user_key);
  3310. if (response.success) {
  3311. GLOBAL_CONFIG.SYNC_CONFIG.server_url = sync_server_url;
  3312. GLOBAL_CONFIG.SYNC_CONFIG.user_key = sync_user_key;
  3313. updateSyncStatus(setTextfromTemplate('sync_panel_status_connect_success'), 'success');
  3314. initWebSocket();
  3315. return true;
  3316. } else {
  3317. updateSyncStatus(setTextfromTemplate('sync_panel_status_connect_failed') + response.message, 'error');
  3318. return false;
  3319. }
  3320. }
  3321. async function deleteCloudConfig() {
  3322. try {
  3323. if (!confirm(setTextfromTemplate('sync_panel_status_delete_confirm'))) {
  3324. return;
  3325. }
  3326. if (!wsConnection || wsConnection.readyState !== WebSocket.OPEN) {
  3327. initWebSocket();
  3328. if(wsConnection.readyState !== WebSocket.OPEN){
  3329. throw new Error(setTextfromTemplate('sync_panel_status_connect_error'));
  3330. }
  3331. }
  3332. wsConnection.send(JSON.stringify({
  3333. type: 'delete',
  3334. userKey: GLOBAL_CONFIG.SYNC_CONFIG.user_key
  3335. }));
  3336. const originalOnMessage = wsConnection.onmessage;
  3337. wsConnection.onmessage = (event) => {
  3338. const data = JSON.parse(event.data);
  3339. if (data.type === 'delete') {
  3340. if (data.success) {
  3341. updateSyncStatus(setTextfromTemplate('sync_panel_status_delete_success'), 'success');
  3342. } else {
  3343. updateSyncStatus(setTextfromTemplate('sync_panel_status_delete_failed') + (data.message || ''), 'error');
  3344. }
  3345. wsConnection.onmessage = originalOnMessage;
  3346. } else {
  3347. originalOnMessage(event);
  3348. }
  3349. };
  3350. } catch (error) {
  3351. updateSyncStatus(setTextfromTemplate('sync_panel_status_delete_failed') + error.message, 'error');
  3352. }
  3353. }
  3354. function updateSyncStatus(message, type = 'info') {
  3355. const statusDiv = document.getElementById('sync-status');
  3356. statusDiv.textContent = message;
  3357. statusDiv.className = `sync-status ${type}`;
  3358. switch(type) {
  3359. case 'success':
  3360. statusDiv.style.color = '#4caf50';
  3361. break;
  3362. case 'error':
  3363. statusDiv.style.color = '#f44336';
  3364. break;
  3365. case 'warning':
  3366. statusDiv.style.color = '#ff9800';
  3367. break;
  3368. case 'info':
  3369. default:
  3370. statusDiv.style.color = '#2196f3';
  3371. break;
  3372. }
  3373. }
  3374. function initWebSocket() {
  3375. closeWebSocket();
  3376. const wsUrl = GLOBAL_CONFIG.SYNC_CONFIG.server_url.startsWith('wss') ?
  3377. GLOBAL_CONFIG.SYNC_CONFIG.server_url :
  3378. GLOBAL_CONFIG.SYNC_CONFIG.server_url.startsWith('http') ?
  3379. GLOBAL_CONFIG.SYNC_CONFIG.server_url.replace(/^https?/, 'wss') :
  3380. 'wss://' + GLOBAL_CONFIG.SYNC_CONFIG.server_url;
  3381. wsConnection = new WebSocket(`${wsUrl}/ws/config/${GLOBAL_CONFIG.SYNC_CONFIG.user_key}`);
  3382. const isFirstSync = GM_getValue('isFirstSync_' + GLOBAL_CONFIG.SYNC_CONFIG.user_key+'_'+GLOBAL_CONFIG.SYNC_CONFIG.server_url, true);
  3383. wsConnection.onopen = () => {
  3384. if(isFirstSync){
  3385. GM_setValue('isFirstSync_' + GLOBAL_CONFIG.SYNC_CONFIG.user_key+'_'+GLOBAL_CONFIG.SYNC_CONFIG.server_url, false);
  3386. GLOBAL_CONFIG.SYNC_CONFIG.lastSyncTime = Date.now();
  3387. wsConnection.send(JSON.stringify({
  3388. type: 'firstSync',
  3389. globalConfig: GLOBAL_CONFIG,
  3390. userConfig: userConfig
  3391. }));
  3392. }else{
  3393. wsConnection.send(JSON.stringify({
  3394. type: 'update',
  3395. globalConfig: GLOBAL_CONFIG,
  3396. userConfig: userConfig
  3397. }));
  3398. }
  3399. updateSyncStatus(setTextfromTemplate('sync_panel_status_connect_server_success'), 'success');
  3400. };
  3401. wsConnection.onmessage = (event) => {
  3402. const data = JSON.parse(event.data);
  3403. switch(data.type) {
  3404. case 'firstSync':
  3405. if(data.message === 'firstSync_success'){
  3406. updateSyncStatus(setTextfromTemplate('sync_panel_status_client_to_server_success'), 'success');
  3407. }
  3408. break;
  3409. case 'update':
  3410. if(data){
  3411. saveConfig(data,false,true);
  3412. GLOBAL_CONFIG.SYNC_CONFIG.lastSyncTime = Date.now();
  3413. if(data.message === 'config_updated'){
  3414. updateSyncStatus(setTextfromTemplate('sync_panel_status_config_updated'), 'success');
  3415. }
  3416. }
  3417. break;
  3418. case 'configConflict':
  3419. const useCloud = confirm(
  3420. setTextfromTemplate('sync_panel_status_config_conflict_1') + '\n\n' +
  3421. setTextfromTemplate('sync_panel_status_config_conflict_2') + data.cloudTime + '\n' +
  3422. setTextfromTemplate('sync_panel_status_config_conflict_3') + data.localTime + '\n\n' +
  3423. setTextfromTemplate('sync_panel_status_config_conflict_4') + '\n\n' +
  3424. (data.cloudTime > data.localTime ? setTextfromTemplate('sync_panel_status_config_conflict_cloud_newer') : setTextfromTemplate('sync_panel_status_config_conflict_local_newer'))
  3425. );
  3426. wsConnection.send(JSON.stringify({
  3427. type: 'resolveConflict',
  3428. choice: useCloud ? 'useCloud' : 'useLocal'
  3429. }));
  3430. break;
  3431. case 'delete':
  3432. if (data.success) {
  3433. updateSyncStatus(setTextfromTemplate('sync_panel_status_delete_success'), 'success');
  3434. } else {
  3435. updateSyncStatus(setTextfromTemplate('sync_panel_status_delete_failed') + (data.message || ''), 'error');
  3436. }
  3437. break;
  3438. }
  3439. };
  3440. wsConnection.onclose = () => {
  3441. updateSyncStatus(setTextfromTemplate('sync_panel_status_disconnect'), 'warning');
  3442. };
  3443. wsConnection.onerror = (error) => {
  3444. console.error('WebSocket 错误:', error);
  3445. updateSyncStatus(setTextfromTemplate('sync_panel_status_connect_error'), 'error');
  3446. };
  3447. }
  3448. function closeWebSocket() {
  3449. if (wsConnection) {
  3450. wsConnection.close();
  3451. wsConnection = null;
  3452. }
  3453. }
  3454. async function testConnection(serverUrl, userKey) {
  3455. try {
  3456. const wsUrl = serverUrl + '/ws/config/' + userKey;
  3457. const ws = new WebSocket(wsUrl);
  3458. return new Promise((resolve) => {
  3459. ws.onopen = () => {
  3460. ws.close();
  3461. resolve({ success: true });
  3462. };
  3463. ws.onerror = (error) => {
  3464. ws.close();
  3465. resolve({
  3466. success: false,
  3467. message: 'WebSocket连接失败'
  3468. });
  3469. };
  3470. });
  3471. } catch (error) {
  3472. return {
  3473. success: false,
  3474. message: error.message
  3475. };
  3476. }
  3477. }
  3478. async function initCloudSync() {
  3479. if(GLOBAL_CONFIG.SYNC_CONFIG.server_url && GLOBAL_CONFIG.SYNC_CONFIG.user_key){
  3480. try {
  3481. const response = await testConnection(GLOBAL_CONFIG.SYNC_CONFIG.server_url , GLOBAL_CONFIG.SYNC_CONFIG.user_key);
  3482. if (response.success) {
  3483. initWebSocket();
  3484. } else {
  3485. updateSyncStatus(setTextfromTemplate('sync_panel_status_connect_failed') + response.message, 'error');
  3486. }
  3487. } catch (error) {
  3488. updateSyncStatus(setTextfromTemplate('sync_panel_status_connect_error') + error.message, 'error');
  3489. }
  3490. if (GLOBAL_CONFIG.SYNC_CONFIG.server_url && GLOBAL_CONFIG.SYNC_CONFIG.user_key) {
  3491. initWebSocket();
  3492. }
  3493. }
  3494. }
  3495. async function pushConfigUpdate() {
  3496. try {
  3497. if (wsConnection && wsConnection.readyState === WebSocket.OPEN) {
  3498. GLOBAL_CONFIG.SYNC_CONFIG.lastSyncTime = Date.now();
  3499. const configData = {
  3500. type: 'update',
  3501. globalConfig: GLOBAL_CONFIG,
  3502. userConfig: userConfig
  3503. };
  3504. await wsConnection.send(JSON.stringify(configData));
  3505. } else {
  3506. console.warn('WebSocket未连接');
  3507. initWebSocket();
  3508. }
  3509. } catch (error) {
  3510. console.error('同步失败:', error);
  3511. updateSyncStatus(setTextfromTemplate('sync_panel_status_sync_failed') + error.message, 'error');
  3512. }
  3513. }
  3514. function downloadAndApplyConfig(){
  3515. const urls = GLOBAL_CONFIG.GLOBAL_CONFIG_URL;
  3516. urls.forEach(async (url) => {
  3517. try {
  3518. const response = await fetch(url);
  3519. if (!response.ok) {
  3520. console.error(`从 ${url} 下载配置失败:`, response.statusText);
  3521. return;
  3522. }
  3523. const configData = await response.json();
  3524. saveConfig(configData, true);
  3525. } catch (error) {
  3526. console.error(`处理URL ${url} 时出错:`, error);
  3527. }
  3528. });
  3529. GM_setValue('LAST_UPDATE_TIME', Date.now());
  3530. }
  3531. if (document.readyState === 'loading') {
  3532. document.addEventListener('DOMContentLoaded', function() {
  3533. debouncedHandleElements();
  3534. listenUrlChange(debouncedHandleElements);
  3535. setInterval(checkUpdateTime, 60000);
  3536. });
  3537. } else {
  3538. debouncedHandleElements();
  3539. listenUrlChange(debouncedHandleElements);
  3540. setInterval(checkUpdateTime, 60000);
  3541. }
  3542. function saveConfig(args_config = null,isglobalurl = false,isPushConfigUpdate = false) {
  3543. const panel = document.getElementById('forum-filter-panel');
  3544. if (!panel) return;
  3545. if (args_config) {
  3546. if(args_config.globalConfig){
  3547. for (const key in args_config.globalConfig) {
  3548. if (args_config.globalConfig.hasOwnProperty(key)) {
  3549. if (isglobalurl && key === 'GLOBAL_CONFIG_URL') continue;
  3550. GLOBAL_CONFIG[key] = args_config.globalConfig[key];
  3551. }
  3552. }
  3553. saveGlobalConfig();
  3554. }
  3555. if(args_config.userConfig && args_config.userConfig.length > 0){
  3556. args_config.userConfig.forEach(config => {
  3557. const existingConfig = getDomainConfig(config.domain);
  3558. if (existingConfig) {
  3559. if(isPushConfigUpdate){
  3560. updateDomainConfigOverride(config.domain, config);
  3561. }else{
  3562. updateDomainConfig(config.domain, config);
  3563. }
  3564. } else {
  3565. addDomainConfig(config);
  3566. }
  3567. });
  3568. }
  3569. if (GLOBAL_CONFIG.SYNC_CONFIG.server_url && GLOBAL_CONFIG.SYNC_CONFIG.user_key) {
  3570. if(!isPushConfigUpdate){
  3571. pushConfigUpdate()
  3572. }
  3573. }
  3574. saveUserConfig(userConfig);
  3575. debouncedHandleElements();
  3576. updatePanelContent();
  3577. return;
  3578. }
  3579. const currentConfig = getDomainConfig(getCurrentDomain()) || SAMPLE_TEMPLATE;
  3580. const config = {
  3581. domain: getCurrentDomain(),
  3582. enabled: panel.querySelector('#domain-enabled').checked,
  3583. shareKeywordsAcrossPages: panel.querySelector('#share-keywords').checked,
  3584. shareUsernamesAcrossPages: panel.querySelector('#share-usernames').checked,
  3585. mainPageUrlPatterns: currentConfig.mainPageUrlPatterns || [],
  3586. subPageUrlPatterns: currentConfig.subPageUrlPatterns || [],
  3587. contentPageUrlPatterns: currentConfig.contentPageUrlPatterns || [],
  3588. mainAndSubPageKeywords: {
  3589. ...currentConfig.mainAndSubPageKeywords,
  3590. xpath: currentConfig.mainAndSubPageKeywords?.xpath || []
  3591. },
  3592. mainAndSubPageUserKeywords: {
  3593. ...currentConfig.mainAndSubPageUserKeywords,
  3594. xpath: currentConfig.mainAndSubPageUserKeywords?.xpath || []
  3595. },
  3596. contentPageKeywords: {
  3597. ...currentConfig.contentPageKeywords,
  3598. xpath: currentConfig.contentPageKeywords?.xpath || []
  3599. },
  3600. contentPageUserKeywords: {
  3601. ...currentConfig.contentPageUserKeywords,
  3602. xpath: currentConfig.contentPageUserKeywords?.xpath || []
  3603. }
  3604. };
  3605. saveGlobalConfig();
  3606. const existingIndex = userConfig.findIndex(c => c.domain === getCurrentDomain());
  3607. if (existingIndex !== -1) {
  3608. userConfig[existingIndex] = config;
  3609. } else {
  3610. userConfig.push(config);
  3611. }
  3612. if (GLOBAL_CONFIG.SYNC_CONFIG.server_url && GLOBAL_CONFIG.SYNC_CONFIG.user_key) {
  3613. if(!isPushConfigUpdate){
  3614. pushConfigUpdate()
  3615. }
  3616. }
  3617. saveUserConfig(userConfig);
  3618. debouncedHandleElements();
  3619. updatePanelContent();
  3620. return config;
  3621. }
  3622. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址