Skip to content

Commit

Permalink
Release: MVP published to chrome web store 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaybharambe14 committed Apr 24, 2021
1 parent c2061f6 commit 8f2a5fc
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 2 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
# docgo
A browser extension 🧱 to redirect from Go source code repositories to official go documentation
# DOCGO!

![Chrome Web Store](https://img.shields.io/chrome-web-store/users/jllcbbemppedmpfjjeaoifdogcinmjpm)
[![Rating](https://img.shields.io/chrome-web-store/stars/jllcbbemppedmpfjjeaoifdogcinmjpm.svg)](https://chrome.google.com/webstore/detail/docgo/jllcbbemppedmpfjjeaoifdogcinmjpm)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/v/jllcbbemppedmpfjjeaoifdogcinmjpm)](https://chrome.google.com/webstore/detail/docgo/jllcbbemppedmpfjjeaoifdogcinmjpm)
![GitHub manifest.json dynamic](https://img.shields.io/github/manifest-json/permissions/akshaybharambe14/docgo)
[![GitHub](https://img.shields.io/github/license/akshaybharambe14/docgo)](LICENSE)
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)


A browser extension 🧱 to redirect from Go source code repositories to official go documentation 📄.

I made if for fun and it might help you. Enjoy!

## How to use it

1. Add the extension from [chrome wb store](https://chrome.google.com/webstore/detail/docgo/jllcbbemppedmpfjjeaoifdogcinmjpm) to your browser.

2. Head over to any Go package/module ex. [The Go repository](https://github.com/golang/go).

3. Click on the extension and Go!

![Click "Go" to get redirected](./images/example.png)

**Pro tip:** You can pin the extension.

## Why

Sometimes, Go developers fail to mention official documentation URL for their repository. We have to manually go to [pkg.go.dev](pkg.go.dev) and search for that repository. This extension helps to go to the documentation right from where ypu are.

## Contributing

If you have any idea, feel free to open an issue.

## Thank You!
If you like it, please rate it on chrome store and keep coding!
2 changes: 2 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// package docgo is here make Go community aware of this extension. DOCGO is a browser extension 🧱 to redirect from Go source code repositories to official go documentation 📄.
package docgo
55 changes: 55 additions & 0 deletions docgo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.center {
text-align: center;
}
.container {
height: 100px;
position: relative;
}

.btn-center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}

button {
display: inline-block;
background-color: #7b38d8;
border-radius: 10px;
border: 4px double #cccccc;
color: #eeeeee;
text-align: center;
font-size: 28px;
padding: 20px;
width: 100px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}
button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
button span:after {
content: "\00bb";
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
button:hover {
background-color: #f7c2f9;
}
button:hover span {
padding-right: 25px;
}
button:hover span:after {
opacity: 1;
right: 0;
}
24 changes: 24 additions & 0 deletions docgo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Load package documentation</title>
<script src="docgo.js"></script>
<link rel="stylesheet" href="docgo.css" />
</head>
<body>
<div class="center">
<h1>DOCGO</h1>
<h3>
Redirect from Go source code repositories(ex. Github) to official
documentation
</h3>
</div>
<div class="container">
<div class="btn-center">
<button id="go">
<span>Go!</span>
</button>
</div>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions docgo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const splitChar = '//'
const goDocURL = 'https://pkg.go.dev/'

const clean = (url = '') => {
const start = url.indexOf(splitChar)

return url.substring(start + splitChar.length)
}

const redirect = (tabs = [] /* active tabs */) => {
if (tabs.length == 0) {
alert("You don't have any active tabs!")
return
}
const tab = tabs[0]
const repoURL = clean(tab.url)
const docURL = goDocURL + repoURL
window.open(docURL, '_blank').focus(); // open new tab with documentation
}

document.addEventListener('DOMContentLoaded', (e) => {

var goBtn = document.getElementById('go');

goBtn.addEventListener('click', () => {
chrome.tabs.query({ active: true, currentWindow: true }, redirect)
})

}, false);

3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/akshaybharambe14/docgo

go 1.16
Binary file added icons/icon128.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 icons/icon16.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 icons/icon48.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 icons/icon500.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 images/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"manifest_version": 3,
"name": "DOCGO",
"description": "Redirect from Go source code repositories(ex. Github) to official documentation",
"version": "1.0",
"action": {
"default_icon": "icons/icon500.png",
"default_popup": "docgo.html"
},
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"permissions": [
"activeTab"
]
}

0 comments on commit 8f2a5fc

Please sign in to comment.