You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Chromium on Arch Linux. I am new to TamperMonkey, so it's likely I'm just doing something wrong. Here is my script:
// ==UserScript==
// @name Fix Walmart
// @namespace http://tampermonkey.net/
// @version 2024-09-05
// @description fix walmart
// @author You
// @match https://www.walmart.com/orders*
// @icon https://i5.walmartimages.com/dfw/63fd9f59-fd82/d9c2b350-71fe-4bc2-be43-23fd97630434/v1/Walmart+_Logo_mweb.svg
// @grant none
// ==/UserScript==
function hideSidebar() {
const element = document.querySelector('.flex>.dn.br.b--black-10');
console.log("tampermonkey; hiding sidebar. got element", element);
element.style.display = 'none';
}
async function viewDetailsLink() {
const buttons = document.querySelectorAll('main>section section>div>div>div>div>span>div>button');
console.log("tampermonkey: view details link, got", buttons.length, "buttons");
for (let i = 0; i < buttons.length; ++i) {
// The default listener appears to be mousedown. By overriding mousedown, we eliminate the default
//action and replace with our own
const orderNumber =buttons[i].ariaLabel.split(' ').at(-1);
buttons[i].onmousedown = ()=>window.open('https://walmart.com/orders/' + orderNumber, '_blank').focus();
}
}
// The site is a SPA, so it changes dynamically without us knowing about it
setInterval(hideSidebar, 1000);
setInterval(viewDetailsLink, 1000);
When I go to walmart.com/orders, the page is not affected (I expect hideSidebar() to hide the sidebar). When I open devtools then reload the page, the sidebar is hidden as expected.
I looked for a discord server or IRC channel to discuss this as it's likely PEBKAC, but didn't find anything.
Can I get the script to run when I visit the site without devtools open?
The text was updated successfully, but these errors were encountered:
derjanb
transferred this issue from Tampermonkey/tampermonkey-i18n
Oct 7, 2024
I'm using Chromium on Arch Linux. I am new to TamperMonkey, so it's likely I'm just doing something wrong. Here is my script:
When I go to walmart.com/orders, the page is not affected (I expect
hideSidebar()
to hide the sidebar). When I open devtools then reload the page, the sidebar is hidden as expected.I looked for a discord server or IRC channel to discuss this as it's likely PEBKAC, but didn't find anything.
Can I get the script to run when I visit the site without devtools open?
The text was updated successfully, but these errors were encountered: