Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
samoneilll committed May 28, 2021
0 parents commit 783a39c
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Sam O'Neill

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added assets/chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/goryn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions content_script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
if (document.readyState === "complete") {
backtoZkill();
} else {
document.onreadystatechange = function () {
if (document.readyState === "complete") {
backtoZkill();
}
};
}

const backtoZkill = async () => {
await delay(1000); // delay 2s since br.evetools uses semi-random strings for class names, we cannot trigger on load of any particular element
const links_to_replace = new RegExp(/.*evetools\.org\/(kill|character|corporation|alliance|ship|system|constellation|region).*/);
let elements = document.getElementsByTagName("a");
for (const element of elements) {
if (links_to_replace.test(element.href) === true) {
let link = element.href
var replacedLink = link.replace(/kb\.evetools.org/gi, "zkillboard.com");
if (replacedLink !== link) {
element.setAttribute("href", replacedLink)
}
}
}
}

const delay = ms => new Promise(res => setTimeout(res, ms));

17 changes: 17 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"manifest_version": 2,
"name": "evetools to zkillboard",
"description": "This extension will redirect you to zkill when clicking on a killmail/pilot/corp/etc from br.evetools.org, rather than using the km.evetools.org killboard",
"version": "1.0",
"content_scripts": [
{
"matches": [
"https://*.evetools.org/*"
],
"js": [
"content_script.js"
],
"run_at": "document_idle"
}
]
}
38 changes: 38 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Evetools to Zkillboard

## About

This is an experimental browser extension will change the links for killmails, pilots, corporations, systems etc to use zkillboard.com rather than Evetool's kb.evetools.org.

It works by simply waiting 1 second after the page has loaded to allow all the killmails to be fetched, and then loops through each link and replaces `kb.evetools.org` => `zkillboard.com` so that you can view killmails in zkillboard.

---
## Supported Browsers
[![Chrome](assets/chrome.png "Chrome")](#chrome-installation-instructions)
[![Firefox](assets/firefox.png "Firefox")](#Firefox-installation-instructions)

---

## Installation Instructions

- [Chrome instructions](#chrome-installation-instructions)
- [Firefox instructions](#Firefox-installation-instructions)

### Chrome Installation Instructions

1. Download the latest zip file from the [Releases](https://github.com/samoneilll/Evetools-to-Zkillboard-Extension/releases/tag/v1.0) page
1. Extract the zip somewhere on your PC
1. In Chrome go to [Extensions](chrome://extensions/), turn on the "Developer mode" toggle at the top right
1. Click "Load Unpacked", and select the folder that contains the unzipped files
1. Enjoy

### Firefox Installation Instructions

1. Download the latest zip file from the [Releases](https://github.com/samoneilll/Evetools-to-Zkillboard-Extension/releases/tag/v1.0) page
1. Extract the zip somewhere on your PC
1. In Firefox navigate to `about:debugging` and click "This firefox", or [click here](about:debugging#/runtime/this-firefox)
1. Click "Load Temporary Add-on..."
1. Select the `manifest.json` file from the extracted files
1. Enjoy

---

0 comments on commit 783a39c

Please sign in to comment.