Skip to content

Commit

Permalink
Update zsc.js
Browse files Browse the repository at this point in the history
try to pop-up web page when encountering reCAPTCHA from "Unusual traffic warning".
  • Loading branch information
nico-zck committed Mar 31, 2020
1 parent 25f3028 commit a130780
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions chrome/content/zsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,26 @@ zsc.retrieveCitationData = function(item, cb) {
}
}
} else if (this.readyState == 4 && this.status == 429) {
if (isDebug()) Zotero.debug('[scholar-citations] '
+ 'could not retrieve the google scholar data. Server returned: ['
+ xhr.status + ': ' + xhr.statusText + ']. '
+ 'GS want\'s you to wait for ' + this.getResponseHeader("Retry-After")
+ ' seconds before sending further requests.');
if (this.responseText.indexOf('www.google.com/recaptcha/api.js') == -1) {
if (isDebug()) Zotero.debug('[scholar-citations] '
+ 'could not retrieve the google scholar data. Server returned: ['
+ xhr.status + ': ' + xhr.statusText + ']. '
+ 'GS want\'s you to wait for ' + this.getResponseHeader("Retry-After")
+ ' seconds before sending further requests.');
} else {
if (isDebug()) Zotero.debug("[scholar-citations] "
+ "received a captcha instead of a scholar result");
alert(zsc._captchaString);
if (typeof Zotero.openInViewer !== 'undefined') {
Zotero.openInViewer(url);
} else if (typeof ZoteroStandalone !== 'undefined') {
ZoteroStandalone.openInViewer(url);
} else if (typeof Zotero.launchURL !== 'undefined') {
Zotero.launchURL(url);
} else {
window.gBrowser.loadOneTab(url, {inBackground: false});
}
}

} else if (this.readyState == 4) {
if (isDebug()) Zotero.debug('[scholar-citations] '
Expand Down

0 comments on commit a130780

Please sign in to comment.