☰

MissAV Video Seek Controls

New buttons to MissAV players.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu budete musieť nainštalovať rozšírenie, ako je napríklad Tampermonkey alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         MissAV Video Seek Controls
// @icon         https://i.ytimg.com/vi/dFZI0oMybkM/hqdefault.jpg
// @namespace    Stevie B
// @version      1.5
// @license      CC-BY-NC-SA-4.0
// @description  New  buttons to MissAV players.
// @author       Stevie B
// @match        *://missav.ws/*
// @match        *://missav.live/*
// @match        *://missav.fans/*
// @match        *://missav123.com/*
// @match        *://missav.ai/*
// @match        *://missav.com/*
// @match        *://missav.media/*
// @description  Replaces native MissAV seek controls with tightly spaced, precisely centered rewind, play, and forward controls.*
// @run-at       document-idle
// @grant        none
// ==/UserScript==

(() => {
  'use strict';

  const controlsClass = 'mv-controls';
  const steps = [300, 60, 10];
  const label = seconds => seconds === 300 ? '5m' : seconds === 60 ? '1m' : '10s';
  const icon = (backward, doubleArrow) => {
    const path = backward
      ? (doubleArrow ? 'M17 1 10 7l7 6M10 1 3 7l7 6' : 'M13.5 1 6.5 7l7 6')
      : (doubleArrow ? 'M3 1l7 6-7 6M10 1l7 6-7 6' : 'M6.5 1l7 6-7 6');
    return `<svg viewBox="0 0 20 14" aria-hidden="true"><path d="${path}"/></svg>`;
  };

  const makeSeekButton = (player, seconds) => {
    const backward = seconds < 0;
    const text = label(Math.abs(seconds));
    const button = document.createElement('button');
    button.type = 'button';
    button.className = `mv-button mv-seek ${backward ? 'mv-back' : 'mv-forward'}`;
    button.title = `${backward ? 'Rewind' : 'Forward'} ${text}`;
    // Both directions use equal, fixed cells. This keeps the label and chevrons
    // optically centered with no direction-specific text drift.
    button.innerHTML = backward
      ? `${icon(true, text === '5m')}<span>${text}</span>`
      : `<span>${text}</span>${icon(false, text === '5m')}`;
    button.addEventListener('click', event => {
      event.stopPropagation();
      const video = player.querySelector('video');
      if (video) video.currentTime = Math.max(0, Math.min(video.duration || Infinity, video.currentTime + seconds));
    });
    return button;
  };

  const makePlayButton = player => {
    const video = player.querySelector('video');
    const button = document.createElement('button');
    button.type = 'button';
    button.className = 'mv-button mv-play';
    button.title = button.ariaLabel = 'Play / Pause';
    button.innerHTML = '<i aria-hidden="true"></i>';
    const sync = () => button.classList.toggle('is-playing', !video.paused);
    button.addEventListener('click', event => {
      event.stopPropagation();
      video.paused ? video.play() : video.pause();
    });
    video.addEventListener('play', sync);
    video.addEventListener('pause', sync);
    sync();
    return button;
  };

  const install = () => document.querySelectorAll('.plyr').forEach(player => {
    const nativeControls = player.querySelector('.plyr__controls');
    if (!nativeControls || !player.querySelector('video') || nativeControls.querySelector(`.${controlsClass}`)) return;
    const bar = document.createElement('div');
    bar.className = controlsClass;
    bar.setAttribute('aria-label', 'Video controls');
    steps.forEach(seconds => bar.append(makeSeekButton(player, -seconds)));
    bar.append(makePlayButton(player));
    steps.slice().reverse().forEach(seconds => bar.append(makeSeekButton(player, seconds)));
    nativeControls.insertBefore(bar, nativeControls.querySelector('.plyr__progress__container') || nativeControls.firstChild);
  });

document.head.append(Object.assign(document.createElement('style'), { textContent: `
    .plyr__controls [data-plyr="rewind"], .plyr__controls [data-plyr="play"], .plyr__controls [data-plyr="fast-forward"] { display: none !important; }
    .plyr__controls .${controlsClass} { display: flex; align-items: center; gap: 2.5px; flex: none; margin: 0 7px 0 3px; }
    .plyr__controls .mv-button { box-sizing: border-box; display: flex; align-items: center; justify-content: center; width: 44px; height: 34px; padding: 0; border: 2px solid currentColor; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; font: 900 12px/1 system-ui, sans-serif; letter-spacing: -.5px; }
    .plyr__controls .mv-button:hover, .plyr__controls .mv-button:focus-visible { background: #ffffff29; outline: 0; }
    .plyr__controls .mv-button:active { transform: scale(.95); }
    .plyr__controls .mv-seek { gap: 0px; }
    .plyr__controls .mv-seek span { display: inline-flex; align-items: center; justify-content: center; min-width: 13px; height: 14px; text-align: center; font-weight: 900; line-height: 1; }
    .plyr__controls .mv-seek svg { display: block; width: 17px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3.8; stroke-linecap: round; stroke-linejoin: round; }
    .plyr__controls .mv-back span { transform: translateY(-0.2px) translateX(-1.5px); }
    .plyr__controls .mv-forward span { transform: translateY(-0.2px) translateX(0.2px); }
    .plyr__controls .mv-back[title*="10s"] span { transform: translateY(-0.2px) translateX(-2.5px); }
    .plyr__controls .mv-play { width: 34px; }
    .plyr__controls .mv-play i { width: 0; height: 0; margin-left: 3px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 12px solid currentColor; }
    .plyr__controls .mv-play.is-playing i { width: 12px; height: 15px; margin-left: 0; border: 0; border-left: 4.5px solid currentColor; border-right: 4.5px solid currentColor; }
    @media (max-width: 850px) { .plyr__controls .${controlsClass} { gap: 1.5px; margin: 0 4px; } .plyr__controls .mv-button { width: 39px; height: 30px; font-size: 10px; } .plyr__controls .mv-play { width: 30px; } }
  ` }));


  install();
  let remainingAttempts = 30;
  const retry = setInterval(() => {
    install();
    if (!--remainingAttempts) clearInterval(retry);
  }, 500);
})();