Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Generate random channel names.

  • Loading branch information...
commit cb1439152c389097c3857cb692338309dc769d19 1 parent 2b9f6dd
@dv authored
Showing with 22 additions and 1 deletion.
  1. +22 −1 index.html
View
23 index.html
@@ -55,7 +55,7 @@
$(function() {
if(!window.location.hash) {
- window.location.hash = "#BLABLABLA";
+ window.location.hash = "#" + createRandomWord(6);
}
label("channelname").html(window.location.hash);
@@ -102,5 +102,26 @@
return false;
});
});
+
+ // createRandomWord by James Padolsey
+ // http://james.padolsey.com/javascript/random-word-generator/
+ function createRandomWord(length) {
+ var consonants = 'bcdfghjklmnpqrstvwxyz',
+ vowels = 'aeiou',
+ rand = function(limit) {
+ return Math.floor(Math.random()*limit);
+ },
+ i, word='', length = parseInt(length,10),
+ consonants = consonants.split(''),
+ vowels = vowels.split('');
+
+ for (i=0;i<length/2;i++) {
+ var randConsonant = consonants[rand(consonants.length)],
+ randVowel = vowels[rand(vowels.length)];
+ word += randConsonant;
+ word += i*2<length-1 ? randVowel : '';
+ }
+ return word;
+ }
</script>
</body>
Please sign in to comment.
Something went wrong with that request. Please try again.