Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Generate random channel names.

  • Loading branch information...
commit cb1439152c389097c3857cb692338309dc769d19 1 parent 2b9f6dd
David Verhasselt authored

Showing 1 changed file with 22 additions and 1 deletion. Show diff stats Hide diff stats

  1. +22 1 index.html
23 index.html
@@ -55,7 +55,7 @@
55 55 $(function() {
56 56
57 57 if(!window.location.hash) {
58   - window.location.hash = "#BLABLABLA";
  58 + window.location.hash = "#" + createRandomWord(6);
59 59 }
60 60
61 61 label("channelname").html(window.location.hash);
@@ -102,5 +102,26 @@
102 102 return false;
103 103 });
104 104 });
  105 +
  106 + // createRandomWord by James Padolsey
  107 + // http://james.padolsey.com/javascript/random-word-generator/
  108 + function createRandomWord(length) {
  109 + var consonants = 'bcdfghjklmnpqrstvwxyz',
  110 + vowels = 'aeiou',
  111 + rand = function(limit) {
  112 + return Math.floor(Math.random()*limit);
  113 + },
  114 + i, word='', length = parseInt(length,10),
  115 + consonants = consonants.split(''),
  116 + vowels = vowels.split('');
  117 +
  118 + for (i=0;i<length/2;i++) {
  119 + var randConsonant = consonants[rand(consonants.length)],
  120 + randVowel = vowels[rand(vowels.length)];
  121 + word += randConsonant;
  122 + word += i*2<length-1 ? randVowel : '';
  123 + }
  124 + return word;
  125 + }
105 126 </script>
106 127 </body>

0 comments on commit cb14391

Please sign in to comment.
Something went wrong with that request. Please try again.