for this html page make the generate page button generate the code for an html page that…
- User
for this html page make the generate page button generate the code for an html page that displays the bookmarklets as links with the text inputted in as the bookmarklets name and displays each bookmarklets description: Bookmarklets .bookmarklet-section { margin-bottom: 1em; padding: 1em; border: 1px solid black; } .bookmarklet-section input[type="text"] { display: block; margin-bottom: 0.5em; } .bookmarklet-section button { margin-top: 0.5em; } Bookmarklets Remove Add bookmarklet Generate page function addBookmarkletSection() { const bookmarkletSections = document.getElementById("bookmarklet-sections"); const newBookmarkletSection = document.createElement("div"); newBookmarkletSection.classList.add("bookmarklet-section"); newBookmarkletSection.innerHTML =
<input type="text" placeholder="Bookmarklet name"> <input type="text" placeholder="Bookmarklet code"> <input type="text" placeholder="Bookmarklet description"> <button onclick="removeBookmarkletSection(this)">Remove</button>; bookmarkletSections.appendChild(newBookmarkletSection); } function removeBookmarkletSection(button) { const bookmarkletSection = button.parentNode; bookmarkletSection.parentNode.removeChild(bookmarkletSection); } function generatePage() { const bookmarkletSections = document.querySelectorAll(".bookmarklet-section"); let html = ""; for (let i = 0; i < bookmarkletSections.length; i++) { const name = bookmarkletSections[i].querySelectorAll("input").value; const code = bookmarkletSections[i].querySelectorAll("input")[1].value; const description = bookmarkletSections[i].querySelectorAll("input")[2].value; html +=<li><a href="javascript:${code}">${name}</a>: ${description}</li>; } html += ""; const link = document.createElement("a"); link.href = "data:text/html," + encodeURIComponent(html); link.download = "bookmarklets.html"; link.click(); } - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.