MediaWiki:Gadget-code-prettify.js

提供: 萌えっ娘百科事典
2022年3月29日 (火) 13:21時点における星海子 (トーク | 投稿記録)による版 (// Edit Via InPageEdit)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

注意: 保存後、変更を確認するにはブラウザーのキャッシュを消去する必要がある場合があります。

  • Firefox / Safari: Shift を押しながら 再読み込み をクリックするか、Ctrl-F5 または Ctrl-R を押してください (Mac では ⌘-R)
  • Google Chrome: Ctrl-Shift-R を押してください (Mac では ⌘-Shift-R)
  • Internet Explorer: Ctrl を押しながら 最新の情報に更新 をクリックするか、Ctrl-F5 を押してください
  • Opera: メニュー → 設定 (Mac では Opera → 環境設定) に移動し、プライバシーとセキュリティ → 閲覧データを消去 → キャッシュされた画像およびファイル からキャッシュをクリアしてください。
/* 代码高亮  引自http://www.pokemon.name/wiki/MediaWiki:Common.js */
jQuery.cachedScript = function (url, options) {
    options = $.extend(options || {}, {
        dataType: "script",
        cache: true,
        url: url
    });
    return jQuery.ajax(options);
};
(function ($, mw) {
    if (mw.config.get('wgPageName').match(/\.js$/)) $('.mw-code').addClass('prettyprint linenums lang-js');
    if (mw.config.get('wgPageName').match(/\.css$/)) $('.mw-code').addClass('prettyprint linenums lang-css');
    if ($('.prettyprint').length > 0) {
        mw.loader.load('MediaWiki:Prettify.css', 'text/css');
        $.cachedScript('//zh.moegirl.org.cn/index.php?title=MediaWiki:Gadget-code-prettify-prettify.js&action=raw&ctype=text/javascript').done(function () {
            prettyPrint();
        });
    }
})(jQuery, mediaWiki);