MediaWiki:Gadget-ScrollUpButton.js:修订间差异

删除的内容 添加的内容
图标 URL 改回动态获取
修复: 对象展开语法兼容性(改用$.extend) + 图标路径改为动态获取(wgServer)
标签已被回退
第14行:
$('html, body').stop(true, true).animate({ scrollTop: h }, 500);
}
 
var baseCss = {
display: 'none',
position: 'fixed',
right: '18px',
cursor: 'pointer',
opacity: '0.7',
width: '40px',
zIndex: 9999,
'-moz-user-select': 'none',
'-webkit-user-select': 'none',
'user-select': 'none',
transition: 'opacity 0.2s'
};
 
function makeBtn(id, onClick, extraCss) {
var css = $.extend({}, baseCss, extraCss);
display: 'none',
position: 'fixed',
right: '18px',
cursor: 'pointer',
opacity: '0.7',
width: '40px',
zIndex: 9999,
'-moz-user-select': 'none',
'-webkit-user-select': 'none',
'user-select': 'none',
transition: 'opacity 0.2s'
}, extraCss);
 
return $('<img>')
.addClass('noprint')
第66行 ⟶ 第65行:
 
if (isVector2022) {
try {
try { mql.addEventListener('change', onWidthChange); }
catch (_) { mql.addListeneraddEventListener('change', onWidthChange); }
} catch (_) {
try { mql.addEventListeneraddListener('change', onWidthChange); }
};
onWidthChange(mql);
}
第73行 ⟶ 第75行:
function onScroll() {
var y = $window.scrollTop() || 0;
 
if (y > 200 && !visible) {
visible = true;
第80行 ⟶ 第83行:
$elements.fadeOut(300);
}
 
if (
(mw.config.get('wgGEHelpPanelEnabled') && $('#mw-ge-help-panel-cta-button').length) ||
$('#cat_a_lot').length || $('#proveit').length || $('.wordcount').length
$('#proveit').length ||
$('.wordcount').length
) {
setLeft(10);
第93行 ⟶ 第99行:
$window.on('scroll', function () {
if (!ticking) {
requestAnimationFrame(function () { onScroll(); ticking = false; });
onScroll();
ticking = false;
});
ticking = true;
}
});
 
onScroll();
});