Здесь делается вжух 🪄

test

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » test » Тестовый форум » Тестовое сообщение


Тестовое сообщение

Сообщений 1 страница 30 из 65

1

Благодарим за выбор нашего сервиса!

0

2

[html]<!doctype html>
<html lang="ru">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Sudoku</title>
  <style>
    :root{--cell-size:47px;--gap:4px;--accent:#2b6cb0;--bg:#888888}
    body{font-family:Inter,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);padding:9px}
    .sudoku-wrap{display:flex;gap:14px;align-items:flex-start}
    .board{display:grid;grid-template-columns:repeat(9,var(--cell-size));grid-template-rows:repeat(9,var(--cell-size));gap:2px;background:#4a4a4b;padding:12px;border-radius:10px;box-shadow:0 6px 18px rgba(20,20,40,0.06)}
    .cell{width:var(--cell-size);height:var(--cell-size);display:flex;align-items:center;justify-content:center;font-size:18px;background:#b7b8b8}
    .cell input{width:100%;height:100%;border:0;text-align:center;font-weight:600;font-size:14px;background:transparent}
    .cell input:focus{outline:2px solid rgba(43,108,176,.15);border-radius:6px}
    .given input{font-weight:650;color:#0b2540}
    .note{font-size:7px;color:#666}
    .thick-right{border-right:3px solid #999}
    .thick-bottom{border-bottom:3px solid #999}
    .controls{min-width:220px}
    button,select{padding:8px 12px;border-radius:8px;border:1px solid #e2e8f0;background:#fff;cursor:pointer}
    button:hover{box-shadow:0 6px 12px rgba(16,24,40,0.06)}
    .actions{display:flex;flex-direction:column;gap:8px}
    .status{margin-top:8px;color:#0b2540;font-weight:600}
    .small{font-size:13px;color:#334155}
    .hint{background:#fffbeb;border-color:#f6e05e}
    .invalid{background:#fff1f2;border-color:#fecaca}
.button-row {
    display: flex;
    flex-wrap: wrap; /* чтобы на маленьких экранах переносились */
    gap: 8px; /* расстояние между кнопками */
}
    @media (max-width:960px){.sudoku-wrap{flex-direction:column;align-items:center}.controls{width:100%}}
  </style>
</head>
<body>
  <h2>Sudoku</h2>
  <div class="sudoku-wrap">
    <div>
      <div id="board" class="board" aria-label="Судоку поле"></div>
    </div>
<div class="button-row">
    <button id="newBtn">Новая игра</button>
    <button id="solveBtn">Показать решение</button>
    <button id="checkBtn">Проверить</button>
    <button id="hintBtn" class="hint">Подсказка</button>
    <button id="resetBtn">Сбросить ходы</button>
    <button id="fillNotesBtn">Добавить пометки</button>
</div>
    <div class="controls">
      <div class="actions">
        <label class="small">СЛОЖНОСТЬ
          <select id="difficulty">
            <option value="35">Лёгкая</option>
            <option value="45" selected>Средняя</option>
            <option value="55">Сложная</option>
          </select>
        </label>
       
       
      </div>
      <div class="status" id="status">Готово</div>
      <div class="small" style="margin-top:8px"></div>
    </div>
  </div>
<script>
// Sudoku single-file: генерация + UI + проверка
(() => {
  const boardEl = document.getElementById('board');
  const newBtn = document.getElementById('newBtn');
  const solveBtn = document.getElementById('solveBtn');
  const checkBtn = document.getElementById('checkBtn');
  const hintBtn = document.getElementById('hintBtn');
  const resetBtn = document.getElementById('resetBtn');
  const fillNotesBtn = document.getElementById('fillNotesBtn');
  const difficultySelect = document.getElementById('difficulty');
  const status = document.getElementById('status');

  let solution = []; // full solution 9x9
  let puzzle = [];   // puzzle with zeros for empty
  const inputs = []; // DOM inputs
  let givens = new Set();
  let initialSnapshot = null;

  // create board DOM
  function createGrid(){
    boardEl.innerHTML = '';
    inputs.length = 0;
    for(let r=0;r<9;r++){
      for(let c=0;c<9;c++){
        const cell = document.createElement('div');
        cell.className = 'cell';
        if((c+1)%3===0 && c!==8) cell.classList.add('thick-right');
        if((r+1)%3===0 && r!==8) cell.classList.add('thick-bottom');
        const inp = document.createElement('input');
        inp.setAttribute('inputmode','numeric');
        inp.setAttribute('maxlength','1');
        inp.dataset.r = r; inp.dataset.c = c;
        inp.addEventListener('input', onInput);
        inp.addEventListener('keydown', onKeydown);
        cell.appendChild(inp);
        boardEl.appendChild(cell);
        inputs.push(inp);
      }
    }
  }

  function onKeydown(e){
    // allow arrow navigation
    const k = e.key;
    const r = +this.dataset.r; const c = +this.dataset.c;
    if(['ArrowUp','ArrowDown','ArrowLeft','ArrowRight'].includes(k)){
      e.preventDefault();
      let nr=r,nc=c;
      if(k==='ArrowUp') nr = (r+8)%9;
      if(k==='ArrowDown') nr = (r+1)%9;
      if(k==='ArrowLeft') nc = (c+8)%9;
      if(k==='ArrowRight') nc = (c+1)%9;
      inputs[nr*9+nc].focus();
    }
    // allow Backspace to clear
    if(k==='Backspace') this.value='';
  }

  function onInput(e){
    const v = this.value.replace(/[^1-9]/g,'').slice(0,1);
    this.value = v;
    const idx = +this.dataset.r*9 + (+this.dataset.c);
    if(givens.has(idx)) return; // don't change given
    // validate by quick check: conflict -> mark invalid
    validateCell(+this.dataset.r, +this.dataset.c);
  }

  function validateCell(r,c){
    const val = inputs[r*9+c].value;
    clearInvalid();
    if(!val) return;
    // check row/col/box
    for(let i=0;i<9;i++){
      if(i!==c && inputs[r*9+i].value===val) markInvalid(r*9+c);
      if(i!==r && inputs[i*9+c].value===val) markInvalid(r*9+c);
    }
    const br = Math.floor(r/3)*3, bc = Math.floor(c/3)*3;
    for(let dr=0;dr<3;dr++) for(let dc=0;dc<3;dc++){
      const rr = br+dr, cc = bc+dc; const idx = rr*9+cc;
      if((rr!==r || cc!==c) && inputs[idx].value===val) markInvalid(r*9+c);
    }
  }

  function markInvalid(idx){
    inputs[idx].classList.add('invalid');
    status.textContent = 'Есть конфликт! Проверьте отмеченные клетки.';
  }
  function clearInvalid(){
    inputs.forEach(i=>i.classList.remove('invalid'));
    status.textContent = 'Готово';
  }

  // Sudoku generator: backtracking to create full board
  function generateSolution(){
    const grid = Array.from({length:9},()=>Array(9).fill(0));
    const rows = Array.from({length:9},()=>new Set());
    const cols = Array.from({length:9},()=>new Set());
    const boxes = Array.from({length:9},()=>new Set());

    const order = [];
    for(let r=0;r<9;r++) for(let c=0;c<9;c++) order.push([r,c]);

    function shuffle(a){
      for(let i=a.length-1;i>0;i--){
        const j = Math.floor(Math.random()*(i+1)); [a[i],a[j]]=[a[j],a[i]];
      }
    }

    function tryFill(pos=0){
      if(pos===81) return true;
      // choose next with minimum candidates to speed up
      let best = -1, bestOpts=null, bestIdx=-1;
      for(let i=pos;i<81;i++){
        const [r,c] = order[i];
        if(grid[r][c]!==0) continue;
        const opts = getCandidates(grid,r,c,rows,cols,boxes);
        if(opts.length===0) return false;
        if(best===-1 || opts.length < best){ best = opts.length; bestOpts = opts; bestIdx = i; }
      }
      // swap chosen to current pos
      [order[pos], order[bestIdx]] = [order[bestIdx], order[pos]];
      const [r,c] = order[pos];
      shuffle(bestOpts);
      for(const val of bestOpts){
        grid[r][c]=val; rows[r].add(val); cols[c].add(val); boxes[Math.floor(r/3)*3+Math.floor(c/3)].add(val);
        if(tryFill(pos+1)) return true;
        grid[r][c]=0; rows[r].delete(val); cols[c].delete(val); boxes[Math.floor(r/3)*3+Math.floor(c/3)].delete(val);
      }
      // restore order? not needed in this run
      return false;
    }

    function getCandidates(grid,r,c,rows,cols,boxes){
      const used = new Set([...rows[r],...cols[c],...boxes[Math.floor(r/3)*3+Math.floor(c/3)]]);
      const opts = [];
      for(let v=1;v<=9;v++) if(!used.has(v)) opts.push(v);
      return opts;
    }

    // init order randomly
    shuffle(order);
    tryFill(0);
    return grid;
  }

  // remove cells to make puzzle
  function makePuzzle(full, empties){
    const p = full.map(r=>r.slice());
    const indices = Array.from({length:81},(_,i)=>i);
    for(let i=indices.length-1;i>0;i--){ const j = Math.floor(Math.random()*(i+1)); [indices[i],indices[j]]=[indices[j],indices[i]] }
    let removed = 0; let idx = 0;
    while(removed < empties && idx < 81){
      const pos = indices[idx++]; const r = Math.floor(pos/9), c = pos%9;
      const backup = p[r][c]; p[r][c]=0;
      // ensure unique solution (simple check: count solutions <=1)
      const copy = p.map(row=>row.slice());
      const cnt = countSolutions(copy,2);
      if(cnt!==1){ p[r][c]=backup; }
      else removed++;
    }
    return p;
  }

  // count solutions with backtracking (stop after limit)
  function countSolutions(grid,limit){
    let count=0;
    function findEmpty(){ for(let r=0;r<9;r++) for(let c=0;c<9;c++) if(grid[r][c]===0) return [r,c]; return null; }
    function canPlace(r,c,v){
      for(let i=0;i<9;i++){ if(grid[r][i]===v || grid[i][c]===v) return false; }
      const br=Math.floor(r/3)*3, bc=Math.floor(c/3)*3;
      for(let dr=0;dr<3;dr++) for(let dc=0;dc<3;dc++) if(grid[br+dr][bc+dc]===v) return false;
      return true;
    }
    function back(){
      if(count>=limit) return;
      const pos = findEmpty(); if(!pos){ count++; return; }
      const [r,c]=pos;
      for(let v=1;v<=9;v++) if(canPlace(r,c,v)){
        grid[r][c]=v; back(); grid[r][c]=0; if(count>=limit) return;
      }
    }
    back(); return count;
  }

  // fill UI from puzzle
  function renderPuzzle(p){
    givens.clear();
    puzzle = p.map(r=>r.slice());
    for(let r=0;r<9;r++) for(let c=0;c<9;c++){
      const idx = r*9+c; const val = p[r][c]; const inp = inputs[idx];
      inp.value = val?String(val):'';
      inp.disabled = false; inp.classList.remove('given');
      if(val){ inp.disabled = true; inp.classList.add('given'); givens.add(idx); }
    }
    initialSnapshot = inputs.map(i=>i.value);
    clearInvalid();
  }

  function to2d(arr){ return Array.from({length:9},(_,r)=>arr.slice(r*9,(r+1)*9)); }

  // new game
  function newGame(){
    status.textContent='Генерирую...';
    setTimeout(()=>{
      solution = generateSolution();
      const empties = parseInt(difficultySelect.value,10);
      puzzle = makePuzzle(solution, empties);
      renderPuzzle(puzzle);
      status.textContent='Новая игра готова';
    },10);
  }

  // solve: fill with solution
  function showSolution(){
    if(!solution.length){ status.textContent='Решение не сгенерировано'; return; }
    for(let r=0;r<9;r++) for(let c=0;c<9;c++){
      const idx=r*9+c; inputs[idx].value = String(solution[r][c]); inputs[idx].classList.remove('invalid');
    }
    status.textContent='Показано решение';
  }

  // check current board
  function checkBoard(){
    let ok=true; clearInvalid();
    for(let r=0;r<9;r++) for(let c=0;c<9;c++){
      const idx=r*9+c; const v = inputs[idx].value;
      if(!v){ ok=false; inputs[idx].classList.add('invalid'); }
      else if(String(solution[r] && solution[r][c]) !== v){ ok=false; inputs[idx].classList.add('invalid'); }
    }
    status.textContent = ok ? 'Вы выиграли! Все верно.' : 'Есть ошибки или пустые клетки.';
  }

  // hint: find an empty cell and fill correct value
  function hint(){
    for(let r=0;r<9;r++) for(let c=0;c<9;c++){
      const idx=r*9+c; if(!inputs[idx].value){ inputs[idx].value = solution[r][c]; inputs[idx].classList.add('hint'); setTimeout(()=>inputs[idx].classList.remove('hint'),900); status.textContent='Подсказка поставлена'; return; }
    }
    status.textContent='Нечего подсказать — поле заполнено';
  }

  // reset to initial snapshot
  function resetToStart(){
    if(!initialSnapshot) return;
    inputs.forEach((inp,i)=>{ if(!givens.has(i)) inp.value = initialSnapshot[i]||''; inp.classList.remove('invalid'); });
    status.textContent='Ходы сброшены';
  }

  // fill notes small numbers (simple: show 1-9 possible in title attribute)
  function fillNotes(){
    for(let r=0;r<9;r++) for(let c=0;c<9;c++){
      const idx=r*9+c; if(inputs[idx].value) { inputs[idx].title=''; continue; }
      const possibles = [];
      for(let v=1;v<=9;v++){
        // simulate placing v
        let ok=true;
        for(let i=0;i<9;i++){ if(inputs[r*9+i].value==String(v)) ok=false; if(inputs[i*9+c].value==String(v)) ok=false; }
        const br=Math.floor(r/3)*3, bc=Math.floor(c/3)*3;
        for(let dr=0;dr<3;dr++) for(let dc=0;dc<3;dc++){ if(inputs[(br+dr)*9+(bc+dc)].value==String(v)) ok=false; }
        if(ok) possibles.push(v);
      }
      inputs[idx].title = 'Возможные: ' + (possibles.length?possibles.join(', '):'-');
    }
    status.textContent='Пометки добавлены (наведите на клетку)';
  }

  // utils: read puzzle from UI into 2d
  function readCurrent(){ return to2d(inputs.map(i=>i.value?parseInt(i.value,10):0)); }

  // initial setup
  createGrid();
  newBtn.addEventListener('click', newGame);
  solveBtn.addEventListener('click', showSolution);
  checkBtn.addEventListener('click', checkBoard);
  hintBtn.addEventListener('click', hint);
  resetBtn.addEventListener('click', resetToStart);
  fillNotesBtn.addEventListener('click', fillNotes);
  difficultySelect.addEventListener('change', ()=>{});

  // generate first game
  newGame();
})();
</script>
</body>
</html>[/html]

0

3

[html]<h3>🎴 Генератор карт стихий</h3>
<button id="genCard">Получить карту</button>
<button id="copyResult" style="display:none;">📋 Скопировать результат</button>
<div id="result" style="margin-top:10px; font-family:monospace; background:#111; color:#0f0; padding:10px; border-radius:6px;"></div>

<script>
(function(){
  const elements = ["🔥 Огонь","💧 Вода","🌿 Земля","🌪 Воздух","🌞 Свет","🌑 Тьма"];
  const names = {
    "🔥 Огонь":["Саламандра","Огненный дух","Молния","Феникс"],
    "💧 Вода":["Русалка","Водный змей","Шторм","Ледяной голем"],
    "🌿 Земля":["Титан","Голем","Друид","Корень мира"],
    "🌪 Воздух":["Штормовой дух","Орёл ветров","Вихрь","Гроза"],
    "🌞 Свет":["Ангел","Паладин","Лучи рассвета","Хранитель"],
    "🌑 Тьма":["Тень","Некромант","Пожиратель","Призрак"]
  };
  const rarities = ["Обычная","Редкая","Эпическая","Легендарная"];

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  document.getElementById('genCard').onclick = () => {
    const element = random(elements);
    const name = random(names[element]);
    const rarity = random(rarities);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;
    const resultText =
`🎴 ${rarity} карта
Элемент: ${element}
Имя: ${name}
Сила: ${power}
Защита: ${defense}`;
    document.getElementById('result').textContent = resultText;
    document.getElementById('copyResult').style.display = '';
  };

  document.getElementById('copyResult').onclick = () => {
    const text = document.getElementById('result').textContent;
    navigator.clipboard.writeText(text);
    alert("Скопировано! Вставь это в сообщение на форуме 💬");
  };
})();
</script>[/html]

0

4

[html]<h3>🎴 Генератор карт стихий</h3>

<button id="genCard">Получить карту</button>
<button id="copyBB" style="display:none;">📋 Скопировать BB-код</button>

<div id="preview" style="margin-top:15px; font-family:monospace; background:#111; color:#0f0; padding:10px; border-radius:8px; white-space:pre-line;"></div>

<script>
(function(){
  const elements = [
    {symbol:"🔥", name:"Огонь", color:"#ff4500"},
    {symbol:"💧", name:"Вода", color:"#1e90ff"},
    {symbol:"🌿", name:"Земля", color:"#228b22"},
    {symbol:"🌪", name:"Воздух", color:"#aaa"},
    {symbol:"🌞", name:"Свет", color:"#ffd700"},
    {symbol:"🌑", name:"Тьма", color:"#551a8b"}
  ];

  const names = {
    "Огонь":["Саламандра","Феникс","Огненный дух","Пламенный клинок"],
    "Вода":["Русалка","Ледяной голем","Шторм","Морской змей"],
    "Земля":["Титан","Голем","Друид","Корень мира"],
    "Воздух":["Орёл ветров","Штормовой дух","Гроза","Вихрь"],
    "Свет":["Ангел","Паладин","Луч рассвета","Хранитель"],
    "Тьма":["Некромант","Тень","Призрак","Пожиратель"]
  };

  const rarities = [
    {name:"Обычная", color:"#cccccc"},
    {name:"Редкая", color:"#3cb371"},
    {name:"Эпическая", color:"#9370db"},
    {name:"Легендарная", color:"#ff8c00"}
  ];

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  document.getElementById('genCard').onclick = () => {
    const elem = random(elements);
    const rarity = random(rarities);
    const name = random(names[elem.name]);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;

    const bb = `[div style="border:2px solid ${elem.color}; padding:10px; background:#111; color:${rarity.color}; font-family:monospace; width:260px;"]
[center]${rarity.name} карта[/center]


Элемент: [color=${elem.color}]${elem.symbol} ${elem.name}[/color]
Имя: ${name}
Сила: ${power}
Защита: ${defense}
[/div]`;

    const htmlPreview = `
🎴 <b style="color:${rarity.color}">${rarity.name} карта</b><br>
Элемент: <span style="color:${elem.color}">${elem.symbol} ${elem.name}</span><br>
Имя: <i>${name}</i><br>
Сила: <b>${power}</b><br>
Защита: <b>${defense}</b>`;

    document.getElementById('preview').innerHTML = htmlPreview;
    document.getElementById('copyBB').style.display = 'inline-block';

    document.getElementById('copyBB').onclick = () => {
      navigator.clipboard.writeText(bb);
      alert("✅ BB-код скопирован! Вставь его в сообщение на форуме 💬");
    };
  };
})();
</script>[/html]

0

5

[html]<h3>🎴 Генератор карт стихий</h3>

<button id="genCard">Получить карту</button>

<div id="preview" style="margin-top:15px; font-family:monospace; background:#111; color:#0f0; padding:10px; border-radius:8px; white-space:pre-line;"></div>

<div id="bbcodeBox" style="display:none; margin-top:10px;">
  <b>Скопируй этот BB-код и вставь в сообщение на форуме:</b>
  <textarea id="bbcodeText" style="width:100%; height:160px; margin-top:5px; font-family:monospace;"></textarea>
</div>

<script>
(function(){
  const elements = [
    {symbol:"🔥", name:"Огонь", color:"#ff4500"},
    {symbol:"💧", name:"Вода", color:"#1e90ff"},
    {symbol:"🌿", name:"Земля", color:"#228b22"},
    {symbol:"🌪", name:"Воздух", color:"#aaa"},
    {symbol:"🌞", name:"Свет", color:"#ffd700"},
    {symbol:"🌑", name:"Тьма", color:"#551a8b"}
  ];

  const names = {
    "Огонь":["Саламандра","Феникс","Огненный дух","Пламенный клинок"],
    "Вода":["Русалка","Ледяной голем","Шторм","Морской змей"],
    "Земля":["Титан","Голем","Друид","Корень мира"],
    "Воздух":["Орёл ветров","Штормовой дух","Гроза","Вихрь"],
    "Свет":["Ангел","Паладин","Луч рассвета","Хранитель"],
    "Тьма":["Некромант","Тень","Призрак","Пожиратель"]
  };

  const rarities = [
    {name:"Обычная", color:"#cccccc"},
    {name:"Редкая", color:"#3cb371"},
    {name:"Эпическая", color:"#9370db"},
    {name:"Легендарная", color:"#ff8c00"}
  ];

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  document.getElementById('genCard').onclick = () => {
    const elem = random(elements);
    const rarity = random(rarities);
    const name = random(names[elem.name]);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;

    const bb = `[div style="border:2px solid ${elem.color}; padding:10px; background:#111; color:${rarity.color}; font-family:monospace; width:260px;"]
[center]${rarity.name} карта[/center]


Элемент: [color=${elem.color}]${elem.symbol} ${elem.name}[/color]
Имя: ${name}
Сила: ${power}
Защита: ${defense}
[/div]`;

    const htmlPreview = `
🎴 <b style="color:${rarity.color}">${rarity.name} карта</b><br>
Элемент: <span style="color:${elem.color}">${elem.symbol} ${elem.name}</span><br>
Имя: <i>${name}</i><br>
Сила: <b>${power}</b><br>
Защита: <b>${defense}</b>`;

    document.getElementById('preview').innerHTML = htmlPreview;
    document.getElementById('bbcodeBox').style.display = 'block';
    document.getElementById('bbcodeText').value = bb;
  };
})();
</script>[/html]

0

6

[html]<h3>🎴 Генератор карт стихий</h3>

<button id="genCard">Получить карту</button>

<div id="cardsContainer" style="margin-top:15px;"></div>

<script>
(function(){
  const elements = [
    {symbol:"🔥", name:"Огонь", color:"#ff4500"},
    {symbol:"💧", name:"Вода", color:"#1e90ff"},
    {symbol:"🌿", name:"Земля", color:"#228b22"},
    {symbol:"🌪", name:"Воздух", color:"#aaa"},
    {symbol:"🌞", name:"Свет", color:"#ffd700"},
    {symbol:"🌑", name:"Тьма", color:"#551a8b"}
  ];

  const names = {
    "Огонь":["Саламандра","Феникс","Огненный дух","Пламенный клинок"],
    "Вода":["Русалка","Ледяной голем","Шторм","Морской змей"],
    "Земля":["Титан","Голем","Друид","Корень мира"],
    "Воздух":["Орёл ветров","Штормовой дух","Гроза","Вихрь"],
    "Свет":["Ангел","Паладин","Луч рассвета","Хранитель"],
    "Тьма":["Некромант","Тень","Призрак","Пожиратель"]
  };

  const rarities = [
    {name:"Обычная", color:"#ccc"},
    {name:"Редкая", color:"#3cb371"},
    {name:"Эпическая", color:"#9370db"},
    {name:"Легендарная", color:"#ff8c00"}
  ];

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  document.getElementById('genCard').onclick = () => {
    const elem = random(elements);
    const rarity = random(rarities);
    const name = random(names[elem.name]);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;

    const cardHTML = `
    <div style="
      display:inline-block;
      border:2px solid ${elem.color};
      border-radius:10px;
      background:#111;
      color:${rarity.color};
      font-family:monospace;
      padding:10px 15px;
      margin:10px;
      width:260px;
      box-shadow:0 0 10px ${elem.color}55;">
      <center>
        <b style="font-size:1.2em;">${rarity.name} карта</b><br>
        <hr style="border:1px solid ${elem.color}; width:80%;">
      </center>
      <div>Элемент: <b style="color:${elem.color}">${elem.symbol} ${elem.name}</b></div>
      <div>Имя: <i>${name}</i></div>
      <div>Сила: <b>${power}</b></div>
      <div>Защита: <b>${defense}</b></div>
    </div>`;

    const container = document.getElementById('cardsContainer');
    container.insertAdjacentHTML('beforeend', cardHTML);
  };
})();
</script>[/html]

0

7

[html]<h3>🎴 Генератор карт стихий</h3>

<button id="genCard">Получить карту</button>

<div id="preview" style="margin-top:15px; font-family:monospace; background:#111; color:#0f0; padding:10px; border-radius:8px;"></div>

<div id="htmlBox" style="display:none; margin-top:10px;">
  <b>Скопируй этот HTML и вставь в сообщение:</b>
  <textarea id="htmlText" style="width:100%; height:180px; margin-top:5px; font-family:monospace;"></textarea>
</div>

<script>
(function(){
  const elements = [
    {symbol:"🔥", name:"Огонь", color:"#ff4500"},
    {symbol:"💧", name:"Вода", color:"#1e90ff"},
    {symbol:"🌿", name:"Земля", color:"#228b22"},
    {symbol:"🌪", name:"Воздух", color:"#aaa"},
    {symbol:"🌞", name:"Свет", color:"#ffd700"},
    {symbol:"🌑", name:"Тьма", color:"#551a8b"}
  ];

  const names = {
    "Огонь":["Саламандра","Феникс","Огненный дух","Пламенный клинок"],
    "Вода":["Русалка","Ледяной голем","Шторм","Морской змей"],
    "Земля":["Титан","Голем","Друид","Корень мира"],
    "Воздух":["Орёл ветров","Штормовой дух","Гроза","Вихрь"],
    "Свет":["Ангел","Паладин","Луч рассвета","Хранитель"],
    "Тьма":["Некромант","Тень","Призрак","Пожиратель"]
  };

  const rarities = [
    {name:"Обычная", color:"#cccccc"},
    {name:"Редкая", color:"#3cb371"},
    {name:"Эпическая", color:"#9370db"},
    {name:"Легендарная", color:"#ff8c00"}
  ];

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  document.getElementById('genCard').onclick = () => {
    const elem = random(elements);
    const rarity = random(rarities);
    const name = random(names[elem.name]);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;

    const html = `
<div style="display:inline-block; border:2px solid ${elem.color}; border-radius:10px; background:#111; color:${rarity.color}; font-family:monospace; padding:10px 15px; margin:10px; width:260px; box-shadow:0 0 10px ${elem.color}55;">
  <center>
    <b style="font-size:1.2em;">${rarity.name} карта</b><br>
    <hr style="border:1px solid ${elem.color}; width:80%;">
  </center>
  <div>Элемент: <b style="color:${elem.color}">${elem.symbol} ${elem.name}</b></div>
  <div>Имя: <i>${name}</i></div>
  <div>Сила: <b>${power}</b></div>
  <div>Защита: <b>${defense}</b></div>
</div>`;

    document.getElementById('preview').innerHTML = html;
    document.getElementById('htmlBox').style.display = 'block';
    document.getElementById('htmlText').value = html.trim();
  };
})();
</script>[/html]

0

8

[html]<div style="display:inline-block; border:2px solid #1e90ff; border-radius:10px; background:#111; color:#9370db; font-family:monospace; padding:10px 15px; margin:10px; width:260px; box-shadow:0 0 10px #1e90ff55;">
  <center>
    <b style="font-size:1.2em;">Эпическая карта</b><br>
    <hr style="border:1px solid #1e90ff; width:80%;">
  </center>
  <div>Элемент: <b style="color:#1e90ff">💧 Вода</b></div>
  <div>Имя: <i>Русалка</i></div>
  <div>Сила: <b>9</b></div>
  <div>Защита: <b>16</b></div>
</div>[/html]

0

9

[html]<h3>🎴 Генератор карт стихий</h3>

<button id="genCard">Получить карту</button>

<div id="preview" style="margin-top:15px; font-family:monospace; background:#111; color:#0f0; padding:10px; border-radius:8px;"></div>

<div id="htmlBox" style="display:none; margin-top:10px;">
  <b>Скопируй этот HTML и вставь в сообщение:</b>
  <textarea id="htmlText" style="width:100%; height:180px; margin-top:5px; font-family:monospace;"></textarea>
  <div style="margin-top:10px;">
    <button id="apiSend" style="display:none;">📝 Отправить на форум</button>
  </div>
</div>

<script>
(function(){
  // Настройки — адаптируй под свой форум
  const API_URL = "https://forum.mybb.ru/api.php"; // URL API
  const API_METHOD = "posts.create"; // пример метода (тебе нужно проверить актуальный метод)
  const API_KEY = ""; // если нужен ключ или токен
 
  const elements = [
    {symbol:"🔥", name:"Огонь", color:"#ff4500"},
    {symbol:"💧", name:"Вода", color:"#1e90ff"},
    {symbol:"🌿", name:"Земля", color:"#228b22"},
    {symbol:"🌪", name:"Воздух", color:"#aaa"},
    {symbol:"🌞", name:"Свет", color:"#ffd700"},
    {symbol:"🌑", name:"Тьма", color:"#551a8b"}
  ];

  const names = {
    "Огонь":["Саламандра","Феникс","Огненный дух","Пламенный клинок"],
    "Вода":["Русалка","Ледяной голем","Шторм","Морской змей"],
    "Земля":["Титан","Голем","Друид","Корень мира"],
    "Воздух":["Орёл ветров","Штормовой дух","Гроза","Вихрь"],
    "Свет":["Ангел","Паладин","Луч рассвета","Хранитель"],
    "Тьма":["Некромант","Тень","Призрак","Пожиратель"]
  };

  const rarities = [
    {name:"Обычная", color:"#cccccc"},
    {name:"Редкая", color:"#3cb371"},
    {name:"Эпическая", color:"#9370db"},
    {name:"Легендарная", color:"#ff8c00"}
  ];

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  document.getElementById('genCard').onclick = () => {
    const elem = random(elements);
    const rarity = random(rarities);
    const name = random(names[elem.name]);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;

    const html = `
<div style="display:inline-block; border:2px solid ${elem.color}; border-radius:10px; background:#111; color:${rarity.color}; font-family:monospace; padding:10px 15px; margin:10px; width:260px; box-shadow:0 0 10px ${elem.color}55;">
  <center>
    <b style="font-size:1.2em;">${rarity.name} карта</b><br>
    <hr style="border:1px solid ${elem.color}; width:80%;">
  </center>
  <div>Элемент: <b style="color:${elem.color}">${elem.symbol} ${elem.name}</b></div>
  <div>Имя: <i>${name}</i></div>
  <div>Сила: <b>${power}</b></div>
  <div>Защита: <b>${defense}</b></div>
</div>`;

    document.getElementById('preview').innerHTML = html;
    document.getElementById('htmlBox').style.display = 'block';
    document.getElementById('htmlText').value = html.trim();
    document.getElementById('apiSend').style.display = 'inline-block';
  };

  document.getElementById('apiSend').onclick = () => {
    const html = document.getElementById('htmlText').value;
    const data = {
      method: API_METHOD,
      format: "json",
      message: html,
      // тут могут быть другие параметры: topic_id, forum_id, subject и т.д.
      // Добавь: token или key если нужен
    };
    // Если нужен API_KEY, добавь data.key = API_KEY;

    fetch(API_URL + "?format=json", {
      method: "POST",
      headers: {
        "Content-Type": "application/json"
      },
      body: JSON.stringify(data)
    }).then(resp => resp.json())
      .then(json => {
        if (json.error) {
          alert("Ошибка при отправке: " + json.error.message);
        } else {
          alert("Сообщение успешно отправлено!");
        }
      }).catch(err => {
        alert("Ошибка связи с API: " + err);
      });
  };

})();
</script>[/html]

0

10

[html]<div style="display:inline-block; border:2px solid #aaa; border-radius:10px; background:#111; color:#9370db; font-family:monospace; padding:10px 15px; margin:10px; width:260px; box-shadow:0 0 10px #aaa55;">
  <center>
    <b style="font-size:1.2em;">Эпическая карта</b><br>
    <hr style="border:1px solid #aaa; width:80%;">
  </center>
  <div>Элемент: <b style="color:#aaa">🌪 Воздух</b></div>
  <div>Имя: <i>Штормовой дух</i></div>
  <div>Сила: <b>8</b></div>
  <div>Защита: <b>12</b></div>
</div>[/html]

0

11

[html]<h3>🎴 Генератор карт стихий</h3>

<!-- Период генерации (в секундах) -->
<script>
  const GENERATION_INTERVAL = 60 * 60; // 1 час = 3600 секунд
</script>

<button id="genCard">Получить карту</button>
<p id="timerInfo" style="color:#999; font-size:90%; margin-top:5px;"></p>

<div id="preview" style="margin-top:15px; font-family:monospace; background:#111; color:#0f0; padding:10px; border-radius:8px;"></div>

<div id="htmlBox" style="display:none; margin-top:10px;">
  <b>Скопируй этот HTML и вставь в сообщение:</b>
  <textarea id="htmlText" style="width:100%; height:180px; margin-top:5px; font-family:monospace;"></textarea>
</div>

<script>
(function(){
  const elements = [
    {symbol:"🔥", name:"Огонь", color:"#ff4500"},
    {symbol:"💧", name:"Вода", color:"#1e90ff"},
    {symbol:"🌿", name:"Земля", color:"#228b22"},
    {symbol:"🌪", name:"Воздух", color:"#aaa"},
    {symbol:"🌞", name:"Свет", color:"#ffd700"},
    {symbol:"🌑", name:"Тьма", color:"#551a8b"}
  ];

  const names = {
    "Огонь":["Саламандра","Феникс","Огненный дух","Пламенный клинок"],
    "Вода":["Русалка","Ледяной голем","Шторм","Морской змей"],
    "Земля":["Титан","Голем","Друид","Корень мира"],
    "Воздух":["Орёл ветров","Штормовой дух","Гроза","Вихрь"],
    "Свет":["Ангел","Паладин","Луч рассвета","Хранитель"],
    "Тьма":["Некромант","Тень","Призрак","Пожиратель"]
  };

  const rarities = [
    {name:"Обычная", color:"#cccccc"},
    {name:"Редкая", color:"#3cb371"},
    {name:"Эпическая", color:"#9370db"},
    {name:"Легендарная", color:"#ff8c00"}
  ];

  const btn = document.getElementById('genCard');
  const timerInfo = document.getElementById('timerInfo');

  function random(arr){ return arr[Math.floor(Math.random()*arr.length)]; }

  function updateTimer() {
    const last = localStorage.getItem('lastCardTime');
    if (!last) return;

    const now = Math.floor(Date.now()/1000);
    const diff = GENERATION_INTERVAL - (now - parseInt(last));

    if (diff > 0) {
      const mins = Math.floor(diff / 60);
      const secs = diff % 60;
      timerInfo.textContent = `⏳ Следующую карту можно получить через ${mins} мин ${secs} сек.`;
      btn.disabled = true;
      btn.style.opacity = '0.5';
      setTimeout(updateTimer, 1000);
    } else {
      timerInfo.textContent = '';
      btn.disabled = false;
      btn.style.opacity = '1';
    }
  }

  btn.onclick = () => {
    const last = localStorage.getItem('lastCardTime');
    const now = Math.floor(Date.now()/1000);

    if (last && now - parseInt(last) < GENERATION_INTERVAL) {
      alert("⏳ Вы уже получили карту! Попробуйте позже.");
      updateTimer();
      return;
    }

    localStorage.setItem('lastCardTime', now);
    updateTimer();

    const elem = random(elements);
    const rarity = random(rarities);
    const name = random(names[elem.name]);
    const power = Math.floor(Math.random()*20)+5;
    const defense = Math.floor(Math.random()*20)+5;

    const html = `
<div style="display:inline-block; border:2px solid ${elem.color}; border-radius:10px; background:#111; color:${rarity.color}; font-family:monospace; padding:10px 15px; margin:10px; width:260px; box-shadow:0 0 10px ${elem.color}55;">
  <center>
    <b style="font-size:1.2em;">${rarity.name} карта</b><br>
    <hr style="border:1px solid ${elem.color}; width:80%;">
  </center>
  <div>Элемент: <b style="color:${elem.color}">${elem.symbol} ${elem.name}</b></div>
  <div>Имя: <i>${name}</i></div>
  <div>Сила: <b>${power}</b></div>
  <div>Защита: <b>${defense}</b></div>
</div>`;

    document.getElementById('preview').innerHTML = html;
    document.getElementById('htmlBox').style.display = 'block';
    document.getElementById('htmlText').value = html.trim();
  };

  updateTimer();
})();
</script>[/html]

0

12

[html]<style>
  .item-container {
    display: flex;
    max-width: 800px;
    border: 1px solid #ccc;
    border-radius: 10px;
    overflow: hidden;
    font-family: Arial, sans-serif;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  }

  .tabs {
    width: 200px;
    background: #2c3e50;
    color: #fff;
    display: flex;
    flex-direction: column;
  }

  .tab {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #34495e;
    transition: background 0.3s;
  }

  .tab:hover, .tab.active {
    background: #34495e;
  }

  .details {
    flex: 1;
    padding: 20px;
    background: #ecf0f1;
  }

  .item-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
  }

  .ingredients {
    margin-top: 10px;
  }

  .ingredient {
    margin-left: 10px;
    list-style-type: disc;
  }
</style>

<div class="item-container">
  <div class="tabs">
    <div class="tab active" data-item="potion">Зелье исцеления</div>
    <div class="tab" data-item="elixir">Эликсир маны</div>
    <div class="tab" data-item="bomb">Бомба огненная</div>
<div class="tab" data-item="cho">Что-то тестовое</div>
  </div>
  <div class="details">
    <div class="detail" id="potion">
      <div class="item-title">Зелье исцеления</div>
      <p>Восстанавливает здоровье.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Травы</li>
          <li class="ingredient">Вода</li>
        </ul>
      </div>
    </div>
    <div class="detail" id="elixir" style="display:none;">
      <div class="item-title">Эликсир маны</div>
      <p>Восстанавливает ману.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Магические ягоды</li>
          <li class="ingredient">Вода</li>
        </ul>
      </div>
    </div>
    <div class="detail" id="bomb" style="display:none;">
      <div class="item-title">Бомба огненная</div>
      <p>Наносит урон огнем.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Порох</li>
          <li class="ingredient">Фитиль</li>
        </ul>
      </div>
    </div>
   <div class="detail" id="cho" style="display:none;">
      <div class="item-title">Что-то тестовое</div>
      <p>Задает вопросы.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">чо</li>
          <li class="ingredient">каво</li>
        </ul>
      </div>
    </div>
  </div>
</div>

<script>
  const tabs = document.querySelectorAll('.tab');
  const details = document.querySelectorAll('.detail');

  tabs.forEach(tab => {
    tab.addEventListener('click', () => {
      tabs.forEach(t => t.classList.remove('active'));
      tab.classList.add('active');

      details.forEach(d => d.style.display = 'none');
      const selected = document.getElementById(tab.dataset.item);
      if (selected) selected.style.display = 'block';
    });
  });
</script>[/html]

0

13

[html]<style>
  .item-container {
    display: flex;
    max-width: 900px;
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
  }

  .tabs {
    width: 220px;
    background: #1f2a38;
    color: #fff;
    display: flex;
    flex-direction: column;
  }

  .tab {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #2a3b50;
    transition: background 0.3s, transform 0.2s;
  }

  .tab img {
    width: 32px;
    height: 32px;
    margin-right: 10px;
  }

  .tab:hover {
    background: #2a3b50;
    transform: translateX(3px);
  }

  .tab.active {
    background: #3a4b60;
  }

  .details {
    flex: 1;
    padding: 20px;
    background: #f0f0f5;
    position: relative;
  }

  .detail {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
  }

  .detail.active {
    display: block;
  }

  .item-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #1f2a38;
  }

  .ingredients {
    margin-top: 12px;
  }

  .ingredients ul {
    margin-left: 20px;
  }

  .ingredient {
    margin-bottom: 4px;
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
</style>

<div class="item-container">
  <div class="tabs">
    <div class="tab active" data-item="potion"><img src="https://i.imgur.com/qb7K1S6.png" alt="">Зелье исцеления</div>
    <div class="tab" data-item="elixir"><img src="https://i.imgur.com/5H1xAzi.png" alt="">Эликсир маны</div>
    <div class="tab" data-item="bomb"><img src="https://i.imgur.com/f9u5cB3.png" alt="">Бомба огненная</div>
  </div>
  <div class="details">
    <div class="detail active" id="potion">
      <div class="item-title">Зелье исцеления</div>
      <p>Восстанавливает здоровье персонажа.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Травы</li>
          <li class="ingredient">Вода</li>
          <li class="ingredient">Кристалл здоровья</li>
        </ul>
      </div>
    </div>
    <div class="detail" id="elixir">
      <div class="item-title">Эликсир маны</div>
      <p>Восстанавливает ману персонажа.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Магические ягоды</li>
          <li class="ingredient">Вода</li>
          <li class="ingredient">Лунный цветок</li>
        </ul>
      </div>
    </div>
    <div class="detail" id="bomb">
      <div class="item-title">Бомба огненная</div>
      <p>Наносит огненный урон врагам.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Порох</li>
          <li class="ingredient">Фитиль</li>
          <li class="ingredient">Огненный камень</li>
        </ul>
      </div>
    </div>
  </div>
</div>

<script>
  const tabs = document.querySelectorAll('.tab');
  const details = document.querySelectorAll('.detail');

  tabs.forEach(tab => {
    tab.addEventListener('click', () => {
      tabs.forEach(t => t.classList.remove('active'));
      tab.classList.add('active');

      details.forEach(d => d.classList.remove('active'));
      const selected = document.getElementById(tab.dataset.item);
      if (selected) selected.classList.add('active');
    });
  });
</script>[/html]

0

14

[html]<style>
  .item-container {
    display: flex;
    max-width: 900px;
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
  }

  .tabs {
    width: 220px;
    background: #1f2a38;
    color: #fff;
    display: flex;
    flex-direction: column;
  }

  .tab {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #2a3b50;
    transition: background 0.3s, transform 0.2s;
  }

  .tab img {
    width: 32px;
    height: 32px;
    margin-right: 10px;
  }

  .tab:hover {
    background: #2a3b50;
    transform: translateX(3px);
  }

  .tab.active {
    background: #3a4b60;
  }

  .details {
    flex: 1;
    padding: 20px;
    background: #f0f0f5;
    position: relative;
    border-left: 2px solid #1f2a38;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .detail {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
    width: 100%;
    max-width: 500px;
    border: 2px solid #888;
    border-radius: 10px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    text-align: center;
  }

  .detail.active {
    display: block;
  }

  .item-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 12px;
  }

  .item-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #1f2a38;
  }

  .ingredients {
    margin-top: 12px;
  }

  .ingredients ul {
    margin-left: 20px;
  }

  .ingredient {
    margin-bottom: 4px;
  }

  /* Подсветка редкости: обычный - серый, редкий - синий, эпический - фиолетовый */
  .rarity-common { border-color: #888; }
  .rarity-rare { border-color: #3498db; }
  .rarity-epic { border-color: #9b59b6; }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
</style>

<div class="item-container">
  <div class="tabs">
    <div class="tab active" data-item="potion"><img src="https://i.imgur.com/qb7K1S6.png" alt="">Зелье исцеления</div>
    <div class="tab" data-item="elixir"><img src="https://i.imgur.com/5H1xAzi.png" alt="">Эликсир маны</div>
    <div class="tab" data-item="bomb"><img src="https://i.imgur.com/f9u5cB3.png" alt="">Бомба огненная</div>
  </div>
  <div class="details">
    <div class="detail active rarity-common" id="potion">
      <img class="item-icon" src="https://i.imgur.com/qb7K1S6.png" alt="">
      <div class="item-title">Зелье исцеления</div>
      <p>Восстанавливает здоровье персонажа.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Травы</li>
          <li class="ingredient">Вода</li>
          <li class="ingredient">Кристалл здоровья</li>
        </ul>
      </div>
    </div>
    <div class="detail rarity-rare" id="elixir">
      <img class="item-icon" src="https://i.imgur.com/5H1xAzi.png" alt="">
      <div class="item-title">Эликсир маны</div>
      <p>Восстанавливает ману персонажа.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Магические ягоды</li>
          <li class="ingredient">Вода</li>
          <li class="ingredient">Лунный цветок</li>
        </ul>
      </div>
    </div>
    <div class="detail rarity-epic" id="bomb">
      <img class="item-icon" src="https://i.imgur.com/f9u5cB3.png" alt="">
      <div class="item-title">Бомба огненная</div>
      <p>Наносит огненный урон врагам.</p>
      <div class="ingredients">
        <strong>Ингредиенты:</strong>
        <ul>
          <li class="ingredient">Порох</li>
          <li class="ingredient">Фитиль</li>
          <li class="ingredient">Огненный камень</li>
        </ul>
      </div>
    </div>
  </div>
</div>

<script>
  const tabs = document.querySelectorAll('.tab');
  const details = document.querySelectorAll('.detail');

  tabs.forEach(tab => {
    tab.addEventListener('click', () => {
      tabs.forEach(t => t.classList.remove('active'));
      tab.classList.add('active');

      details.forEach(d => d.classList.remove('active'));
      const selected = document.getElementById(tab.dataset.item);
      if (selected) selected.classList.add('active');
    });
  });
</script>[/html]

0

15

[html]<style>
  .calendar-wrapper {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Verdana', sans-serif;
    color: #333;
  }

  .month-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
  }

  .month-tab {
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 6px 14px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: bold;
  }

  .month-tab.active {
    background: #d0e6ff;
    border-color: #4b7bd8;
    color: #003366;
  }

  .month-content {
    display: none;
    animation: fade 0.4s ease;
  }

  .month-content.active {
    display: block;
  }

  @keyframes fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .art-list {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    text-align: center;
  }

  .art-icon n {
    display: block;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: 0.2s;
  }

  .art-icon n:hover {
    background: #e3edff;
    border-color: #88aaff;
  }

  .art-icon.selected n {
    background: #bcd4ff;
    border-color: #4b7bd8;
    color: #002255;
    font-weight: bold;
  }

  .calendar-popup {
    margin-top: 20px;
    background: #f5f5f5;
    border: 2px solid #ccc;
    border-radius: 10px;
    padding: 20px;
    min-height: 120px;
    box-shadow: 0 0 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
  }

  .calendar-popup.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-style: italic;
  }

  .calendar-popup h3 {
    margin-top: 0;
    color: #003366;
  }

  .art-icon .op {
    display: none !important;
  }
</style>

<div class="calendar-wrapper">

  <div class="month-tabs">
    <div class="month-tab active" data-month="november">Ноябрь</div>
    <div class="month-tab" data-month="december">Декабрь</div>
    <div class="month-tab" data-month="january">Январь</div>
  </div>

  <!-- Ноябрь -->
  <div class="month-content active" id="month-november">
    <div class="art-list">
      <div class="art-icon"><n>1</n><div class="op">🍂 Начало ноября — лёгкий туман и прохлада.</div></div>
      <div class="art-icon"><n>2</n><div class="op">☕ Уютный день для горячего шоколада.</div></div>
      <div class="art-icon"><n>3</n><div class="op">🌧 Пасмурно, но атмосферно.</div></div>
      <div class="art-icon"><n>4</n><div class="op">🎉 Малый праздник — день отдыха.</div></div>
      <div class="art-icon"><n>5</n><div class="op">📖 Отличное время для чтения.</div></div>
    </div>
  </div>

  <!-- Декабрь -->
  <div class="month-content" id="month-december">
    <div class="art-list">
      <div class="art-icon"><n>1</n><div class="op">❄ Первый снег — наконец-то зима!</div></div>
      <div class="art-icon"><n>2</n><div class="op">🎁 Начало подготовки к праздникам.</div></div>
      <div class="art-icon"><n>3</n><div class="op">🔥 Вечер у камина.</div></div>
      <div class="art-icon"><n>4</n><div class="op">🍪 Аромат свежего печенья в воздухе.</div></div>
      <div class="art-icon"><n>5</n><div class="op">🎄 Украшаем дом гирляндами.</div></div>
    </div>
  </div>

  <!-- Январь -->
  <div class="month-content" id="month-january">
    <div class="art-list">
      <div class="art-icon"><n>1</n><div class="op">🎆 Новый год! Волшебная ночь.</div></div>
      <div class="art-icon"><n>2</n><div class="op">🌟 День отдыха и хорошего настроения.</div></div>
      <div class="art-icon"><n>3</n><div class="op">🥂 Встречи с друзьями продолжаются.</div></div>
      <div class="art-icon"><n>4</n><div class="op">☃ Идеальное время для прогулки в снегу.</div></div>
      <div class="art-icon"><n>5</n><div class="op">📜 Новый год — новые планы!</div></div>
    </div>
  </div>

  <!-- Общий блок описания -->
  <div id="calendar-info" class="calendar-popup empty">
    Нажмите на любой день, чтобы посмотреть информацию
  </div>
</div>

<script type="text/javascript">
// === Календарь для Rusff ===
(function() {
  var tabs = document.querySelectorAll(".month-tab");
  var months = document.querySelectorAll(".month-content");
  var popup = document.getElementById("calendar-info");
  var allDays = document.querySelectorAll(".art-icon");

  // Переключение вкладок
  for (var i = 0; i < tabs.length; i++) {
    tabs[i].onclick = function() {
      for (var t = 0; t < tabs.length; t++) {
        tabs[t].classList.remove("active");
        months[t].classList.remove("active");
      }
      this.classList.add("active");
      document.getElementById("month-" + this.getAttribute("data-month")).classList.add("active");
    };
  }

  // Клик по дню
  for (var j = 0; j < allDays.length; j++) {
    allDays[j].onclick = function() {
      for (var d = 0; d < allDays.length; d++) allDays[d].classList.remove("selected");
      this.classList.add("selected");
      popup.classList.remove("empty");
      var info = this.querySelector(".op");
      var number = this.querySelector("n").textContent;
      popup.innerHTML = "<h3>День " + number + "</h3>" + (info ? info.innerHTML : "Нет данных");
    };
  }
})();
</script>[/html]

0

16

[html]<style>
  .art-page { max-width: 800px; margin: auto; }
  .art-list { display: flex; flex-wrap: wrap; gap: 5px; }
  .art-icon { cursor: pointer; padding: 5px; border: 1px solid #ccc; text-align: center; width: 40px; position: relative; }
  .day-info { margin-top: 20px; padding: 10px; border: 1px solid #ccc; background: #f9f9f9; }
  .day-info p { margin: 5px 0; }
</style>

<div class="art-page">
  <div class="art-box">
    <div class="art-title">НОЯБРЬ</div>
    <div class="art-list">

      <div class="art-icon cloudy active" data-info='<b>01.11.2024</b> +18°С ... +23°С, облачно, пасмурно<br>Участники: Sergey Hartman, Domino Osborne, Jason Bright, Olivia Barton, Jamie McClane, James White, Samuel Quinn<br>Чтобы наладить мирные отношения с Кларком, Совет поселения Свора принимает решение вернуть Миротворцам пленных...'>
        <n>1</n>
      </div>

      <div class="art-icon sun" data-info='<b>02.11.2024</b> +6°С ... +12°С, солнечно'>
        <n>2</n>
      </div>

      <div class="art-icon sun active" data-info='<b>03.11.2024</b> +5°С ... +15°С, солнечно<br>Участники: Миротворцы<br>Благодаря найденным в сентябре чертежам Миротворцы достроили птичник неподалёку от своей фермы...'>
        <n>3</n>
      </div>

      <!-- Добавляйте остальные дни так же, используя data-info -->
    </div>

    <!-- Блок для отображения информации выбранного дня -->
    <div class="day-info" id="dayInfo">Нажмите на день, чтобы увидеть детали.</div>
  </div>
</div>

<script>
  const days = document.querySelectorAll('.art-icon');
  const infoBlock = document.getElementById('dayInfo');

  days.forEach(day => {
    day.addEventListener('click', () => {
      // Берём информацию из атрибута data-info и выводим в блок
      infoBlock.innerHTML = day.getAttribute('data-info');
    });
  });
</script>[/html]

0

17

[html]<style>
#tarotContainer {
  width: 100%;
  max-width: 420px;
  margin: 10px auto;
  padding: 15px;
  border: 2px solid #ccc;
  border-radius: 10px;
  text-align: center;
  background: rgba(255,255,255,0.9);
  font-family: "Trebuchet MS", sans-serif;
}
#tarotResult {
  margin-top: 15px;
  font-size: 14px;
  color: #333;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px;
  white-space: pre-line;
}
#tarotButton {
  background: #4a4a4a;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}
#tarotButton:hover:enabled {
  background: #000;
}
#tarotButton:disabled {
  background: #888;
  cursor: not-allowed;
}
</style>

<div id="tarotContainer">
  <h3>🌙 Твоя карта судьбы</h3>
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<script>
// === НАСТРОЙКИ ===

// Разрешённые пользователи (по ID на форуме Rusff)
const allowedPlayers = [1, 2, 5, 10]; // ← замените на свои ID

// Интервал между вытягиваниями (в часах)
const drawIntervalHours = 1; // можно поставить, например, 12, 48, 72 и т.д.

// Карточки предсказаний (добавляйте сколько угодно)
const tarotCards = [
  {
    name: "Башня",
    img: "https://i.imgur.com/vRuYxZC.jpg",
    desc: "Резкие перемены. Разрушение старого ради нового."
  },
  {
    name: "Звезда",
    img: "https://i.imgur.com/Jk0JtqT.jpg",
    desc: "Надежда, вдохновение, свет впереди."
  },
  {
    name: "Солнце",
    img: "https://i.imgur.com/W5Zp2yF.jpg",
    desc: "Радость, успех и ясность в делах."
  },
  // Пример добавления новой карты:
  // { name: "Императрица", img: "URL", desc: "Описание..." },
];

// === ЛОГИКА ===

// Определяем ID пользователя
let userID = 0;
const idMatch = document.body.innerHTML.match(/profile\.php\?id=(\d+)/);
if (idMatch) userID = parseInt(idMatch[1]);

const btn = document.getElementById("tarotButton");
const result = document.getElementById("tarotResult");

if (!allowedPlayers.includes(userID)) {
  btn.disabled = true;
  btn.textContent = "Нет доступа";
} else {
  const now = Date.now();
  const lastDrawTime = localStorage.getItem("tarotDrawTime_" + userID);
  const savedCard = localStorage.getItem("tarotCard_" + userID);

  // Проверяем интервал
  if (lastDrawTime && now - lastDrawTime < drawIntervalHours * 3600000) {
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
    if (savedCard) result.innerHTML = savedCard;
    const remaining = Math.ceil(
      (drawIntervalHours * 3600000 - (now - lastDrawTime)) / 3600000
    );
    result.innerHTML += `<br><small>Повторная попытка через примерно ${remaining} ч.</small>`;
  }

  btn.addEventListener("click", () => {
    const random = tarotCards[Math.floor(Math.random() * tarotCards.length)];
    const code = `[tarocard]--\n${random.name}\n${random.desc}[/tarocard]`;

    const html = `
      <b>${random.name}</b><br>
      <img src="${random.img}" width="200"><br>
      <i>${random.desc}</i><br><br>
      Код для вставки в сообщение:<br>
      <textarea style="width:100%;height:80px;">${code}</textarea>
    `;

    result.innerHTML = html;
    localStorage.setItem("tarotDrawTime_" + userID, now);
    localStorage.setItem("tarotCard_" + userID, html);
    btn.disabled = true;
    btn.textContent = "Карта получена";
  });
}
</script>[/html]

0

18

[html]<style>
#tarotContainer {
  width: 100%;
  max-width: 420px;
  margin: 10px auto;
  padding: 15px;
  border: 2px solid #ccc;
  border-radius: 10px;
  text-align: center;
  background: rgba(255,255,255,0.9);
  font-family: "Trebuchet MS", sans-serif;
}
#tarotResult {
  margin-top: 15px;
  font-size: 14px;
  color: #333;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px;
  white-space: pre-line;
}
#tarotButton {
  background: #4a4a4a;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}
#tarotButton:hover:enabled {
  background: #000;
}
#tarotButton:disabled {
  background: #888;
  cursor: not-allowed;
}
</style>

<div id="tarotContainer">
  <h3>🌙 Твоя карта судьбы</h3>
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<script>
// === НАСТРОЙКИ ===

// Разрешённые пользователи (по ID на форуме Rusff)
const allowedPlayers = [1, 2, 5, 10]; // ← замените на свои ID

// Интервал между вытягиваниями (в часах)
const drawIntervalHours = 1; // можно поставить, например, 12, 48, 72 и т.д.

// Карточки предсказаний (добавляйте сколько угодно)
const tarotCards = [
  {
    name: "Башня",
    img: "https://i.imgur.com/vRuYxZC.jpg",
    desc: "Резкие перемены. Разрушение старого ради нового."
  },
  {
    name: "Звезда",
    img: "https://i.imgur.com/Jk0JtqT.jpg",
    desc: "Надежда, вдохновение, свет впереди."
  },
  {
    name: "Солнце",
    img: "https://i.imgur.com/W5Zp2yF.jpg",
    desc: "Радость, успех и ясность в делах."
  },
  // Пример добавления новой карты:
  // { name: "Императрица", img: "URL", desc: "Описание..." },
];

// === ЛОГИКА ===

// Определяем ID пользователя
let userID = 0;
const idMatch = document.body.innerHTML.match(/profile\.php\?id=(\d+)/);
if (idMatch) userID = parseInt(idMatch[1]);

const btn = document.getElementById("tarotButton");
const result = document.getElementById("tarotResult");

if (!allowedPlayers.includes(userID)) {
  btn.disabled = true;
  btn.textContent = "Нет доступа";
} else {
  const now = Date.now();
  const lastDrawTime = localStorage.getItem("tarotDrawTime_" + userID);
  const savedCard = localStorage.getItem("tarotCard_" + userID);

  // Проверяем интервал
  if (lastDrawTime && now - lastDrawTime < drawIntervalHours * 3600000) {
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
    if (savedCard) result.innerHTML = savedCard;
    const remaining = Math.ceil(
      (drawIntervalHours * 3600000 - (now - lastDrawTime)) / 3600000
    );
    result.innerHTML += `<br><small>Повторная попытка через примерно ${remaining} ч.</small>`;
  }

  btn.addEventListener("click", () => {
    const random = tarotCards[Math.floor(Math.random() * tarotCards.length)];
    const code = `[tarocard]--\n${random.name}\n${random.desc}[/tarocard]`;

    const html = `
      <b>${random.name}</b><br>
      <img src="${random.img}" width="200"><br>
      <i>${random.desc}</i><br><br>
      Код для вставки в сообщение:<br>
      <textarea style="width:100%;height:80px;">${code}</textarea>
    `;

    result.innerHTML = html;
    localStorage.setItem("tarotDrawTime_" + userID, now);
    localStorage.setItem("tarotCard_" + userID, html);
    btn.disabled = true;
    btn.textContent = "Карта получена";
  });
}
</script>[/html]

console.log("Ваш ID:", userID);

0

19

[html]<style>
#tarotContainer {
  width: 100%;
  max-width: 420px;
  margin: 15px auto;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f4f4f4, #ffffff);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  text-align: center;
  font-family: "Trebuchet MS", sans-serif;
}
#tarotButton {
  background: linear-gradient(90deg, #333, #666);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
}
#tarotButton:hover:enabled { background: linear-gradient(90deg, #000, #333); transform: scale(1.03); }
#tarotButton:disabled { background: #999; cursor: not-allowed; }
#tarotResult {
  margin-top: 15px;
  font-size: 14px;
  color: #333;
  background: #fafafa;
  border-radius: 12px;
  padding: 15px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.05);
  white-space: pre-line;
  animation: fadeIn 0.6s ease;
}
.tarot-card {
  text-align: center;
  margin: 10px auto;
  padding: 10px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.5s ease;
  width: 250px;
}
.tarot-card:hover { transform: scale(1.05); }
@keyframes fadeIn { from {opacity: 0; transform: translateY(10px);} to {opacity: 1; transform: translateY(0);} }
</style>

<div id="tarotContainer">
  <h3>🌙 Твоя карта судьбы</h3>
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<script>
// === НАСТРОЙКИ ===

// Укажи свой ID вручную (или включи режим "all" для всех)
const yourID = 2; // ← замени на свой ID
const allowedPlayers = [yourID]; // или "all"

// Настройка интервала (часы и минуты)
const drawIntervalHours = 0;   // часы
const drawIntervalMinutes = 1; // минуты

// Список карт
const tarotCards = [
  { name: "Башня", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Резкие перемены. Разрушение старого ради нового." },
  { name: "Звезда", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Надежда, вдохновение, свет впереди." },
  { name: "Солнце", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Радость, успех и ясность в делах." },
  { name: "Луна", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Интуиция, сны, тайные страхи и желания." },
  { name: "Мир", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Завершение цикла, гармония и успех." }
];

// === ЛОГИКА ===
const btn = document.getElementById("tarotButton");
const result = document.getElementById("tarotResult");
const userID = yourID;
const intervalMs = (drawIntervalHours * 3600000) + (drawIntervalMinutes * 60000);

if (allowedPlayers !== "all" && !allowedPlayers.includes(userID)) {
  btn.disabled = true;
  btn.textContent = "Нет доступа";
} else {
  const now = Date.now();
  const lastDraw = localStorage.getItem("tarotDrawTime_" + userID);
  const saved = localStorage.getItem("tarotCard_" + userID);

  if (lastDraw && now - lastDraw < intervalMs) {
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
    if (saved) result.innerHTML = saved;
    const remaining = intervalMs - (now - lastDraw);
    const remHours = Math.floor(remaining / 3600000);
    const remMinutes = Math.ceil((remaining % 3600000) / 60000);
    result.innerHTML += `<br><small>Повторная попытка через ${remHours} ч. ${remMinutes} мин.</small>`;
  }

  btn.addEventListener("click", () => {
    const random = tarotCards[Math.floor(Math.random() * tarotCards.length)];

    // === HTML-карта для вставки ===
    const cardHTML = `
<div class="tarot-card">
  <b>${random.name}</b><br>
  <img src="${random.img}" style="width:200px; border-radius:8px; margin:5px 0;"><br>
  <i>${random.desc}</i>
</div>`;

    const html = `
<div class="tarot-card">
  <b>${random.name}</b><br>
  <img src="${random.img}" style="width:200px; border-radius:8px; margin:5px 0;"><br>
  <i>${random.desc}</i>
</div>
<br><b>HTML-код для вставки в сообщение:</b><br>
<textarea style="width:100%;height:120px;">${cardHTML}</textarea>
`;

    result.innerHTML = html;
    localStorage.setItem("tarotDrawTime_" + userID, now);
    localStorage.setItem("tarotCard_" + userID, html);
    btn.disabled = true;
    btn.textContent = "Карта получена";
  });
}
</script>[/html]

0

20

[html]<style>
#tarotContainer {
  width: 100%;
  max-width: 420px;
  margin: 20px auto;
  padding: 20px;
  border-radius: 16px;
  background: radial-gradient(circle at top, #222 0%, #111 100%);
  box-shadow: 0 0 20px rgba(0,0,0,0.7);
  text-align: center;
  font-family: "Trebuchet MS", sans-serif;
  color: #eee;
}
#tarotContainer h3 {
  color: #c9b6ff;
  text-shadow: 0 0 6px #9b7eff;
}
#tarotButton {
  background: linear-gradient(90deg, #6b48ff, #3b2d80);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(155,126,255,0.4);
}
#tarotButton:hover:enabled {
  background: linear-gradient(90deg, #7e63ff, #4738a3);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(155,126,255,0.8);
}
#tarotButton:disabled { background: #444; color: #aaa; cursor: not-allowed; }
#tarotResult {
  margin-top: 20px;
  font-size: 14px;
  color: #ddd;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  padding: 15px;
  box-shadow: inset 0 0 12px rgba(155,126,255,0.2);
  white-space: pre-line;
  animation: fadeIn 0.6s ease;
}
.tarot-card {
  text-align: center;
  margin: 15px auto;
  padding: 15px;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 12px rgba(155,126,255,0.3);
  transition: transform 0.5s ease, opacity 0.5s ease;
  width: 260px;
  opacity: 0;
  transform: scale(0.9) rotate(-3deg);
  animation: appearCard 1.5s ease forwards;
  backdrop-filter: blur(4px);
}
.tarot-card img {
  width: 200px;
  border-radius: 8px;
  margin: 8px 0;
  box-shadow: 0 0 12px rgba(155,126,255,0.4);
}
.tarot-card b { color: #cbbaff; text-shadow: 0 0 4px #a790ff; }
textarea {
  background: #111;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 12px;
  padding: 5px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes appearCard {
  0% { opacity: 0; transform: scale(0.6) rotate(-10deg); filter: blur(8px); }
  50% { opacity: 0.7; transform: scale(1.05) rotate(3deg); filter: blur(2px); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); filter: blur(0); }
}
</style>

<div id="tarotContainer">
  <h3>🌒 Твоя карта судьбы</h3>
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<script>
// === НАСТРОЙКИ ===

// ID игрока (укажи свой)
const yourID = 57; // ← замени на свой ID
const allowedPlayers = [yourID]; // или "all" для всех

// Интервал времени до новой карты
const drawIntervalHours = 0;   // часы
const drawIntervalMinutes = 1; // минуты

// Список карт (можно добавлять сколько угодно)
const tarotCards = [
  { name: "Башня", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Резкие перемены. Разрушение старого ради нового." },
  { name: "Звезда", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Надежда, вдохновение, свет впереди." },
  { name: "Солнце", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Радость, успех и ясность в делах." },
  { name: "Луна", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Интуиция, сны, тайные страхи и желания." },
  { name: "Мир", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Завершение цикла, гармония и успех." }
];

// === ЛОГИКА ===
const btn = document.getElementById("tarotButton");
const result = document.getElementById("tarotResult");
const userID = yourID;
const intervalMs = (drawIntervalHours * 3600000) + (drawIntervalMinutes * 60000);

if (allowedPlayers !== "all" && !allowedPlayers.includes(userID)) {
  btn.disabled = true;
  btn.textContent = "Нет доступа";
} else {
  const now = Date.now();
  const lastDraw = localStorage.getItem("tarotDrawTime_" + userID);
  const saved = localStorage.getItem("tarotCard_" + userID);

  if (lastDraw && now - lastDraw < intervalMs) {
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
    if (saved) result.innerHTML = saved;
    const remaining = intervalMs - (now - lastDraw);
    const remHours = Math.floor(remaining / 3600000);
    const remMinutes = Math.ceil((remaining % 3600000) / 60000);
    result.innerHTML += `<br><small>Повторная попытка через ${remHours} ч. ${remMinutes} мин.</small>`;
  }

  btn.addEventListener("click", () => {
    const random = tarotCards[Math.floor(Math.random() * tarotCards.length)];

    // HTML-карта
    const cardHTML = `
<div class="tarot-card">
  <b>${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}">
  <i>${random.desc}</i>
</div>`;

    const html = `
<div class="tarot-card">
  <b>${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}">
  <i>${random.desc}</i>
</div>
<br><b>HTML-код для вставки в сообщение:</b><br>
<textarea style="width:100%;height:120px;">${cardHTML}</textarea>
`;

    result.innerHTML = html;
    localStorage.setItem("tarotDrawTime_" + userID, now);
    localStorage.setItem("tarotCard_" + userID, html);
    btn.disabled = true;
    btn.textContent = "Карта получена";
  });
}
</script>[/html]

0

21

[html]<div id="tarotContainer"></div>

<script>
const yourID = 57; // Ваш ID
const allowedPlayers = [yourID]; // или "all" для всех
const drawIntervalHours = 0;   // Часы
const drawIntervalMinutes = 1; // Минуты

const tarotCards = [
  { name: "Башня", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Резкие перемены. Разрушение старого ради нового." },
  { name: "Звезда", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Надежда, вдохновение, свет впереди." },
  { name: "Солнце", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Радость, успех и ясность в делах." },
  { name: "Луна", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Интуиция, сны, тайные страхи и желания." },
  { name: "Мир", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Завершение цикла, гармония и успех." }
];

// Создаем контейнер и кнопку
const container = document.getElementById('tarotContainer');
container.innerHTML = `
  <div style="width:100%;max-width:450px;margin:20px auto;padding:20px;border-radius:16px;
              background: radial-gradient(circle at top,#222 0%,#111 100%);
              box-shadow:0 0 20px rgba(0,0,0,0.7);text-align:center;color:#eee;font-family:'Trebuchet MS',sans-serif;">
    <h3 style="color:#c9b6ff;text-shadow:0 0 6px #9b7eff;">🌒 Твоя карта судьбы</h3>
    <button id="tarotButton" style="background:linear-gradient(90deg,#6b48ff,#3b2d80);
            color:white;border:none;padding:10px 20px;border-radius:10px;cursor:pointer;
            font-size:15px;transition:all 0.3s ease;box-shadow:0 0 10px rgba(155,126,255,0.4);">Вытянуть карту</button>
    <div id="tarotResult" style="margin-top:20px;font-size:14px;color:#ddd;
         background:rgba(0,0,0,0.4);border-radius:12px;padding:15px;
         box-shadow:inset 0 0 12px rgba(155,126,255,0.2);white-space:pre-line;"></div>
  </div>
`;

const btn = document.getElementById('tarotButton');
const result = document.getElementById('tarotResult');
const userID = yourID;
const intervalMs = (drawIntervalHours*3600000)+(drawIntervalMinutes*60000);

// Проверка доступа
if(allowedPlayers !== "all" && !allowedPlayers.includes(userID)){
    btn.disabled = true;
    btn.textContent = "Нет доступа";
}else{
    const now = Date.now();
    const lastDraw = localStorage.getItem("tarotDrawTime_"+userID);
    const saved = localStorage.getItem("tarotCard_"+userID);

    if(lastDraw && now - lastDraw < intervalMs){
        btn.disabled = true;
        btn.textContent = "Карта уже вытянута";
        if(saved) result.innerHTML = saved;
        const remaining = intervalMs-(now-lastDraw);
        const remHours = Math.floor(remaining/3600000);
        const remMinutes = Math.ceil((remaining%3600000)/60000);
        result.innerHTML += `<br><small>Повторная попытка через ${remHours} ч. ${remMinutes} мин.</small>`;
    }

    btn.addEventListener('click',()=>{
        const random = tarotCards[Math.floor(Math.random()*tarotCards.length)];

        // HTML для отображения карты
        const cardHTML = `
<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;
            opacity:0;transform:scale(0.9) rotate(-3deg);
            animation: appearCard 1.5s ease forwards;">
  <b style="color:#cbbaff;">${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">${random.desc}</i>
</div>

<style>
@keyframes appearCard{
  0% {opacity:0; transform:scale(0.6) rotate(-10deg); filter:blur(8px);}
  50% {opacity:0.7; transform:scale(1.05) rotate(3deg); filter:blur(2px);}
  100% {opacity:1; transform:scale(1) rotate(0deg); filter:blur(0);}
}
</style>
`;

        // HTML для вставки в сообщение (с тем же оформлением)
        const copyableHTML = `
<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;">
  <b style="color:#cbbaff;">${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">${random.desc}</i>
</div>
`;

        result.innerHTML = `
${cardHTML}<br>
<b>HTML-код для вставки в сообщение:</b><br>
<textarea style="width:100%;height:150px;">${copyableHTML}</textarea>
`;

        localStorage.setItem("tarotDrawTime_"+userID, now);
        localStorage.setItem("tarotCard_"+userID, result.innerHTML);
        btn.disabled = true;
        btn.textContent = "Карта получена";
    });
}
</script>
[/html]

0

22

[html]<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;">
  <b style="color:#cbbaff;">Солнце</b><br>
  <img src="https://upforme.ru/uploads/001c/84/76/2/735286.jpg" alt="Солнце" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">Радость, успех и ясность в делах.</i>
</div>[/html]

0

23

[dice=11616-1:6:0:]

0

24

[html]<div id="tarotContainer"></div>

<script>
const yourID = 57; // Ваш ID
const allowedPlayers = [yourID]; // или "all" для всех
const drawIntervalHours = 0;   // Часы
const drawIntervalMinutes = 1; // Минуты

const tarotCards = [
  { name: "Башня", img: "https://i.imgur.com/vRuYxZC.jpg", desc: "Резкие перемены. Разрушение старого ради нового." },
  { name: "Звезда", img: "https://i.imgur.com/Jk0JtqT.jpg", desc: "Надежда, вдохновение, свет впереди." },
  { name: "Солнце", img: "https://i.imgur.com/W5Zp2yF.jpg", desc: "Радость, успех и ясность в делах." },
  { name: "Луна", img: "https://i.imgur.com/DP4mYj7.jpg", desc: "Интуиция, сны, тайные страхи и желания." },
  { name: "Мир", img: "https://i.imgur.com/ul6vR1e.jpg", desc: "Завершение цикла, гармония и успех." }
];

// Создаем контейнер и кнопку
const container = document.getElementById('tarotContainer');
container.innerHTML = `
  <div style="width:100%;max-width:450px;margin:20px auto;padding:20px;border-radius:16px;
              background: radial-gradient(circle at top,#222 0%,#111 100%);
              box-shadow:0 0 20px rgba(0,0,0,0.7);text-align:center;color:#eee;font-family:'Trebuchet MS',sans-serif;">
    <h3 style="color:#c9b6ff;text-shadow:0 0 6px #9b7eff;">🌒 Твоя карта судьбы</h3>
    <button id="tarotButton" style="background:linear-gradient(90deg,#6b48ff,#3b2d80);
            color:white;border:none;padding:10px 20px;border-radius:10px;cursor:pointer;
            font-size:15px;transition:all 0.3s ease;box-shadow:0 0 10px rgba(155,126,255,0.4);">Вытянуть карту</button>
    <div id="tarotResult" style="margin-top:20px;font-size:14px;color:#ddd;
         background:rgba(0,0,0,0.4);border-radius:12px;padding:15px;
         box-shadow:inset 0 0 12px rgba(155,126,255,0.2);white-space:pre-line;"></div>
  </div>
`;

const btn = document.getElementById('tarotButton');
const result = document.getElementById('tarotResult');
const userID = yourID;
const intervalMs = (drawIntervalHours*3600000)+(drawIntervalMinutes*60000);

// Проверка доступа
if(allowedPlayers !== "all" && !allowedPlayers.includes(userID)){
    btn.disabled = true;
    btn.textContent = "Нет доступа";
}else{
    const now = Date.now();
    const lastDraw = localStorage.getItem("tarotDrawTime_"+userID);
    const saved = localStorage.getItem("tarotCard_"+userID);

    if(lastDraw && now - lastDraw < intervalMs){
        btn.disabled = true;
        btn.textContent = "Карта уже вытянута";
        if(saved) result.innerHTML = saved;
        const remaining = intervalMs-(now-lastDraw);
        const remHours = Math.floor(remaining/3600000);
        const remMinutes = Math.ceil((remaining%3600000)/60000);
        result.innerHTML += `<br><small>Повторная попытка через ${remHours} ч. ${remMinutes} мин.</small>`;
    }

    btn.addEventListener('click',()=>{
        const random = tarotCards[Math.floor(Math.random()*tarotCards.length)];

        // HTML для отображения карты на экране с анимацией
        const cardHTML = `
<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;
            opacity:0;transform:scale(0.9) rotate(-3deg);
            animation: appearCard 1.5s ease forwards;">
  <b style="color:#cbbaff;">${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">${random.desc}</i>
</div>

<style>
@keyframes appearCard{
  0% {opacity:0; transform:scale(0.6) rotate(-10deg); filter:blur(8px);}
  50% {opacity:0.7; transform:scale(1.05) rotate(3deg); filter:blur(2px);}
  100% {opacity:1; transform:scale(1) rotate(0deg); filter:blur(0);}
}
</style>
`;

        // HTML для вставки в сообщение — с таким же оформлением
        const copyableHTML = `
<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;">
  <b style="color:#cbbaff;">${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">${random.desc}</i>
</div>
`;

        result.innerHTML = `
${cardHTML}<br>
<b>HTML-код для вставки в сообщение:</b><br>
<textarea style="width:100%;height:160px;">${copyableHTML}</textarea>
`;

        localStorage.setItem("tarotDrawTime_"+userID, now);
        localStorage.setItem("tarotCard_"+userID, result.innerHTML);
        btn.disabled = true;
        btn.textContent = "Карта получена";
    });
}
</script>[/html]

0

25

[html]<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;">
  <b style="color:#cbbaff;">Мир</b><br>
  <img src="https://i.imgur.com/ul6vR1e.jpg" alt="Мир" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">Завершение цикла, гармония и успех.</i>
</div>[/html]

0

26

[html]<div id="tarotContainer"></div>

<script>
const yourID = 57; // Ваш ID
const allowedPlayers = [yourID]; // или "all" для всех
const drawIntervalHours = 0;   // Часы
const drawIntervalMinutes = 0; // Минуты

const tarotCards = [
  { name: "Башня", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Резкие перемены. Разрушение старого ради нового." },
  { name: "Звезда", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Надежда, вдохновение, свет впереди." },
  { name: "Солнце", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Радость, успех и ясность в делах." },
  { name: "Луна", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Интуиция, сны, тайные страхи и желания." },
  { name: "Мир", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg", desc: "Завершение цикла, гармония и успех." }
];

// Создаем контейнер и кнопку
const container = document.getElementById('tarotContainer');
container.innerHTML = `
  <div style="width:100%;max-width:450px;margin:20px auto;padding:20px;border-radius:16px;
              background: radial-gradient(circle at top,#222 0%,#111 100%);
              box-shadow:0 0 20px rgba(0,0,0,0.7);text-align:center;color:#eee;font-family:'Trebuchet MS',sans-serif;">
    <h3 style="color:#c9b6ff;text-shadow:0 0 6px #9b7eff;">🌒 Твоя карта судьбы</h3>
    <button id="tarotButton" style="background:linear-gradient(90deg,#6b48ff,#3b2d80);
            color:white;border:none;padding:10px 20px;border-radius:10px;cursor:pointer;
            font-size:15px;transition:all 0.3s ease;box-shadow:0 0 10px rgba(155,126,255,0.4);">Вытянуть карту</button>
    <div id="tarotResult" style="margin-top:20px;font-size:14px;color:#ddd;
         background:rgba(0,0,0,0.4);border-radius:12px;padding:15px;
         box-shadow:inset 0 0 12px rgba(155,126,255,0.2);white-space:pre-line;position:relative;"></div>
  </div>
`;

const btn = document.getElementById('tarotButton');
const result = document.getElementById('tarotResult');
const userID = yourID;
const intervalMs = (drawIntervalHours*3600000)+(drawIntervalMinutes*60000);

// Проверка доступа
if(allowedPlayers !== "all" && !allowedPlayers.includes(userID)){
    btn.disabled = true;
    btn.textContent = "Нет доступа";
}else{
    const now = Date.now();
    const lastDraw = localStorage.getItem("tarotDrawTime_"+userID);
    const saved = localStorage.getItem("tarotCard_"+userID);

    if(lastDraw && now - lastDraw < intervalMs){
        btn.disabled = true;
        btn.textContent = "Карта уже вытянута";
        if(saved) result.innerHTML = saved;
        const remaining = intervalMs-(now-lastDraw);
        const remHours = Math.floor(remaining/3600000);
        const remMinutes = Math.ceil((remaining%3600000)/60000);
        result.innerHTML += `<br><small>Повторная попытка через ${remHours} ч. ${remMinutes} мин.</small>`;
    }

    btn.addEventListener('click',()=>{
        const random = tarotCards[Math.floor(Math.random()*tarotCards.length)];

        // Создаем эффект дыма/облака
        const smoke = document.createElement('div');
        smoke.style.position = 'absolute';
        smoke.style.top = '-20px';
        smoke.style.left = '50%';
        smoke.style.transform = 'translateX(-50%)';
        smoke.style.width = '280px';
        smoke.style.height = '280px';
        smoke.style.background = 'radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%)';
        smoke.style.borderRadius = '50%';
        smoke.style.filter = 'blur(10px)';
        smoke.style.animation = 'smokeMove 3s ease-out forwards';
        result.appendChild(smoke);

        // CSS-анимация для дыма
        const style = document.createElement('style');
        style.innerHTML = `
        @keyframes smokeMove {
            0% { transform: translateX(-50%) translateY(20px) scale(0.5); opacity:0.8; }
            50% { transform: translateX(-50%) translateY(-20px) scale(0.8); opacity:0.5; }
            100% { transform: translateX(-50%) translateY(-60px) scale(1.1); opacity:0; }
        }`;
        document.head.appendChild(style);

        // HTML для отображения карты на экране с анимацией
        const cardHTML = `
<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;
            opacity:0;transform:scale(0.9) rotate(-3deg);
            animation: appearCard 1.5s ease forwards;">
  <b style="color:#cbbaff;">${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">${random.desc}</i>
</div>

<style>
@keyframes appearCard{
  0% {opacity:0; transform:scale(0.6) rotate(-10deg); filter:blur(8px);}
  50% {opacity:0.7; transform:scale(1.05) rotate(3deg); filter:blur(2px);}
  100% {opacity:1; transform:scale(1) rotate(0deg); filter:blur(0);}
}
</style>
`;

        // HTML для вставки в сообщение — с тем же оформлением, без анимации
        const copyableHTML = `
<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgba(255,255,255,0.07);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;">
  <b style="color:#cbbaff;">${random.name}</b><br>
  <img src="${random.img}" alt="${random.name}" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">${random.desc}</i>
</div>
`;

        result.innerHTML = `
${cardHTML}<br>
<b>HTML-код для вставки в сообщение:</b><br>
<textarea style="width:100%;height:160px;">${copyableHTML}</textarea>
`;

        localStorage.setItem("tarotDrawTime_"+userID, now);
        localStorage.setItem("tarotCard_"+userID, result.innerHTML);
        btn.disabled = true;
        btn.textContent = "Карта получена";
    });
}
</script>[/html]

0

27

[html]<div style="text-align:center;margin:15px auto;padding:15px;border-radius:12px;
            background: rgb(0,0,0);box-shadow:0 0 12px rgba(155,126,255,0.3);
            width:260px;color:#eee;font-family:'Trebuchet MS',sans-serif;">
  <b style="color:#cbbaff;">Луна</b><br>
  <img src="https://upforme.ru/uploads/001c/84/76/2/735286.jpg" alt="Луна" style="width:200px;border-radius:8px;margin:8px 0;
       box-shadow:0 0 12px rgba(155,126,255,0.4);"><br>
  <i style="color:#ddd;">Интуиция, сны, тайные страхи и желания.</i>
</div>[/html]

0

28

[html]<div id="tarotContainer">
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<style>
  #tarotContainer {
    background: #111;
    color: #ddd;
    border: 2px solid #444;
    border-radius: 12px;
    padding: 15px;
    max-width: 400px;
    margin: 20px auto;
    text-align: center;
    font-family: 'Georgia', serif;
    box-shadow: 0 0 15px rgba(0,0,0,0.7);
  }
  #tarotButton {
    background: linear-gradient(135deg, #222, #444);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
  }
  #tarotButton:hover {
    background: linear-gradient(135deg, #333, #666);
  }
  #tarotButton:disabled {
    background: #222;
    color: #777;
    cursor: not-allowed;
  }
  #tarotResult {
    margin-top: 15px;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 14px;
    color: #ccc;
    word-break: break-word;
  }
</style>

<script>
(function() {
  const allowedIDs = [2, 5, 57]; // Разрешённые ID
  const btn = document.getElementById("tarotButton");
  const result = document.getElementById("tarotResult");

  // Пытаемся получить ID пользователя с форума Rusff
  let userID = 2;
  const userLink = document.querySelector('.pa-author a[href*="profile.php?id="]');
  if (userLink) {
    const match = userLink.href.match(/id=(\d+)/);
    if (match) userID = parseInt(match[1]);
  }

  // Проверка доступа
  if (!allowedIDs.includes(userID)) {
    btn.disabled = true;
    btn.textContent = "Нет доступа";
    return;
  }

  const intervalHours = 0;
  const intervalMinutes = 0;
  const intervalMs = (intervalHours * 60 + intervalMinutes) * 60000;

  const cards = [
    { title: "Башня", description: "Перемены и неожиданности.", img: "https://example.com/card1.jpg" },
    { title: "Солнце", description: "Успех, радость, ясность.", img: "https://example.com/card2.jpg" },
    { title: "Луна", description: "Тайны, интуиция, иллюзии.", img: "https://example.com/card3.jpg" }
  ];

  const now = Date.now();
  const lastDraw = localStorage.getItem("tarotDrawTime_" + userID);
  const saved = localStorage.getItem("tarotCard_" + userID);

  if (lastDraw && now - lastDraw < intervalMs) {
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
    if (saved) result.innerHTML = saved;
    return;
  }

  btn.addEventListener("click", () => {
    const card = cards[Math.floor(Math.random() * cards.length)];
    const html = `
      <div style="background:#111;border:1px solid #444;border-radius:10px;padding:10px;color:#ccc;text-align:center;">
        <b>${card.title}</b><br>
        <img src="${card.img}" alt="${card.title}" style="width:100%;max-width:150px;border-radius:6px;margin:8px 0;"><br>
        ${card.description}
      </div>
    `;
    result.innerHTML = html;
    localStorage.setItem("tarotDrawTime_" + userID, Date.now());
    localStorage.setItem("tarotCard_" + userID, html);
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
  });
})();
</script>[/html]

0

29

[html]<div id="tarotContainer">
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<style>
  #tarotContainer {
    background: #111;
    color: #ddd;
    border: 2px solid #444;
    border-radius: 12px;
    padding: 15px;
    max-width: 400px;
    margin: 20px auto;
    text-align: center;
    font-family: 'Georgia', serif;
    box-shadow: 0 0 15px rgba(0,0,0,0.7);
  }
  #tarotButton {
    background: linear-gradient(135deg, #222, #444);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
  }
  #tarotButton:hover {
    background: linear-gradient(135deg, #333, #666);
  }
  #tarotButton:disabled {
    background: #222;
    color: #777;
    cursor: not-allowed;
  }
  #tarotResult {
    margin-top: 15px;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 14px;
    color: #ccc;
    word-break: break-word;
  }
</style>

<script>
(function() {
  const allowedIDs = [2, 5, 57]; // Разрешённые ID
  const btn = document.getElementById("tarotButton");
  const result = document.getElementById("tarotResult");

  // Пытаемся получить ID пользователя с форума Rusff
  let userID = 0;
  const userLink = document.querySelector('.pa-author a[href*="profile.php?id="]');
  if (userLink) {
    const match = userLink.href.match(/id=(\d+)/);
    if (match) userID = parseInt(match[1]);
  }

  // Проверка доступа
  if (!allowedIDs.includes(userID)) {
    btn.disabled = true;
    btn.textContent = "Нет доступа";
    return;
  }

  const intervalHours = 0;
  const intervalMinutes = 0;
  const intervalMs = (intervalHours * 60 + intervalMinutes) * 60000;

  const cards = [
    { title: "Башня", description: "Перемены и неожиданности.", img: "https://example.com/card1.jpg" },
    { title: "Солнце", description: "Успех, радость, ясность.", img: "https://example.com/card2.jpg" },
    { title: "Луна", description: "Тайны, интуиция, иллюзии.", img: "https://example.com/card3.jpg" }
  ];

  const now = Date.now();
  const lastDraw = localStorage.getItem("tarotDrawTime_" + userID);
  const saved = localStorage.getItem("tarotCard_" + userID);

  if (lastDraw && now - lastDraw < intervalMs) {
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
    if (saved) result.innerHTML = saved;
    return;
  }

  btn.addEventListener("click", () => {
    const card = cards[Math.floor(Math.random() * cards.length)];
    const html = `
      <div style="background:#111;border:1px solid #444;border-radius:10px;padding:10px;color:#ccc;text-align:center;">
        <b>${card.title}</b><br>
        <img src="${card.img}" alt="${card.title}" style="width:100%;max-width:150px;border-radius:6px;margin:8px 0;"><br>
        ${card.description}
      </div>
    `;
    result.innerHTML = html;
    localStorage.setItem("tarotDrawTime_" + userID, Date.now());
    localStorage.setItem("tarotCard_" + userID, html);
    btn.disabled = true;
    btn.textContent = "Карта уже вытянута";
  });
})();
</script>[/html]

0

30

[html]<div id="tarotContainer">
  <button id="tarotButton">Вытянуть карту</button>
  <div id="tarotResult"></div>
</div>

<script>
// --- НАСТРОЙКИ ---
const allowedIDs = [2, 5, 57]; // кому можно вытягивать карты
const intervalHours = 0; // часы до следующей попытки
const intervalMinutes = 0; // минуты до следующей попытки
// -----------------

// Получаем ID пользователя с движка Rusff
let userID = 0;
try {
  if (typeof user_id !== "undefined" && user_id) {
    userID = parseInt(user_id);
  }
} catch (e) { userID = 0; }

const btn = document.getElementById("tarotButton");
const result = document.getElementById("tarotResult");

if (!allowedIDs.includes(userID)) {
  btn.disabled = true;
  btn.textContent = "Нет доступа";
  return;
}

const intervalMs = (intervalHours * 60 + intervalMinutes) * 60000;
const cards = [
  { title: "Башня", desc: "Резкие перемены. Разрушение старого ради нового.", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg" },
  { title: "Солнце", desc: "Радость, успех и ясность.", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg" },
  { title: "Луна", desc: "Интуиция и тайные страхи.", img: "https://upforme.ru/uploads/001c/84/76/2/735286.jpg" }
];

const now = Date.now();
const lastDraw = localStorage.getItem("tarotDrawTime_" + userID);
const saved = localStorage.getItem("tarotCard_" + userID);

if (lastDraw && now - lastDraw < intervalMs) {
  btn.disabled = true;
  btn.textContent = "Карта уже вытянута";
  if (saved) result.innerHTML = saved;
  const rem = intervalMs - (now - lastDraw);
  const h = Math.floor(rem / 3600000);
  const m = Math.ceil((rem % 3600000) / 60000);
  result.innerHTML += `<br><small>Повторная попытка через ${h} ч. ${m} мин.</small>`;
  return;
}

btn.addEventListener("click", () => {
  const card = cards[Math.floor(Math.random() * cards.length)];
  const cardHTML = `
    <div style="background:#111;border:1px solid #444;border-radius:12px;padding:12px;color:#ccc;text-align:center;">
      <b style="color:#cbbaff;">${card.title}</b><br>
      <img src="${card.img}" style="width:200px;border-radius:8px;margin:8px 0;"><br>
      <i>${card.desc}</i>
    </div>`;
  result.innerHTML = cardHTML;
  localStorage.setItem("tarotDrawTime_" + userID, now);
  localStorage.setItem("tarotCard_" + userID, cardHTML);
  btn.disabled = true;
  btn.textContent = "Карта уже вытянута";
});
</script>[/html]

0


Вы здесь » test » Тестовый форум » Тестовое сообщение


Рейтинг форумов | Создать форум бесплатно