Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
22062481
Commit
22062481
authored
Apr 05, 2016
by
d11e9
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable extension to sync files using chrome.storage.sync
parent
e44ceb83
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
8 deletions
+51
-8
app.js
assets/js/app.js
+33
-0
background.js
background.js
+8
-3
index.html
index.html
+1
-0
manifest.json
manifest.json
+9
-5
No files found.
assets/js/app.js
View file @
22062481
...
...
@@ -51,6 +51,36 @@
}
// ----------------- storage --------------------
function
syncStorage
()
{
var
obj
=
{}
function
check
(
key
){
chrome
.
storage
.
sync
.
get
(
key
,
function
(
resp
){
console
.
log
(
"comparing to cloud"
,
resp
)
if
(
obj
[
key
]
!==
resp
[
key
]
&&
confirm
(
"Overwrite '"
+
fileNameFromKey
(
key
)
+
"' from cloud storage?"
))
{
console
.
log
(
"Overwriting"
,
key
)
localStorage
.
setItem
(
key
,
resp
[
key
]
);
updateFiles
();
}
})
}
for
(
var
y
in
window
.
localStorage
)
{
console
.
log
(
"checking"
,
y
)
obj
[
y
]
=
window
.
localStorage
.
getItem
(
y
);
if
(
y
.
indexOf
(
SOL_CACHE_FILE_PREFIX
)
!==
0
)
continue
;
check
(
y
)
}
}
window
.
syncStorage
=
syncStorage
;
if
(
chrome
&&
chrome
.
storage
&&
chrome
.
storage
.
sync
)
syncStorage
()
// ----------------- editor ----------------------
...
...
@@ -801,4 +831,6 @@
return
funABI
;
};
syncStorage
()
});
\ No newline at end of file
background.js
View file @
22062481
chrome
.
browserAction
.
onClicked
.
addListener
(
function
(
tab
)
{
chrome
.
tabs
.
create
({
'url'
:
chrome
.
extension
.
getURL
(
'index.html'
)},
function
(
tab
)
{
// tab opened
});
chrome
.
storage
.
sync
.
set
({
"chrome-app-sync"
:
true
});
chrome
.
tabs
.
create
({
'url'
:
chrome
.
extension
.
getURL
(
'index.html'
)},
function
(
tab
)
{
// tab opened
});
});
index.html
View file @
22062481
...
...
@@ -33,6 +33,7 @@
<link
rel=
"stylesheet"
href=
"assets/css/universal-dapp.css"
>
<link
rel=
"stylesheet"
href=
"assets/css/browser-solidity.css"
>
<link
rel=
"stylesheet"
href=
"assets/css/font-awesome.min.css"
>
<link
rel=
"icon"
type=
"x-icon"
href=
"icon.png"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, user-scalable=no"
>
<script
src=
"https://ethereum.github.io/solc-bin/bin/list.js"
></script>
...
...
manifest.json
View file @
22062481
...
...
@@ -5,24 +5,28 @@
"description"
:
"Realtime compiler and runtime"
,
"devtools_page"
:
"devtools.html"
,
"update_url"
:
"https://chriseth.github.io/browser-solidity/"
,
"version"
:
"1.
0"
,
"version"
:
"1.
1"
,
"manifest_version"
:
2
,
"background"
:
{
"scripts"
:
[
"background.js"
],
"persistent"
:
true
},
"icons"
:
{
"32"
:
"icon.png"
},
"browser_action"
:
{
"default_icon"
:
"icon.png"
},
"permissions"
:
[
"storage"
,
"tabs"
,
"activeTab"
,
"https://ajax.googleapis.com/"
,
"webRequest"
,
"webRequestBlocking"
,
"
\u
003Call_urls>"
,
"storage"
"webRequest"
,
"webRequestBlocking"
,
"
\u
003Call_urls>"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment