Ok, the jquery is also not needed, it just slows things down...

So again:

// ==UserScript==
// @name            ModGHacks
// @namespace       nsModGHacks
// @description     Modify ghacks.net
// @include         http://www.ghacks.net/*
// @version         1.0.0
// @grant           none
// ==/UserScript==

document.addEventListener("load",

  function (){
    var imgNodes = document.getElementsByTagName("img"),
        imgNode,
        i = imgNodes.length,
        imgWidth,
        maxWidth = 640;    // modify this to your own max size ;)

    for (;i;) {
      imgNode = imgNodes[--i];

      imgWidth = imgNode.clientWidth;
      imgHeight = imgNode.clientHeight;
      if (imgWidth > maxWidth) {
        imgNode.style.maxWidth = maxWidth + "px";
        imgNode.style.height = "auto";
        console.log('Image with client width: %dpx modified to %dpx.',
imgWidth, maxWidth);
      }
    }
  }, true
);

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to