vzvu3k6k / convert_scriptish-config.json_to_greasemonkey-config.xml

Convert scriptish-config.json to Greasemonkey's config.xml
0 stars 0 forks source link

Just convert metadata not included in script, and have GM rebuild config.xml? #2

Open vzvu3k6k opened 9 years ago

vzvu3k6k commented 9 years ago

Converting all metadata is cumbersome, and we have to fix the code every time a new property is added.

Since Greasemonkey seems to rebuild config.xml when a userscript file is updated, it would be better just to convert metadata not included in script and have Greasemonkey rebuild config.xml by touch userscripts/**/*.user.js or something.

I'll do a search on what Greasemonkey exactly does when a userscript file is updated.

vzvu3k6k commented 9 years ago

What Greasemonkey Does

Metadata is updated probably in Config.prototype.updateModifiedScripts(). If GM_prefRoot.getValue('enableScriptRefreshing') is truthy, updateModifiedScripts() is invoked every time Greasemonkey try to run user scripts. And if script._modifiedTime (modified time recorded in the script config) is not equal to script.file.lastModifiedTime (modified time of the user script file itself) (see Script.prototype.isModified()) or script.pendingExec.length != 0 (I don't know what it means.), a script's metadata is parsed and config is updated.

Problem of Changing Last Modified Time

automatic script updates will be disabled.