Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tosch110 committed Jun 17, 2016
2 parents 6169ea9 + 5d93bb8 commit 91708cc
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 15 deletions.
24 changes: 24 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,30 @@ header {
}


/* Backup pop-up style */
#header-wPop-backup {
max-width: 550px;
}

#header-wPop-backup a {
text-decoration: none;
}

#header-wPop-backup input, #header-wPop-backup textarea {
width: 100%;
resize: none;
margin-bottom: .5rem;
}

.wPop-content-buttons {
padding-top: 1rem;
}

#copy_and_close_backup_modal {
margin-right: 1rem;
}


/* ==================================================== */
/* /* TAB SELECTOR SETTINGS */ /* TAB SELECTOR SETTINGS */
/* ==================================================== */
Expand Down
3 changes: 3 additions & 0 deletions img/uiTB-iconset-backup.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 27 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h2>NEW ACCOUNT - NOTICE</h2>
<label for="walletSeed">WALLET SEED</label>
<br/>

<textarea type="text" id="walletSeed" name="walletSeed" class="wInput"> </textarea><span class="clipSpan tooltip-1" title="Copy the seed to the clipboard." data-clipboard-target="#walletSeed" ></span>
<textarea id="walletSeed" type="text" rows="3" name="walletSeed" class="wInput"> </textarea><span class="clipSpan tooltip-1" title="Copy the seed to the clipboard." data-clipboard-target="#walletSeed" data-clipboard-message-success="Wallet seed has been successfully copied to clipboard" ></span>
<br/><br/>

<button id="generateKeys" class="wButton fade">GENERATE ADDRESS FROM SEED</button><span class="divider-1"></span><button id="generateRandomSeed" class="wButton fade">GENERATE NEW SEED</button>
Expand Down Expand Up @@ -205,7 +205,30 @@ <h2>NEW ACCOUNT - NOTICE</h2>

<div id=header-Iconset>

<!-- <a href="#header-wPop-pref" rel="modal:open"> -->
<a href="#header-wPop-backup" rel="modal:open">
<img class="header-Icon fade tooltip-2" src="img/uiTB-iconset-backup.svg" alt="Backup" title="Backup"/>
</a>
<div id="header-wPop-backup" class="wavesPop">
<img class="wPop-header" src="img/modal-header.svg" />
<div class="wPop-content">
<h2>ACCOUNT INFO BACKUP</h2>
<p>Your account's basic information, click the COPY button in order to copy the contents to the clipboard or CLOSE to exit.</p></br>
<form id="backupForm">
<label for="seedBackup">Seed</label><br/>
<textarea id="seedBackup" class="wInput" rows="3" readonly></textarea><br/>
<label for="privateKeyBackup">Private Key</label><br/>
<input id="privateKeyBackup" class="wInput" type="text" name="privateKeyBackup" readonly/><br/>
<label for="publicKeyBackup">Public Key</label><br/>
<input id="publicKeyBackup" class="wInput" type="text" name="publicKeyBackup" readonly/><br/>
<label for="addressBackup">Address</label><br/>
<input id="addressBackup" class="wInput" type="text" name="addressBackup" readonly/>
<div class="wPop-content-buttons">
<a id="copy_and_close_backup_modal" href="#" class="wButton paymentForm-but fade tooltip-1" title="Click here to copy everything to clipboard.">COPY</a>
<a href="#" rel="modal:close" class="wButton paymentForm-but fade tooltip-1">CLOSE</a>
</div>
</form>
</div>
</div>
<a href="#feat-not-active" rel="modal:open">
<img class="header-Icon fade tooltip-2" src="img/uiTB-iconset-preferences.svg" alt="Preferences" title="Preferences"/>
</a>
Expand Down Expand Up @@ -911,6 +934,7 @@ <h2>LATEST BLOCKS INFORMATION</h2>
<script src="js/util/converters.js" type="text/javascript"></script>

<!-- Crypto Dependencies -->
<script src="js/crypto/wordlist.js" type="text/javascript"></script>
<script src="js/crypto/base58.js" type="text/javascript"></script>
<script src="js/crypto/sha3.js" type="text/javascript"></script>
<script src="js/blake2b/blake2b.js" type="text/javascript"></script>
Expand All @@ -934,6 +958,7 @@ <h2>LATEST BLOCKS INFORMATION</h2>
<script src="js/waves.api.address.js" type="text/javascript"></script>
<script src="js/waves.constants.js" type="text/javascript"></script>
<script src="js/waves.util.js" type="text/javascript"></script>
<script src="js/waves.chrome.js" type="text/javascript"></script>

<script src="js/waves.ui.js"></script>
<script src="js/waves.ui.functions.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions js/crypto/wordlist.js

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions js/waves.chrome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/******************************************************************************
* Copyright © 2016 The Waves Developers. *
* *
* See the LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Waves software, including this file, may be copied, modified, propagated, *
* or distributed except according to the terms contained in the LICENSE *
* file. *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
/**
* @depends {3rdparty/jquery-2.1.0.js}
* @depends {3rdparty/jquery-validate.js}
* @depends {3rdparty/bootstrap.js}
* @depends {3rdparty/big.js}
* @depends {3rdparty/jsbn.js}
* @depends {3rdparty/jsbn2.js}
* @depends {3rdparty/webdb.js}
* @depends {3rdparty/growl.js}
* @depends {crypto/curve25519.js}
* @depends {crypto/curve25519_.js}
* @depends {crypto/base58.js}
* @depends {crypto/blake32.js}
* @depends {crypto/keccak32.js}
* @depends {crypto/passphrasegenerator.js}
* @depends {crypto/sha256worker.js}
* @depends {crypto/3rdparty/cryptojs/aes.js}
* @depends {crypto/3rdparty/cryptojs/sha256.js}
* @depends {crypto/3rdparty/jssha256.js}
* @depends {crypto/3rdparty/seedrandom.js}
* @depends {util/converters.js}
* @depends {util/extensions.js}
*/
var Waves = (function(Waves, $, undefined) {
"use strict";

Waves.checkChromeAccounts = function (accounts){

$.each(accounts.WavesAccounts.accounts, function(WavesKey, WavesAccount) {

if(WavesAccount.password !== undefined || WavesAccount.passphrase !== undefined) {

var saveData = {
name: WavesAccount.name,
cipher: WavesAccount.cipher,
checksum: WavesAccount.checksum,
publicKey: WavesAccount.publicKey,
address: WavesAccount.address
};

accounts.WavesAccounts.accounts[WavesKey] = saveData;

}

});

chrome.storage.sync.set({'WavesAccounts': accounts.WavesAccounts}, function() {

});

};

return Waves;
}(Waves || {}, jQuery));
10 changes: 9 additions & 1 deletion js/waves.ui.functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ var Waves = (function(Waves, $, undefined) {

Waves.setInitApp = function (userAccounts) {

$('html').bind('keypress', function(e) {
if(e.keyCode == 13)
{
return false;
}
});

switch(Waves.network) {
case 'devel':
case 'testnet':
Expand All @@ -64,7 +71,6 @@ var Waves = (function(Waves, $, undefined) {
accounts = JSON.parse(userAccounts);
} else {
accounts = userAccounts;
console.log(accounts);
}

$.each(accounts.accounts, function(accountKey, accountDetails) {
Expand Down Expand Up @@ -234,6 +240,8 @@ var Waves = (function(Waves, $, undefined) {
chrome.storage.sync.get('WavesAccounts', function (result) {

if($.isEmptyObject(result) === false) {

Waves.checkChromeAccounts(result);
callback(result);
} else {
callback('');
Expand Down
48 changes: 46 additions & 2 deletions js/waves.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,46 @@ var Waves = (function(Waves, $, undefined) {

$("#contactTable").html(row);

});
});

$('#header-wPop-backup').on($.modal.BEFORE_OPEN, function() {
Waves.apiRequest(Waves.api.waves.address, Waves.publicKey, function(response) {
$('#seedBackup').val(Waves.passphrase);
$('#privateKeyBackup').val(Waves.privateKey);
$('#publicKeyBackup').val(Waves.publicKey);
$("#addressBackup").val(Waves.Addressing.fromRawAddress(response.address).getDisplayAddress());
});
});

$('#header-wPop-backup').on($.modal.AFTER_CLOSE, function() {
$('#seedBackup').val('');
$('#privateKeyBackup').val('');
$('#publicKeyBackup').val('');
$("#addressBackup").val('');
});


$('#copy_and_close_backup_modal').click(function (e) {
e.preventDefault();

//copy to clipboard
var text = "Seed: " + $('#seedBackup').val() + "\n";
text += "Private key: " + $('#privateKeyBackup').val() + "\n";
text += "Public key: " + $('#publicKeyBackup').val() + "\n";
text += "Address: " + $('#addressBackup').val();
var clipboard = new Clipboard('#copy_and_close_backup_modal', {
text : function(trigger) {
return text;
}
});
clipboard.on('success', function(e) {
$.growl.notice({ message: "Account backup has been copied to clipboard" });

e.clearSelection();
});

$.modal.close();
})

$('#uiTB-iconset-logout').click(function() {
Waves.logout();
Expand All @@ -332,8 +371,12 @@ var Waves = (function(Waves, $, undefined) {
var clipboard = new Clipboard('.clipSpan');

clipboard.on('success', function(e) {

var message = $(e.trigger).attr("data-clipboard-message-success");
if (message === undefined)
message = "Address successfully copied to clipboard";

$.growl.notice({ message: "Address successfully copied to clipboard" });
$.growl.notice({ message: message });

e.clearSelection();
});
Expand Down Expand Up @@ -393,6 +436,7 @@ var Waves = (function(Waves, $, undefined) {
$(document).ready(function(){

Waves.initApp();

$('.tooltip').tooltipster();

$('.tooltip-1').tooltipster({
Expand Down
26 changes: 16 additions & 10 deletions js/waves.ui.lockscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ var Waves = (function(Waves, $, undefined) {
isValid : function() { return this.getForm().valid(); }
};

//Import Waves Account

//Import Waves Account
$("#import_account").on("click", function(e) {
e.preventDefault();

Expand Down Expand Up @@ -116,11 +115,12 @@ var Waves = (function(Waves, $, undefined) {

$("#step2_reg").show();
$("#login-wPop-new").modal("show");
$("#walletSeed").prop('disabled', true);
NProgress.start();

});

$('#login-wPop-new').on($.modal.OPEN, function(event, modal) {
$('#login-wPop-new').on($.modal.CLOSE, function(event, modal) {

var passphrase = PassPhraseGenerator.generatePassPhrase();
$("#walletSeed").val(passphrase);
Expand Down Expand Up @@ -194,15 +194,13 @@ var Waves = (function(Waves, $, undefined) {

var passphrase = $("#walletSeed").val();
var publicKey = Waves.getPublicKey(passphrase);
var privateKey = Waves.getPrivateKey(passphrase);
var name = $("#walletName").val();
var password = $("#walletPassword").val();


Waves.apiRequest(Waves.api.waves.address, publicKey, function(response) {

var address = Waves.Addressing.fromDisplayAddress(Waves.Addressing.fromRawAddress(response.address).getDisplayAddress());

var address = Waves.Addressing.fromRawAddress(response.address);
var cipher = Waves.encryptWalletSeed(passphrase, password).toString();
var checksum = converters.byteArrayToHexString(Waves.simpleHash(converters.stringToByteArray(passphrase)));

Expand Down Expand Up @@ -235,24 +233,32 @@ var Waves = (function(Waves, $, undefined) {

Waves.getAccounts(function(currentAccounts) {

var saveData = {
name: name,
cipher: cipher,
checksum: checksum,
publicKey: publicKey,
address: address.getRawAddress()
};

if(currentAccounts !== '') {

currentAccounts = currentAccounts['WavesAccounts'];

currentAccounts.accounts.push(accountData);
currentAccounts.accounts.push(saveData);
chrome.storage.sync.set({'WavesAccounts': currentAccounts}, function() {
// Notify that we saved.
$.growl.notice({ message: "Added Account!" });
$("#wavesAccounts").append('<br><b>'+accountData.name+'</b> ' + address.getDisplayAddress());
$("#wavesAccounts").append('<br><b>'+saveData.name+'</b> ' + address.getDisplayAddress());
});

} else {

var accountArray = { accounts: [accountData] };
var accountArray = { accounts: [saveData] };
chrome.storage.sync.set({'WavesAccounts': accountArray}, function() {
// Notify that we saved.
$.growl.notice({ message: "Added Account!" });
$("#wavesAccounts").append('<br><b>'+accountData.name+'</b> ' + address.getDisplayAddress());
$("#wavesAccounts").append('<br><b>'+saveData.name+'</b> ' + address.getDisplayAddress());
});
}

Expand Down
4 changes: 4 additions & 0 deletions js/waves.ui.wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ var Waves = (function(Waves, $, undefined) {
}
};

$("#wB-butSend-WAV").on($.modal.OPEN, function(event, modal) {
$("#wavesrecipient").focus();
});

$("#wavessend").on("click", function(e) {
e.preventDefault();

Expand Down

0 comments on commit 91708cc

Please sign in to comment.