查看“MediaWiki:Gadget-ScrollUpButton.js”的源代码
←
MediaWiki:Gadget-ScrollUpButton.js
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
该页提供此wiki软件的界面文字,它已被保护以防止恶意修改。如欲修改所有wiki的翻译,请到
translatewiki.net
上的MediaWiki本地化计划。
您可以查看与复制此页面的源代码。
/* * @name ScrollUpButton * @desc Add a button to scroll up to the top of the current page. * @rev 3 (2019-28-07) * @fork fandom-zhcc-1 (2021-06-14) * @author Kwj2772 * @contributor Perhelion * @contributor [wikipedia:ko:] Ykhwong * @contributor [wikipedia:zh:] AnYiLin * @contributor [wikia:zh:] Winston Sung * * No internationalisation required * * [kowiki] Fixed an issue with help-panel-button. (wikipedia:ko:User:Ykhwong) * [zhwiki] Add a timer to autohide button, check more gadgets. Add scrollDownButton. * [fandom-zhcc] Adding compatibility with Toolbar/QuickBar. (wikia:zh:User:Winston Sung) * * @from https://ko.wikipedia.org/?oldid=25440719 * @zhwikipedia_maintainer 安忆 (wikipedia:zh:User:AnYiLin) * @fandom-zhcc Winston Sung (wikia:zh:User:Winston Sung) */ (function($, mw) { var scrollDownButtonId = 'scrollDownButton', scrollUpButtonId = 'scrollUpButton'; if (mw.config.get('wgServerName').match(/wikimirror\.org$/)) { scrollDownButtonId += '-zhwiki'; scrollUpButtonId += '-zhwiki' } var scrollButtonIcon = '//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')) scrollButtonIcon = '//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'; $scrollDownButton = $('<img>', { src: scrollButtonIcon, id: scrollDownButtonId }).css({ cursor: 'pointer', opacity: 0.7, position: 'fixed', display: 'none', right: '18px', transform: 'rotate(180deg)', '-webkit-transform': 'rotate(180deg)', '-moz-transform': 'rotate(180deg)', '-o-transform': 'rotate(180deg)', '-ms-transform': 'rotate(180deg)' }).on('click', function() { $('html, body').animate({ scrollTop: $(document).height() - $(window).height() }, 660) }).on('mouseenter mouseleave', function(e) { this.style.opacity = e.type === 'mouseenter' ? 1 : 0.7 }).appendTo('body'); $scrollUpButton = $('<img>', { src: scrollButtonIcon, id: scrollUpButtonId }).css({ cursor: 'pointer', opacity: 0.7, position: 'fixed', display: 'none', right: '18px' }).on('click', function() { $('html, body').animate({ scrollTop: 0 }, 660) }).on('mouseenter mouseleave', function(e) { this.style.opacity = e.type === 'mouseenter' ? 1 : 0.7 }).appendTo('body'); var scrollButtonTimer; $(window).on('scroll', function() { var dingHeight = $('#bluedeck_ding>div').height() ? $('#bluedeck_ding>div').height() : 0; $('#mw-ge-help-panel-cta-button').length > 0 ? $scrollDownButton.css('bottom', dingHeight + 75 + 'px') && $scrollUpButton.css('bottom', dingHeight + 116 + 'px') : $('.skin-fandomdesktop').length > 0 ? $scrollDownButton.css('bottom', dingHeight + 54 + 'px') && $scrollUpButton.css('bottom', dingHeight + 95 + 'px') : $scrollDownButton.css('bottom', dingHeight + 24 + 'px') && $scrollUpButton.css('bottom', dingHeight + 65 + 'px'); $('#cat_a_lot').length > 0 || $('#proveit').length > 0 || $('.wordcount').length > 0 ? $scrollDownButton.css('left', '10px') && $scrollUpButton.css('left', '10px') : $scrollDownButton.css('left', 'unset') && $scrollUpButton.css('left', 'unset'); $(this).scrollTop() > 60 ? $scrollDownButton.fadeIn('slow') && $scrollUpButton.fadeIn('slow') : $scrollDownButton.fadeOut('slow') && $scrollUpButton.fadeOut('slow'); this.clearTimeout(scrollButtonTimer); scrollButtonTimer = this.setTimeout(function() { $scrollDownButton.fadeOut('slow'); $scrollUpButton.fadeOut('slow') }, 2000) }); $scrollDownButton.on('mouseenter', function() { window.clearTimeout(scrollButtonTimer) }); $scrollUpButton.on('mouseenter', function() { window.clearTimeout(scrollButtonTimer) }) })(jQuery, mw);
返回至
MediaWiki:Gadget-ScrollUpButton.js
。
导航菜单
个人工具
登录
名字空间
消息
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
随机页面
最近更改
最新文件
常用
上传多个文件
工具
链入页面
相关更改
特殊页面
页面信息