User:TrJVoRoN/global.js

/*Скрипт рандомайзера Автор Дима*/ function randomize{ if($('#randomValue').length == 0) return if($('#randomValue span.randItem').length == 0) return window.randomValueM = []; for (i=0;i<$('#randomValue span.randItem').length;i++) randomValueM[i] = $($('#randomValue span.randItem')[i]).html $('#randomValue')[0].innerHTML = randomValueM[Math.floor(Math.random * (randomValueM.length))] }; randomize; function reRandomize{ console.log('triggered') reReRand = $('#randomValue')[0].innerHTML $('#randomValue')[0].innerHTML = randomValueM[Math.floor(Math.random * (randomValueM.length))] if ($('#randomValue')[0].innerHTML == reReRand) reRandomize } $('body').on('click', '#reRandomize', reRandomize)