Scaffold in Firefox 3.1
Scaffold does not seem to support Firefox 3.1. Are there any plan on making it compatible?
Mikko
Mikko
This is an old discussion that has not been active in a long time. Instead of commenting here, you should start a new discussion. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
Scaffold doesn't support Zotero 1.5, however, and updating it isn't a priority, since translators in 1.5 are stored as individual JS files in the data directory and are trivial to edit.
If creating a new translator, just copy an existing one into a new file and generate a new GUID. The only required parts are the JSON block at the top, detectWeb(), and doWeb().
Theoretically Zotero should reload the code every time a page is refreshed, so you'd only need to restart Firefox if you updated the target regexp in the JSON block. It may not currently be reloading the code on refreshes, however, so restart Firefox if changes don't seem to be taking.
In Zotero, Zotero.Translator in translate.js and _translatorXMLToFile() in schema.js would probably be helpful.
* http://bitbucket.org/rmzelle/scaffold/
I'm now at the point where Scaffold has to save the translator to the local translator directory. If I could XMLify the translator code myself, I guess I could just use the unmodified _translatorXMLToFile().
I've created Zotero.Translators.save(metadata, code) on the trunk. You can use that for saving. I tested it only briefly, so let me know if you have any problems with it.
var fileName = Zotero.Translators.getFileNameFromLabel(metadata.label);
(code in scaffold.js)Zotero.debug(fileName);
var fileName2 = Zotero.Translators.save(metadata.label);
Zotero.debug(fileName2);
and
this.getFileNameFromLabel = function(label) {
(code in translate.js)Zotero.debug("test");
return Zotero.File.getValidFileName(label) + ".js";
}
//comments
this.save = function(label) {
Zotero.debug("test2");
return Zotero.File.getValidFileName(label) + ".js";
}
but I only get output for "Zotero.debug(fileName);" (I don't get a result for "Zotero.debug("test");" however). Renaming the new save function (from "save" to something else) also didn't work. Could it be that the save function still has to be registered someplace else?
2) Do you have showInConsole enabled in about:config and the Error Console open? You can't debug Mozilla-based code without it.
3) Be sure to pass 'code' to Zotero.Translators.save() as well.
@2) Up to this point I just ran Firefox from the command prompt with debug logging enabled. Thanks for the pointer. But how are error messages exactly distributed over the command prompt and the error console?
For your dev profile, I'd recommend Console2 and the -jsconsole command-line flag to open it on startup.