MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / createQuickReplyContent

Function createQuickReplyContent

quickReply.js:797–1399  ·  view source on GitHub ↗
(dialog)

Source from the content-addressed store, hash-verified

795
796 // 创建快捷回复弹窗内容
797 function createQuickReplyContent(dialog) {
798 let categories = getCategories();
799 let activeCategory = categories[0] || '通用回复';
800
801 // 清空弹窗内容
802 dialog.innerHTML = '';
803
804 // 头部
805 const header = document.createElement('div');
806 header.className = 'quick-reply-header';
807
808 const title = document.createElement('h3');
809 title.className = 'quick-reply-title';
810 title.textContent = '快捷回复';
811
812 const closeBtn = document.createElement('button');
813 closeBtn.className = 'quick-reply-close';
814 closeBtn.innerHTML = '×';
815 closeBtn.onclick = () => dialog.remove();
816
817 // 新增:管理分类按钮
818 const manageCategoryBtn = document.createElement('button');
819 manageCategoryBtn.className = 'quick-reply-btn quick-reply-btn-secondary';
820 manageCategoryBtn.textContent = '管理分类';
821 manageCategoryBtn.style.minWidth = 'unset'; // 移除最小宽度限制
822 manageCategoryBtn.style.padding = '5px 10px'; // 调整内边距
823 manageCategoryBtn.style.fontSize = '13px'; // 调整字体大小
824 manageCategoryBtn.onclick = () => showCategoryManageDialog();
825
826 // 新增:重置按钮
827 const resetBtn = document.createElement('button');
828 resetBtn.className = 'quick-reply-btn quick-reply-btn-secondary';
829 resetBtn.textContent = '重置';
830 resetBtn.style.minWidth = 'unset'; // 移除最小宽度限制
831 resetBtn.style.padding = '5px 10px'; // 调整内边距
832 resetBtn.style.fontSize = '13px'; // 调整字体大小
833 resetBtn.onclick = () => {
834 if (confirm('确定要重置为默认快捷回复吗?这将删除所有自定义内容。')) {
835 resetToDefault();
836 updateQuickReplyContent();
837 if (window.addQuickReplyLog) {
838 window.addQuickReplyLog('重置快捷回复为默认设置');
839 }
840 }
841 };
842
843 // 创建一个容器来包裹管理分类和重置按钮
844 const actionButtonsWrapper = document.createElement('div');
845 actionButtonsWrapper.style.display = 'flex';
846 actionButtonsWrapper.style.alignItems = 'center';
847 actionButtonsWrapper.style.gap = '8px'; // 按钮之间的间距
848 actionButtonsWrapper.style.marginLeft = 'auto'; // 推到最右侧
849 actionButtonsWrapper.style.marginRight = '110px'; // 整体向左移动 110px
850
851 actionButtonsWrapper.appendChild(manageCategoryBtn);
852 actionButtonsWrapper.appendChild(resetBtn);
853
854 header.appendChild(title);

Callers 1

showQuickReplyDialogFunction · 0.85

Calls 8

resetToDefaultFunction · 0.85
updateQuickReplyContentFunction · 0.85
rebuildTabsFunction · 0.85
addReplyToCategoryFunction · 0.85
insertReplyTextFunction · 0.85
updateLabelTextFunction · 0.85
getCategoriesFunction · 0.70
showCategoryManageDialogFunction · 0.70

Tested by

no test coverage detected