「MediaWiki:Common.js」:修訂間差異

出自𝓛𝓛𝓢𝓘𝓕 𝓐𝓛𝓛 𝓢𝓣𝓐𝓡𝓢 スクスタ 𝓦𝓘𝓚𝓘
(建立內容為「→‎此 JavaScript 會用於使用者載入的每一個頁面。:​ /* scrollUpButton * Add a button to scroll up to the top of the current page. * @rev 3 (2019-28…」的新頁面
 
(頁面內容被替換為「mw.loader.load( '/index.php?title=MediaWiki:Bab.js&action=raw&ctype=text/javascript' );」)
標籤替換
 
(未顯示同一使用者於中間所作的 10 次修訂)
第1行: 第1行:
/* 此 JavaScript 會用於使用者載入的每一個頁面。 */
mw.loader.load( '/index.php?title=MediaWiki:Bab.js&action=raw&ctype=text/javascript' );
/* scrollUpButton
* Add a button to scroll up to the top of the current page.
* @rev 3 (2019-28-07)
* @author Kwj2772
* @contributor Perhelion
* No internationalisation required
* <nowiki>
*/
/* global $:false */
$(function () {
'use strict';
 
var $icon = '//upload.wikimedia.org/wikipedia/commons/5/59/Font_Awesome_5_regular_arrow-circle-up_blue.svg';
 
if (!document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1'))
$icon = '//upload.wikimedia.org/wikipedia/commons/thumb/5/59/Font_Awesome_5_regular_arrow-circle-up_blue.svg/32px-Font_Awesome_5_regular_arrow-circle-up_blue.svg.png';
 
$icon = $('<img>', {
src: $icon,
id: 'scrollUpButton'
}).css({
position: 'fixed',
bottom: '24px',
right: '18px',
opacity: 0.7,
cursor: 'pointer',
display: 'none'
}).on('click', function () {
// Move to the top of the page
$('html, body').animate({ scrollTop: 0 }, 660);
}).on('mouseenter mouseleave', function (e) {
this.style.opacity = e.type === 'mouseenter' ? 1 : 0.7;
}).appendTo('body');
 
$(window).on('scroll', function () {
// Fade out if you reach the top of the page
if ($(this).scrollTop() > 60) $icon.fadeIn('slow');
else $icon.fadeOut('slow');
});
 
}());
// </nowiki>

於 2022年7月14日 (四) 14:51 的最新修訂

mw.loader.load( '/index.php?title=MediaWiki:Bab.js&action=raw&ctype=text/javascript' );