-
Notifications
You must be signed in to change notification settings - Fork 823
Update The Straits Times #3443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update The Straits Times #3443
Conversation
change for loop Co-authored-by: Abe Jellinek <[email protected]>
…ertsky/translators into straits-times-may2025-update
Could you add a search test? I'm having trouble finding a search page that this detects (e.g. https://www.straitstimes.com/search?searchkey=test doesn't work). |
if (url.includes('/search?') && url.includes('searchKey')) { | ||
Zotero.debug(url); | ||
if (url.includes('/search?') && url.includes('searchkey')) { | ||
await sleep(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AbeJellinek apparently the third party tool that the site uses for search loads much slower, hence the sleep here. but i am not sure if this is the right way to go about it... Also when I tried to run and update the test, it went into a perpetual 'updating' mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't have access to setTimeout()
in all translation environments, so we can't do that. More importantly, though, doc
is a static copy of the document in its current state; it won't change (in the browser) when the page updates.
The right way to do this is by calling ZU.monitorDOMChanges()
in detectWeb()
. Take a look at the standard web translator template for an example of what this should look like:
The only difference here is that if the URL matches a search page but getSearchResults(doc, true)
returns false, we'll want to call ZU.monitorDOMChanges(someTargetElement)
, which will automatically rerun detectWeb()
when that element changes.
(Right now we're only matching search pages with the search term test
, so that will also need to be changed.)
simplify byline detection for straits times. update author list