diff --git a/index.html b/index.html
index 35b451e..69d505d 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":"/"}
-
+
@@ -1486,13 +1853,6 @@
+
+
+
@@ -4717,6 +5112,25 @@ scaling solutions.
+
diff --git a/script.js b/script.js
index 34eeb3e..862157a 100644
--- a/script.js
+++ b/script.js
@@ -104,39 +104,34 @@ function updatePromptPreview(promptText, form) {
// Initialize everything after DOM loads
document.addEventListener("DOMContentLoaded", () => {
- // Initialize dev mode
- const devModeToggle = document.getElementById("devModeToggle");
- const initialDevMode = localStorage.getItem("dev-mode") === "true";
- devModeToggle.checked = initialDevMode;
-
- // Initialize chat button icons
- updateChatButtonIcons(initialDevMode);
-
- // Handle dev mode toggle
- devModeToggle.addEventListener("change", (e) => {
- const newDevMode = e.target.checked;
- localStorage.setItem("dev-mode", newDevMode);
- // Toggle dev-mode class on body element
- document.body.classList.toggle("dev-mode", newDevMode);
+ // Initialize audience selector and dev mode
+ const audienceSelect = document.getElementById('audienceSelect');
+ const initialAudience = localStorage.getItem('audience') || 'everyone';
+ audienceSelect.value = initialAudience;
+ document.body.classList.toggle('dev-mode', initialAudience === 'developers');
+ // Handle audience changes
+ audienceSelect.addEventListener('change', (e) => {
+ const isDevMode = e.target.value === 'developers';
+ document.body.classList.toggle('dev-mode', isDevMode);
+ localStorage.setItem('audience', e.target.value);
+
// Update chat button icons
- updateChatButtonIcons(newDevMode);
+ updateChatButtonIcons(isDevMode);
// Check if we should show Copilot suggestion
- if (newDevMode) {
+ if (isDevMode) {
const currentPlatform = document.querySelector(".platform-tag.active");
- const shouldNotShow =
- localStorage.getItem("copilot-suggestion-hidden") === "true";
+ const shouldNotShow = localStorage.getItem("copilot-suggestion-hidden") === "true";
- if (
- currentPlatform &&
- currentPlatform.dataset.platform !== "github-copilot" &&
- !shouldNotShow
- ) {
+ if (currentPlatform &&
+ currentPlatform.dataset.platform !== "github-copilot" &&
+ !shouldNotShow) {
showCopilotSuggestion();
}
}
+ // Trigger prompt filtering
filterPrompts();
});
@@ -179,10 +174,8 @@ document.addEventListener("DOMContentLoaded", () => {
// Initialize search functionality
initializeSearch();
- // Initialize chat button icons on page load
- const isDevMode = localStorage.getItem("dev-mode") === "true";
- document.body.classList.toggle("dev-mode", isDevMode);
- updateChatButtonIcons(isDevMode);
+ // Initialize language and tone selectors
+ initializeLanguageAndTone();
});
// Search functionality
@@ -198,7 +191,7 @@ async function initializeSearch() {
const searchInput = document.getElementById("searchInput");
const searchResults = document.getElementById("searchResults");
const promptCount = document.getElementById("promptCount");
- const isDevMode = document.getElementById("devModeToggle").checked;
+ const isDevMode = document.getElementById("audienceSelect").value === "developers";
// Update prompt count
const totalPrompts = isDevMode
@@ -214,6 +207,7 @@ async function initializeSearch() {
searchInput.addEventListener("input", (e) => {
const searchTerm = e.target.value.toLowerCase();
+ const isDevMode = document.getElementById("audienceSelect").value === "developers";
const filteredPrompts = prompts.filter((prompt) => {
const matchesSearch =
@@ -286,7 +280,7 @@ function parseCSV(csv) {
function displaySearchResults(results) {
const searchResults = document.getElementById("searchResults");
const searchInput = document.getElementById("searchInput");
- const isDevMode = document.getElementById("devModeToggle").checked;
+ const isDevMode = document.getElementById("audienceSelect").value === "developers";
// Filter results based on dev mode
if (isDevMode) {
@@ -401,7 +395,7 @@ function displaySearchResults(results) {
// Function to filter prompts based on dev mode
function filterPrompts() {
- const isDevMode = document.getElementById("devModeToggle").checked;
+ const isDevMode = document.getElementById("audienceSelect").value === "developers";
const searchInput = document.getElementById("searchInput");
const searchTerm = searchInput.value.toLowerCase();
@@ -496,7 +490,7 @@ function createPromptCards() {
.then((response) => response.text())
.then((csvText) => {
const prompts = parseCSV(csvText);
- const isDevMode = document.getElementById("devModeToggle").checked;
+ const isDevMode = document.getElementById("audienceSelect").value === "developers";
const promptElements = document.querySelectorAll(
"h2[id^=act] + p + blockquote"
@@ -757,7 +751,7 @@ function showModal(title, content) {
// Update chat button text with platform name and handle visibility
const platform = document.querySelector(".platform-tag.active");
- const isDevMode = document.getElementById("devModeToggle").checked;
+ const isDevMode = document.getElementById("audienceSelect").value === "developers";
if (platform) {
const shouldHideChat = ["gemini", "llama"].includes(
@@ -811,7 +805,7 @@ function showModal(title, content) {
// Add copy functionality
modalCopyButton.addEventListener("click", async () => {
try {
- await navigator.clipboard.writeText(modalContent.textContent);
+ copyPrompt(modalCopyButton, modalContent.textContent);
modalCopyButton.innerHTML = `