Участник:Gevron/common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Gevron (обсуждение | вклад) мНет описания правки |
Gevron (обсуждение | вклад) мНет описания правки |
||
Строка 6: | Строка 6: | ||
// HotCat — инструмент для быстрого изменения категорий страниц | // HotCat — инструмент для быстрого изменения категорий страниц | ||
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' ); | mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' ); | ||
// Добавляет кнопку для очистки кэша | |||
if ( !$( '#ca-purge' ).length ) { | if ( !$( '#ca-purge' ).length ) { | ||
$( '#p-cactions' ).find( 'ul' ).append( | $( '#p-cactions' ).find( 'ul' ).append( | ||
Строка 15: | Строка 16: | ||
); | ); | ||
} | } | ||
mw.loader.using( 'mediawiki.api' ).then( function() { | |||
$( '#ca-purge a' ).on( 'click', function( e ) { | |||
new mw.Api().post( { | |||
action: 'purge', | |||
titles: mw.config.get( 'wgPageName' ) | |||
} ).then( function() { | |||
location.reload(); | |||
}, function() { | |||
mw.notify( 'Purge failed', { type: 'error' } ); | |||
} ); | |||
e.preventDefault(); | |||
} ); | |||
} ); |
Версия от 17:12, 12 декабря 2022
// Всплывающие окна предпросмотра статей mw.loader.load('https://ru.wikipedia.org/w/index.php?title=Участник:Lockal/strings-ru.js&action=raw&ctype=text/javascript'); mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&oldid=954732624&action=raw&ctype=text/javascript'); mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-navpop.css&action=raw&ctype=text/css', 'text/css'); // HotCat — инструмент для быстрого изменения категорий страниц mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' ); // Добавляет кнопку для очистки кэша if ( !$( '#ca-purge' ).length ) { $( '#p-cactions' ).find( 'ul' ).append( $( '<li>' ).attr( { 'id': 'ca-purge', 'class': 'mw-list-item' } ).append( $( '<a>' ).attr( { 'href': mw.util.getUrl( null, { action: 'purge' } ), 'title': 'Очистить серверный кэш страницы' } ).append( $( '<span>' ).text( 'Очистить кэш' ) ) ) ); } mw.loader.using( 'mediawiki.api' ).then( function() { $( '#ca-purge a' ).on( 'click', function( e ) { new mw.Api().post( { action: 'purge', titles: mw.config.get( 'wgPageName' ) } ).then( function() { location.reload(); }, function() { mw.notify( 'Purge failed', { type: 'error' } ); } ); e.preventDefault(); } ); } );