MediaWiki:Common.js:修订间差异
外观
mw.message 测试 |
小无编辑摘要 |
||
| 第40行: | 第40行: | ||
$.when( mw.loader.using( [ 'mediawiki.api', 'mediawiki.jqueryMsg' ] ), $.ready ) | $.when( mw.loader.using( [ 'mediawiki.api', 'mediawiki.jqueryMsg' ] ), $.ready ) | ||
.then( () => new mw.Api().loadMessagesIfMissing( [ 'toc' ] ) ) | .then( () => new mw.Api().loadMessagesIfMissing( [ 'toc' ] ) ) | ||
.then( | .then( () => { | ||
var b = $("<div id='rightToc' style='opacity: 0;'><div id='rtocbt'>" + mw.message( 'toc' ).text() + "</div></div>"); | |||
b.append($('#toc').children('ul').clone().removeAttr("style")); | |||
$("#toc").after(b); | |||
var IsAnim=false; | |||
b.ready(function(){ | |||
$("#rightToc").children("ul").wrap("<div id='rtoculw'></div>"); | |||
$("#rtoculw").children("ul").attr('id','rtocul'); | |||
$("#rightToc").css("marginRight",-$("#rtoculw").outerWidth()); | |||
$('#rtocbt').on('mouseover',function(){ | |||
if(IsAnim){ | |||
return; | |||
} | |||
IsAnim=true; | |||
$("#rightToc").animate({ | |||
marginRight:'5px' | |||
},"fast",function() { | |||
IsAnim=false; | |||
$('#rightToc').addClass('rtshow'); | |||
$('#rightToc').removeClass('rthide'); | |||
}); | |||
}); | }); | ||
$($("#rtoculw")[0]).on('mouseleave',function(){ | |||
if(IsAnim){ | |||
return; | |||
} | |||
IsAnim=true; | |||
$("#rightToc").animate({ | |||
marginRight:-$("#rtoculw").outerWidth() | |||
},"fast",function(){ | |||
IsAnim=false; | |||
$('#rightToc').addClass('rthide'); | |||
$('#rightToc').removeClass('rtshow'); | |||
}); | |||
}); | }); | ||
$("#rightToc").css('opacity','1'); | |||
}); | }); | ||
}); | }); | ||
/* 回到顶部 */ | /* 回到顶部 */ | ||
$(function() { | $(function() { | ||