|
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" "/icons/openai.svg" }} |
67 | | - </span> |
68 | | - <div class="leading-tight"> |
69 | | - <div class="text-base">Open in ChatGPT</div> |
70 | | - </div> |
71 | | - </button> |
72 | | - |
73 | 60 | <button |
74 | 61 | onclick="openInClaude()" |
75 | 62 | data-heap-id="search-docs-ai-button" |
|
86 | 73 | </div> |
87 | 74 | </details> |
88 | 75 |
|
89 | | - <script> |
| 76 | +<script> |
90 | 77 | function getCurrentPlaintextUrl() { |
91 | 78 | const url = window.location.href.split("#")[0].replace(/\/$/, ""); |
92 | 79 | return `${url}/index.md`; |
|
131 | 118 | } |
132 | 119 | } |
133 | 120 |
|
134 | | - function openInChatGPT() { |
135 | | - const markdownUrl = getCurrentPlaintextUrl(); |
136 | | - const prompt = `Read ${markdownUrl} so I can ask questions about it.`; |
137 | | - const encodedText = encodeURIComponent(prompt); |
138 | | - const chatGPTUrl = `https://chat.openai.com/?q=${encodedText}`; |
139 | | - window.open(chatGPTUrl, "_blank"); |
140 | | -} |
141 | | - |
142 | | -function openInClaude() { |
143 | | - const markdownUrl = getCurrentPlaintextUrl(); |
144 | | - const prompt = `Read ${markdownUrl} so I can ask questions about it.`; |
145 | | - const encodedText = encodeURIComponent(prompt); |
146 | | - const claudeUrl = `https://claude.ai/new?q=${encodedText}`; |
147 | | - window.open(claudeUrl, '_blank'); |
148 | | -} |
149 | | - |
150 | | - document.addEventListener("click", function (event) { |
151 | | - const dropdown = document.getElementById("markdownDropdown"); |
152 | | - |
153 | | - if (!dropdown) return; |
154 | | - |
155 | | - const isClickInside = dropdown.contains(event.target); |
156 | | - |
157 | | - if (!isClickInside && dropdown.hasAttribute("open")) { |
158 | | - dropdown.removeAttribute("open"); |
159 | | - } |
160 | | - }); |
| 121 | + function openInClaude() { |
| 122 | + const markdownUrl = getCurrentPlaintextUrl(); |
| 123 | + const prompt = `Read ${markdownUrl} so I can ask questions about it.`; |
| 124 | + const encodedText = encodeURIComponent(prompt); |
| 125 | + const claudeUrl = `https://claude.ai/new?q=${encodedText}`; |
| 126 | + window.open(claudeUrl, '_blank'); |
| 127 | + } |
161 | 128 | </script> |
0 commit comments