설치한 확장기능

From XFwiki
Revision as of 11:52, 17 October 2009 by Zootv (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


엑파위키에 설치한 확장기능 모음

# 오늘의 명언

# ShowHide (글 접었다 펴기)

http://www.mediawiki.org/wiki/Extension:ShowHide

Source

Helpful hint: the copyright symbol and the script tags are messing up the display. Edit this page to copy the code! --Bytesmiths 03:14, 20 December 2005 (UTC)

v 0.1.1

PHP5 version with corrections according to Smerf's comments.

   Note the following version does not work correctly for me on MediaWiki 1.5. The following will work correctly on the first load, but after loading from cache, the one-time Javascript code inserted by $wgOut->addHtml does not get added leading to problems. v.0.1 above works fine for me.

<?php
# MediaWiki ShowHide extension v0.1.1
#
# Based on example code from
# http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension
# Contains code from MediaWiki's Skin.php and wikibits.js
#
# All other code is copyright © 2005 Nikola Smolenski <smolensk@eunet.yu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# To install, copy the extension to your extensions directory and add line
# include("extensions/ShowHide.php");
# to the bottom of your LocalSettings.php
#
# Example syntax:
#
# <showhide>
# Some text (usually title) which will not be hidden __HIDER__
# <hide>Text which will be hidden</hide>
# </showhide>
#
# If <show></show> tags are used instead of <hide></hide>, the text will be
# shown by default
#
# For more information see its page at
# http://www.mediawiki.org/wiki/Extension:ShowHide

$wgExtensionFunctions[]="wfShowHideExtension";
 
function wfShowHideExtension()
{
	$GLOBALS['wgParser']->setHook("showhide","ShowHideExtension");
}
 
function ShowHideExtension($in)
{
	global $wgOut;
	static $numrun=0;
 
	$out=$wgOut->parse($in);
	if(
                strpos($out,"__HIDER__")!==FALSE &&
                ((
                        ($s=strpos($out,htmlentities("<show>")))!==FALSE &&
                        strpos($out,htmlentities("</show>"))>$s
                ) || (
                        ($h=strpos($out,htmlentities("<hide>")))!==FALSE &&
                        strpos($out,htmlentities("</hide>"))>$h
                ))
        ) {
                if($numrun==0) {
                        $wgOut->addHTML(
"<script type=\"text/javascript\"><!--
shWas=new Array();
function showSHToggle(show,hide,num) {
        if(document.getElementById) {
                document.writeln('<span class=\'toctoggle\'>[<a href=\"javascript:toggleSH('+num+')\" class=\"internal\">' +
                '<span id=\"showlink'+num+'\" style=\"display:none;\">' + show + '</span>' +
                '<span id=\"hidelink'+num+'\">' + hide + '</span>' +
                '</a>]</span>');
        }
}
function toggleSH(num) {
        var shmain = document.getElementById('showhide'+num);
        var sh = document.getElementById('shinside'+num);
        var showlink=document.getElementById('showlink'+num);
        var hidelink=document.getElementById('hidelink'+num);
        if(sh.style.display == 'none') {
                sh.style.display = shWas[num];
                hidelink.style.display='';
                showlink.style.display='none';
                shmain.className = '';
        } else {
                shWas[num] = sh.style.display;
                sh.style.display = 'none';
                hidelink.style.display='none';
                showlink.style.display='';
                shmain.className = 'tochidden';
        }
} // --></script>
");
                }
                $numrun++;
 
                if($s!==FALSE)
                        $act="show";
                else
                        $act="hide";
 
                $hideline = ' <script type="text/javascript">showSHToggle("' . addslashes( wfMsg('showtoc') ) . '","' . addslashes( wfMsg('hidetoc') ) . '",' . $numrun . ')</script>';
 
                $out=str_replace("__HIDER__","$hideline",$out);
                $out=str_replace(
                        array(htmlentities("<$act>"),                htmlentities("</$act>")),
                        array("<div id=\"shinside$numrun\">","</div>"),
                        $out
                );
		$out="<span id=\"showhide$numrun\">$out</span>";
		if($act=="hide")
			$out.="<script type=\"text/javascript\">toggleSH($numrun)</script>";
	}
	return $out;
}


Personal tools
Namespaces

Variants
Actions
원전
팬활동
1013 Production
기타
그리고
Toolbox