Extension:FloatingToolbar
This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net . |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
Floating Toolbar Release status: unmaintained |
|
---|---|
Implementation | Skin |
Description | Adds a strip to the bottom of the window. Contents and visibility are set in LocalSettings.php |
Author(s) | (User:tdwrighttalk) |
Latest version | 0.1 |
MediaWiki | |
License | GNU General Public License 2.0 |
Download | No link |
$wgFloatingToolbarContents, $wgFloatingToolbarAllUsers, $wgFloatingToolbarLoggedIn |
|
What can this extension do?
[edit]This extension adds a subtle grey strip to the bottom of the window (stays on the bottom while users scroll) with your text/HTML in it. 3 levels of visibility: none (off), logged in users and all users.
Download instructions
[edit]Please cut and paste the code found below and place it in $IP/extensions/FloatingToolbar/FloatingToolbar.php
. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php .
Installation
[edit]To install this extension, add the following to LocalSettings.php :
$wgFloatingToolbarContents = 'Your text (or <b>H</b><i>T</i><u>M</u><a href="#">L</a>) here.';
$wgFloatingToolbarAllUsers = false;
$wgFloatingToolbarLoggedIn = true;
require_once("$IP/extensions/FloatingToolbar/FloatingToolbar.php");
Configuration parameters
[edit]The contents are modified by changing $wgFloatingToolbarContents.
User rights
[edit]The visibility is set by altering $wgFloatingToolbarAllUsers and $wgFloatingToolbarLoggedIn. Both are booleans. The first dictates whether all users should be able to see the bar. The second dictates whether logged in users should be able to see it. If $wgFloatingToolbarAllUsers is set to true, $wgFloatingToolbarLoggedIn isn't checked.
Code
[edit]<?
/**
* Floating Toolbar
*
* @version 0.1
* @author Tom Wright
* @link http://www.mediawiki.org/wiki/Extension:FloatingToolbar
*/
//Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Floating Toolbar',
'author' => 'Tom Wright',
'url' => 'http://www.mediawiki.org/wiki/Extension:FloatingToolbar',
'version' => '0.5',
'description' => 'Adds fixed strip with customisable text to the bottom of the window.',
);
$wgHooks['BeforePageDisplay'][] = 'wfFloatingToolbar';
function wfFloatingToolbar(&$out) {
global $wgFloatingToolbarContents, $wgFloatingToolbarAllUsers, $wgFloatingToolbarLoggedIn, $wgUser;
if (!$wgFloatingToolbarAllUsers) {
if ($wgFloatingToolbarLoggedIn) {
if (!$wgUser->isLoggedIn()) return $out;
} else {
return $out;
}
}
$out->mBodytext .= <<<TXT
<style type="text/css">
#floatingtoolbar {
position:fixed;
padding:0;
overflow:hidden;
background:#CCC;
background:rgba(200, 200, 200, 0.75);
/* Set the y vars */
top:100%;
margin-top:-2em;
height:2em;
/* Set the x vars */
width:90%;
left:50%;
margin-left:-45%;
/* Get the borders right */
border:#333 1px solid;
border-bottom:0;
border-radius: 0.5em 0.5em 0 0;
}
#floatingtoolbar p {
position:relative;
width:100%;
padding:0.5em 0;
text-align:center;
line-height:1em;
margin:0;
font-size:small;
color:#000;
text-shadow: -0.1em -0.1em 0.2em #CCC, 0.1em 0.1em 0.2em #999;
}
#floatingtoolbar p a {
color:#000;
text-decoration:underline;
}
#floatingtoolbar p a:hover {
color:#000;
text-decoration:underline;
font-style:italic;
}
#floatingtoolbar_spacer {
height:2em;
position:relative;
}
</style>
<div id="floatingtoolbar">
<p>
TXT;
$out->mBodytext .= $wgFloatingToolbarContents;
$out->mBodytext .= <<<TXT
</p>
</div>
<div id="floatingtoolbar_spacer"> </div>
TXT;
return $out;
}