var doc = document.querySelectorAll("a"); doc.forEach(function() { if…
- User
var doc = document.querySelectorAll("a"); doc.forEach(function() { if ((this).activeElement.tabIndex == "-1") { (this).ariaSelected = "true"; } });
- Assistant
This JavaScript code uses the
querySelectorAllmethod to select all elements on the page with the tag "a". It then uses theforEachmethod to loop through each of the selected elements, and within the loop, it checks if thetabIndexproperty of the current element is set to "-1". If it is, the code sets theariaSelectedproperty of that element to "true". This code is likely used to set the aria-selected attribute on links that are not tabbable. - User
Please make a tampermonkey script that will change the first ariaSelected to true the first occurence of a A navigation link with tabindex as -1
- Assistant
Here is an example Tampermonkey script that will change the first ariaSelected to true for the first occurrence of a "A" navigation link with tabindex as -1:
code// ==UserScript== // @name Change ariaSelected // @namespace http://tampermonkey.net/ // @version 0.1 // @description Change the first ariaSelected to true for the first occurrence of a "A" navigation link with tabindex as -1 // @author You // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; var doc = document.querySelectorAll("a[tabindex='-1']"); if(doc.length > 0){ doc[0].setAttribute('ariaSelected', 'true'); } })();This script uses the
querySelectorAllmethod to select all "A" navigation links on the page with a tabindex of -1. It then checks if any such elements were found and if found it will set the first element's ariaSelected attribute to true.Please note that you will need to have the Tampermonkey extension installed in your browser in order to use this script.
- User
Please make a tampermonkey script that will change ariaSelected to true the first occurence of a A navigation link with tabindex as -1
- Assistant
Here is an example Tampermonkey script that will change the ariaSelected to true for the first occurrence of a "A" navigation link with tabindex as -1:
code// ==UserScript== // @name Change ariaSelected // @namespace http://tampermonkey.net/ // @version 0.1 // @description Change the ariaSelected to true for the first occurrence of a "A" navigation link with tabindex as -1 // @author You // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; var doc = document.querySelectorAll("a[tabindex='-1']"); if(doc.length > 0){ doc[0].setAttribute('ariaSelected', 'true'); } })();This script uses the
querySelectorAllmethod to select all "A" navigation links on the page with a tabindex of -1. It then checks if any such elements were found and if found it will set the first element's ariaSelected attribute to true.Please note that you will need to have the Tampermonkey extension installed in your browser in order to use this script.
- User
Please make a tampermonkey script that will force twitter homepage to display the "Subscribed" tab instead of the "For you" tab by default
- Assistant
Here's an updated version of the Tampermonkey script that will force the Twitter homepage to display the "Subscribed" tab instead of the "For you" tab by default:
code// ==UserScript== // @name Force Twitter Subscribed Tab // @namespace http://tampermonkey.net/ // @version 0.2 // @description Force the Twitter homepage to display the "Subscribed" tab instead of the "For you" tab by default // @author You // @match https://twitter.com/ // @grant none // ==/UserScript== (function() { 'use strict'; // Waiting for twitter to load the subscribed tab var interval = setInterval(() => { var tabs = document.querySelectorAll("[role='tab']"); if(tabs.length > 0){ for(var i=0;i<tabs.length;i++){ if(tabs[i].innerText == "Subscribed"){ tabs[i].click(); clearInterval(interval); break; } } } },2000); })();
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.