Discussions » Creation Requests

can someone fix this script?

§
Posted: 2014-10-22

can someone fix this script?

For some time Now I have been using this script I found with Firefox to make large images fit inside the browser window. It worked really well - it only resized images that were larger than the width of the firefox window,it kept them at the original aspect ratio, and would even resize the images automatically if you changed the size of the browser window.

I'm not sure what happened, if it's because of a firefox update (the script is 4-5 years old) or a conflict with some other addon, but it's not working anymore. Just doesn't do anything. Could someone take a look at it?

§
Posted: 2014-10-23

I haven't run your script but it looks like you just need to add in your @grant values:

// @grant GM_getValue
// @grant GM_registerMenuCommand
// @grant GM_setValue


http://www.greasespot.net/2014/06/greasemonkey-20-release.html

§
Posted: 2014-10-23

Thanks, that fixed it.

§
Posted: 2014-10-30

If you want it to work in Chrome you also need to add this code segment now at the beginning, just after the metadata.

// Chrome Equivalent For getValue/setValue (thanks Joe Simmons!)

var isGM = (typeof GM_getValue != 'undefined' && typeof GM_getValue('a', 'b') != 'undefined'),
getValue = (isGM ? GM_getValue : (function(name, def) {var s=localStorage.getItem(name); return (s=="undefined" || s=="null") ? def : s})),
setValue = (isGM ? GM_setValue : (function(name, value) {return localStorage.setItem(name, value)}));

§
Posted: 2017-11-17

Script is broken with Firefox 57 and Greasemonkey 4, can someone help fix it again?

Deleted user 101827
§
Posted: 2017-11-18
Edited: 2017-11-18

you can read about the changes in GM 4 for script authors here: https://www.greasespot.net/2017/09/greasemonkey-4-for-script-authors.html

Deleted user 101827
§
Posted: 2017-11-18
Edited: 2017-11-18

I think my Advanced Image Viewer Script does what you need. Maybe take a look? https://greasyfork.org/en/scripts/27738-advanced-image-viewer

Post reply

Sign in to post a reply.