-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug with new paperswithcode version
- Loading branch information
Showing
5 changed files
with
95 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,44 @@ | ||
# Scholar With Code | ||
|
||
[![Chrome Web Store](https://img.shields.io/chrome-web-store/v/nlnjigejpgngahmoainkakaafabijeki)](https://chrome.google.com/webstore/detail/scholar-with-code/nlnjigejpgngahmoainkakaafabijeki) | ||
|
||
A simple chrome extension to present the number of available code implementions (via `Papers With Code`) for articles listed on `Google Scholar` and `arXiv`. | ||
|
||
<p align="center"> | ||
<img src="docs/teaser_scholar.gif" width="800px"/> | ||
</p> | ||
<br> | ||
<p align="center"> | ||
<img src="docs/teaser_arxiv.gif" width="800px"/> | ||
</p> | ||
|
||
## Recent Updates | ||
**`2020.07.15`**: Added arXiv Support | ||
|
||
**`2020.06.24`**: Chrome Extension release | ||
|
||
**`2020.06.16`**: First Release | ||
|
||
|
||
## Why? | ||
Two of the most used tools for me during research are `Google Scholar` and `Papers with Code`, together giving a full view of citations and code implementations. | ||
|
||
I've noticed that a thing that I do a lot is to start from a paper I know, go through the "Papers that cite this work" page on `Google Scholar`, and then for each paper check whether it has a code implementation using `Papers With Code`. | ||
|
||
As it is kind of annoying to go back and forth between the two, I've written a small chrome extension that shows whether the paper has code implementation and links to the matching page on `Papers with Code`. | ||
|
||
<p align="center"> | ||
<img src="docs/teaser_scholar.png" width="800px"/> | ||
</p> | ||
|
||
## Installation | ||
|
||
Extension is available in the [Chrome Web Store](https://chrome.google.com/webstore/detail/scholar-with-code/nlnjigejpgngahmoainkakaafabijeki). Alternatively you can download the project directory and drag it to your chrome extensions. | ||
|
||
|
||
## TODOs | ||
- [x] Publish to Chrome Web Store | ||
- [x] Check how to remove permissions to all sites | ||
- [x] Support arXiv.org | ||
# Scholar With Code | ||
|
||
[![Chrome Web Store](https://img.shields.io/chrome-web-store/v/nlnjigejpgngahmoainkakaafabijeki)](https://chrome.google.com/webstore/detail/scholar-with-code/nlnjigejpgngahmoainkakaafabijeki) | ||
|
||
A simple chrome extension to present the number of available code implementations (via `Papers With Code`) for articles listed on `Google Scholar` and `arXiv`. | ||
|
||
<p align="center"> | ||
<img src="docs/teaser_scholar.gif" width="800px"/> | ||
</p> | ||
<br> | ||
<p align="center"> | ||
<img src="docs/teaser_arxiv.gif" width="800px"/> | ||
</p> | ||
|
||
## Recent Updates | ||
**`2021.11.18`**: Minor fix to support changes in `Papers With Code` | ||
|
||
**`2020.07.15`**: Added arXiv Support | ||
|
||
**`2020.06.24`**: Chrome Extension release | ||
|
||
**`2020.06.16`**: First Release | ||
|
||
|
||
## Why? | ||
Two of the most used tools for me during research are `Google Scholar` and `Papers with Code`, together giving a full view of citations and code implementations. | ||
|
||
I've noticed that a thing that I do a lot is to start from a paper I know, go through the "Papers that cite this work" page on `Google Scholar`, and then for each paper check whether it has a code implementation using `Papers With Code`. | ||
|
||
As it is kind of annoying to go back and forth between the two, I've written a small chrome extension that shows whether the paper has code implementation and links to the matching page on `Papers with Code`. | ||
|
||
<p align="center"> | ||
<img src="docs/teaser_scholar.png" width="800px"/> | ||
</p> | ||
|
||
## Installation | ||
|
||
Extension is available in the [Chrome Web Store](https://chrome.google.com/webstore/detail/scholar-with-code/nlnjigejpgngahmoainkakaafabijeki). Alternatively you can download the project directory and drag it to your chrome extensions. | ||
|
||
|
||
## TODOs | ||
- [x] Publish to Chrome Web Store | ||
- [x] Check how to remove permissions to all sites | ||
- [x] Support arXiv.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | ||
var xhr = new XMLHttpRequest(); | ||
xhr.responseType = "document" | ||
var paperurl = "https://paperswithcode.com/search?q_meta=&q="+request.title.replace(/\s/g,"+") //Search in PapersWithCode | ||
xhr.open("GET", paperurl, true); | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState == 4) { | ||
var paper_link = paperurl; // Initialize with search query | ||
var elems = xhr.response.getElementsByClassName('col-lg-9 item-content') | ||
if (elems.length == 0) | ||
{ | ||
var txt = "no code implementation"; // No results | ||
} | ||
else { | ||
var title = elems[0].childNodes[1].textContent.toUpperCase() | ||
if (title == request.title.toUpperCase()){ | ||
var txt = elems[0].childNodes[3].childNodes[3].text; | ||
paper_link = elems[0].childNodes[1].childNodes[0].href; // If exist, use page url | ||
} | ||
else { | ||
var txt = "no code implementation"; // No result with same title | ||
} | ||
} | ||
sendResponse({txt: txt, paper_link: paper_link, payload: request.payload}); | ||
} | ||
} | ||
xhr.send(); | ||
return true; | ||
}); | ||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | ||
var xhr = new XMLHttpRequest(); | ||
xhr.responseType = "document" | ||
var paperurl = "https://paperswithcode.com/search?q_meta=&q="+request.title.replace(/\s/g,"+") //Search in PapersWithCode | ||
xhr.open("GET", paperurl, true); | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState == 4) { | ||
var paper_link = paperurl; // Initialize with search query | ||
var elems = xhr.response.getElementsByClassName('col-lg-9 item-content') | ||
if (elems.length == 0) | ||
{ | ||
var txt = "no code implementation"; // No results | ||
} | ||
else { | ||
var title = elems[0].childNodes[1].textContent.toUpperCase() | ||
if (title == request.title.toUpperCase()){ | ||
var txt = elems[0].childNodes[3].childNodes[1].text; | ||
paper_link = elems[0].childNodes[1].childNodes[0].href; // If exist, use page url | ||
} | ||
else { | ||
var txt = "no code implementation"; // No result with same title | ||
} | ||
} | ||
sendResponse({txt: txt, paper_link: paper_link, payload: request.payload}); | ||
} | ||
} | ||
xhr.send(); | ||
return true; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
var paper_title = document.querySelector("#abs h1").childNodes[1].textContent; | ||
chrome.runtime.sendMessage({title: paper_title}, function(response) { | ||
var a = document.createElement('a'); | ||
a.innerText = response.txt; | ||
a.href = response.paper_link; | ||
var li = document.createElement('li'); | ||
li.appendChild(a); | ||
document.querySelector(".full-text ul").appendChild(li); | ||
}); | ||
var paper_title = document.querySelector("#abs h1").childNodes[1].textContent; | ||
chrome.runtime.sendMessage({title: paper_title}, function(response) { | ||
var a = document.createElement('a'); | ||
a.innerText = response.txt; | ||
a.href = response.paper_link; | ||
var li = document.createElement('li'); | ||
li.appendChild(a); | ||
document.querySelector(".full-text ul").appendChild(li); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
var panels = document.getElementsByClassName('gs_ri'); | ||
// Go over all regions and add code implementations | ||
for (var i = 0, l = panels.length; i < l; i++) { | ||
var title = panels[i].childNodes[0].textContent; | ||
chrome.runtime.sendMessage({title: title, payload: i}, function(response) { | ||
var panels = document.getElementsByClassName('gs_ri'); | ||
var a = document.createElement('a'); | ||
a.innerText = response.txt; | ||
a.href = response.paper_link; | ||
panels[response.payload].childNodes[3].appendChild(a); | ||
}); | ||
} | ||
var panels = document.getElementsByClassName('gs_ri'); | ||
// Go over all regions and add code implementations | ||
for (var i = 0, l = panels.length; i < l; i++) { | ||
var title = panels[i].childNodes[0].textContent; | ||
chrome.runtime.sendMessage({title: title, payload: i}, function(response) { | ||
var panels = document.getElementsByClassName('gs_ri'); | ||
var a = document.createElement('a'); | ||
a.innerText = response.txt; | ||
a.href = response.paper_link; | ||
panels[response.payload].childNodes[3].appendChild(a); | ||
}); | ||
} |