Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
i've tried these examples separately. For some reason, I can modify other values from x.style such as width and height, and even add position, top, and left attributes/values. For the max attributes, I get nothing, at least not through tampermonkey. The code works just find in the console
(function() { 'use strict'; var x; x = document.getElementById("img"); x.style.maxHeight = "100vh"; x.style.maxWidth = "100vw"; x.style.width = ""; x.style.height = ""; x.style.position = "fixed"; x.style.top = "0"; x.style.left = "15%"; })();
x.setAttribute("style", "max-height: 100vh; max-width: 100vw; position: fixed; top: 0px; left: 15%;");
both work fully inside the console but not in the script, and I'm not sure why
I've seen some browser issues with this particular method just recently.
id
is supposed to be unique to one element/tag albeit some sites still don't pay attention to this, use it incorrectly and optionally abusively... then .user.js doesn't seem to handle them in the scope they are assigned.getElementsByTagName
and see if that works better for you. You may need to use a selector withquerySelectorAll
if this alternative is "too wide" of a capture in the DOM.P.S. As OUJS Admin I fixed your lack of code fences on your snippets... please see this FAQ on how to use them.
Thank you for the response. It seems to be an issue with chrome then. I've had success using it with firefox. Thank you. The reason I've been confused is that there's only one img id and every value tested was able to be changed, removed, etc., except for the max values.
My two cents:
I think using
x.style.cssText = "max-height: 100vh; max-width: 100vw;/* and so on */";
is more solid thanx.style.property = 'something';
Also, do not set width and height as empty string, rather set them to
auto
orinitial
.Thanks for recommendations, though that snippet doesn't seem to work with my code after translating to that format
Sorry I missed the uppercase "Text" somehow