Skip to content

Commit

Permalink
✨ Add Restore Option
Browse files Browse the repository at this point in the history
  • Loading branch information
mskian committed May 20, 2020
1 parent a899094 commit 7d6a5f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
10 changes: 0 additions & 10 deletions css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,6 @@ h2 {
color: #1b0404;
}

.btn.btn-gotify:focus,.btn.btn-gotify:hover{
background:#2d9ee9;;
border-color:#2d9ee9;
color:#ffffff;
}
.btn.btn-gotify.active,.btn.btn-gotify:active{
background:#2d9ee9;
border-color:#2d9ee9;
color:#ffffff;
}
.btn.btn-gotify.loading::after{
border-bottom-color:#ffffff;
border-left-color:#ffffff;
Expand Down
25 changes: 25 additions & 0 deletions js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ function restoreOptions() {
});
}

function restoreBackup() {
chrome.storage.sync.get({
backup: []
}, restore => {
if (restore.backup == 0) {
document.getElementById('connection').innerHTML = '<b>No backup</b>';
setTimeout(() => {
document.getElementById('connection').innerHTML = '';
}, 2000);
} else {
document.getElementById('connection').innerHTML = '<p>Restored <b>Save Proxy 👆</b> to Connect the Server</p>';
setTimeout(() => {
document.getElementById('connection').innerHTML = '';
}, 3000);
if (document.getElementById('apiurl') != null) {
document.getElementById('apiurl').value = restore.backup;
}
}
});
}

document.addEventListener('DOMContentLoaded', restoreOptions);
var el = document.getElementById('save');
if (el) {
Expand All @@ -76,4 +97,8 @@ if (gc) {

if (document.getElementById('clear') != null) {
document.getElementById('clear').addEventListener('click', clear);
}

if (document.getElementById('backuprestore') != null) {
document.getElementById('backuprestore').addEventListener('click', restoreBackup);
}
4 changes: 2 additions & 2 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div class="container text-center">

<h2>Enter your Socks5 IP and PORT 🔐</h2>
<h2>Enter your Socks IP and PORT 🔐</h2>

<br>

Expand All @@ -33,7 +33,7 @@ <h2>Enter your Socks5 IP and PORT 🔐</h2>
<br>

<div class="container text-center">
<button class="btn btn-gotify btn-lg read-more" id="clear">⏺ Disable</button>
<button class="btn btn-gotify btn-lg read-more" id="clear">⏺ Disable</button>&nbsp;&nbsp;&nbsp;<button class="btn btn-gotify btn-lg read-more" id="backuprestore">♻ Restore</button>
<br>
<br>
<div id="connection"></div>
Expand Down

0 comments on commit 7d6a5f4

Please sign in to comment.