3 ms·
Here's the entirety of the prompt: <|endoftext|>/* This code is running inside of a bookmarklet. Each section should set and return _.*/ // The bookmarklet
by tectonic 5y ago
Here's the entirety of the prompt:
<|endoftext|>/* This code is running inside of a bookmarklet. Each section should set and return _.*/
// The bookmarklet is now executing on example.com.
// Command: The variable called _ will always contain the previous result.
let _ = null;
/* Command: Add a new primary header "[PAGE TITLE]" by adding an HTML DOM node */
(() => {
let newHeader = document.createElement('h1');
newHeader.innerHTML = '[PAGE TITLE]';
document.body.appendChild(newHeader);
_ = newHeader;
return newHeader;
})()
/* Command: Find the first node containing the word 'house' */
(() => {
let xpath = "//*[contains(text(), 'house')]";
let matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
_ = matchingElement;
return matchingElement;
})()
/* Command: Delete that node */
(() => {
_.parentNode.removeChild(_);
return _;
})()
/* Command: Change the background color to white */
(() => {
document.body.style.backgroundColor = 'white';
_ = document.body;
return document.body;
})()
/* Command: Select the contents of the first pre tag */
(() => {
let node = document.querySelector('pre');
let selection = window.getSelection();
let range = document.createRange();
range.selectNodeContents(node);
selection.removeAllRanges();
selection.addRange(range);
_ = selection;
return selection;
})()
// The bookmarklet is now executing on [PAGE URL]. It is customized for [PAGE TITLE] and knows the correct
CSS selectors and DOM layout.
let _ = null;
/* Command: [USER INPUT] */