|
57 | 57 | <div class="text-base">Ask questions with Docs AI</div> |
58 | 58 | </div> |
59 | 59 | </button> |
| 60 | + <button |
| 61 | + onclick="openInChatGPT()" |
| 62 | + data-heap-id="search-docs-ai-button" |
| 63 | + class="sub-button" |
| 64 | + > |
| 65 | + <span class="icon-svg mt-[2px] text-base leading-none"> |
| 66 | + {{ partial "icon" "search" }} |
| 67 | + </span> |
| 68 | + <div class="leading-tight"> |
| 69 | + <div class="text-base">Open in ChatGPT</div> |
| 70 | + </div> |
| 71 | + </button> |
| 72 | + |
| 73 | + <button |
| 74 | + onclick="openInClaude()" |
| 75 | + data-heap-id="search-docs-ai-button" |
| 76 | + class="sub-button" |
| 77 | + > |
| 78 | + <span class="icon-svg mt-[2px] text-base leading-none"> |
| 79 | + {{ partial "icon" "search" }} |
| 80 | + </span> |
| 81 | + <div class="leading-tight"> |
| 82 | + <div class="text-base">Open in Claude</div> |
| 83 | + </div> |
| 84 | + </button> |
| 85 | + |
60 | 86 | </div> |
61 | 87 | </details> |
62 | 88 |
|
|
105 | 131 | } |
106 | 132 | } |
107 | 133 |
|
| 134 | + function openInChatGPT() { |
| 135 | + fetch(getCurrentPlaintextUrl()) |
| 136 | + .then((response) => response.text()) |
| 137 | + .then((text) => { |
| 138 | + const encodedText = encodeURIComponent(text); |
| 139 | + const chatGPTUrl = `https://chat.openai.com/?q=${encodedText}`; |
| 140 | + window.open(chatGPTUrl, "_blank"); |
| 141 | + }) |
| 142 | + .catch((err) => { |
| 143 | + console.error("Error opening in ChatGPT:", err); |
| 144 | + }); |
| 145 | + } |
| 146 | + |
| 147 | + function openInClaude() { |
| 148 | + fetch(getCurrentPlaintextUrl()) |
| 149 | + .then((response) => response.text()) |
| 150 | + .then((text) => { |
| 151 | + const encodedText = encodeURIComponent(text); |
| 152 | + const claudeUrl = `https://claude.ai/chat?contextUrl=${currentUrl}`; |
| 153 | + window.open(claudeUrl, '_blank'); |
| 154 | + }) |
| 155 | + .catch((err) => { |
| 156 | + console.error("Error opening in Claude:", err); |
| 157 | + }); |
| 158 | + } |
| 159 | + |
108 | 160 | document.addEventListener("click", function (event) { |
109 | 161 | const dropdown = document.getElementById("markdownDropdown"); |
110 | 162 |
|
|
0 commit comments