User:Ancap

From mediawiki.org
(Redirected from User:Netsu)

How to install <math>[edit]

aptitude install ocaml
cd /math
make clean
make

Prepend new section[edit]

Current MediaWiki functionality only allows to append new section when edit page with link /index.php?title=Page&action=edit&section=new. There is now option to change this on prepend. To change this you need to edit /includes/Article.php.

On line 1742 replace: ? "{$oldtext}\n\n{$subject}{$text}" to ? prependSection($subject.$text, $oldtext)

And to LocalSettings.php add:

function prependSection($newtext, $oldtext) {

  if (preg_match("(==(.*?)==)", $oldtext)) {

    return preg_replace("(==(.*?)==)", $newtext."\n\n$0", $oldtext, 1);

  } else {

    return $oldtext."\n\n".$newtext;

  }

}

This code will prepent new section to current except section 0, and append if there is no sections.

Как добавить код trustlink / sape в MediaWiki?[edit]

Добавить в LocalSettings.php:

$wgHooks['SkinAfterContent'][] = "fnTrustlink";

function fnTrustlink(&$data) {

  global $wgOut;

  define('TRUSTLINK_USER', '9c99962990f1699990bc891d919e8599929199e7');
  require_once($_SERVER['DOCUMENT_ROOT'].'/'.TRUSTLINK_USER.'/trustlink.php');
  $o['charset'] = 'utf-8'; // кодировка сайта
  $trustlink = new TrustlinkClient($o);
  unset($o);
  // $wgOut->prependHTML($trustlink->build_links()); // В начале статьи
  $data .= $trustlink->build_links(); // В конце статьи

  return true;

}

How to remove timestamps in image links[edit]

Extension FlaggedRevs adds by default to image links timestamps e.g. /index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:Kokoko.jpg&filetimestamp=20130105013229. To avoid this add to LocalSettings.php: $wgFlaggedRevsOverride = false;

Авто увеличение высоты texarea[edit]

Bug in jQuery 1.5.2 (1.4.2) and before, fixed in 1.6.0 / Баг в Jquery 1.5.2 и в более ранних версиях, исправленный в 1.6.0[edit]

  • Ширина картинки устанавливается в 0:
  • Здесь работает (v 1.6):
  • Как исправить? Не добалять width если это возможно:
  • Либо добавить так:

Disable/Remove/Update default jQuery in MediaWiki 1.17 / Как удалить/отключить/обновить jQuery в MediaWIki 1.17[edit]

How to disable load /resources/jquery/jquery.js in mediawiki1.17?

Number of pages in category / Pages count in category / Количество страниц в категории[edit]

// $name - name of category
$cat_title_obj = Title::makeTitle(NS_CATEGORY, $name);
$cat_obj = Category::newFromTitle($cat_title_obj);
$cat_count = $cat_obj->getPageCount();

How todo fixed monobook design / Фиксированный посередине дизайн[edit]

Open file:

/skins/MonoBook.php

Find:

v1.15

<body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
 class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">

v1.16

		$this->html( 'headelement' );

Add after:

<table width="994px" cellpadding="0" cellspacing="0" style='margin-left: auto; margin-right: auto; background: transparent'>
<tr><td valign="top">

Find:

</body></html>
<?php
	wfRestoreWarnings();

Add above:

</td>
</tr>
</table>

Open file:

/skins/monobook/main.css

Find:

#globalWrapper {
	font-size: 127%;
	width: 100%;
	margin: 0;
	padding: 0;
}

Replace with:

#globalWrapper {
	font-size: 127%;
	width: 100%;
	margin: 0;
	padding: 0;
        position: relative;
}

Result:


Page title max length / Максимальная длина названия страницы[edit]

Find in includes/Title.php:

if ( ( $this->mNamespace != NS_SPECIAL && strlen( $dbkey ) > 255 ) ||

Change 255 to what you want.

Edit in your database table wiki_page field page_title edit field length (max length 767).