“MediaWiki:Gadget-LetYouDown.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
1个标签由机器人或全自动脚本执行的操作
1个标签由机器人或全自动脚本执行的操作
 
第4行: 第4行:
 
  * -------------------------------------------------------------------------
 
  * -------------------------------------------------------------------------
 
  */
 
  */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/LetYouDown/MediaWiki:Gadget-LetYouDown.js|user=[[U:AnnAngela]]|co-authors=|longId=7fa442f9d53de0e1c150a588bf8612eb4b6d3abd|shortId=7fa442f|summary=refactor: prefer arrow function}}';  
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/LetYouDown/MediaWiki:Gadget-LetYouDown.js|user=[[U:AnnAngela]]|co-authors=|longId=7fa442f9d53de0e1c150a588bf8612eb4b6d3abd|shortId=7fa442f9|summary=refactor: prefer arrow function}}';  
  
 
/* <pre> */
 
/* <pre> */

2024年4月16日 (二) 08:51的最新版本

/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/LetYouDown/MediaWiki:Gadget-LetYouDown.js|user=[[U:AnnAngela]]|co-authors=|longId=7fa442f9d53de0e1c150a588bf8612eb4b6d3abd|shortId=7fa442f9|summary=refactor: prefer arrow function}}'; 

/* <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> */