Skip to content

Commit

Permalink
make country list a dropdown
Browse files Browse the repository at this point in the history
[fixes #7]
  • Loading branch information
weilu committed Apr 25, 2014
1 parent a382ac9 commit 66b0e79
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@
I want to sell bitcoins
</label>
</div>
<div><input id="search-country" placeholder="country" type="text" /></div>
<div>
<select id="search-country" placeholder="country"></select>
</div>
<div>
<select>
<optgroup id="paymend-method" label="Online">
Expand Down
15 changes: 8 additions & 7 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
var localbitcoins = new LocalBitcoins()
Object.getPrototypeOf(localbitcoins).ajax = function(xhrParams) {
var url = xhrParams.url;
var url = encodeURI(xhrParams.url);
delete xhrParams.url;
bitcoin.makeRequest(url, xhrParams);
}

jQuery(document).ready(function(){
initCountries()
InitLocalization();
});

Expand Down Expand Up @@ -95,6 +96,12 @@ var locationInfo = {
countryCode: 'pl'
}

function initCountries() {
COUNTRY_NAMES.sort().forEach(function(country){
jQuery('#search-country').append('<option value="' + country + '">' + country + '</option>')
})
}

function updateInfo(val,own)
{
var json = parseInt(val);
Expand Down Expand Up @@ -617,9 +624,3 @@ function InitLocalbitcoins(tn)
});
}

function ajax(xhrParams) {
var url = xhrParams.url;
delete xhrParams.url;
bitcoin.makeRequest(url, xhrParams);
}

4 changes: 2 additions & 2 deletions js/localbitcoins.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ LocalBitcoins.prototype.request_post = function(path, extra_data, success_callba
}

LocalBitcoins.prototype.request_get = function(path, extra_data, success_callback) {
ajax({
this.ajax({
dataType: "json",
type: 'GET',
url: site.root + path,
Expand Down Expand Up @@ -86,7 +86,7 @@ getEndpoints.forEach(function(method) {
})

function post(path, data, success, error){
ajax({
this.ajax({
dataType: "json",
type: 'POST',
url: site.root + path,
Expand Down

0 comments on commit 66b0e79

Please sign in to comment.