Discussions » Creation Requests

can someone fix this script?

§
Posted: 22 Oktober 2014

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: 23 Oktober 2014

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: 23 Oktober 2014

Thanks, that fixed it.

Deleted user 2469
§
Posted: 30 Oktober 2014

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: 17 November 2017

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

Deleted user 101827
§
Posted: 18 November 2017
Edited: 18 November 2017

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: 18 November 2017
Edited: 18 November 2017

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

Post reply

Sign in to post a reply.

长期地址
遇到问题?请前往 GitHub 提 Issues。