MediaWiki:Common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Shaseer (обсуждение | вклад) |
Shaseer (обсуждение | вклад) |
||
| Строка 44: | Строка 44: | ||
//Generate .epub name | //Generate .epub name | ||
epubName = conf.wgPageName; | epubName = conf.wgPageName; | ||
| − | epubName.replace(/:/g,"_"); | + | epubName.replace(new RegExp(":", 'g'), "_"); |
| − | epubName.replace(/\//g,"_"); | + | //epubName.replace(/:/g,"_"); |
| + | //epubName.replace(/\//g,"_"); | ||
// Add a link to the actions menu | // Add a link to the actions menu | ||
mw.loader.using( 'mediawiki.util', function () { | mw.loader.using( 'mediawiki.util', function () { | ||
Версия 12:36, 23 января 2020
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
/* Yandex Metrika */
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(56096482, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
/* Yandex Metrika */
/* Google Analytics */
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-100709782-2');
/* Google Analytics */
/* Back to Top Button */
var btn = $('#button');
$(window).scroll(function() {
if ($(window).scrollTop() > 300) {
btn.addClass('show');
} else {
btn.removeClass('show');
}
});
btn.on('click', function(e) {
e.preventDefault();
$('html, body').animate({scrollTop:0}, '300');
});
/* Back to Top Button */
/*Export to EPUB Button*/
var conf = mw.config.get([
'wgCanonicalNamespace',
'wgPageName'
]);
//Generate .epub name
epubName = conf.wgPageName;
epubName.replace(new RegExp(":", 'g'), "_");
//epubName.replace(/:/g,"_");
//epubName.replace(/\//g,"_");
// Add a link to the actions menu
mw.loader.using( 'mediawiki.util', function () {
mw.util.addPortletLink(
'p-views',
'https://wiki.warpfrog.wtf/index.php?title=%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%9D%D0%B5%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF%D0%BD%D0%BE',
'Экспорт в EPUB',
'ca-epub',
epubName
);
} );
/*Export to EPUB Button*/