| @@ -272,11 +272,8 @@ | ||
| 272 | 272 | <?php |
| 273 | 273 | // Render the Content Selector Modal |
| 274 | 274 | mxchat_render_content_selector_modal(); |
| 275 | 275 | |
| 276 | - // Render the Edit Entry Modal | |
| 277 | - mxchat_render_edit_entry_modal(); | |
| 278 | - | |
| 279 | 276 | // Render the navigation JavaScript |
| 280 | 277 | mxchat_render_knowledge_page_scripts(); |
| 281 | 278 | } |
| 282 | 279 | |
| @@ -848,39 +845,15 @@ | ||
| 848 | 845 | </form> |
| 849 | 846 | <!-- Delete Button Container - transforms between Delete All and Delete Selected --> |
| 850 | 847 | <div class="mxchat-delete-container" id="mxchat-delete-container"> |
| 851 | 848 | <!-- Delete All Form (shown when nothing selected) --> |
| 852 | - <?php | |
| 853 | - // Build confirm message and button text based on active filter | |
| 854 | - $delete_all_label = __('Delete All', 'mxchat'); | |
| 855 | - $delete_all_confirm = __('Are you sure you want to delete all knowledge?', 'mxchat'); | |
| 856 | - if (!empty($content_type_filter)) { | |
| 857 | - $filter_display = $content_type_filter; | |
| 858 | - // Try to get a human-readable label | |
| 859 | - $pt_obj = get_post_type_object($content_type_filter); | |
| 860 | - if ($pt_obj) { | |
| 861 | - $filter_display = $pt_obj->label; | |
| 862 | - } elseif ($content_type_filter === 'pdf') { | |
| 863 | - $filter_display = 'PDFs'; | |
| 864 | - } elseif ($content_type_filter === 'url') { | |
| 865 | - $filter_display = 'URLs'; | |
| 866 | - } | |
| 867 | - /* translators: %s: content type label (e.g. "Pages", "PDFs") */ | |
| 868 | - $delete_all_label = sprintf(__('Delete All %s', 'mxchat'), $filter_display); | |
| 869 | - /* translators: %s: content type label */ | |
| 870 | - $delete_all_confirm = sprintf(__('Are you sure you want to delete all %s from the knowledge base?', 'mxchat'), $filter_display); | |
| 871 | - } | |
| 872 | - ?> | |
| 873 | - <form method="post" action="<?php echo esc_url(admin_url('admin-post.php?action=mxchat_delete_all_prompts')); ?>" id="mxchat-delete-all-form" onsubmit="return confirm('<?php echo esc_attr($delete_all_confirm); ?>');"> | |
| 849 | + <form method="post" action="<?php echo esc_url(admin_url('admin-post.php?action=mxchat_delete_all_prompts')); ?>" id="mxchat-delete-all-form" onsubmit="return confirm('<?php esc_attr_e('Are you sure you want to delete all knowledge?', 'mxchat'); ?>');"> | |
| 874 | 850 | <?php wp_nonce_field('mxchat_delete_all_prompts_action', 'mxchat_delete_all_prompts_nonce'); ?> |
| 875 | 851 | <input type="hidden" name="data_source" value="<?php echo esc_attr($data_source); ?>" /> |
| 876 | 852 | <input type="hidden" name="bot_id" value="<?php echo esc_attr($current_bot_id); ?>" /> |
| 877 | - <?php if (!empty($content_type_filter)) : ?> | |
| 878 | - <input type="hidden" name="content_type_filter" value="<?php echo esc_attr($content_type_filter); ?>" /> | |
| 879 | - <?php endif; ?> | |
| 880 | 853 | <button type="submit" class="mxch-btn mxch-btn-secondary mxch-btn-sm" style="color: var(--mxch-error);"> |
| 881 | 854 | <span class="dashicons dashicons-trash" style="font-size: 14px;"></span> |
| 882 | - <?php echo esc_html($delete_all_label); ?> | |
| 855 | + <?php esc_html_e('Delete All', 'mxchat'); ?> | |
| 883 | 856 | </button> |
| 884 | 857 | </form> |
| 885 | 858 | <!-- Delete Selected Button (shown when items selected) --> |
| 886 | 859 | <button type="button" |
| @@ -988,22 +961,10 @@ | ||
| 988 | 961 | <?php else : ?> |
| 989 | 962 | <span style="color: var(--mxch-text-muted);"><?php esc_html_e('Manual Content', 'mxchat'); ?></span> |
| 990 | 963 | <?php endif; ?> |
| 991 | 964 | </td> |
| 992 | - <td class="mxchat-actions-cell" style="padding: 12px 16px; white-space: nowrap;"> | |
| 993 | - <?php if ($data_source !== 'pinecone') : ?> | |
| 965 | + <td class="mxchat-actions-cell" style="padding: 12px 16px;"> | |
| 994 | 966 | <button type="button" |
| 995 | - class="mxch-btn mxch-btn-ghost mxch-btn-sm mxchat-edit-entry-btn" | |
| 996 | - data-source-url="<?php echo esc_attr($source_url); ?>" | |
| 997 | - data-entry-id="<?php echo esc_attr($first_prompt->id); ?>" | |
| 998 | - data-data-source="<?php echo esc_attr($data_source); ?>" | |
| 999 | - data-bot-id="<?php echo esc_attr($current_bot_id); ?>" | |
| 1000 | - data-nonce="<?php echo wp_create_nonce('mxchat_edit_entry_nonce'); ?>" | |
| 1001 | - title="<?php esc_attr_e('Edit content', 'mxchat'); ?>"> | |
| 1002 | - <span class="dashicons dashicons-edit" style="font-size: 14px;"></span> | |
| 1003 | - </button> | |
| 1004 | - <?php endif; ?> | |
| 1005 | - <button type="button" | |
| 1006 | 967 | class="mxch-btn mxch-btn-ghost mxch-btn-sm delete-button-group" |
| 1007 | 968 | data-source-url="<?php echo esc_attr($source_url); ?>" |
| 1008 | 969 | data-chunk-count="<?php echo esc_attr($chunk_count); ?>" |
| 1009 | 970 | data-data-source="<?php echo esc_attr($data_source); ?>" |
| @@ -1138,21 +1099,9 @@ | ||
| 1138 | 1099 | <?php else : ?> |
| 1139 | 1100 | <span style="color: var(--mxch-text-muted);"><?php esc_html_e('Manual', 'mxchat'); ?></span> |
| 1140 | 1101 | <?php endif; ?> |
| 1141 | 1102 | </td> |
| 1142 | - <td style="padding: 12px 16px; white-space: nowrap;"> | |
| 1143 | - <?php if ($data_source !== 'pinecone') : ?> | |
| 1144 | - <button type="button" | |
| 1145 | - class="mxch-btn mxch-btn-ghost mxch-btn-sm mxchat-edit-entry-btn" | |
| 1146 | - data-source-url="<?php echo esc_attr($prompt->source_url ?? ''); ?>" | |
| 1147 | - data-entry-id="<?php echo esc_attr($prompt->id); ?>" | |
| 1148 | - data-data-source="<?php echo esc_attr($data_source); ?>" | |
| 1149 | - data-bot-id="<?php echo esc_attr($current_bot_id); ?>" | |
| 1150 | - data-nonce="<?php echo wp_create_nonce('mxchat_edit_entry_nonce'); ?>" | |
| 1151 | - title="<?php esc_attr_e('Edit content', 'mxchat'); ?>"> | |
| 1152 | - <span class="dashicons dashicons-edit" style="font-size: 14px;"></span> | |
| 1153 | - </button> | |
| 1154 | - <?php endif; ?> | |
| 1103 | + <td style="padding: 12px 16px;"> | |
| 1155 | 1104 | <?php if ($data_source === 'pinecone') : ?> |
| 1156 | 1105 | <button type="button" class="mxch-btn mxch-btn-ghost mxch-btn-sm delete-button-ajax" data-vector-id="<?php echo esc_attr($prompt->id); ?>" data-bot-id="<?php echo esc_attr($current_bot_id); ?>" data-nonce="<?php echo wp_create_nonce('mxchat_delete_pinecone_prompt_nonce'); ?>" style="color: var(--mxch-error);"> |
| 1157 | 1106 | <span class="dashicons dashicons-trash" style="font-size: 14px;"></span> |
| 1158 | 1107 | </button> |
| @@ -1246,19 +1195,8 @@ | ||
| 1246 | 1195 | <span style="font-weight: 500;"><?php esc_html_e('Auto-sync Pages', 'mxchat'); ?></span> |
| 1247 | 1196 | </div> |
| 1248 | 1197 | </div> |
| 1249 | 1198 | |
| 1250 | - <div class="mxch-field" style="margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--mxch-card-border);"> | |
| 1251 | - <div style="display: flex; align-items: center; gap: 12px;"> | |
| 1252 | - <label class="mxchat-toggle-switch"> | |
| 1253 | - <input type="checkbox" name="mxchat_auto_sync_acf_pdfs" class="mxchat-autosave-field" value="1" data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>" <?php checked(get_option('mxchat_auto_sync_acf_pdfs', '0'), '1'); ?>> | |
| 1254 | - <span class="mxchat-toggle-slider"></span> | |
| 1255 | - </label> | |
| 1256 | - <span style="font-weight: 500;"><?php esc_html_e('Extract text from PDFs in ACF fields on save', 'mxchat'); ?></span> | |
| 1257 | - </div> | |
| 1258 | - <p class="mxch-field-description" style="margin-top: 8px;"><?php esc_html_e('When ON, editor saves re-extract every PDF referenced in ACF fields. Default OFF — saves stay fast and don\'t re-parse the same PDFs on every edit. The manual content selector has its own per-batch checkbox; this setting only controls the auto-sync path.', 'mxchat'); ?></p> | |
| 1259 | - </div> | |
| 1260 | - | |
| 1261 | 1199 | <div style="margin-top: 24px;"> |
| 1262 | 1200 | <button id="mxchat-custom-post-types-toggle" class="mxch-btn mxch-btn-secondary"> |
| 1263 | 1201 | <?php esc_html_e('Advanced Custom Post Sync Settings', 'mxchat'); ?> |
| 1264 | 1202 | <span style="margin-left: 5px;">▼</span> |
| @@ -1776,15 +1714,8 @@ | ||
| 1776 | 1714 | </div> |
| 1777 | 1715 | </div> |
| 1778 | 1716 | <div class="mxchat-kb-modal-footer"> |
| 1779 | 1717 | <div class="mxchat-kb-pagination"></div> |
| 1780 | - <div class="mxchat-kb-acf-pdf-option" style="display:flex; align-items:flex-start; gap:8px; padding:8px 0; font-size:12px; color: var(--mxch-text-secondary, #64748b);"> | |
| 1781 | - <input type="checkbox" id="mxchat-kb-acf-pdf-extract" style="margin-top:2px;"> | |
| 1782 | - <label for="mxchat-kb-acf-pdf-extract" style="cursor:pointer; line-height:1.4;"> | |
| 1783 | - <strong style="color: var(--mxch-text-primary, #1a1a2e);"><?php esc_html_e('Also extract text from PDFs linked in ACF File/Image fields', 'mxchat'); ?></strong><br> | |
| 1784 | - <span><?php esc_html_e('Adds 200-500ms per post and ~30 KB to each KB entry. Recommended only if your ACF setup uses PDF attachments for primary content.', 'mxchat'); ?></span> | |
| 1785 | - </label> | |
| 1786 | - </div> | |
| 1787 | 1718 | <div class="mxchat-kb-footer-actions"> |
| 1788 | 1719 | <button type="button" id="mxchat-kb-process-selected" class="mxchat-kb-button-primary" disabled> |
| 1789 | 1720 | <?php esc_html_e('Process Selected Content', 'mxchat'); ?> |
| 1790 | 1721 | <span class="mxchat-kb-selected-count">(0)</span> |
| @@ -1799,47 +1730,8 @@ | ||
| 1799 | 1730 | <?php |
| 1800 | 1731 | } |
| 1801 | 1732 | |
| 1802 | 1733 | /** |
| 1803 | - * Render Edit Entry Modal | |
| 1804 | - */ | |
| 1805 | -function mxchat_render_edit_entry_modal() { | |
| 1806 | - ?> | |
| 1807 | - <div id="mxchat-kb-edit-modal" class="mxchat-kb-modal"> | |
| 1808 | - <div class="mxchat-kb-modal-content mxchat-kb-edit-modal-content"> | |
| 1809 | - <div class="mxchat-kb-modal-header"> | |
| 1810 | - <h3 id="mxchat-kb-edit-title"><?php esc_html_e('Edit Knowledge Entry', 'mxchat'); ?></h3> | |
| 1811 | - <span class="mxchat-kb-modal-close" id="mxchat-kb-edit-close">×</span> | |
| 1812 | - </div> | |
| 1813 | - <div class="mxchat-kb-edit-body"> | |
| 1814 | - <div class="mxchat-kb-edit-source" id="mxchat-kb-edit-source"></div> | |
| 1815 | - <textarea id="mxchat-kb-edit-textarea" class="mxchat-kb-edit-textarea" placeholder="<?php esc_attr_e('Loading content...', 'mxchat'); ?>"></textarea> | |
| 1816 | - <div class="mxchat-kb-edit-meta"> | |
| 1817 | - <span id="mxchat-kb-edit-charcount"></span> | |
| 1818 | - <span id="mxchat-kb-edit-chunkinfo"></span> | |
| 1819 | - </div> | |
| 1820 | - </div> | |
| 1821 | - <div class="mxchat-kb-edit-footer"> | |
| 1822 | - <div class="mxchat-kb-edit-notice" id="mxchat-kb-edit-notice"></div> | |
| 1823 | - <div class="mxchat-kb-edit-actions"> | |
| 1824 | - <button type="button" id="mxchat-kb-edit-cancel" class="mxch-btn mxch-btn-ghost"> | |
| 1825 | - <?php esc_html_e('Cancel', 'mxchat'); ?> | |
| 1826 | - </button> | |
| 1827 | - <button type="button" id="mxchat-kb-edit-save" class="mxch-btn mxch-btn-primary"> | |
| 1828 | - <span class="mxchat-kb-edit-save-text"><?php esc_html_e('Save & Re-embed', 'mxchat'); ?></span> | |
| 1829 | - <span class="mxchat-kb-edit-save-spinner" style="display:none;"> | |
| 1830 | - <span class="mxchat-kb-spinner is-active" style="margin: 0;"></span> | |
| 1831 | - <?php esc_html_e('Saving...', 'mxchat'); ?> | |
| 1832 | - </span> | |
| 1833 | - </button> | |
| 1834 | - </div> | |
| 1835 | - </div> | |
| 1836 | - </div> | |
| 1837 | - </div> | |
| 1838 | - <?php | |
| 1839 | -} | |
| 1840 | - | |
| 1841 | -/** | |
| 1842 | 1734 | * Render Knowledge Page Navigation Scripts |
| 1843 | 1735 | */ |
| 1844 | 1736 | function mxchat_render_knowledge_page_scripts() { |
| 1845 | 1737 | ?> |
| @@ -2014,197 +1906,8 @@ | ||
| 2014 | 1906 | } |
| 2015 | 1907 | |
| 2016 | 1908 | // Sitemap detection is now handled by knowledge-processing.js |
| 2017 | 1909 | // It will be initialized when user clicks "Sitemap Import" option |
| 2018 | - | |
| 2019 | - // ─── Edit Entry Modal ──────────────────────────────────── | |
| 2020 | - initEditModal(); | |
| 2021 | - | |
| 2022 | - function initEditModal() { | |
| 2023 | - var modal = document.getElementById('mxchat-kb-edit-modal'); | |
| 2024 | - var textarea = document.getElementById('mxchat-kb-edit-textarea'); | |
| 2025 | - var saveBtn = document.getElementById('mxchat-kb-edit-save'); | |
| 2026 | - var cancelBtn = document.getElementById('mxchat-kb-edit-cancel'); | |
| 2027 | - var closeBtn = document.getElementById('mxchat-kb-edit-close'); | |
| 2028 | - var notice = document.getElementById('mxchat-kb-edit-notice'); | |
| 2029 | - var charCount = document.getElementById('mxchat-kb-edit-charcount'); | |
| 2030 | - var chunkInfo = document.getElementById('mxchat-kb-edit-chunkinfo'); | |
| 2031 | - var sourceEl = document.getElementById('mxchat-kb-edit-source'); | |
| 2032 | - var titleEl = document.getElementById('mxchat-kb-edit-title'); | |
| 2033 | - var saveText = saveBtn ? saveBtn.querySelector('.mxchat-kb-edit-save-text') : null; | |
| 2034 | - var saveSpin = saveBtn ? saveBtn.querySelector('.mxchat-kb-edit-save-spinner') : null; | |
| 2035 | - | |
| 2036 | - if (!modal) return; | |
| 2037 | - | |
| 2038 | - var currentEntry = {}; | |
| 2039 | - | |
| 2040 | - // Bind edit buttons (delegated) | |
| 2041 | - document.addEventListener('click', function(e) { | |
| 2042 | - var btn = e.target.closest('.mxchat-edit-entry-btn'); | |
| 2043 | - if (btn) { | |
| 2044 | - e.preventDefault(); | |
| 2045 | - openEditModal(btn); | |
| 2046 | - } | |
| 2047 | - }); | |
| 2048 | - | |
| 2049 | - // Close handlers | |
| 2050 | - if (closeBtn) closeBtn.addEventListener('click', closeModal); | |
| 2051 | - if (cancelBtn) cancelBtn.addEventListener('click', closeModal); | |
| 2052 | - modal.addEventListener('click', function(e) { | |
| 2053 | - if (e.target === modal) closeModal(); | |
| 2054 | - }); | |
| 2055 | - | |
| 2056 | - // Character count | |
| 2057 | - if (textarea) { | |
| 2058 | - textarea.addEventListener('input', function() { | |
| 2059 | - updateCharCount(); | |
| 2060 | - }); | |
| 2061 | - } | |
| 2062 | - | |
| 2063 | - // Save handler | |
| 2064 | - if (saveBtn) saveBtn.addEventListener('click', saveContent); | |
| 2065 | - | |
| 2066 | - function openEditModal(btn) { | |
| 2067 | - currentEntry = { | |
| 2068 | - sourceUrl: btn.getAttribute('data-source-url') || '', | |
| 2069 | - entryId: btn.getAttribute('data-entry-id') || '', | |
| 2070 | - dataSource: btn.getAttribute('data-data-source') || 'wordpress', | |
| 2071 | - botId: btn.getAttribute('data-bot-id') || 'default', | |
| 2072 | - nonce: btn.getAttribute('data-nonce') || '' | |
| 2073 | - }; | |
| 2074 | - | |
| 2075 | - // Reset state | |
| 2076 | - textarea.value = ''; | |
| 2077 | - textarea.placeholder = 'Loading content...'; | |
| 2078 | - textarea.disabled = true; | |
| 2079 | - saveBtn.disabled = true; | |
| 2080 | - notice.textContent = ''; | |
| 2081 | - notice.className = 'mxchat-kb-edit-notice'; | |
| 2082 | - charCount.textContent = ''; | |
| 2083 | - chunkInfo.textContent = ''; | |
| 2084 | - | |
| 2085 | - // Show source | |
| 2086 | - if (currentEntry.sourceUrl && currentEntry.sourceUrl.indexOf('mxchat://') !== 0) { | |
| 2087 | - sourceEl.innerHTML = 'Source: <a href="' + escapeHtml(currentEntry.sourceUrl) + '" target="_blank">' + escapeHtml(truncate(currentEntry.sourceUrl, 60)) + '</a>'; | |
| 2088 | - } else { | |
| 2089 | - sourceEl.textContent = 'Manual Content'; | |
| 2090 | - } | |
| 2091 | - | |
| 2092 | - // Show modal | |
| 2093 | - modal.classList.add('active'); | |
| 2094 | - | |
| 2095 | - // Fetch content | |
| 2096 | - var formData = new FormData(); | |
| 2097 | - formData.append('action', 'mxchat_get_entry_content'); | |
| 2098 | - formData.append('nonce', currentEntry.nonce); | |
| 2099 | - formData.append('source_url', currentEntry.sourceUrl); | |
| 2100 | - formData.append('entry_id', currentEntry.entryId); | |
| 2101 | - formData.append('data_source', currentEntry.dataSource); | |
| 2102 | - formData.append('bot_id', currentEntry.botId); | |
| 2103 | - | |
| 2104 | - fetch(ajaxurl, { method: 'POST', body: formData }) | |
| 2105 | - .then(function(r) { return r.json(); }) | |
| 2106 | - .then(function(resp) { | |
| 2107 | - if (resp.success) { | |
| 2108 | - textarea.value = resp.data.content || ''; | |
| 2109 | - textarea.disabled = false; | |
| 2110 | - textarea.placeholder = 'Edit your content here...'; | |
| 2111 | - saveBtn.disabled = false; | |
| 2112 | - currentEntry.contentType = resp.data.content_type || 'content'; | |
| 2113 | - | |
| 2114 | - updateCharCount(); | |
| 2115 | - | |
| 2116 | - if (resp.data.is_chunked) { | |
| 2117 | - chunkInfo.textContent = resp.data.chunk_count + ' chunks — will be re-chunked on save'; | |
| 2118 | - titleEl.textContent = 'Edit Knowledge Entry (' + resp.data.chunk_count + ' chunks)'; | |
| 2119 | - } else { | |
| 2120 | - chunkInfo.textContent = ''; | |
| 2121 | - titleEl.textContent = 'Edit Knowledge Entry'; | |
| 2122 | - } | |
| 2123 | - | |
| 2124 | - textarea.focus(); | |
| 2125 | - } else { | |
| 2126 | - textarea.placeholder = ''; | |
| 2127 | - showNotice((resp.data && resp.data.message) || 'Failed to load content.', 'error'); | |
| 2128 | - } | |
| 2129 | - }) | |
| 2130 | - .catch(function(err) { | |
| 2131 | - textarea.placeholder = ''; | |
| 2132 | - showNotice('Network error: ' + err.message, 'error'); | |
| 2133 | - }); | |
| 2134 | - } | |
| 2135 | - | |
| 2136 | - function saveContent() { | |
| 2137 | - if (!textarea.value.trim()) { | |
| 2138 | - showNotice('Content cannot be empty.', 'error'); | |
| 2139 | - return; | |
| 2140 | - } | |
| 2141 | - | |
| 2142 | - saveBtn.disabled = true; | |
| 2143 | - if (saveText) saveText.style.display = 'none'; | |
| 2144 | - if (saveSpin) saveSpin.style.display = ''; | |
| 2145 | - showNotice('Saving and re-embedding...', ''); | |
| 2146 | - | |
| 2147 | - var formData = new FormData(); | |
| 2148 | - formData.append('action', 'mxchat_save_entry_content'); | |
| 2149 | - formData.append('nonce', currentEntry.nonce); | |
| 2150 | - formData.append('source_url', currentEntry.sourceUrl); | |
| 2151 | - formData.append('entry_id', currentEntry.entryId); | |
| 2152 | - formData.append('content', textarea.value); | |
| 2153 | - formData.append('data_source', currentEntry.dataSource); | |
| 2154 | - formData.append('bot_id', currentEntry.botId); | |
| 2155 | - formData.append('content_type', currentEntry.contentType || 'content'); | |
| 2156 | - | |
| 2157 | - fetch(ajaxurl, { method: 'POST', body: formData }) | |
| 2158 | - .then(function(r) { return r.json(); }) | |
| 2159 | - .then(function(resp) { | |
| 2160 | - if (saveText) saveText.style.display = ''; | |
| 2161 | - if (saveSpin) saveSpin.style.display = 'none'; | |
| 2162 | - saveBtn.disabled = false; | |
| 2163 | - | |
| 2164 | - if (resp.success) { | |
| 2165 | - showNotice('Saved successfully!', 'success'); | |
| 2166 | - setTimeout(function() { | |
| 2167 | - closeModal(); | |
| 2168 | - window.location.reload(); | |
| 2169 | - }, 1000); | |
| 2170 | - } else { | |
| 2171 | - showNotice((resp.data && resp.data.message) || 'Save failed.', 'error'); | |
| 2172 | - } | |
| 2173 | - }) | |
| 2174 | - .catch(function(err) { | |
| 2175 | - if (saveText) saveText.style.display = ''; | |
| 2176 | - if (saveSpin) saveSpin.style.display = 'none'; | |
| 2177 | - saveBtn.disabled = false; | |
| 2178 | - showNotice('Network error: ' + err.message, 'error'); | |
| 2179 | - }); | |
| 2180 | - } | |
| 2181 | - | |
| 2182 | - function closeModal() { | |
| 2183 | - modal.classList.remove('active'); | |
| 2184 | - } | |
| 2185 | - | |
| 2186 | - function updateCharCount() { | |
| 2187 | - var len = textarea.value.length; | |
| 2188 | - charCount.textContent = len.toLocaleString() + ' characters'; | |
| 2189 | - } | |
| 2190 | - | |
| 2191 | - function showNotice(msg, type) { | |
| 2192 | - notice.textContent = msg; | |
| 2193 | - notice.className = 'mxchat-kb-edit-notice' + (type ? ' ' + type : ''); | |
| 2194 | - } | |
| 2195 | - | |
| 2196 | - function escapeHtml(str) { | |
| 2197 | - var div = document.createElement('div'); | |
| 2198 | - div.textContent = str; | |
| 2199 | - return div.innerHTML; | |
| 2200 | - } | |
| 2201 | - | |
| 2202 | - function truncate(str, max) { | |
| 2203 | - return str.length > max ? str.substring(0, max) + '...' : str; | |
| 2204 | - } | |
| 2205 | - } | |
| 2206 | - | |
| 2207 | 1910 | })(); |
| 2208 | 1911 | </script> |
| 2209 | 1912 | <?php |
| 2210 | 1913 | } |