aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMarak <[email protected]>2014-09-15 04:02:14 +0200
committerMarak <[email protected]>2014-09-15 04:02:14 +0200
commit2e08141fffb8de9790b42a44208e2f44d50beed5 (patch)
treef88cd22192ff2ccc304ef833accb8889ee4046bc /examples
parentfbf2615e6e7bb28c3fc845c0cd94aa31d269fe75 (diff)
downloadfaker-2e08141fffb8de9790b42a44208e2f44d50beed5.tar.xz
faker-2e08141fffb8de9790b42a44208e2f44d50beed5.zip
[examples] Added drop down for locale selection
Diffstat (limited to 'examples')
-rw-r--r--examples/index.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/index.html b/examples/index.html
index 3caf325a..eb9daf7f 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -35,6 +35,10 @@
$(document).ready(function(e){
+ for (var locale in faker.locales) {
+ $('#locale').append('<option value="' + locale + '">' + locale + '</option>');
+ }
+
var card = faker.helpers.createCard();
$('#output').html(prettyPrint(card));
@@ -43,6 +47,14 @@
$('#output').html(prettyPrint(card));
});
+
+ $('#locale').change(function(e){
+ var locale = $(this).attr('value');
+ faker.locale = locale;
+ var card = faker.helpers.createCard();
+ $('#output').html(prettyPrint(card));
+ });
+
$('#generateSet').click(function(){
setTimeout(function(){
@@ -65,6 +77,13 @@
<a href="http://github.com/marak/faker.js/"><img style="position:absolute; z-index:10; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub" /></a>
<input id = "generate" type = "button" value = "generate one random card as HTML" />
<input id = "generateSet" type = "button" value = "generate an assosative array of random cards as JSON" />
+ <br/>
+ <br/>
+ locale <select id = "locale">
+ <option value="en">en</option>
+ <option value="es">es</option>
+ <option value="de">de</option>
+ </select>
card count : <input id = "cardCount" type = "text" size = "3" value = "5" /><br/><br/>
<strong>protip</strong>: open your console on this page and run: <code>console.log(faker); var randomName = faker.name.findName(); console.log(randomName);</code><hr/>
<div id = "output"></div>