MediaWiki:Gadget-noteTAvector.js

来自红砖维基

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
noteTAvector = ( function() { $( function() {
    $( 'body.skin-vector .mw-indicator[id^=mw-indicator-noteTA-]' )
        .addClass( 'vector-menu' )
        .addClass( 'vector-menu-tabs' )
        //.addClass( 'vectorTabs' )
        .addClass( 'vector-menu-tabs-legacy' )        
        .removeAttr( 'style' )
        .css( 'float', 'left' )
        .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('vectorTabs') ) 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);
});