Skip to content

Commit

Permalink
Pressing the "Random" button will fill the input box automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
controversial committed Feb 15, 2016
1 parent f3ae515 commit 46de5f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,24 @@ window.onload = function() {
var event = e || window.event;
var charCode = event.which || event.keyCode;
if ( charCode == '13' ) { //Enter was pressed inside dialog
var pagename = document.getElementById('pageName').value || "Wikipedia";
var pagename = inputBox.value || "Wikipedia";
getPageName(pagename,resetNetwork);
}
}

//Bind the action of pressing the button
var submitButton = document.getElementById('submit');

submitButton.onclick = function() {
var pagename = document.getElementById('pageName').value || "Wikipedia";
var pagename = inputBox.value || "Wikipedia";
getPageName(pagename,resetNetwork);
}

var randomButton = document.getElementById('random');
randomButton.onclick = function() {
getRandomName(resetNetwork);
getRandomName(function (data) {
resetNetwork(data);
inputBox.value = data;
});
}


Expand Down

0 comments on commit 46de5f0

Please sign in to comment.