Skip to content

Commit 26a07ef

Browse files
committed
update, add notice page on installed
1 parent 3b4b100 commit 26a07ef

File tree

4 files changed

+100
-8
lines changed

4 files changed

+100
-8
lines changed

background.js

+7
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,10 @@ chrome.runtime.onMessage.addListener(
308308
}
309309

310310
});
311+
312+
313+
chrome.runtime.onInstalled.addListener(function (details) {
314+
if (details.reason === 'install') {
315+
chrome.tabs.create({url: 'html/welcome.html'})
316+
}
317+
})

contentscript.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var port = chrome.runtime.connect({name: "contentscript"});
1414
port.postMessage({src: "contentScript",dst:"background"});
1515

1616
port.onMessage.addListener(function(msg) {
17-
console.log("port.onMessage: " +JSON.stringify(msg));
17+
//console.log("port.onMessage: " +JSON.stringify(msg));
1818

1919
window.postMessage({ //forward msg from background to webpage
2020
"data":msg
@@ -31,10 +31,10 @@ port.onDisconnect.addListener(function(message) {
3131
//message from background
3232
chrome.runtime.onMessage.addListener(
3333
function(request, sender, sendResponse) {
34-
console.log(sender.tab ?
35-
"from a content script:" + sender.tab.url :
36-
"from the extension");
37-
console.log("chrome.runtime.onMessage." + JSON.stringify(request));
34+
// console.log(sender.tab ?
35+
// "from a content script:" + sender.tab.url :
36+
// "from the extension");
37+
// console.log("chrome.runtime.onMessage." + JSON.stringify(request));
3838

3939
if(request.logo === "nebulas"){
4040
request.src = "content"
@@ -53,7 +53,7 @@ window.addEventListener('message', function(e) {
5353
//if (e.source != window)
5454
// return;
5555

56-
console.log("window.addEventListener: msg.data: " + JSON.stringify(e.data) );
56+
//console.log("window.addEventListener: msg.data: " + JSON.stringify(e.data) );
5757

5858
if(e.data.target === "contentscript") {
5959
port.postMessage({ //forward msg from webpage to background, [just for compatible]
@@ -66,7 +66,7 @@ window.addEventListener('message', function(e) {
6666
if(e.data.logo === "nebulas" && e.data.src === "nebPay") { //msg from nebPay
6767
e.data.src = "content"
6868
chrome.runtime.sendMessage(e.data, function (response) {
69-
console.log("response: " + JSON.stringify(response));
69+
//console.log("response: " + JSON.stringify(response));
7070
});
7171
}
7272

html/welcome.html

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset=utf-8>
5+
<link rel="icon shortcut" href=images/logo.png>
6+
<link rel=apple-touch-icon href=images/logo.png>
7+
<link rel=stylesheet href=lib/bootstrap-4.0.0-dist/css/bootstrap.min.css>
8+
<link rel=stylesheet href=css/base.css>
9+
<link rel=stylesheet href=css/ui-block.css>
10+
<title>Notice</title>
11+
<meta name=viewport content="width=device-width">
12+
<style>
13+
.active1 {
14+
display: none;
15+
}
16+
17+
.errmsg {
18+
color: red;
19+
}
20+
21+
.form-control {
22+
text-align: center;
23+
}
24+
25+
.hash,
26+
.information {
27+
text-align: center;
28+
}
29+
30+
.information {
31+
margin-top: 20px;
32+
}
33+
34+
.mod-child td:last-child {
35+
padding-bottom: 0;
36+
padding-top: 0;
37+
vertical-align: middle;
38+
}
39+
40+
.number-comma input.form-control {
41+
/* override .form-control:disabled */
42+
background-color: initial;
43+
border: 0;
44+
}
45+
46+
.table tr>td:first-child {
47+
text-align: left;
48+
}
49+
50+
div#main-outer {
51+
width: 400px;
52+
margin: 5px;
53+
/*background: #DDD;*/
54+
border-radius: 5px;
55+
}
56+
57+
.table table-striped {
58+
59+
}
60+
61+
.check_words{
62+
font-size: 12px;
63+
}
64+
</style>
65+
</head>
66+
67+
<body>
68+
<section class="container hash">
69+
<section class=col>
70+
<br>
71+
<h3>How to debug with local html file</h3>
72+
<br>
73+
<p>Please note that chrome extension installed from Google Web Store cannot interact with local page files by default.</p>
74+
75+
<p>If you need to test your local page files with this extension, please check the options "Allow access to file URLs" at extension setting, just copy this link to chrome address bar: <span style="color: #0e90d2">chrome://extensions/?id=gehjkhmhclgnkkhpfamakecfgakkfkco</span></p>
76+
<div>
77+
<img src="./../resources/extension_options.png">
78+
</div>
79+
</section>
80+
81+
</section>
82+
83+
84+
</body>
85+
</html>

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"default_locale": "en",
44
"description": "The extension for Nebulas Dapp",
55

6-
"version": "0.1.1",
6+
"version": "0.1.2",
77
"manifest_version": 2,
88

99
"icons": {

0 commit comments

Comments
 (0)