Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fill input fields more appropriately

  • Loading branch information...
commit 694c48dbc620f98c7723d775ea34e559c9918b78 1 parent d5dfb13
Garret Alfert galfert authored
Showing with 13 additions and 7 deletions.
  1. +3 −3 index.html
  2. +10 −4 js/unhosted.js
6 index.html
View
@@ -21,7 +21,7 @@
<p>
<label for="userAddress">Your user address:</label>
- <input type="text" id="userAddress" value="yourusername@5apps.com" />
+ <input type="text" id="userAddress" placeholder="yourusername@5apps.com" />
<input type="submit" id="connect" value="Connect to remoteStorage" />
<input type="submit" id="disconnect" value="Disconnect" class="hidden" />
<img src="images/spinner.gif" id="connectionSpinner" class="hidden" />
@@ -38,7 +38,7 @@ <h2 id="publicTitle">Read access for "public" category</h2>
</p>
<p>
<label for="publicValue">Value:</label>
- <input type="text" id="publicValue" value="bar" />
+ <input type="text" id="publicValue" />
</p>
<p>
<input type="submit" id="publishPublic" value="Save" />
@@ -60,7 +60,7 @@ <h2 id="publicTitle">Read access for "public" category</h2>
</p>
<p>
<label for="tutorialValue">Value:</label>
- <input type="text" id="tutorialValue" value="baz" />
+ <input type="text" id="tutorialValue" />
</p>
<p>
<input type="submit" id="publishTutorial" value="Save" />
14 js/unhosted.js
View
@@ -81,6 +81,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
$('#connectionState').html('connected');
$('#connect').hide();
$('#disconnect').show();
+ $('#userAddress').val(localStorage.getItem('userAddress'));
} else {
for (var i = 0; i < elementIds.length; i++) {
$('#' + elementIds[i]).attr('disabled', 'disabled');
@@ -88,6 +89,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
$('#connectionState').html('disconnected');
$('#connect').show();
$('#disconnect').hide();
+ $('#userAddress').val('');
deauthorize();
}
$('#connectionState').toggleClass('enabled', connected);
@@ -170,7 +172,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
});
$('#fetchPublicKey').on('click', function() {
- var key = $('publicKey').val();
+ var key = $('#publicKey').val();
showSpinner('fetchPublicSpinner');
@@ -183,6 +185,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
console.log('There wasn\'t anything for "' + key + '" in category "public"');
} else {
console.log('We received this for key "' + key + '" in category "public": ' + data);
+ $('#publicValue').val(data);
}
}
@@ -203,6 +206,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
console.log('Could not store "' + key + '" in "public" category');
} else {
console.log('Stored "' + value + '" for key "' + key + '" in "public" category');
+ $('#publicValue').val('');
}
hideSpinner('publishPublicSpinner');
@@ -217,8 +221,8 @@ require(['./js/remoteStorage'], function(remoteStorage) {
});
$('#publishTutorial').on('click', function() {
- var key = $('tutorialKey').val();
- var value = $('tutorialValue').val();
+ var key = $('#tutorialKey').val();
+ var value = $('#tutorialValue').val();
showSpinner('publishTutorialSpinner');
@@ -227,6 +231,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
console.log('Could not store "' + key + '" in "tutorial" category');
} else {
console.log('Stored "' + value + '" for key "' + key + '" in "tutorial" category');
+ $('#tutorialValue').val('');
}
hideSpinner('publishTutorialSpinner');
@@ -236,7 +241,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
});
$('#fetchTutorialKey').on('click', function() {
- var key = $('tutorialKey').val();
+ var key = $('#tutorialKey').val();
showSpinner('fetchTutorialSpinner');
@@ -249,6 +254,7 @@ require(['./js/remoteStorage'], function(remoteStorage) {
console.log('There wasn\'t anything for "' + key + '" in category "tutorial"');
} else {
console.log('We received this for key "' + key + '" in category "tutorial": ' + data);
+ $('#tutorialValue').val(data);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.