注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
( function( $, mw, window ) { $( function() { mw.hook( 'wikipage.content' ).add( function( $content ) { $( '.ilh-all', $content ).not( '.ilh-blue' ).on( 'internalLinkHelper-close', function( event ) { var $this = $( this ); if ( $this.data( 'internalLinkHelper-showing' ) ) { $( this ).removeClass( 'ilh-active' ).find( '.ilh-page a' ).tipsy( 'hide' ).end() .data( 'internalLinkHelper-showing', false ); } } ).each( function() { var origTitle = $( this ).data( 'orig-title' ), $foreignSpan = $( '.ilh-link', this ), $linkAnchor = $( '.ilh-page a', this ), $langSpan = $( '.ilh-lang', this ), langName = $langSpan.text(), $that = $( this ).data( 'internalLinkHelper-showing', false ); if ( !$linkAnchor.length ) { return; } var timeout = null; var maybeClearTimeout = function() { if ( timeout !== null ) { clearTimeout( timeout ); } }, autoSetTimeout = function() { maybeClearTimeout(); timeout = setTimeout.apply( null, arguments ); }; var mouseleave = function() { autoSetTimeout( function() { $that.trigger( 'internalLinkHelper-close' ); }, 500 ); }, mouseenter = function() { if ( $that.data( 'internalLinkHelper-showing' ) ) { maybeClearTimeout(); } else { $( '.ilh-all', $content ).not( $that ).trigger( 'internalLinkHelper-close' ); $that.addClass( 'ilh-active' ).data( 'internalLinkHelper-showing', true ); $linkAnchor.tipsy( 'show' ).tipsy( true ).tip().mouseleave( mouseleave ).mouseenter( mouseenter ); } }; $linkAnchor.tipsy( { className: 'ilh-tipsy', gravity: 'nw', html: true, trigger: 'manual', title: function() { return '<div>' + wgUVS( '条目“', '條目「' ) + $( '<span/>' ).text( origTitle ).html() + wgUVS( '”尚未创建,可参考', '」尚未創建,可參考' ) + $( '<span/>' ).text( langName ).html() + wgUVS( '维基导游的对应页面:', '維基导游的對應頁面:' ) + $foreignSpan.html() + '。</div>'; } } ) .mouseleave( mouseleave ).mouseenter( mouseenter ); } ); } ); } ); } )( jQuery, mediaWiki, window );