Fandom Developers Wiki
Advertisement

Ajax近期變更(AjaxRC)是一種腳本,能自動刷新近期變更及監視列表。原腳本代碼來自 WoWWiki

安裝方法

腳本功能

  • 在標題文字 Special:RecentChanges 右側加入複選框
  • 可勾選進行 Cookie 設置(每個維基單獨設定),系統就會開始更新列表。
  • 每60秒刷新一次,刷新時不會重新載入當前頁面。

組態

這個腳本含有許多配置選項:

選項 名稱 說明 預設值
Ajax 頁面 window.ajaxPages 頁面會自動刷新 []
Ajax 特殊頁面 window.ajaxSpecialPages Special pages that are automatically refreshed (language-neutral) ['Recentchanges']
指示器圖標 window.ajaxIndicator 進度指示器 latest
刷新時間 window.ajaxRefresh 刷新頁面間隔 60000 (60 seconds)
Display text window.AjaxRCRefreshText
Deprecated; please override the message ajaxrc-refresh-text instead
Text displayed beside the checkbox on the page "Auto-refresh"
Hover text window.AjaxRCRefreshHoverText
Deprecated; please override the message ajaxrc-refresh-hover instead
Text displayed when hovering over the display text "Automatically refresh the page"

若您調整過重新載入內容的功能,調整後,系統不會執行第一次刷新的操作,要等到內容載入後才會重新執行。要讓內容載入,您可以在 ajaxCallAgain 變量添加下列代碼,如下所示:

window.ajaxCallAgain = window.ajaxCallAgain || [];
window.ajaxCallAgain.push(function1, function2, function3);

配置舉例

window.ajaxPages = ["Some Frequently Updated Page"];
window.ajaxSpecialPages = ["Recentchanges", "Watchlist", "Log", "Contributions"];
window.ajaxIndicator = 'https://images.wikia.nocookie.net/software/images/a/a9/Indicator.gif';
window.ajaxRefresh = 30000;
$.extend(true, window, {dev: {i18n: {overrides: {AjaxRC: {
    'ajaxrc-refresh-text': 'AJAX',
    'ajaxrc-refresh-hover': 'Enable page auto-refresh',
}}}}});

Using configuration options with Fandom Developers Wiki scripts

The instructions on this page describe how to use configuration options with a script. Here on the Fandom Developers Wiki, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.

Configuration options load too late, don't work
// 1. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

// 2. AjaxRC configuration option
window.ajaxRefresh = 30000;
Proper placement of configuration options
// 1. AjaxRC configuration option
window.ajaxRefresh = 30000;

// 2. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

參閱

Advertisement