-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fe3de3d
Showing
10 changed files
with
154 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SimplyPapers Browser Extension (mainly Chrome) | ||
WebExtension API based browser extension to simply access papers via our LMU/TUM institutional accounts. | ||
|
||
Click the Extension icon and select through which institution you want to access the paper you're currently viewing (e.g. on ACM, IEE, ...). The extension will redirect to the paper through the institutional login. Actually logging in is only necessary the first time. (until you delete your cookies ;) | ||
|
||
> The extension does NOT log you in, it merely redirects. I.e. your passwords are not read by the extension. | ||
## Example Usage | ||
![gif of useage](doc/paperAccessPreview.gif) | ||
|
||
## Setup | ||
1. Download the current release from the github releases page of this repo and unzip it. Or simply clone the repo. | ||
2. Install it | ||
|
||
__For Chome:__ follow [this guide](https://ui.vision/howto/install-chrome-extension-from-file) to install the extension via `load unpacked` | ||
|
||
__For Firefox:__ Sadly you can't install local extensions permanently without [some hassle](https://stackoverflow.com/questions/62237202/firefox-add-ons-how-to-install-my-own-local-add-on-extension-permanently-in-f). To install it temporarily (i.e. until you close Firefoy again): | ||
|
||
- got to `about:debugging#/runtime/this-firefox` | ||
- `load temporary add-on` | ||
- Select the `manifest.json` in this repo | ||
3. Happy paper accessing ;) | ||
|
||
## Roadmap | ||
Currently the urls for lmu and tum are hardcoded. It would be nice to make them user configurable -> i.e. add a dialog to add new ones and dynamically generate the buttons in the popup from these. But we all have to write our thesis, I guess... |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "SimplyPapers", | ||
"description": "Access scientific papers via your institution account on any site with a single click.", | ||
"version": "1.0", | ||
"icons": { | ||
"48": "images/logo_48.png", | ||
"256": "images/logo_256.png", | ||
"512": "images/logo_512.png", | ||
"1024": "images/logo_1024.png" | ||
}, | ||
"manifest_version": 3, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"*://*/*" | ||
], | ||
"css": [], | ||
"js": [ | ||
"scripts/content.js" | ||
] | ||
} | ||
], | ||
"permissions": [ | ||
"activeTab", | ||
"scripting" | ||
], | ||
"action": { | ||
"default_icon": { | ||
"16": "images/logo_48.png" | ||
}, | ||
"default_title": "SimplyPapers", | ||
"default_popup": "popup.html" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
<style> | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.institutions { | ||
min-width: 160px; | ||
padding: 12px; | ||
background: #25272b; | ||
} | ||
|
||
button { | ||
width: 100%; | ||
border-radius: 4px; | ||
border: 1px solid white; | ||
color: white; | ||
padding: 12px; | ||
} | ||
|
||
#lmu { | ||
background-color: #00ac25; | ||
} | ||
|
||
#tum { | ||
background-color: #3437f0; | ||
} | ||
|
||
button:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.spacer { | ||
height: 12px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="institutions"> | ||
<button id="lmu">Access via LMU</button> | ||
<div class="spacer"></div> | ||
<button id="tum">Access via TUM</button> | ||
</div> | ||
|
||
<script type="text/javascript" src="popup.js"></script> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Replace the currently active url xay.abc.com/... with a version xay-abc-com.<accessUrl>/... | ||
* And navigate to that new url. | ||
* | ||
* The <accessUrl> is provided by the message request | ||
*/ | ||
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { | ||
let currentLocation = document.location; | ||
|
||
//ensure idempotence | ||
if (!currentLocation.hostname.includes(request.accessUrl)) { | ||
let newURL = currentLocation.protocol + "//"; | ||
|
||
let paperAccessHostName = currentLocation.hostname.replaceAll('.', '-') + "." + request.accessUrl; | ||
|
||
newURL += paperAccessHostName + (currentLocation.port.length > 0 ? ":" + currentLocation.port : "") + currentLocation.pathname + currentLocation.search + currentLocation.hash; | ||
|
||
console.log("Redirect to: " + newURL); | ||
|
||
document.location.assign(newURL); | ||
} else { | ||
//we already are on a "accessified" page, do nothing :) | ||
} | ||
|
||
sendResponse({ success: true }); | ||
}); | ||
|
||
console.log("Registered Paper Access Extension"); |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const TUMeaccessUrl = "eaccess.ub.tum.de" | ||
const LMUeaccessUrl = "emedien.ub.uni-muenchen.de" | ||
|
||
function accessPaper(accessUrl) { | ||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { | ||
chrome.tabs.sendMessage(tabs[0].id, { accessUrl }, function (response) { | ||
console.log('success'); | ||
}); | ||
}); | ||
} | ||
|
||
document.getElementById('lmu').addEventListener('click', () => accessPaper(LMUeaccessUrl)); | ||
document.getElementById('tum').addEventListener('click', () => accessPaper(TUMeaccessUrl)); |