in " const { stash, Stash, waitForElementId, waitForElementClass, waitForElementByXpath,…
- User
in " const { stash, Stash, waitForElementId, waitForElementClass, waitForElementByXpath, getElementByXpath, getClosestAncestor, updateTextInput, } = unsafeWindow.stash;
code// Function to unset rating and send it to the graphql function function unsetRating() { // Remove "selected" class from all stars ratingStars.forEach((star) => { star.classList.remove('selected'); }); // reset currentRating variable currentRating = 0; // Send the unset rating to the GraphQL function sendRatingToGraphQL(currentRating); }let sceneId; let currentrating stash.addEventListener("page:scene", async function() {
function updateSceneId() { const currentUrl = window.location.href.split('?')[0]; sceneId = currentUrl.substring(currentUrl.lastIndexOf('/') + 1); console.log(sceneId); }
updateSceneId();
async function querySceneRating() { const gqlQuery = { 'query':
query { findScene(id: ${sceneId}){ rating } }}; return stash.callGQL(gqlQuery); }const rating = (await querySceneRating()).data.findScene.rating; currentrating = rating; console.log("currentrating 1: " +currentrating);
codewaitForElementByXpath("//div[contains(@class, 'VideoPlayer')]", function (xpath, el) { if (!document.getElementById('custom-stars-row')) { const control = el.querySelector('.vjs-control-bar'); let ratingStarsNode = document.createElement('div'); ratingStarsNode.setAttribute('id', 'custom-stars-row'); ratingStarsNode.innerHTML = ratingstars; control.appendChild(ratingStarsNode); control.insertBefore(ratingStarsNode, control.childNodes[9]); } const ratingButtons = document.querySelectorAll('.rating-stars button'); Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.