MediaWiki:Common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Dream (обсуждение | вклад) (+1) |
Dream (обсуждение | вклад) м (small fix) |
||
Строка 56: | Строка 56: | ||
var mpTitle = "Заглавная страница"; | var mpTitle = "Заглавная страница"; | ||
− | var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" | + | var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" — ")) == mpTitle); |
− | var isDiff = (document.location.search && (document.location.search.indexOf( | + | var isDiff = (document.location.search && (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1)); |
− | if (isMainPage && !isDiff) | + | if (isMainPage && !isDiff) |
{ | { | ||
document.write('<style type="text/css">/*<![CDATA[*/ #siteSub, #contentSub, h1.firstHeading { display: none !important; } /*]]>*/</style>'); | document.write('<style type="text/css">/*<![CDATA[*/ #siteSub, #contentSub, h1.firstHeading { display: none !important; } /*]]>*/</style>'); | ||
Строка 66: | Строка 66: | ||
/* подгрузка файла со скриптами для редактирования ***************************************** | /* подгрузка файла со скриптами для редактирования ***************************************** | ||
*/ | */ | ||
− | /* if (document.URL.indexOf( | + | /* if (document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0) |
{ | { | ||
if (wgCanonicalNamespace != "Special") | if (wgCanonicalNamespace != "Special") | ||
Строка 100: | Строка 100: | ||
* Description: Includes a raw wiki page as javascript or CSS, | * Description: Includes a raw wiki page as javascript or CSS, | ||
* used for including user made modules. | * used for including user made modules. | ||
− | * Maintainers: User: | + | * Maintainers: [[:en:User:AzaToth]] |
*/ | */ | ||
− | + | ||
function importScript( page ) { | function importScript( page ) { | ||
− | + | var url = wgScriptPath + '/index.php?title=' | |
− | + | + escape( page.replace( ' ', '_' ) ) | |
− | + | + '&action=raw&ctype=text/javascript&dontcountme=s'; | |
− | |||
− | var url = wgScriptPath | ||
− | |||
− | |||
− | |||
var scriptElem = document.createElement( 'script' ); | var scriptElem = document.createElement( 'script' ); | ||
scriptElem.setAttribute( 'src' , url ); | scriptElem.setAttribute( 'src' , url ); | ||
Строка 122: | Строка 117: | ||
+ wgScriptPath | + wgScriptPath | ||
+ '/index.php?title=' | + '/index.php?title=' | ||
− | + | + | + escape( page.replace( ' ', '_' ) ) |
+ '&action=raw&ctype=text/css";' | + '&action=raw&ctype=text/css";' | ||
var styleElem = document.createElement( 'style' ); | var styleElem = document.createElement( 'style' ); | ||
Строка 129: | Строка 124: | ||
document.getElementsByTagName( 'head' )[0].appendChild( styleElem ); | document.getElementsByTagName( 'head' )[0].appendChild( styleElem ); | ||
} | } | ||
+ | |||
var auto_comment = 0 | var auto_comment = 0 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
/* </source> */ | /* </source> */ |
Версия от 10:09, 4 июня 2007
/* <source lang="javascript">
Размещённый здесь код JavaScript будет загружен всем пользователям при обращении к какой-либо странице
*/
/* tooltips and access keys */
ta = new Object();
ta['pt-userpage'] = new Array('.','Моя страница пользователя');
ta['pt-anonuserpage'] = new Array('.','Страница пользователя для моего IP');
ta['pt-mytalk'] = new Array('n','Моя страница обсуждений');
ta['pt-anontalk'] = new Array('n','Страница обсуждений для моего IP');
ta['pt-preferences'] = new Array('','Мои настройки');
ta['pt-watchlist'] = new Array('l','Список страниц моего наблюдения');
ta['pt-mycontris'] = new Array('y','Список страниц, которые я редактировал');
ta['pt-login'] = new Array('o','Здесь можно зарегистрироваться в системе, но это необязательно');
ta['pt-anonlogin'] = new Array('o','Здесь можно зарегистрироваться в системе, но это необязательно');
ta['pt-logout'] = new Array('o','Отказаться от регистрации');
ta['ca-talk'] = new Array('t','Обсуждение статьи');
ta['ca-edit'] = new Array('e','Эту статью можно изменять. Перед сохранением изменений, пожалуйста, нажмите кнопку предварительного просмотра для визуальной проверки результата');
ta['ca-addsection'] = new Array('+','Добавить комментарий к обсуждению');
ta['ca-viewsource'] = new Array('e','Эта страница защищена от изменений, но вы можете посмотреть и скопировать её исходный текст');
ta['ca-history'] = new Array('h','Журнал изменений страницы');
ta['ca-protect'] = new Array('=','Защитить страницу от изменений');
ta['ca-delete'] = new Array('d','Удалить эту страницу');
ta['ca-undelete'] = new Array('d','Восстановить исправления страницы, сделанные до того, как она была удалена');
ta['ca-move'] = new Array('m','Переименовать страницу');
ta['ca-watch'] = new Array('w','Добавить эту страницу в ваш список наблюдения');
ta['ca-unwatch'] = new Array('w','Удалить эту страницу из вашего списка наблюдения');
ta['search'] = new Array('f','Искать это слово');
ta['p-logo'] = new Array('','Заглавная страница');
ta['n-mainpage'] = new Array('z','Перейти на заглавную страницу');
ta['n-portal'] = new Array('','О проекте, о том, что вы можете сделать, где что находится');
ta['n-currentevents'] = new Array('','Список текущих событий');
ta['n-recentchanges'] = new Array('r','Список последних изменений');
ta['n-randompage'] = new Array('x','Посмотреть случайную страницу');
ta['n-help'] = new Array('','Справочник по проекту «{{SITENAME}}»');
ta['n-sitesupport'] = new Array('','Поддержите проект');
ta['t-whatlinkshere'] = new Array('j','Список всех страниц, которые ссылаются на эту страницу');
ta['t-recentchangeslinked'] = new Array('k','Последние изменения в страницах, которые ссылаются на эту страницу');
ta['feed-rss'] = new Array('','Трансляция в формате RSS для этой страницы');
ta['feed-atom'] = new Array('','Трансляция в формате Atom для этой страницы');
ta['t-contributions'] = new Array('','Список страниц, которые изменял этот участник');
ta['t-emailuser'] = new Array('','Отправить письмо этому участнику');
ta['t-upload'] = new Array('u','Загрузить изображения или мультимедиа-файлы');
ta['t-specialpages'] = new Array('q','Список служебных страниц');
ta['t-print']=new Array('', 'Версия без кнопок, пригодная для распечатки');
ta['t-permalink'] = new Array('', 'Ссылка на текущую версию этой статьи');
ta['ca-nstab-main'] = new Array('c','Содержание статьи');
ta['ca-nstab-user'] = new Array('c','Персональная страница участника');
ta['ca-nstab-media'] = new Array('c','Мультимедиа-файл');
ta['ca-nstab-special'] = new Array('','Это служебная страница, она недоступна для редактирования');
ta['ca-nstab-wp'] = new Array('a','Страница Traditio');
ta['ca-nstab-image'] = new Array('c','Страница изображения');
ta['ca-nstab-mediawiki'] = new Array('c','Страница сообщения MediaWiki');
ta['ca-nstab-template'] = new Array('c','Страница шаблона');
ta['ca-nstab-help'] = new Array('c','Страница справки');
ta['ca-nstab-category'] = new Array('c','Страница категории');
var mpTitle = "Заглавная страница";
var isMainPage = (document.title.substr(0, document.title.lastIndexOf(" — ")) == mpTitle);
var isDiff = (document.location.search && (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1));
if (isMainPage && !isDiff)
{
document.write('<style type="text/css">/*<![CDATA[*/ #siteSub, #contentSub, h1.firstHeading { display: none !important; } /*]]>*/</style>');
}
/* подгрузка файла со скриптами для редактирования *****************************************
*/
/* if (document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0)
{
if (wgCanonicalNamespace != "Special")
{
document.write('<script type="text/javascript" src="/index.php?title=MediaWiki:Onlyifediting.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}
}*/
function addLoadEvent(func)
{
if (window.addEventListener)
window.addEventListener("load", func, false);
else if (window.attachEvent)
window.attachEvent("onload", func);
}
/**********************************************************************************/
function addLoadEvent( f ) { addOnloadHook( f ); }
/*************************************************************************************************/
/*Alex Mashin, May 19, 2007. Script for expandable tables moved here from extension and HTML body.
*/
function toggleExpandable(id) {
var heading = document.getElementById('expandable-heading-'+id);
var content = document.getElementById('expandable-content-'+id);
if (content.style.display == 'none') content.style.display = '';
else content.style.display = 'none';
this.parent.focus();
}
/*************************************************************************************************/
/** Import module *************************************************************
*
* Description: Includes a raw wiki page as javascript or CSS,
* used for including user made modules.
* Maintainers: [[:en:User:AzaToth]]
*/
function importScript( page ) {
var url = wgScriptPath + '/index.php?title='
+ escape( page.replace( ' ', '_' ) )
+ '&action=raw&ctype=text/javascript&dontcountme=s';
var scriptElem = document.createElement( 'script' );
scriptElem.setAttribute( 'src' , url );
scriptElem.setAttribute( 'type' , 'text/javascript' );
document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
}
function importStylesheet( page ) {
var sheet = '@import "'
+ wgScriptPath
+ '/index.php?title='
+ escape( page.replace( ' ', '_' ) )
+ '&action=raw&ctype=text/css";'
var styleElem = document.createElement( 'style' );
styleElem.setAttribute( 'type' , 'text/css' );
styleElem.appendChild( document.createTextNode( sheet ) );
document.getElementsByTagName( 'head' )[0].appendChild( styleElem );
}
var auto_comment = 0
/* </source> */