Created
December 10, 2014 00:32
-
-
Save mmcc/a5ba61d93c4704739371 to your computer and use it in GitHub Desktop.
Had trouble with too many temporary accounts on slack import, so hacked this together.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $selects = $('.user_map_selector select'); | |
var throwAwayEmail = function(index) { | |
return 'oldsupportacct+'+ getRandomInt(2500, 99999) +'@zencoder.com'; | |
} | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min)) + min; | |
} | |
var count = 0; | |
$selects.each(function(index) { | |
var $emailInput = $(this).closest('.user_map_selector').children("div").children("input"); | |
var currentVal = $(this).val(); | |
if (currentVal === '-') { | |
count++; | |
$(this).val('create'); | |
$emailInput.removeClass('hidden'); | |
$emailInput.val(throwAwayEmail(index)); | |
} | |
}); | |
console.log(count); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment