User:YFdyh000/Gadget-noteTAvector.js
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
noteTAvector = ( function() { $( function() {
$( 'body.skin-vector .mw-indicator[id^=mw-indicator-noteTA-]' )
.addClass( 'vector-menu-tabs' )
.removeAttr( 'style' )
.empty()
.each( function() {
$( '<a href="#"><span style="padding:1px 3px; background: #d3e3f4; color:#000000;height:85%;">汉</span><span style="padding:1px 3px; background: #e9e9e9; color:#434343;height:85%;">漢</span></a>' )
.click( function( e ) {
e.preventDefault();
} )
.wrap( '<ul><li><span></span></li></ul>' )
.parent().parent().parent().appendTo( this );
} )
.insertAfter( '#p-variants' );
} ); } );
mw.hook('wikipage.content').add( function ( $content ) {
//if ( $( '#p-variants' ).next().hasClass('vector-menu-tabs') ) return;
$( '#p-variants' ).next().remove(); // Will blink duing load preview, but this will avoid the icon won't removed if the TA template is removed, and avoid repeated click event listener from noteTAViewer.
setTimeout("noteTAvector();", 1);
});
$(window).load(function() {
noteTAvector();
});