Skip to content

Commit

Permalink
Fixes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-zck committed Jul 24, 2023
1 parent d474ae6 commit e8c52b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
19 changes: 15 additions & 4 deletions chrome/content/zsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,23 @@ zsc.retrieveCitationData = function (item, cb) {
xhr.setRequestHeader("User-Agent", zsc.getUserAgent());
// xhr.responseType = "document"; // will return a HTMLDocument instead of text
xhr.onreadystatechange = function () {
if (isDebug())
Zotero.debug(
"[scholar-citations] readyState: " +
this.readyState.toString() +
", status: " +
this.status.toString()
);

if (this.readyState == 4 && this.status == 200) {
// // debug on response text
// if (isDebug()) Zotero.debug(this.responseText);

// check if response includes meaningful content
if (this.responseText.indexOf('class="gs_r gs_or gs_scl"') != -1) {
if (
this.responseText.indexOf('class="gs_r gs_or gs_scl"') != -1 ||
this.responseText.indexOf('class="gs_r gs_or gs_scl gs_fmar"') != 0
) {
if (isDebug()) {
Zotero.debug(
"[scholar-citations] received non-captcha scholar results!"
Expand Down Expand Up @@ -249,7 +260,7 @@ zsc.retrieveCitationData = function (item, cb) {
Zotero.debug(
"[scholar-citations] neither got meaningful text or captcha, please check the following response text"
);
if (isDebug()) Zotero.debug(this.responseText);
Zotero.debug(this.responseText);
alert("neither got meaningful text or captcha, please check it in log");
}
} else if (this.readyState == 4 && this.status == 429) {
Expand Down Expand Up @@ -410,8 +421,8 @@ zsc.getUserAgent = function () {
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36";
userUA = getPref("userAgent");
if (userUA != null && userUA.length > 0) {
return userUA
} else{
return userUA;
} else {
return defaultUA;
}
};
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>Zotero Scholar Citations</em:name>
<em:version>2.1.3</em:version>
<em:version>2.1.4</em:version>
<em:type>2</em:type>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<em:creator>Nico</em:creator>
Expand Down
6 changes: 3 additions & 3 deletions update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>2.1.3</em:version>
<em:version>2.1.4</em:version>

<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>5.0.0</em:minVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/nico-zck/zotero-scholar-citations/releases/download/2.1.3/zotero-scholar-citations-2.1.3.xpi</em:updateLink>
<em:updateLink>https://github.com/nico-zck/zotero-scholar-citations/releases/download/2.1.4/zotero-scholar-citations-2.1.4.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>

Expand All @@ -22,7 +22,7 @@
<em:id>[email protected]</em:id>
<em:minVersion>4.999</em:minVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/nico-zck/zotero-scholar-citations/releases/download/2.1.3/zotero-scholar-citations-2.1.3.xpi</em:updateLink>
<em:updateLink>https://github.com/nico-zck/zotero-scholar-citations/releases/download/2.1.4/zotero-scholar-citations-2.1.4.xpi</em:updateLink>
</rdf:Description>
</em:targetApplication>

Expand Down

0 comments on commit e8c52b1

Please sign in to comment.