User:小躍/GoToSubmit.js
< User:小躍
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
var GoToSubmit='';
var GoToSubmitLG=mw.config.get('wgUserLanguage');
switch(GoToSubmitLG){
case 'de':GoToSubmit='Gehe zu Senden';break;
case 'es':GoToSubmit='Ir a Enviar';break;
case 'fr':GoToSubmit='Aller à soumettre';break;
case 'it':GoToSubmit='Vai a Invia';break;
case 'pt':GoToSubmit='Vá para Enviar';break;
case 'zh':case 'zh-cn':
case 'zh-hans':case 'zh-my':GoToSubmit='前往发布';break;
case 'zh-hant':case 'zh-hk':case 'zh-mo':
case 'zh-sg':case'zh-tw':GoToSubmit='前往發布';break;
case 'ja':GoToSubmit='送信する';break;
default:GoToSubmit=wgULS('Go to Submit');
}
if( $.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
var GoToSubmitBtn='<button id="wpGoToSubmit">' + GoToSubmit +'</button>';
$('#mw-content-text').before(GoToSubmitBtn);
$('#wpGoToSubmit').addClass('mw-ui-button mw-ui-progressive');
$('#wpGoToSubmit').css('position','fixed').css('top','140px').css('right','50%');
}
$('#wpGoToSubmit').click(function(){
$("html, body").animate({scrollTop:($("#content").height()-$(".mw-editTools").height()-$(".editOptions").height())}, 1000);
});
$(window).scroll(function() {
if ( $(this).scrollTop() < ($("#content").height()-($(".mw-editTools").height()+$(".editOptions").height()+$("#footer").height()+$(".wikiEditor-ui").height()))){
$('#wpGoToSubmit').fadeIn();
} else {
$('#wpGoToSubmit').fadeOut();
}
});