-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save Network in a cookie #223
Open
maxbethke
wants to merge
9
commits into
OutCast3k:master
Choose a base branch
from
maxbethke:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
745f32f
Added cookie class
maxbethke 23dd62c
added cookie class for network to be saved
maxbethke d604678
Merge pull request #1 from maxbethke/staging
maxbethke cd5c681
Fixed indentation in navbar
maxbethke 9a9bb4d
removed ESNext private fields
maxbethke 7cbb8e7
Switched from cookies to localStorage
maxbethke cb4924d
Delete cookie.js
maxbethke f39ecb1
tidy up comments and use of constant for storage key
maxbethke 8151b3e
Delete cookie.js (again)
maxbethke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ $(document).ready(function() { | |
|
||
var wallet_timer = false; | ||
|
||
var LOCALSTORAGE_COIN_KEY = "coinjs_coin_option" | ||
|
||
$("#openBtn").click(function(){ | ||
var email = $("#openEmail").val().toLowerCase(); | ||
if(email.match(/[\s\w\d]+@[\s\w\d]+/g)){ | ||
|
@@ -1932,33 +1934,35 @@ $(document).ready(function() { | |
}); | ||
|
||
$("#coinjs_coin").change(function(){ | ||
// set localStorage for use after page (re)load | ||
localStorage.setItem(LOCALSTORAGE_COIN_KEY, $(this).val()); | ||
|
||
var o = ($("option:selected",this).attr("rel")).split(";"); | ||
optionSeleted = ($("option:selected",this).attr("rel")).split(";"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no Also, |
||
|
||
// deal with broadcasting settings | ||
if(o[5]=="false"){ | ||
if(optionSeleted[5]=="false"){ | ||
$("#coinjs_broadcast, #rawTransaction, #rawSubmitBtn, #openBtn").attr('disabled',true); | ||
$("#coinjs_broadcast").val("coinb.in"); | ||
} else { | ||
$("#coinjs_broadcast").val(o[5]); | ||
$("#coinjs_broadcast").val(optionSeleted[5]); | ||
$("#coinjs_broadcast, #rawTransaction, #rawSubmitBtn, #openBtn").attr('disabled',false); | ||
} | ||
|
||
// deal with unspent output settings | ||
if(o[6]=="false"){ | ||
if(optionSeleted[6]=="false"){ | ||
$("#coinjs_utxo, #redeemFrom, #redeemFromBtn, #openBtn, .qrcodeScanner").attr('disabled',true); | ||
$("#coinjs_utxo").val("coinb.in"); | ||
} else { | ||
$("#coinjs_utxo").val(o[6]); | ||
$("#coinjs_utxo").val(optionSeleted[6]); | ||
$("#coinjs_utxo, #redeemFrom, #redeemFromBtn, #openBtn, .qrcodeScanner").attr('disabled',false); | ||
} | ||
|
||
// deal with the reset | ||
$("#coinjs_pub").val(o[0]); | ||
$("#coinjs_priv").val(o[1]); | ||
$("#coinjs_multisig").val(o[2]); | ||
$("#coinjs_hdpub").val(o[3]); | ||
$("#coinjs_hdprv").val(o[4]); | ||
$("#coinjs_pub").val(optionSeleted[0]); | ||
$("#coinjs_priv").val(optionSeleted[1]); | ||
$("#coinjs_multisig").val(optionSeleted[2]); | ||
$("#coinjs_hdpub").val(optionSeleted[3]); | ||
$("#coinjs_hdprv").val(optionSeleted[4]); | ||
|
||
// hide/show custom screen | ||
if($("option:selected",this).val()=="custom"){ | ||
|
@@ -2285,4 +2289,16 @@ $(document).ready(function() { | |
return true; | ||
}; | ||
|
||
/* set network from localStorage on page load */ | ||
|
||
function setNetwork () { | ||
var storageItem = localStorage.getItem(LOCALSTORAGE_COIN_KEY); | ||
if(storageItem) | ||
{ | ||
$("#coinjs_coin").val(storageItem) | ||
$("#coinjs_coin").trigger("change") | ||
} | ||
} | ||
setNetwork() | ||
|
||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the custom attributes?