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
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
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.
Upgrade Storage
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).
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.
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.