Skins Hacks

From The Scuba Wiki

Jump to: navigation, search
45px 50px
This page should be moved to MediaWiki.org.
Please do not move the page by hand. It will be imported by a MediaWiki.org administrator with the full edit history. In the meantime, you may continue to edit the page as normal.

This page might be obsolete.

Contents

Opening external links in a new window

Interwiki-Links

Every interwiki-link inside the "interwiki" table that is extended with the target attribute:
target="_blank"
will open up in a new window (tab).

Note, however, that this violates the W3C's Web Content Accessibility GuidelinesCheckpoint 10.1[1] and is often considered a Generally Bad Idea.[2][3][4]

External http-links

  • Open the file /includes/Linker.php
  • Search for the function
    function getExternalLinkAttributes( $link, $text, $class='' )
  • Replace
    $r = ($class != '') ? " class='$class'" : " class='external'";
    for
    $r = ($class != '') ? " class='$class' target='_blank'" : " class='external' target='_blank'";
  • It lacks a check to see if a http-link is actualy within the mediawiki-domain.

Create adjustable menus

Skin MonoBook

(Note: This hack has been made obsolete by version 1.5.X, just modify MediaWiki:Sidebar to do the same thing as below.)

This contribution is only compatible with the Skin MonoBook.

  • Insert content into this page, according to the Mediawiki content format; for example:
  * [[Main Page]]
  * [[Fundraising]]
  * [http://www.external_link.org external http-link]
  • Open the file skins/MonoBook.php
  • search for
  <h5><?php $this->msg('navigation') ?></h5>
    <div class="pBody">
      <ul>
        <?php foreach($this->data['navigation_urls'] as $navlink) { ?>
        <li id="<?php echo htmlspecialchars($navlink['id'])
        ?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php 
        echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
      </ul>
    </div>

and replace

      <ul>
        <?php foreach($this->data['navigation_urls'] as $navlink) { ?>
        <li id="<?php echo htmlspecialchars($navlink['id'])
        ?>"><a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php 
        echo htmlspecialchars($navlink['text']) ?></a></li><?php } ?>
      </ul>

for:

      <?php $this->msgWiki( 'NavigationMenu' ) ?>
  • The code should now look like this:
  <h5><?php $this->msg('navigation') ?></h5>
    <div class="pBody">
      <?php $this->msgWiki( 'NavigationMenu' ) ?>
    </div>
Personal tools
support the site