detectWeb(doc, url) -> url is empty

I am writing a translator for an internal site using Scaffold 3.3.0 in Zotero 5.0.33. However, I ran into a problem at the detectWeb function:

function detectWeb(doc, url) {

Z.debug(url)
if (url.search("partialfields") != -1) {
Z.debug(url)
return "report";
}// else if (ZU.xpathText(doc, "//*[@id=\"ctl00_cphContents_divSearchresult\"])").search("Searchresult") > 0 || ZU.xpathText(doc, "//*[@id=\"ctl00_cphContents_divSearchresult\"])").search("WhatsNewResult") > 0) {
// return "multiple";
//}
}

The output I get when running the detectWeb test is:
13:59:21 about:blank
13:59:21 detectWeb did not match

Somehow, the URL defined in my test (below) is not even being passed to the test. Do you have a suggestion to at least return the url?

/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.somedomain.com/app/GSA/View.aspx?partialfields=R160022",
"items": "report"
}
]
/** END TEST CASES **/

Thanks!

Nathaniel
  • Is this just a test problem or do you get the same if you actually open the page in the Scaffold Browser?
  • Two comments-
    1) somehow, I missed the Browser in Scaffold. I will use that during testing.
    2) no, this is a test case that I was running. When I put the actual url (replacing somedomain with my intranet domain), I get an error in the Scaffold browser (401 - Unauthorized: Access is denied due to invalid credentials).
  • When I have a URL in the browser, it will at least run with detectWeb appropriately and return a matching value. I think the 401 error is likely due to the corporate firewall and Scaffold not using the system proxy server.
  • Hard to say about the test -- but if the Scaffold browser isn't able to authenticate with the site, then obviously the test wouldn't work anyway (well, the url part might, but that seems uninteresting).

    If you can't get the page to load in Scaffold, you can still use Scaffold and save your edits, then update the translator from the Zotero browser connector and looking at the debug there. Certainly a lot less comfortable, works in a pinch.
  • The url part finally did work, thanks.

    I will certainly move development over to the browser. However, I am having a hard time getting the translators to update. In both Chrome and Firefox, I got to the extension options, advanced, and click on "update translators". I can get it to update once when I first start the browser, then need to restart the browser to get any effect. Is that consistent with what is expected?

    Anyway, thank you for the help, I can now make some progress updating the translator.
  • No, the update button should (and does for me) update after every local save to the translator -- might require updating the timestamp, which Scaffold would do automatically on save.
  • The time-stamp was the ticket - thanks for helping out!

This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.

Sign In or Register to comment.