Greasy Fork

Greasy Fork is available in English.

Fix "Show Another Film" Position

Positions the "Show Another Film" link on Criticker.com statically above the cover image of the Top Recommendation.

当前为 2024-11-16 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Fix "Show Another Film" Position
// @namespace    http://tampermonkey.net/
// @version      2024-11-16
// @description  Positions the "Show Another Film" link on Criticker.com statically above the cover image of the Top Recommendation.
// @author       Alsweider
// @match        https://www.criticker.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=criticker.com
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    //Funktion, um den Link zu fixieren
    const fixLinkPosition = () => {
        const linkDiv = document.getElementById('rc_toprec_nextdiv'); //"Show Another Film"-Link
        const mainRecDiv = document.getElementById('rc_mainrec'); //Hauptdiv mit der Top Recommendation
        const topRecHeader = mainRecDiv?.querySelector('h2'); //Überschrift der Top Recommendation

        if (linkDiv && mainRecDiv && topRecHeader) {
            //Prüfen, ob der Link bereits verschoben wurde
            if (linkDiv.parentElement !== mainRecDiv) {
                //Link an die richtige Stelle verschieben (direkt unter die Überschrift)
                mainRecDiv.insertBefore(linkDiv, topRecHeader.nextSibling);

                //Link stylisieren, falls nötig
                linkDiv.style.marginTop = '10px'; //Abstandsregelung
                linkDiv.style.marginBottom = '10px';
            }
        }
    };

    //MutationObserver, um Änderungen auf der Seite zu verfolgen
    const observer = new MutationObserver(() => {
        fixLinkPosition();
    });

    //Beobachte Änderungen im Body
    observer.observe(document.body, { childList: true, subtree: true });

    //Initiales Fixieren des Links
    window.addEventListener('load', fixLinkPosition);
})();