Skip to content

Commit 42dddcf

Browse files
committed
first draft
1 parent fe4b51a commit 42dddcf

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

Diff for: content.js

+22-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
(function() {
22
var location = window.location.href;
33
var paper_id = location.substr(location.lastIndexOf('/') + 1);
4-
$.ajax({
5-
url: "http://www.shortscience.org/search?term=" + paper_id,
6-
success: function(data) {
7-
// This selector is brittle.
8-
paper_page = $(data).find(".col-md-10 > div > a")[0].href.substr(location.lastIndexOf('/') + 1);
9-
$.ajax({
10-
url: "http://www.shortscience.org/" + paper_page,
11-
success: function(data) {
12-
// As is this one.
13-
paper_summary = $(data).find(".source.panel-body.entry")[0]
14-
// If there's a summary, open the page.
15-
if (paper_summary.innerText !== "") {
16-
window.open("http://www.shortscience.org/" + paper_page,'_blank');
17-
}
18-
}
19-
})
20-
}
21-
});
4+
//alert(paper_id);
5+
6+
// Create box and allow people to click and write summaries
7+
a = document.createElement("div");
8+
a.id = "shortscienceorg-box";
9+
a.style.position="absolute";
10+
a.style.top="0px";
11+
a.style.right="0px";
12+
13+
document.body.appendChild(a)
14+
$("#shortscienceorg-box").html("<a href='http://www.shortscience.org/paper?bibtexKey=" + paper_id + "'>Write Summary</a>");
15+
16+
17+
//read rss and show summaries that have already been written
18+
19+
// var xml = chrome.extension.getURL('rss-all.xml')
20+
//
21+
// $.get(xml, function(data) {
22+
// alert(jQuery.parseXML( data ))
23+
// });
24+
//
25+
2226
})();

Diff for: manifest.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"manifest_version": 2,
3-
"name": "arxiv - shortscience integration",
3+
"name": "ShortScience.org - Chrome Extension",
44
"version": "0.1",
55
"permissions": [
66
"http://www.shortscience.org/*"
77
],
8+
"web_accessible_resources" : [
9+
"rss-all.xml"
10+
],
811
"content_scripts": [
912
{
1013
"matches": [

0 commit comments

Comments
 (0)