“MediaWiki:Common.js”的版本间的差异
跳到导航
跳到搜索
(创建页面,内容为“→这里的任何JavaScript将为所有用户在每次页面载入时加载。: $(self.document).ready(function () { function Event_Break() { return false; }…”) |
|||
| (未显示同一用户的8个中间版本) | |||
| 第14行: | 第14行: | ||
'-webkit-touch-callout': 'none' | '-webkit-touch-callout': 'none' | ||
}).bind('selectStart', Event_Break).bind('contextmenu', Event_Break); | }).bind('selectStart', Event_Break).bind('contextmenu', Event_Break); | ||
}); | |||
// 官方文档:添加MediaWiki:Common.js: | |||
function waitForMathJax($content) { | |||
if (typeof MathJax === 'undefined') { | |||
setTimeout(function () { waitForMathJax($content); }, 1000); | |||
} else { | |||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute(); | |||
} | |||
} | |||
mw.hook('wikipage.content').add(waitForMathJax); | |||
/* | |||
$(document).ready(function(){ | |||
//首先将#back-to-top隐藏 | |||
$("#back-to-top").hide(); | |||
//当滚动条的位置处于距顶部600像素以下时,跳转链接出现,否则消失 | |||
$(function () { | |||
$(window).scroll(function(){ | |||
if ($(window).scrollTop()>600){ | |||
$("#back-to-top").fadeIn(500); | |||
}else{ | |||
$("#back-to-top").fadeOut(500); | |||
} | |||
}); | |||
//当点击跳转链接后,回到页面顶部位置 | |||
$("#back-to-top").click(function(){ | |||
$('body,html').animate({scrollTop:0},500); | |||
return false; | |||
}); | |||
}); | |||
}); | |||
*/ | |||
//悬停的卡片 | |||
function qxmgTip(){ | |||
$(document).on('mouseover','.j-qxmgtip',function(){ | |||
$tip = $(this).find('.mgtip-tip'); | |||
$tip.show(); | |||
//修复图片不加载 | |||
$(window).scrollTop($(window).scrollTop()-1).scrollTop($(window).scrollTop()+1); | |||
$(this).on('mousemove',function(e){ | |||
var _oleft = $(this).offset().left, | |||
_otop = $(this).offset().top, | |||
_wt = $(window).scrollTop() + $(window).outerHeight(), | |||
_wl = $(window).scrollLeft() + $(window).outerWidth(), | |||
_left = e.pageX - _oleft + 15, | |||
_top = e.pageY - _otop + 15, | |||
_targetWidth = $tip.outerWidth(), | |||
_targetHeight = $tip.outerHeight(); | |||
if( _left + _oleft + _targetWidth > _wl ){ | |||
_left -= _targetWidth + 30; | |||
} | |||
if( _top + _otop + _targetHeight > _wt ){ | |||
_top -= _targetHeight + 30; | |||
} | |||
$tip.css({ | |||
left: _left, | |||
top: _top | |||
}); | |||
}); | |||
$(this).on('mouseout',function(){ | |||
$tip.hide(); | |||
$(this).off('mousemove').off('mouseout'); | |||
}); | |||
}); | |||
} | |||
$(document).ready(function() { | |||
setInterval('AutoScroll("#scrollDiv")',5000); | |||
//图片载入效果 | |||
$('img').on('appear', function(e){ | |||
var that = $(this); | |||
that.css('opacity',0); | |||
setTimeout(function(){ | |||
that.css('transition','opacity 1s').css('opacity',1); | |||
}, 1); | |||
}); | |||
//End of 图片载入效果 | |||
//悬停的卡片 | |||
qxmgTip(); | |||
}); | |||
var snowId = document.getElementById("footer"); | |||
var solfId = document.createElement("a"); | |||
solfId.setAttribute("id","gotop"); | |||
solfId.setAttribute("title","回到顶部"); | |||
snowId.appendChild(solfId); | |||
function goTop(){ | |||
$(window).scroll(function(e) { | |||
//若滚动条离顶部大于200元素 | |||
if($(window).scrollTop()>200) | |||
$("#gotop").fadeIn(100);//以1秒的间隔渐显id=gotop的元素 | |||
else | |||
$("#gotop").fadeOut(100);//以1秒的间隔渐隐id=gotop的元素 | |||
}); | |||
}; | |||
$(function(){ | |||
//点击回到顶部的元素 | |||
$("#gotop").click(function(e) { | |||
//以1秒的间隔返回顶部 | |||
$('body,html').animate({scrollTop:0},100); | |||
}); | |||
$("#gotop").mouseover(function(e) { | |||
$(this).css("background","url(/images/backtop.gif) no-repeat 0px -100px"); | |||
}); | |||
$("#gotop").mouseout(function(e) { | |||
$(this).css("background","url(/images/backtop.gif) no-repeat 0px 0px"); | |||
}); | |||
goTop();//实现回到顶部元素的渐显与渐隐 | |||
}); | }); | ||
2022年4月28日 (四) 23:10的最新版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
$(self.document).ready(function () {
function Event_Break() { return false; }
$(
'button, .No_Select'
).attr('unSelectable', 'on').css({
'-moz-user-select': '-moz-none',
'-khtml-user-select': 'none',
'-webkit-user-select': 'none',
'-o-user-select': 'none',
'-ms-user-select': 'none',
'user-select': 'none',
'-webkit-touch-callout': 'none'
}).bind('selectStart', Event_Break).bind('contextmenu', Event_Break);
});
// 官方文档:添加MediaWiki:Common.js:
function waitForMathJax($content) {
if (typeof MathJax === 'undefined') {
setTimeout(function () { waitForMathJax($content); }, 1000);
} else {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
}
}
mw.hook('wikipage.content').add(waitForMathJax);
/*
$(document).ready(function(){
//首先将#back-to-top隐藏
$("#back-to-top").hide();
//当滚动条的位置处于距顶部600像素以下时,跳转链接出现,否则消失
$(function () {
$(window).scroll(function(){
if ($(window).scrollTop()>600){
$("#back-to-top").fadeIn(500);
}else{
$("#back-to-top").fadeOut(500);
}
});
//当点击跳转链接后,回到页面顶部位置
$("#back-to-top").click(function(){
$('body,html').animate({scrollTop:0},500);
return false;
});
});
});
*/
//悬停的卡片
function qxmgTip(){
$(document).on('mouseover','.j-qxmgtip',function(){
$tip = $(this).find('.mgtip-tip');
$tip.show();
//修复图片不加载
$(window).scrollTop($(window).scrollTop()-1).scrollTop($(window).scrollTop()+1);
$(this).on('mousemove',function(e){
var _oleft = $(this).offset().left,
_otop = $(this).offset().top,
_wt = $(window).scrollTop() + $(window).outerHeight(),
_wl = $(window).scrollLeft() + $(window).outerWidth(),
_left = e.pageX - _oleft + 15,
_top = e.pageY - _otop + 15,
_targetWidth = $tip.outerWidth(),
_targetHeight = $tip.outerHeight();
if( _left + _oleft + _targetWidth > _wl ){
_left -= _targetWidth + 30;
}
if( _top + _otop + _targetHeight > _wt ){
_top -= _targetHeight + 30;
}
$tip.css({
left: _left,
top: _top
});
});
$(this).on('mouseout',function(){
$tip.hide();
$(this).off('mousemove').off('mouseout');
});
});
}
$(document).ready(function() {
setInterval('AutoScroll("#scrollDiv")',5000);
//图片载入效果
$('img').on('appear', function(e){
var that = $(this);
that.css('opacity',0);
setTimeout(function(){
that.css('transition','opacity 1s').css('opacity',1);
}, 1);
});
//End of 图片载入效果
//悬停的卡片
qxmgTip();
});
var snowId = document.getElementById("footer");
var solfId = document.createElement("a");
solfId.setAttribute("id","gotop");
solfId.setAttribute("title","回到顶部");
snowId.appendChild(solfId);
function goTop(){
$(window).scroll(function(e) {
//若滚动条离顶部大于200元素
if($(window).scrollTop()>200)
$("#gotop").fadeIn(100);//以1秒的间隔渐显id=gotop的元素
else
$("#gotop").fadeOut(100);//以1秒的间隔渐隐id=gotop的元素
});
};
$(function(){
//点击回到顶部的元素
$("#gotop").click(function(e) {
//以1秒的间隔返回顶部
$('body,html').animate({scrollTop:0},100);
});
$("#gotop").mouseover(function(e) {
$(this).css("background","url(/images/backtop.gif) no-repeat 0px -100px");
});
$("#gotop").mouseout(function(e) {
$(this).css("background","url(/images/backtop.gif) no-repeat 0px 0px");
});
goTop();//实现回到顶部元素的渐显与渐隐
});