Greasy Fork

Greasy Fork is available in English.

Backloggd ➜ Botones: Gameplay YouTube + HowLongToBeat

Añade botones de gameplay en YouTube y duración en HowLongToBeat en el sidebar de Backloggd

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Backloggd ➜ Botones: Gameplay YouTube + HowLongToBeat
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Añade botones de gameplay en YouTube y duración en HowLongToBeat en el sidebar de Backloggd
// @match        https://backloggd.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const insertButtons = () => {
        const titleEl = document.querySelector('h1');
        const sidebar = document.querySelector('.side-section');

        if (!titleEl || !sidebar) return;

        const gameTitle = titleEl.textContent.trim();
        const ytId = 'yt-gameplay-button';
        const hltbId = 'hltb-button';

        // Evitar insertar duplicados
        if (!document.getElementById(ytId)) {
            const ytButton = document.createElement('a');
            ytButton.id = ytId;
            ytButton.href = `https://www.youtube.com/results?search_query=gameplay+${encodeURIComponent(gameTitle)}`;
            ytButton.textContent = 'Gameplay';
            ytButton.target = '_self';
            ytButton.className = 'btn btn-main mx-auto mt-2';
            ytButton.style.display = 'block';
            ytButton.style.width = '100%';
            sidebar.appendChild(ytButton);
        }

        if (!document.getElementById(hltbId)) {
            const hltbButton = document.createElement('a');
            hltbButton.id = hltbId;
            hltbButton.href = `https://howlongtobeat.com/?q=${encodeURIComponent(gameTitle)}`;
            hltbButton.textContent = 'Duración';
            hltbButton.target = '_self';
            hltbButton.className = 'btn btn-main mx-auto mt-2';
            hltbButton.style.display = 'block';
            hltbButton.style.width = '100%';
            sidebar.appendChild(hltbButton);
        }
    };

    // Insertar botones cada medio segundo (solo si no existen aún)
    setInterval(insertButtons, 500);
})();