TamperGuide

Lightweight library for product tours, highlights, and contextual help in Tampermonkey userscripts. Inspired by driver.js, designed for the userscript ecosystem. Zero dependencies, Auto-injects CSS, Sandbox-compatible

Este script no debería instalarse directamente. Es una biblioteca que utilizan otros scripts mediante la meta-directiva de inclusión // @require https://update.greasyfork.org/scripts/567414/1761553/TamperGuide.js

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

You will need to install an extension such as Tampermonkey to install this script.

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

Autor
UNKchr
Versión
1.4.1
Creado
25/02/2026
Actualizado
25/02/2026
Tamaño
46.5 KB
Licencia
MIT

TamperGuide

Lightweight library for product tours, highlights, and contextual help in Tampermonkey userscripts.

Inspired by driver.js, designed specifically for the userscript ecosystem.

  • Zero dependencies
  • Auto-injects CSS (no external stylesheets)
  • Compatible with Tampermonkey sandbox
  • Clear developer-facing error messages
  • Exhaustive configuration validation
  • Fault-tolerant (handles missing elements, dynamic DOM, SPAs)
  • Keyboard navigation (arrows, Tab, Escape)
  • SVG-based overlay (no z-index stacking issues)

Installation

Option A: @require from https://www.jsdelivr.com (recommended)

// @require https://cdn.jsdelivr.net/gh/UNKchr/tamperguide@f106cd219d37c7c9d362a896b28ef0ca6cfd8aab/tamperguide/tamperGuide.js

Option B: @require from Greasy Fork

// @require https://update.greasyfork.org/scripts/567414/1761172/TamperGuide.js

Option C: @require from GitHub Raw

// @require https://raw.githubusercontent.com/UNKchr/tamperguide/refs/heads/main/tamperguide/tamperGuide.js

Quick Start

// ==UserScript==
// @name         My Tour Script
// @match        https://example.com/*
// @require      // @require https://update.greasyfork.org/scripts/567414/1761172/TamperGuide.js
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  const guide = tamperGuide({
    showProgress: true,
    steps: [
      {
        element: 'h1',
        popover: {
          title: 'Page Title',
          description: 'This is the main heading of the page.',
          side: 'bottom',
        },
      },
      {
        element: 'nav',
        popover: {
          title: 'Navigation',
          description: 'Use these links to explore sections.',
          side: 'bottom',
        },
      },
      {
        popover: {
          title: 'Tour Complete!',
          description: 'You are now familiar with this page.',
        },
      },
    ],
  });

  guide.drive();
})();

Highlight a Single Element

const guide = tamperGuide();

guide.highlight({
  element: '#search-input',
  popover: {
    title: 'Search',
    description: 'Type here to find anything.',
    side: 'bottom',
  },
});

Configuration Options

Option Type Default Description
steps Array [] Array of step objects
animate boolean true Enable/disable animations
overlayColor string '#000' Overlay background color
overlayOpacity number 0.7 Overlay opacity (0–1)
stagePadding number 10 Padding around highlighted element (px)
stageRadius number 5 Border radius of highlight cutout (px)
allowClose boolean true Allow closing via Escape/overlay click
allowKeyboardControl boolean true Arrow keys / Tab navigation
showProgress boolean false Show "1 of 5" progress text
showButtons Array ['next','previous','close'] Which buttons to display
progressText string '{{current}} of {{total}}' Progress text template
nextBtnText string 'Next →' Next button label
prevBtnText string '← Previous' Previous button label
doneBtnText string 'Done ✓' Done button label (last step)
popoverClass string '' Extra CSS class for the popover
popoverOffset number 10 Distance between popover and element (px)
smoothScroll boolean true Smooth scroll to off-screen elements
disableActiveInteraction boolean false Block clicks on highlighted element

Step Object

{
  element: '#my-el',           // CSS selector, function, or DOM Element
  popover: {
    title: 'Title',            // String or DOM Element
    description: 'Text',       // String or DOM Element (supports HTML)
    side: 'bottom',            // 'top' | 'right' | 'bottom' | 'left' (auto if omitted)
    align: 'center',           // 'start' | 'center' | 'end'
    showProgress: true,        // Override global showProgress
    showButtons: ['next'],     // Override global showButtons
  },
  onHighlightStarted: (el, step, opts) => {},
  onHighlighted:      (el, step, opts) => {},
  onDeselected:       (el, step, opts) => {},
}

Hooks

All hooks receive (element, step, { config, state, driver }):

Hook Scope Description
onHighlightStarted Global / Step Fires when a step begins highlighting
onHighlighted Global / Step Fires after the step is fully visible
onDeselected Global / Step Fires when leaving a step
onDestroyStarted Global Fires before destroy — return false to cancel
onDestroyed Global Fires after full cleanup
onNextClick Global / Step Fires on next click — return false to cancel
onPrevClick Global / Step Fires on prev click — return false to cancel
onCloseClick Global / Step Fires on close click — return false to cancel
onPopoverRender Global / Step Fires after popover DOM is created

API Methods

Method Description
guide.drive(index?) Start tour (optionally from a step index)
guide.highlight(step) Highlight a single element
guide.moveNext() Go to next step
guide.movePrevious() Go to previous step
guide.moveTo(index) Jump to specific step
guide.hasNextStep() Returns boolean
guide.hasPreviousStep() Returns boolean
guide.isActive() Returns boolean
guide.isFirstStep() Returns boolean
guide.isLastStep() Returns boolean
guide.getActiveIndex() Current step index
guide.getActiveStep() Current step object
guide.getActiveElement() Current highlighted element
guide.setConfig(config) Update configuration
guide.setSteps(steps) Replace all steps
guide.getConfig(key?) Get config (or specific key)
guide.getState(key?) Get internal state
guide.refresh() Recalculate positions
guide.destroy() Clean up everything

Keyboard Shortcuts

Key Action
/ Tab Next step
/ Shift+Tab Previous step
Escape Close tour

License

MIT © UNKchr