Skip to content

Commit a254371

Browse files
committed
Add: initial structure for quicktip.
1 parent adecc46 commit a254371

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ASSEMBLY=./quicktip
2+
3+
.DEFAULT_GOAL: $(ASSEMBLY)
4+
5+
$(ASSEMBLY):
6+
$(GOPATH)/bin/gopherjs build app.go -o ${ASSEMBLY}/app.js
7+
cp manifest.json ${ASSEMBLY}
8+
cp info.html ${ASSEMBLY}
9+
clean:
10+
if [ -d ${ASSEMBLY} ] ; then rm -rf ${ASSEMBLY} ; fi

app.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"github.com/dominikh/go-js-dom"
5+
"github.com/fabioberger/chrome"
6+
"strconv"
7+
)
8+
9+
func main() {
10+
c := chrome.NewChrome()
11+
12+
tabDetails := chrome.Object{
13+
"active": false,
14+
}
15+
16+
c.Tabs.Create(tabDetails, func(tab chrome.Tab) {
17+
notification := "Tab with id: " + strconv.Itoa(tab.Id) + " created!"
18+
dom.GetWindow().Document().GetElementByID("notification").SetInnerHTML(notification)
19+
})
20+
21+
}

info.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
<style>
4+
#notification {
5+
width: 300px;
6+
}
7+
</style>
8+
</head>
9+
<body>
10+
<h1 id="notification"></h1>
11+
<script src="app.js"></script>
12+
</body>
13+
</html>

manifest.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"manifest_version": 2,
3+
4+
"name": "QuickTip Chrome extension",
5+
"description": "Chrome extension that is used to translate particular words/phrases on site via TranslateAPI",
6+
"version": "1.0",
7+
8+
"browser_action": {
9+
"default_popup": "info.html"
10+
},
11+
"permissions": [
12+
"tabs"
13+
]
14+
}

0 commit comments

Comments
 (0)