From 9b50532543b236d696568fd85a7e7e0da27f29a6 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 3 Mar 2025 23:05:50 +0000 Subject: [PATCH] deploy: 7c5879f24936d71b9b928197272d72e544cbf482 --- index.html | 104 ++++++++++++++++++++++++++++++++++++++++++++++------- script.js | 4 +++ 2 files changed, 96 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 34baa85..73689c2 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@ {"@context":"https://schema.org","@type":"WebSite","description":"This repo includes ChatGPT prompt curation to use ChatGPT and other LLM tools better.","headline":"Awesome ChatGPT Prompts","name":"Awesome ChatGPT Prompts","url":"/"} - + @@ -1844,7 +1882,14 @@
- +
+ + +
@@ -5126,6 +5171,41 @@ scaling solutions.

// Initialize audience selector const audienceSelect = document.getElementById('audienceSelect'); + // Handle Grok platform selection + document.addEventListener('DOMContentLoaded', () => { + const grokButton = document.querySelector('[data-platform="grok"]'); + const grokDropdown = document.querySelector('.grok-mode-dropdown'); + const grokOptions = document.querySelectorAll('.grok-mode-option'); + let isGrokDropdownVisible = false; + + // Hide dropdown when clicking outside + document.addEventListener('click', (e) => { + if (!e.target.closest('.platform-tag-container')) { + grokDropdown.style.display = 'none'; + isGrokDropdownVisible = false; + } + }); + + // Toggle dropdown + grokButton.addEventListener('click', (e) => { + e.stopPropagation(); + isGrokDropdownVisible = !isGrokDropdownVisible; + grokDropdown.style.display = isGrokDropdownVisible ? 'block' : 'none'; + }); + + // Handle option selection + grokOptions.forEach(option => { + option.addEventListener('click', (e) => { + const selectedUrl = option.dataset.url; + const selectedText = option.textContent; + grokButton.dataset.url = selectedUrl; + grokButton.textContent = selectedText; + grokDropdown.style.display = 'none'; + isGrokDropdownVisible = false; + }); + }); + }); + // Set initial state based on URL params or default const urlParams = new URLSearchParams(window.location.search); const initialAudience = urlParams.get('audience') || 'everyone'; diff --git a/script.js b/script.js index 862157a..399ffbd 100644 --- a/script.js +++ b/script.js @@ -906,6 +906,7 @@ function openInChat(button, encodedPrompt) { if (!platform) return; const baseUrl = platform.dataset.url; + console.log(baseUrl); let url; switch (platform.dataset.platform) { @@ -915,6 +916,9 @@ function openInChat(button, encodedPrompt) { case "chatgpt": url = `${baseUrl}?prompt=${encodeURIComponent(promptText)}`; break; + case "grok": + url = `${baseUrl}&q=${encodeURIComponent(promptText)}`; + break; case "claude": url = `${baseUrl}?q=${encodeURIComponent(promptText)}`; break;