注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

(function($, mw) { $(function() {
    $('.ilh-all', mw.util.$content).each(function() {
        var exta = $('.ilh-link', this), that = this;
        if (exta.length == 0) return;
        $('.ilh-page a', this).tipsy({
            className: 'ilh-tipsy',
            delayOut: 500,
            gravity: 'nw',
            html: true,
            title: function() {
                return '<div>'
                    + wgULS('条目', '條目')
                    + $('.ilh-dest', that).html()
                    + wgULS('不存在,可参考', '不存在,可參考')
                    + $('.ilh-lang', that).html()
                    + wgULS('维基百科的对应页面:', '維基百科的對應頁面:')
                    + $('.ilh-link', that).html()
                    + '。</div>';
            }
        });
        var setTipsyHoverState = function (state) {
          $('.ilh-page a').each(function (_, ele) {
            //A hack
            var tipsy = $.data(ele, 'tipsy');
            if (tipsy) {
              tipsy.hoverState = state;
              if (state == 'out') setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, 500);
            }
          });
        };
        $(document.body).on('mouseenter', '.ilh-tipsy', function (_) {
          setTipsyHoverState('in');
        }).on('mouseleave', '.ilh-tipsy', function (_) {
          setTipsyHoverState('out');
        });
    });
}); })(jQuery, mediaWiki);