навёл прицел — кликнул — отправил номер — получил задание — выполнил — стреляешь в следующее
функционал:
1. вносится перечень заданий
2. указывается id темы с лотереей
3. скрипт создаёт табличку с номерами, выдаёт задания каждому, кто напишет в теме номер (с проверкой, свободен ли он), отмечает в табличке, какие номера заняты
4. выполняя задания, игроки редактируют своё сообщение, свободный администратор смотрит в тему, прячет под спойлер и выдаёт наградку
5. после использования — удалить или переназначить.[hideprofile]
[html]<script type="text/javascript" src="https://forumstatic.ru/files/001c/6b/d4/53198.js"></script>
<!-- автолотерея с заданиями / © hagalnaud -->
<script type="text/javascript">
var idtl = 7; // айди темы с лотереей
</script>
<script type="text/javascript" src="https://forumstatic.ru/files/001c/6b/d4/10164.js"></script>
[/html]
лотерея
Сообщений 1 страница 2 из 2
Поделиться12025-03-14 10:29:52
Поделиться22025-03-14 10:30:16
генератор кодов служит для быстрого создания массивов. каждое задание - новая строка.
кнопка "перемешать" собирает массив в случайном порядке.
[html]<div id='codegen'><textarea id="inputText" placeholder="Введите текст"></textarea>
<div id='btns'><div id='shuff'><label for="shuffle">Перемешать?</label>
<input type="checkbox" id="shuffle"></div>
<button onclick="generateArray()">Собрать</button></div>
<textarea id="outputArray" placeholder="Массив будет здесь" disabled></textarea> </div>
<script>
function generateArray() {
var inputText = document.getElementById('inputText').value;
var shuffle = document.getElementById('shuffle').checked;
var outputArray = document.getElementById('outputArray');
// Разбиваем текст на строки и удаляем пустые строки
var lines = inputText.split('\n').filter(Boolean);
if (shuffle) {
// Перемешиваем строки
for (var i = lines.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = lines[i];
lines[i] = lines[j];
lines[j] = temp;
}
}
// Формируем массив в виде текста
var arrayText = 'var tasks = [\n';
for (var i = 0; i < lines.length; i++) {
arrayText += ' "' + lines[i] + '"';
if (i !== lines.length - 1) {
arrayText += ',';
}
arrayText += '\n';
}
arrayText += '];';
// Выводим массив в окне вывода
outputArray.value = arrayText;
}
</script>
<style>div#codegen {display: inline-flex;
width: 608px;
margin: 0 auto;
padding: 20px;
background-color: rgb(180 180 180 / 78%);
border: 1px double #77777757;
position: relative;
box-shadow: 0px 0px 6px -2px #00000040;
justify-content: space-around;
align-items: center;
flex-direction: column;}
div#codegen button {
background-color: var(--authorbg);
color: var(--color-accent);
padding: 3px 6px 4px 6px !important;
border: 1px solid var(--color-accent)!important;
border-radius: 4px;
font-size: 12px;
margin: 5px!important;
}
div#codegen textarea {
border: 1px solid #0706091c!important;
outline: 1px solid #ffffff3d;
background: #fffffe24!important;
box-shadow: 0px 0px 6px -5px var(--color-accent), 0px 0px 19px -10px inset hsl(0deg 0% 54.96% / 39%);
width: 561px!important;
height: 200px;
margin: 13px;
padding: 7px;
}
div#shuff {
display: flex;
padding: 3px;
align-items: center;
}
div#btns {
display: inline-flex;
}
</style>[/html]