MediaWiki:Gadget-LetYouDown.js

萌娘百科,萬物皆可萌的百科全書!轉載請標註來源頁面的網頁連結,並聲明引自萌娘百科。內容不可商用。
貢獻者:

注意:在您儲存之後您必須清除瀏覽器快取才可看到最新的變動。

  • Firefox / Safari:按住「Shift」時點選「重新整理」,或按「Ctrl-F5」或「Ctrl-R」 (Mac則為「⌘-R」)
  • Google Chrome:按「Ctrl-Shift-R」 (Mac 則為「⌘-Shift-R」)
  • Internet Explorer:按住「Ctrl」時點選「重新整理」,或按「Ctrl-F5」
  • Opera:進入「工具→偏好設定」中清除快取。
  • 如果您已登入但該頁面出現未登入狀態,請嘗試在網址列的URL最後新增代碼?_=1來訪問最新頁面。
萌娘百科界面管理員團隊提醒您
大萌字-InterfaceAdmin.png
本頁面由萌娘百科界面管理員團隊在其 GitHub 庫內進行維護,通過機器人自動生成可被 MediaWiki Gadget 擴展接受的版本並保存到此處。
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com>
如果您有任何意見或建議,建議您到技術實現版提出。
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/LetYouDown/Gadget-LetYouDown.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=103d1a563ea4ccc8ff29fb55c9bcd88329a56eb5|shortId=103d1a56|summary=feat: rename (#594)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; 

/* <pre> */

"use strict";
$(function () {
    var container = $("#mw-content-text");
    var getScrollTop = function () {
        var headings = $("#mw-content-text .mw-parser-output > :is(h1, h2)");
        return (headings.length >= 3 ? headings.last().offset().top : container.offset().top + container.outerHeight()) - 20;
    };
    var scrollTop = getScrollTop();
    setInterval(function () {
        scrollTop = getScrollTop();
    }, 7130);
    var btn = insertToBottomRightCorner("跳到底部").attr({
        title: "跳到底部",
        id: "LetYouDown"
    }).css({
        "user-select": "none",
        transition: "opacity .13s ease-in-out",
        order: "999"
    }).on("click", function () {
        $("html, body").animate({
            scrollTop: scrollTop
        }, 130);
    });
    var $document = $(document);
    $(window).on("resize", function () {
        scrollTop = getScrollTop();
    }).on("scroll", function () {
        btn.css("opacity", $document.scrollTop() < scrollTop ? ".6" : "0");
    }).trigger("scroll");
}); 

/* </pre> */
此頁面最後編輯於 2025年1月21日 (週二) 11:49。
有新的未讀公告