Fandom Developers Wiki
Advertisement

Гэта старонка цалкам ці часткова не перакладзена. Просьба перакласці яе на адпаведную мову (беларуская).

AjaxRC — гэта скрыпт для пашыранага аўтаматычнага абнаўлення нядаўніх змяненняў і спіса назірання. Ён заснаваны на арыгінальным скрыпце з Wowpedia.

Ўстаноўка[]

Што робіць[]

  • Код дадае сцяжок угары Адмысловае:RecentChanges поруч з загалоўкам.
  • Гэта адбываецца неўпрыкмет кожныя 60 секундаў без поўнай перазагрузкі старонкі.

Канфігурацыя[]

Існуе трохі варыянтаў канфігурацыі:

Опцыя Параметр Апісанне Па змаўчанні
Старонкі Ajax window.ajaxPages Старонкі, якія аўтаматычна абнаўляюцца []
Адмысловыя старонкі Ajax window.ajaxSpecialPages Адмысловыя старонкі, што аўтаматычна абнаўляюцца (без уліку мовы) ['Recentchanges']
Значок індыкатара window.ajaxIndicator Індыкатар прагрэсу latest
Час абнаўлення window.ajaxRefresh Час, за які старонка аўтаматычна абнаўляецца 60000 (60 секундаў)
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