www.menards.com not working properly

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
User avatar
Stargate38
Moonbather
Moonbather
Posts: 59
Joined: 2018-05-27, 22:55
Location: Earth

www.menards.com not working properly

Unread post by Stargate38 » 2022-07-02, 00:13

Please always mention the name/domain of the website in question in your topic title.

Please try and include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:

1) Clear any current output
2) Navigate or refresh the page in question
3) Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.

Code: Select all

**PASTE CONSOLE OUTPUT HERE**
TypeError: gt.getOwnPropertyDescriptor(...) is undefined[Learn More]  
menards:3:31692
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/  
ruxitagentjs_ICA27QSVfhjqrux_10225210924095553.js:268:34
TypeError: document.currentScript is null[Learn More]  
520.js:15:1
TypeError: document.currentScript is null[Learn More]  
3665.js:1:118
TypeError: document.currentScript is null[Learn More]  
3629.js:1:118
TypeError: document.currentScript is null[Learn More]  
481.js:1:160
Use of getPreventDefault() is deprecated.  Use defaultPrevented instead.  
smartserve-4897.js:10:40197
Anyone know how to get it to work in PM? I went on their website to look for something, and I can't get the search to work. Also, there are a bunch of "Loading" graphics and moving circles that are supposed to show products.

PM Version: 31.1.0 (32-bit)

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: www.menards.com not working properly

Unread post by bSun0000 » 2022-07-02, 07:38

You should ask the site owners to fix their shit.
Calls to document.currentScript under callback (or something like that) WILL return NULL instead of expected src\object.
This is a documented behavior.

Here, i made a dirty fix for you. Install GreaseMonkey addon and the script below:

Code: Select all

// ==UserScript==
// @name        MenardsFix
// @namespace   mebards
// @include     http*://menards.com/*
// @include     http*://www.menards.com/*
// @version     1
// @grant       none
// @run-at      document-start
// ==/UserScript==

var hack_injected = false;
var currentScript = 'currentScript';

function beforescriptexecute_func(e) {
	if (!hack_injected) {
		hack_injected = true;

		Object.defineProperty(document, currentScript, {
			get: function () {
				try {
					throw new Error();
				}
				catch (err) {
					var split = err.stack.split(/\r?\n/);
					var script_src = split[1]; // 0 is our userscript

					script_src = script_src.substring(
						script_src.indexOf('@') + 1, script_src.indexOf(':', script_src.indexOf('/'))
					);

					var obj = Object.create({src: script_src})
					return obj;
				}
			}
		});
	}
}

document.addEventListener ("beforescriptexecute", beforescriptexecute_func, false);


Locked