Commit 22062481 authored by d11e9's avatar d11e9

Enable extension to sync files using chrome.storage.sync

parent e44ceb83
......@@ -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
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
});
});
......@@ -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>
......
......@@ -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",
"\u003Call_urls>",
"storage"
"webRequest",
"webRequestBlocking",
"\u003Call_urls>"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment