Extension:ElmEasyRef

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
ElmEasyRef

Release status: beta

Extension-ElmEasyRef-Logo.png
Implementation User interface
Description Add popup field to display reference's content
Author(s) NordTalk
Last version 0.8.2b
License No license specified
Download ElmEasyRef-0.8.2b.zip
Example TestPage
Hooks used
BeforePageDisplay

Check usage (experimental)

Contents

[edit] What can this extension do?

Add popup field to display reference's content


So when user click on reference, he will see:

Extension-ElmEasyRef-Screen1.jpg


Note: extension does not provide <ref> and <references /> tags, so you should install extension like Extension:Cite first


[edit] Download instructions

Download latest version from http://elancev.name/extensions/ElmEasyRef/versions/ and extract it to the MediaWiki "/extensions/" directory

Or

Copy it from http://svn.mediawiki.org/viewvc/mediawiki/trunk/extensions/ElmEasyRef/


[edit] Installation

To install this extension, add the following lines at the end of LocalSettings.php file:

# ElmEasyRef Extension
require_once("$IP/extensions/ElmEasyRef/ElmEasyRef.php");


[edit] Configuration parameters

If it is necessary you can change standart behaivor of extension by adding following options after the require_once:

// If debug mode is on (true), debug messages will be enabled and uncompressed version of js-script will be attached
$wgElmEasyRefDebugMode = false;
 
// Full path to additional css file, which can change styles of referencefield.css
$wgElmEasyRefAddCSS = '';
 
// Field metrics
$wgElmEasyRefMetrics = array(
    // Min size of popup field
    'min_width'  => 140,
    'min_height' => 40,
 
    // Size of collapsed popup field
    'col_width'  => 400,
    'col_height' => 140,
 
    // Size of expanded popup field (Max size)
    // Note: popup apear in collapsed mode first. 
    //       Expanded mode is for large references and opened with "More button"
    'exp_width'  => 400,
    'exp_height' => 380
);
 
// Animation properties
$wgElmEasyRefAnimation = array(
    // If true, enable apear animation
    'enable' => true,
    // Interval delay
    'delay'  => 50,
    // How long width and height will grow up
    'stepw'  => 1.2,
    'steph'  => 3     
);
 
// bodyContent: ID of element which contain articles body
$wgElmEasyRefBodyContentId = 'bodyContent';
 
// Regular expression to retrieve number of reference (for links look like: [123])
// (with no / /)
$wgElmEasyRefNum_rp = '(<.*?>)';    // strip that first
$wgElmEasyRefNum_mt = '([0-9]+)';   // search


[edit] Changing Style

By default popup field look so:

Extension-ElmEasyRef-stdlook.jpg


Easy way of changing it is to set $wgElmEasyRefAddCSS parameter. It will load aditional css which overwrite current one.

    // Will make field green
    $wgElmEasyRefAddCSS = $wgScriptPath . '/extensions/ElmEasyRef/css/refield-green.css';
 
    // Will make field red
    $wgElmEasyRefAddCSS = $wgScriptPath . '/extensions/ElmEasyRef/css/refield-red.css'; 
 
    // Will make field gray
    $wgElmEasyRefAddCSS = $wgScriptPath . '/extensions/ElmEasyRef/css/refield-white.css';


Also you can change style by yourself with editing $IP/extensions/ElmEasyRef/css/referencefield.css file directly


[edit] Try it

You can test extension in other wiki (such as en.wikipedia.org) by adding following line to your "vector.js" user subpage:

importScriptURI("http://elancev.name/extensions/ElmEasyRef/current/js/userjs-ElmEasyRef.js")


[edit] Try with your configuration

If you want to change style, add following line:

importStylesheetURI("http://elancev.name/extensions/ElmEasyRef/current/css/refield-green.css")


If you want to load debug version, add debug parameter to url:

importScriptURI("http://elancev.name/extensions/ElmEasyRef/current/js/userjs-ElmEasyRef.js&debug")


If you want to change other settings, add initf parameter with initialization function name. Following example turn off animation and change size of popup field:

importScriptURI("http://elancev.name/extensions/ElmEasyRef/current/js/userjs-ElmEasyRef.js&initf=doElmEasyRefSettings")
 
function doElmEasyRefSettings(elm){
    // elm.animation contain same properties as $wgElmEasyRefAnimation
    elm.animation.enable = false;
 
    // elm.fieldm contain same properties as $wgElmEasyRefMetrics 
    elm.fieldm.min_width  = 200;
    elm.fieldm.min_height = 80;
    elm.fieldm.col_width  = 600;
    elm.fieldm.col_height = 200;
    elm.fieldm.exp_width  = 600;
    elm.fieldm.exp_height = 500;
 
    // elm.bodyContentId is same as $wgElmEasyRefBodyContentId 
 
    // elm.regRefNum_rp is same as $wgElmEasyRefNum_rp
    // elm.regRefNum_mt is same as $wgElmEasyRefNum_mt
}


[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox