Back To Top / Elevator Button -- Fandom Wiki

Adds a Back To Top / Elevator button for those pesky long pages.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Back To Top / Elevator Button -- Fandom Wiki
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a Back To Top / Elevator button for those pesky long pages. 
// @author       cass_per
// @match        https://*.fandom.com/wiki/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=fandom.com
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

var kiddo = document.body.getElementsByClassName("main-container")[0];

var newElement = document.createElement('div');
newElement.id = "backTop";

newElement.innerHTML = '<a href="#">Back To Top</a>';


//GM_addStyle() not by me!!
function GM_addStyle(css) {
  const style = document.getElementById("GM_addStyleBy8626") || (function() {
    const style = document.createElement('style');
    style.type = 'text/css';
    style.id = "GM_addStyleBy8626";
    document.head.appendChild(style);
    return style;
  })();
  const sheet = style.sheet;
  sheet.insertRule(css, (sheet.rules || sheet.cssRules || []).length);
}

GM_addStyle("#backTop { position:fixed; bottom:4em; right:0; z-index:2000; background: var(--fandom-global-nav-background-color); width: fit-content; padding: 5px; border: 3px solid var(--fandom-accent-color); }");


document.body.insertBefore(newElement, kiddo);