Translation through Standalone should wait for page to finish loading

When a translator is incompatible with Chrome (or Safari), the page is sent to Standalone for translation (this is probably also broken on zotero.org server). Standalone loads the page and appears to immediately start translation. However, as we've seen previously with automatic translation testing, some pages load a precursor page with little to no content. Standalone translation should wait a bit before translating the page.

E.g.
https://github.com/zotero/translators/pull/545

Currently breaks in Chrome on http://ntrs.nasa.gov/search.jsp?R=19910053222&hterms=jegley&qs=Ntx=mode%20matchallpartial%20&Ntk=All&N=4294937145&Ntt=jegley

(there's no reason for the translator to be incompatible with Chrome, but it illustrates the problem)

Adding some debug code, I see that the following page is being translated by Standalone

<head>[...omitted...]</head><body><div style="visibility: hidden; height: 1px; width: 1px; position: absolute; z-index: 100000;" id="_atssh"><iframe id="_atssh227" title="AddThis utility frame" style="height: 1px; width: 1px; position: absolute; z-index: 100000; border: 0px; left: 0px; top: 0px;" src="//ct1.addthis.com/static/r07/sh114.html#iit=1361949378153&amp;tmr=load%3D1361949377996%26core%3D1361949378072%26main%3D1361949378149%26ifr%3D1361949378154&amp;cb=0&amp;cdn=0&amp;chr=UTF-8&amp;kw=&amp;ab=-&amp;dh=ntrs.nasa.gov&amp;dr=http%3A%2F%2Fntrs.nasa.gov%2Fsearch.jsp%3FNtx%3Dmode%2520matchallpartial%2520%26Ntk%3DAll%26N%3D4294937145%26Ntt%3Djegley&amp;du=http%3A%2F%2Fntrs.nasa.gov%2Fsearch.jsp%3FR%3D19910053222%26hterms%3Djegley%26qs%3DNtx%253Dmode%252520matchallpartial%252520%2526Ntk%253DAll%2526N%253D4294937145%2526Ntt%253Djegley&amp;dt=NASA%20Technical%20Reports%20Server%20-%20Study%20of%20thermal-expansion-molded%2C%20graphite-epoxy%20hat-stiffened%20sandwich%20panels&amp;dbg=0&amp;md=0&amp;cap=tc%3D0%26ab%3D0&amp;inst=1&amp;irt=0&amp;jsl=6&amp;prod=undefined&amp;lng=en-US&amp;ogt=&amp;pc=men&amp;pub=nasacasi&amp;ssl=0&amp;sid=512db2c25b1d842f&amp;srpl=0.00001&amp;srd=0&amp;srf=0.02&amp;srp=0.2&amp;srl=1&amp;srx=1&amp;ver=250&amp;xck=1&amp;xtr=0&amp;og=&amp;rev=119513&amp;ct=1&amp;xld=1&amp;xd=1"></iframe></div><script type="text/javascript" src="http://ct1.addthis.com/static/r07/core065.js"></script></body>;


addthis.com looks like it might be a pretty popular service, so we are likely to run into this issue in the future. Even with compatible translators, this is probably an issue with the bookmarklet.

Introducing a general delay might be unnecessary (and depending on the delay would probably be quite annoying), so maybe we can add a translator property similar to "delay: true" for automatic testing. Or perhaps there is a way to detect when, say, no HTTP requests have been made (and none are active) from the page for a set amount of time before we begin translation.
Sign In or Register to comment.