Always run detect on all frames, even if a translator has already been found, in order to ensure that we get the translator with the highest priority
This commit is contained in:
parent
62b3ee14ea
commit
5c324134c6
|
@ -634,14 +634,7 @@ Zotero_Browser.Tab.prototype.clear = function() {
|
||||||
/*
|
/*
|
||||||
* detects translators for this browser object
|
* detects translators for this browser object
|
||||||
*/
|
*/
|
||||||
Zotero_Browser.Tab.prototype.detectTranslators = function(rootDoc, doc) {
|
Zotero_Browser.Tab.prototype.detectTranslators = function(rootDoc, doc) {
|
||||||
// if there's already a scrapable page in the browser window, and it's
|
|
||||||
// still there, ensure it is actually part of the page, then return
|
|
||||||
if(this.page.translators && this.page.translators.length && this.page.document.location) {
|
|
||||||
if(this._searchFrames(rootDoc, this.page.document)) return;
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(doc instanceof HTMLDocument && doc.documentURI.substr(0, 6) != "about:") {
|
if(doc instanceof HTMLDocument && doc.documentURI.substr(0, 6) != "about:") {
|
||||||
// get translators
|
// get translators
|
||||||
var me = this;
|
var me = this;
|
||||||
|
@ -791,6 +784,17 @@ Zotero_Browser.Tab.prototype._selectItems = function(obj, itemList, callback) {
|
||||||
*/
|
*/
|
||||||
Zotero_Browser.Tab.prototype._translatorsAvailable = function(translate, translators) {
|
Zotero_Browser.Tab.prototype._translatorsAvailable = function(translate, translators) {
|
||||||
if(translators && translators.length) {
|
if(translators && translators.length) {
|
||||||
|
// if there's already a scrapable page in the browser window, and it's
|
||||||
|
// still there, ensure it is actually part of the page, then return
|
||||||
|
if(this.page.translators && this.page.translators.length && this.page.document.location) {
|
||||||
|
if(this.page.document.defaultView && !this.page.document.defaultView.closed) {
|
||||||
|
// if it is still there, switch translation to take place on
|
||||||
|
if(!translators.length || this.page.translators[0].priority <= translators[0].priority) return;
|
||||||
|
} else {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.page.translate = translate;
|
this.page.translate = translate;
|
||||||
this.page.translators = translators;
|
this.page.translators = translators;
|
||||||
this.page.document = translate.document;
|
this.page.document = translate.document;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user