Skip to content

Instantly share code, notes, and snippets.

@puterleat
Created May 31, 2016 17:36
Show Gist options
  • Save puterleat/270aab5f66573c84affbc20b162c1652 to your computer and use it in GitHub Desktop.
Save puterleat/270aab5f66573c84affbc20b162c1652 to your computer and use it in GitHub Desktop.
<a href="javascript:var%20auto%20={names:%20'Steve%20Buscemi%20Catherine%20Keener%20Dermot%20Mulroney%20Danielle%20Zerneck%20James%20LeGros%20Rica%20Martens%20Peter%20Dinklage%20Kevin%20Corrigan%20Hilary%20Gilford%20Robert%20Wightman%20Tom%20Jarmusch%20Michael%20Griffiths%20Matthew%20Grace%20Ryan%20Bowker%20Francesca%20DiMauro',blurb:%20'Excepteur%20pariatur%20cillum%20labore%20ea%20proident%20et%20deserunt.%20Ex%20commodo%20ea%20esse%20incididunt%20deserunt%20dolor%20ea%20minim%20do%20qui%20irure.%20Qui%20aute%20irure%20ut%20ad%20id%20duis%20esse%20tempor%20occaecat%20exercitation%20excepteur%20do%20nostrud.%20Aute%20ex%20fugiat%20tempor%20laboris%20ex%20consequat%20consequat%20tempor%20anim%20ipsum%20consectetur%20et%20proident%20cupidatat%20duis%20nulla%20reprehenderit.%20Velit%20adipisicing%20occaecat%20nulla%20officia%20irure%20anim%20dolor%20quis%20cupidatat%20cupidatat%20deserunt%20esse%20Lorem%20exercitation%20in%20commodo.%20Amet%20ea%20labore%20duis%20mollit%20sit%20labore%20laborum%20sit%20aliqua%20veniam%20sint%20elit%20est%20aliquip%20dolore%20nulla.%20Velit%20est%20ut%20culpa%20ut%20eu%20magna%20quis%20id.%20Voluptate%20Lorem%20non%20incididunt%20reprehenderit%20occaecat%20sit%20velit%20tempor%20eiusmod%20cillum%20excepteur%20exercitation%20do%20proident.',password:%20'secret',fillerup:%20function()%20{var%20all_inputs%20=%20document.getElementsByTagName('input');var%20all_selects%20=%20document.getElementsByTagName('select');var%20all_textareas%20=%20document.getElementsByTagName('textarea');for%20(var%20i%20=%200,%20max%20=%20all_selects.length;%20i%20<%20max;%20i++)%20{var%20sel%20=%20all_selects[i];%20if%20(sel.selectedIndex%20!=%20-1&&%20sel.options[sel.selectedIndex].value)%20{continue;%20}var%20howmany%20=%201;%20if%20(sel.type%20==%20'select-multiple')%20{%20var%20howmany%20=%201%20+%20this.getRand(sel.options.length%20-%201);}for%20(var%20j%20=%200;%20j%20<%20howmany;%20j++)%20{var%20index%20=%20this.getRand(sel.options.length%20-%201);sel.options[index].selected%20=%20'selected';}}for%20(var%20i%20=%200,%20max%20=%20all_textareas.length;%20i%20<%20max;%20i++)%20{var%20ta%20=%20all_textareas[i];if%20(!ta.value)%20{ta.value%20=%20this.getRandomString(10)+%20'\n\n'+%20this.getRandomString(10);}}for%20(var%20i%20=%200,%20max%20=%20all_inputs.length;%20i%20<%20max;%20i++)%20{var%20inp%20=%20all_inputs[i];var%20type%20=%20inp.getAttribute('type');if%20(!type)%20{type%20=%20'text';%20}if%20(type%20==%20'checkbox')%20{inp.setAttribute('checked',%20'checked');}if%20(type%20==%20'radio')%20{var%20to_update%20=%20true;var%20name%20=%20inp.name;var%20input_array%20=%20inp.form.elements[inp.name];for%20(var%20j%20=%200;%20j%20<%20input_array.length;%20j++)%20{if%20(input_array[j].checked)%20{to_update%20=%20false;continue;}}if%20(to_update)%20{var%20index%20=%20this.getRand(input_array.length%20-%201);input_array[index].setAttribute('checked',%20'checked');}}if%20(type%20==%20'password')%20{if%20(!inp.value)%20{inp.value%20=%20this.getPassword();}}if%20(type%20==%20'text')%20{if%20(!inp.value)%20{if%20(inp.name.indexOf('name')%20!=%20-1)%20{inp.value%20=%20this.getRandomName()%20+%20'%20'%20+%20this.getRandomName();}%20else%20if%20(inp.name.indexOf('email')%20!=%20-1)%20{inp.value%20=%20this.getRandomString(1)%20+%20'@example.org';}%20else%20{inp.value%20=%20this.getRandomString(1);}}}}},getRandomString:%20function%20(how_many_words)%20{if%20(!how_many_words)%20{how_many_words%20=%205;}if%20(!this.words)%20{this.words%20=%20this.blurb.split('%20');}var%20retval%20=%20'';for%20(var%20i%20=%200;%20i%20<%20how_many_words;%20i++)%20{retval%20+=%20this.words[this.getRand(this.words.length)%20-%201];retval%20+=%20(i%20<%20how_many_words%20-%201)%20?%20'%20'%20:%20'';}return%20retval;},getRandomName:%20function%20()%20{if%20(!this.split_names)%20{this.split_names%20=%20this.names.split('%20');}return%20this.split_names[this.getRand(this.split_names.length)%20-%201];},getPassword:%20function%20()%20{if%20(!this.password)%20{this.password%20=%20'secret';}return%20this.password;},getRand:%20function%20(count)%20{return%20Math.round(count%20*%20Math.random());}};%20auto.fillerup()">Fill with junk</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment