Greasy Fork is available in English.

GMCommonAPI.js

GM Common API (GMC) is a simple library designed for easily adding Greasemonkey 4 compatibilty to existing userscripts

< Feedback em GMCommonAPI.js

Pergunta/comentário

§
Publicado: 16/11/2017

GMCommonAPI.js : It is possible to fix this script (Flick Functional Suite) with your libray ?

I use this old script since a long time:

Flickr Functional Suite - NEW (My Pastebin Backup - Updated and working with Waterfox and Greasemonkey No Beta )

Here it's usercript page (with detailed description) but Broken:
Flickr Functional Suite By Charles Tilford (in userscripts-mirror)

I tested it in Firefox 57 and it fail with Greasemonkey Alpha.
Too with Tampermonkey (wich save me for an other old script: GM - Number of Favs on Photostream (Alesadam) 2017 - My PasteBin Backup).

Evidently, I don't know where is the problem.....

It's possible to fix it to regain access to it with the new firefox ?

§
Publicado: 16/11/2017

I see it uses GM_xmlhttpRequest. That's currently not supported by my script. But I think it should be possible to make a replacement for GM_xmlhttpRequest() as long as it used to call a service on the same domain
(Your script is calling api.flickr.com from flickr.com. I THINK that would be okay, but not 100% sure).
But as of today, you need something more than my script.

§
Publicado: 18/11/2017
Editado: 26/12/2017

I have updated my script with support for xmlhttpRequest. And I don't know what I was thinking when I was saying xmlhttpRequest wouldn't work cross-domain. It should work too (even if not needed here).
By looking at the meta-data block in top of your userscript and scanning it for use of GM_* functions, I would say: Yes, there's a good change you can fix the script by using GMCommonAPI.js.

Keep the current grant declarations in the script, but also add:

// @grant GM.xmlHttpRequest
// @require https://greasyfork.org/scripts/34527/code/GMCommonAPI.js?version=237846
// @connect flickr.com

and replace all calls to GM_* functions with the equivalent GMC.* functions in the code.

The added connect declaration is not needed for Greasemonkey, but might be needed if to run with other userscript managers.

§
Publicado: 25/12/2017

Thanks for the reply!

I Tested Your solution (last firefox + Last tampermonkey):
But it doesn't want to work ...

What i do:


// ==UserScript==
// @name Flickr Functional Suite - NEW - TEST TAMPERMOKEY ( STIG IDEA)
// @namespace http://www.tilford.net/
// @description Adds some additional functionality to page
// @include http://*.flickr.com/*
// @include http://flickr.com/*
// @include https://*.flickr.com/*
// @include https://flickr.com/*

// @grant GM_getValue
// @grant GM_setValue
// @grant GM_log
// @grant GM_xmlhttpRequest

// TEST TAMPERMONKEY / STIG
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.log
// @grant GM.xmlhttpRequest

// @grant GM.xmlHttpRequest
// @require https://greasyfork.org/scripts/34527/code/GMCommonAPI.js?version=232851
// @connect flickr.com


And As you said change all GM_* by GMC.
Bye example:
var cstr = GM_getValue("UserColor"+purl);
by:
var cstr = GMC.getValue("UserColor"+purl);

An other idea ?

§
Publicado: 26/12/2017
Editado: 26/12/2017

Hi @decembre

It works with Greasemonkey?
There's been an error in some version of GMC which might give problems for Tampermonkey. Try with latest version of GMC (version=237846):

// @require https://greasyfork.org/scripts/34527/code/GMCommonAPI.js?version=237846

When using GMC, these are the grants you need to support both Greasemonkey and Tampermonkey:

// @grant GM_getValue
// @grant GM_setValue
// @grant GM_log
// @grant GM.xmlHttpRequest
// @grant GM_xmlhttpRequest

Remove the other grants. They might confuse.

If it still doesn't work, there's probably not much I can help. The new xmlHttpRequest in GM4 is not 100% compatible with the old GM_xmlhttpRequest. So in some cases it will not work in GM4. But I'm not an expert on that, and I can't tell by code-inspection if it works here. But if it's only Tampermonkey giving you problems now, there's big hope.

PS: If the original script didn't work with Tampermonkey either, it probably won't help using GMC. GMC is for fixing problems in Greasemonkey 4.x. Typically to be used for scripts already running fine in Tampermonkey and in old versions of Greasemonkey (GM3.x).

§
Publicado: 28/12/2017

Thanks for the help!
i tested in Tampermonkey and greasemonkey last version but it didn't work....

My initial fork only work with Waterfox + Old greasemonkey.

Publicar resposta

Faça o login para publicar uma resposta.