User:Roc michael
About Myself
[edit]Hi. I am Michael Chang (張致信Email),a Chinese in Taiwan. Since my name is too popular to be an ID for me, I chose the roc michael (Republic Of China's Michael). Then MW turned it into Roc michael.
- Hi, everybody I am in Jiaosi, Yilan Taiwan now. I wish everybody study to use(or to develop Mediawiki Extension) easily.
- 大家好,我現在人在台灣省宜蘭縣礁溪鄉。祝大家維基學習之旅能愉快順利。
Translation
[edit]- Extension:UserRightsList
- Extension talk:ImagePlus#Chinese message (Zh_tw)
- Extension:Replace Text
- Extension:Semantic MediaWiki
- DPL Chinese UI
- SpecialPages_grouped_into_categories/Chinese
- Extension:AWC's Forum
- Extension:Todo Tasks
- Extension:WhoIsWatchingTabbed
- Extension:WhoIsWatching
- Extension:Data Transfer
- Extension talk:IssueTracker#i18n_for_Taiwanese_Chinese
My page in other wiki
[edit]Mediawiki Study
[edit]
Developing & Extending
|
|
此頁很炫*諸多連結圍著圓形的圖檔。
Files not using anymore
[edit]My Environment
[edit]- MediaWiki: 1.12.0
- Win XP
- The AppServ Open Project - 2.5.7 for Windows
- Apache Web Server Version 2.2.3
- PHP Script Language Version 5.1.6
- MySQL Database Version 5.0.24a
- phpMyAdmin Database Manager Version 2.9.0.2
Could you give me a hand?
My Environment
[edit]- MediaWiki: 1.14.0
- Win XP
- The AppServ Open Project - 2.5.7 for Windows
- Apache Web Server Version 2.2.3
- PHP Script Language Version 5.1.6
- MySQL Database Version 5.0.24a
- phpMyAdmin Database Manager Version 2.9.0.2
Could you give me a hand?
The MediaWiki:Common.css in my testwiki
[edit]/** CSS placed here will be applied to all skins */
/********** Colour of Main + Talk
主頁面與討論頁面的相關顏色設定 ************/
.ns-0 #content, .ns-0 #p-cactions li, .ns-0 #p-cactions li a { background: #eeeeff; }
.ns-0 div.thumb { border-color: #f4f4f4; }
.ns-1 #content, .ns-1 #p-cactions li, .ns-1 #p-cactions li a { background: #ffcc00; }
.ns-1 div.thumb { border-color: #f4f4f4; }
/********** Colour of NS MediaWiki + MediaWiki_talk
MediaWiki 與 MediaWiki_talk頁面的相關顏色設定 **********/
.ns-8 #content, .ns-8 #p-cactions li, .ns-8 #p-cactions li a { background: #ffcc00; }
.ns-8 div.thumb { border-color: #f4f4f4; }
.ns-9 #content, .ns-9 #p-cactions li, .ns-9 #p-cactions li a { background: #ffcc00; }
.ns-9 div.thumb { border-color: #f4f4f4; }
/* Background colors */
.backgroundc1 { background-color: #ffffff; } /* white */
.backgroundc2 { background-color: #f9f9f9; } /* light grey (as toc) */
.backgroundc3 { background-color: #eeeeee; } /* light grey (headers) */
.backgroundc4 { background-color: #e0e0e0; } /* more grey */
.backgroundc5 { background-color: #d2d2d2; } /* more grey */
.backgroundc6 { background-color: #b7b7b7; } /* more grey */
.backgroundc7 { background-color: #a3a3a3; } /* darker grey */
/* Major warning - used on the main page template to warn against editing carelessly, but can be used elsewhere as well */
.majorwarning {
background: yellow;
padding: 0.3em;
text-align: center;
font-size: 125%;
border: 2px solid red;
}
/******* MAIN PAGE STYLING
以下為Mediawiki.org首頁所使用的特定CSS
**********/
#mainpage_topbox {
background: #f9f9f9;
padding: 0px;
border: 1px solid #aaaaaa;
margin: 0.2em 10px 10px;
}
.mainpage_boxtitle, .mainpage_hubtitle, #mainpage_pagetitle {
font-size: 105%;
padding: 0.4em;
background-color: #eeeeee;
border-bottom: 1px solid #aaaaaa;
}
.mainpage_boxtitle {
line-height: 120%;
}
#mainpage_pagetitle {
color: #cf7606;
font-size: 200% !important;
}
#mainpage_sitelinks {
padding: 0.2em;
text-align: center;
background-color: white;
}
.mainpage_hubtitle {
text-align: center;
}
.mainpage_boxcontents, .mainpage_boxcontents_small {
background: #ffffff;
padding:0.2em 0.4em;
}
.mainpage_boxcontents_small {
font-size: 95%;
}
.mainpage_hubbox, #mainpage_newscell, #mainpage_downloadcell {
padding: 0;
border: 1px solid #aaaaaa;
}
.mainpage_hubbox {
margin-bottom: 0;
}
#mainpage_newscell {
margin-bottom: 15px;
margin-top: 0 !important;
}
#mainpage_newscell .mainpage_boxtitle {
background-image: url(http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Exquisite-khelpcenter.png/20px-Exquisite-khelpcenter.png);
background-repeat: no-repeat;
background-position: 99% 0.3em;
padding-right: 25px;
}
#mainpage_downloadcell {
width: 17em;
margin-bottom: 5px;
}
#mainpage_downloadcell .mainpage_boxtitle {
background-image: url(http://upload.wikimedia.org/wikipedia/commons/thumb/5/5d/Crystal_Clear_action_build.png/18px-Crystal_Clear_action_build.png);
background-repeat: no-repeat;
background-position: 96% 0.33em;
padding-right: 25px;
}
/* The words 'MediaWiki.org' in the title.*/
#mainpage_mwtitle {
color: #005288;
}
/**** For Extensions
Simple Calendar */
table.calendar { margin: 0; padding: 10px; }
table.calendar td { margin: 0; padding: 2px; vertical-align: top; }
table.month .heading td { padding:2px; background-color:#d4d4d4; color:#aaa; text-align:center; font-size:120%; font-weight:bold; }
table.month .dow td { color:#aaa; text-align:center; font-size:110%; }
table.month td.today { background-color:#ddd; }
table.month td {
border: none;
margin: 0;
padding: 1pt 1.5pt;
font-weight: bold;
font-size: 8pt;
text-align: right;
background-color: #eee;
}
#bodyContent table.month a { background:none; padding:0 }
.day-active { color:#0000cc }
.day-empty { color:#cc0000 }
/* Extension Infobox Styling */
.ext-infobox {
border: 2px solid #aaaaaa;
width: 272px;
float: right;
margin: 0 0 0.5em 0.5em;
border-collapse: collapse;
background-color: white;
}
.ext-infobox td {
border: 2px none #aaaaaa;
padding: 0.2em 0.5em;
border-bottom: 1px solid #f0f0f0 !important;
}
.ext-header {
background-color: #aaaaaa;
color: white;
text-align: left;
}
.ext-header td {
padding-top: 0.5em;
}
.ext-header img {
padding: 0 0.2em 0 0.5em;
}
.ext-status-unstable, .ext-status-unstable td {
border-color: #990000;
}
.ext-status-unstable .ext-header {
background-color: #990000;
color: #ffff00;
}
.ext-status-experimental, .ext-status-experimental td {
border-color: #CC6600;
}
.ext-status-experimental .ext-header {
background-color: #CC6600;
}
.ext-status-beta, .ext-status-beta td {
border-color: #000099;
}
.ext-status-beta .ext-header {
background-color: #000099;
}
.ext-status-stable, .ext-status-stable td {
border-color: #009900;
}
.ext-status-stable .ext-header {
background-color: #009900;
}
/* prettify [[Extension Matrix]] */
.xm-table {
border: 1px solid #666666;
background-color: white;
}
.xm-table td, .xm-table th {
vertical-align: top;
text-align: left;
border: none;
background-color: #EEEEEE;
}
.xm-table th {
font-weight: bold;
}
.xm-name { font-weight: bold; }
.xm-status-unknown { color:#888888; }
.xm-status-experimental { color:red; }
.xm-status-beta { color:blue; }
.xm-status-stable { color:green; }
.xm-type-unknown { color:#888888; }
.xm-name, .xm-status, .xm-type, .xm-version, .xm-updated { white-space: nowrap; }
.xm-updated { font-size:80%; }
.xm-alert { background-color: yellow; }
td.xm-blank { background-color: inherit; }
td.xm-updated { background-color: inherit; }
td.xm-description {
background-color: inherit;
font-style: italic;
}
th.xm-blank, th.xm-updated, th.xm-description {
background-color: inherit;
padding-bottom:0.6ex;
border-bottom: 1px solid #666666;
}
th.xm-description {
font-style: italic;
}
/* Extension:Expandable tables */
.expandable-heading {
background-color: #eee;
border: 1px solid #aaa;
width: 100%;
margin: 0.2em 0 0.2em 0;
padding: 0;
}
.expandable-heading td {
border: none;
padding: 0;
}
.expandable-link {
color: #3D5270;
font-weight: bold;
font-size: 90%;
white-space: nowrap;
padding: 0;
}
.expandable-content {
width: 100%;
background-color: #f4f4f4;
border: none;
padding: 0 0.2em 0 0.2em;
margin: 0;
}
.expandable-content td {
border: none;
margin: 0;
padding: 0 0.2em 0 0.2em;
vertical-align: top;
}
.expandable-content td a { white-space: nowrap; }
/* For DPL-forum use */
table td.forum_title a.forum_new { font-weight: bold }
table td.forum_title a.forum_new:visited { font-weight: normal }
table td.forum_edited a { text-decoration: none }
.forumlist { border-collapse: collapse }
.forumlist td { border-top: solid #999 1px }
.forumlist td span { display: block; padding-left: 10px; font-size: smaller }
.forumlist td span a { text-decoration: none; }
.forumlist td span.forum_author { padding-left: 30px; }
.forumlist td.forum_title a { padding-left: 20px }
.forumlist td.forum_title span a { padding-left: 0px }
.forumlist td.forum_title a.forum_new { background: url(/w/images/Forum_new.gif) center left no-repeat }
.forumlist td.forum_title a.forum_new:visited { background: none }
.forumlist th.forum_title { padding-left: 20px }
/*一般用途
Extension Infobox Styling */
.ext-infobox {
border: 2px solid #aaaaaa;
width: 272px;
float: right;
margin: 0 0 0.5em 0.5em;
border-collapse: collapse;
background-color: white;
}
.ext-infobox td {
border: 2px none #aaaaaa;
padding: 0.2em 0.5em;
border-bottom: 1px solid #f0f0f0 !important;
}
.ext-header {
background-color: #aaaaaa;
color: white;
text-align: left;
}
.ext-header td {
padding-top: 0.5em;
}
.ext-header img {
padding: 0 0.2em 0 0.5em;
}
.ext-status-unstable, .ext-status-unstable td {
border-color: #990000;
}
.ext-status-unstable .ext-header {
background-color: #990000;
color: #ffff00;
}
.ext-status-experimental, .ext-status-experimental td {
border-color: #CC6600;
}
.ext-status-experimental .ext-header {
background-color: #CC6600;
}
.ext-status-beta, .ext-status-beta td {
border-color: #000099;
}
.ext-status-beta .ext-header {
background-color: #000099;
}
.ext-status-stable, .ext-status-stable td {
border-color: #009900;
}
.ext-status-stable .ext-header {
background-color: #009900;
}
/* GENERAL PURPOSE PRETTY TABLES */
table.datatable {
background-color: transparent;
}
table.datatable th, td {
padding: 4px;
}
table.datatable th {
text-align: left;
background-color: #999999;
}
table.datatable tr {
background-color: #CCCCCC;
}
table.datatable tr:hover {
background-color: #FFFFCC;
}
/* GENERAL PURPOSE PRETTY TABLES (淺色) */
table.datatable_light {
background-color: transparent;
}
table.datatable_light th, td {
padding: 4px;
}
table.datatable_light th {
text-align: center; vertical-align:middle;
background-color: #ccccff;
}
table.datatable_light tr {
background-color: #CCCCCC;
}
table.datatable_light tr:hover {
background-color: #FFFFCC;
}
/*wikitable/prettytable class for skinning normal tables */
table.wikitable,
table.prettytable {
margin: 1em 1em 1em 0;
background: #f9f9f9;
border: 1px #aaa solid;
border-collapse: collapse;
empty-cells:show;
}
table.wikitable th, table.wikitable td,
table.prettytable th, table.prettytable td {
border: 1px #aaa solid;
padding: 0.2em;
}
table.wikitable th, table.wikitable td.hl3, table.wikitable th.hl3,
table.prettytable th, table.prettytable td.hl3, table.wikitable th.hl3 {
background: #8da7d6;
text-align: center;
}
table.wikitable td.hl1, table.wikitable th.hl1,
table.prettytable td.hl1, table.wikitable th.hl1 {
background: #c5d8fc;
text-align: center;
}
table.wikitable td.hl2, table.wikitable th.hl2,
table.prettytable td.hl2, table.wikitable th.hl2 {
background: #a7c1f2;
text-align: center;
}
table.wikitable caption,
table.prettytable caption {
margin-left: inherit;
margin-right: inherit;
font-weight: bold;
}
/* Sidebar External Links */
#n-browse-cvs a, #n-phpdoc a, #n-Mailing-list a {
background: url(/skins-1.5/monobook/external.png) center right no-repeat;
padding-right: 13px;
color: #36b;
}
/* make the list of references look smaller */
ol.references {
font-size: 100%;
}
.references-small { font-size: 90%;}
/* prevent ugly horizontal page expansion */
pre { overflow: auto; }
/* Standard Navigationsleisten, aka box hiding thingy from .de. Documentation at [[Wikipedia:NavFrame]]. */
div.Boxmerge,
div.NavFrame {
margin: 0px;
padding: 4px;
border: 1px solid #aaa;
text-align: center;
border-collapse: collapse;
font-size: 95%;
}
div.Boxmerge div.NavFrame {
border-style: none;
border-style: hidden;
}
div.NavFrame + div.NavFrame {
border-top-style: none;
border-top-style: hidden;
}
div.NavPic {
background-color: #fff;
margin: 0px;
padding: 2px;
float: left;
}
div.NavFrame div.NavHead {
height: 1.6em;
font-weight: bold;
background-color: #ccf;
position:relative;
}
div.NavFrame p {
font-size: 100%;
}
div.NavFrame div.NavContent {
font-size: 100%;
}
div.NavFrame div.NavContent p {
font-size: 100%;
}
div.NavEnd {
margin: 0px;
padding: 0px;
line-height: 1px;
clear: both;
}
a.NavToggle {
position:absolute;
top:0px;
right:3px;
font-weight:normal;
font-size:smaller;
}
/* Coloured watchlist numbers */
.mw-plusminus-pos {
color: #006400; /* darkgreen */
}
/* .mw-plusminus-null currently at developer default */
.mw-plusminus-neg {
color: #8B0000; /* darkred */
}
.dablink {
font-style: italic;
padding-left: 2em;
}
.dablink i {
font-style: normal;
}
/* Style for horizontal UL lists */
.horizontal ul {
padding: 0;
margin: 0;
}
.horizontal li {
padding: 0 0.6em 0 0.4em;
display: inline;
border-right: 1px solid;
}
.horizontal li:last-child {
border-right: none;
padding-right: 0;
}
/* Coloured watchlist / Special:Recentchanges numbers */
.mw-plusminus-pos {
color: #006400; /* darkgreen */
}
/* .mw-plusminus-null currently at developer default */
.mw-plusminus-neg {
color: #8B0000; /* darkred */
}
/* extra buttons for edit dialog */
/* from commons:MediaWiki:Common.css */
.my-buttons {
padding: 0.5em;
}
.my-buttons a {
color: black;
background-color: #ccddee !important;
font-weight: bold;
font-size: 1.2em;
text-decoration: none;
border: thin #006699 outset;
padding: 0 0.1em 0.1em 0.1em;
}
.my-buttons a:hover, .my-buttons a:active {
background-color: #bbccdd;
border-style: inset;
}
/* Infobox template style */
.infobox {
border: 1px solid #aaaaaa;
background-color: #f9f9f9;
color: black;
margin-bottom: 0.5em;
margin-left: 1em;
padding: 0.2em;
float: right;
clear: right;
}
.infobox td,
.infobox th {
vertical-align: top;
}
.infobox caption {
font-size: larger;
margin-left: inherit;
}
.infobox.bordered {
border-collapse: collapse;
}
.infobox.bordered td,
.infobox.bordered th {
border: 1px solid #aaaaaa;
}
.infobox.bordered .borderless td,
.infobox.bordered .borderless th {
border: 0;
}
.infobox.sisterproject {
width: 20em;
font-size: 90%;
}
@media print {
.infobox.sisterproject {
display: none;
}
}
/* styles for bordered infobox with merged rows */
.infobox.bordered .mergedtoprow td,
.infobox.bordered .mergedtoprow th {
border: 0;
border-top: 1px solid #aaaaaa;
border-right: 1px solid #aaaaaa;
}
.infobox.bordered .mergedrow td,
.infobox.bordered .mergedrow th {
border: 0;
border-right: 1px solid #aaaaaa;
}
/* styles for geography infoboxes, e.g. countries, country subdivisions, cities, etc. */
.infobox.geography {
text-align: left;
border-collapse: collapse;
line-height: 1.2em;
font-size: 90%;
}
.infobox.geography td,
.infobox.geography th {
border-top: solid 1px #aaaaaa;
padding: 0.4em 0.6em 0.4em 0.6em;
}
.infobox.geography .mergedtoprow td,
.infobox.geography .mergedtoprow th {
border-top: solid 1px #aaaaaa;
padding: 0.4em 0.6em 0.2em 0.6em;
}
.infobox.geography .mergedrow td,
.infobox.geography .mergedrow th {
border: 0;
padding: 0 0.6em 0.2em 0.6em;
}
.infobox.geography .mergedbottomrow td,
.infobox.geography .mergedbottomrow th {
border-top: 0;
border-bottom: solid 1px #aaaaaa;
padding: 0 0.6em 0.4em 0.6em;
}
.infobox.geography .maptable td,
.infobox.geography .maptable th {
border: 0;
padding: 0;
}
/* CSS for Extension:TransformChanges */
table.changes { border:none; width:100%; }
table.changes tr { margin:0; padding:0; }
table.changes tr.even { background:white; }
table.changes tr.odd { background:#eee; }
table.changes td { margin:0; padding: 1px 4px 0 4px; vertical-align: top; }
table.changes td.heading { font-size: 110%; font-weight:bold; padding-top:10px; }
table.changes td.comment { width:100%; }
table.changes td.talk,
table.changes td.diff { font-size: 90%; }
table.changes td.user,
table.changes td.talk,
table.changes td.diff,
table.changes td.info { white-space: nowrap; }
/*--------------------------------------------------|
| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
|---------------------------------------------------|
| Copyright (c) 2002-2003 Geir Landr� |
|--------------------------------------------------*/
.dtree {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #666;
white-space: nowrap;
}
.dtree img {
border: 0px;
vertical-align: middle;
}
.dtree a {
color: #333;
text-decoration: none;
}
.dtree a.node, .dtree a.nodeSel {
white-space: nowrap;
padding: 1px 2px 1px 2px;
}
.dtree a.node:hover, .dtree a.nodeSel:hover {
color: #333;
text-decoration: underline;
}
.dtree a.nodeSel {
background-color: #c0d2ec;
}
.dtree .clip {
overflow: hidden;
}
/*
* Dynamic menus
*/
.dmenu { width: 180px }
.dmenu, .dmenu ul { /* all lists */
padding: 0;
margin: 0;
list-style: none;
}
.dmenu .selflink { font-weight: normal; }
.dmenu li { /* all list items */
position: relative;
float: left;
width: 172px;
padding: 4px;
z-index: 100;
}
.dmenu li,
.dmenu li.even a,
.dmenu li.odd a,
.dmenu li li,
.dmenu li li a,
.dmenu li li li,
.dmenu li li li a {
color : black;
}
.dmenu li li { margin: 0; }
.dmenu li ul { /* second-level lists */
position: absolute;
left: -999em;
z-index: 101;
border: 1px solid #ccc;
}
.dmenu li ul ul { /* third-and-above-level lists */
position: absolute;
left: -999em;
margin: 0 0 0 0;
z-index: 102;
}
.dmenu li.odd .submenu {
width: 12px;
height: 15px;
float: right;
background: url(/common/images/rarr-lt.png) 0 3px no-repeat;
}
.dmenu li.even .submenu {
width: 12px;
height: 15px;
float: right;
background: url(/common/images/rarr-dk.png) 0 3px no-repeat;
}
.dmenu li.odd {
background: #E9EDF4;
border: 2px solid #E9EDF4;
}
.dmenu li.even {
background: #D0D8E8;
border: 2px solid #D0D8E8;
}
.dmenu li:hover, .dmenu li.sfhover {
border: 2px solid #385D8A;
}
.dmenu li:hover ul ul,
.dmenu li:hover ul ul ul,
.dmenu li.sfhover ul ul,
.dmenu li.sfhover ul ul ul {
left: -999em;
}
.dmenu li:hover ul,
.dmenu li li:hover ul,
.dmenu li li li:hover ul,
.dmenu li.sfhover ul,
.dmenu li li.sfhover ul,
.dmenu li li li.sfhover ul { /* lists nested under hovered list items */
left: 182px;
top: -3px;
}
/*
--------- Extension:PageBy
*/
ul.pageby {
float:right;
clear:right;
border:1px solid #60606F;
background-color:#E0E0EF;
font-size: 80%;
margin:1ex;
padding:1ex;
list-style-type:none;
/*
The MediaWiki:Common.js in my testwiki
[edit]/*所有用戶在加載任何頁面時,這裡的JavaScript都會加載
__FORCETOC__
*說明
*按鈕設定方式參見[[MediaWiki:Common.js編輯按鈕維護]]
*設定值
*輔助處理 ****/
//功能設定
var JSConfig={
'isEdit0':true, //設置是否顯示編輯首段按鈕
'collapseText':wgULS('隱藏▲','隱藏▲'),//指示折疊收縮的默認文字
'expandText':wgULS('顯示▼','顯示▼'),//指示折疊展開的默認文字
'autoCollapse':2, //文章少於 autoCollapse 個折疊塊時,不自動折疊
'SpecialSearchEnhancedDisabled':false//是否禁止增加其他搜索引擎
}
// 相容性修正
if (window.showModalDialog && document.compatMode && document.compatMode == "CSS1Compat")
{
var oldWidth;
var docEl = document.documentElement;
function fixIEScroll()
{
if (!oldWidth || docEl.clientWidth > oldWidth){
doFixIEScroll();
}else{
setTimeout(doFixIEScroll, 1);
}
oldWidth = docEl.clientWidth;
}
function doFixIEScroll() {
docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
}
document.attachEvent("onreadystatechange", fixIEScroll);
attachEvent("onresize", fixIEScroll);
}
// 移動元素
function elementMoveto(node, refNode, pos){//默認位置爲refNode前
if(node && refNode){
var parent=refNode.parentNode;
if (pos && pos=='after') {refNode=refNode.nextSibling;}
try {
if(refNode){
parent.insertBefore(node, refNode);
}else{
parent.appendChild(node);
}
} catch (DOMException) {};
}
}
//創建元素
function createElement(tag,children,props){
var element = document.createElement(tag);
if(children instanceof Array){
for(var i=0;i<children.length;i++){
var child=children[i];
if(typeof child=='string'){child=document.createTextNode(child);}
if(child){element.appendChild(child);}
}
}
if(typeof props=='object'){
for(var k in props){
switch(k){
case 'styles':
var styles=props.styles;
if(typeof styles=='object'){
for(var s in styles){element.style[s]=styles[s];}
}
break;
case 'events':
var events=props.events;
if(typeof events=='object'){
for(var e in events){element['on'+e]=events[e];}
}
break;
case 'class':
element.className=props[k];break;
default:
element.setAttribute(k,props[k]);
}
}
}
return element;
}
//導入模組
function getWikiPath(page,paras){
paras.ctype=paras.ctype||'text';
paras.dontcountme=paras.dontcountme||'s';
paras.action=paras.action||'raw';
var url = wgScriptPath + '/index.php?title=' + encodeURI( page.replace( ' ', '_' ) );
for(var k in paras){url += '&' + k + '=' + paras[k]; }
return url;
}
function importScript( page ) {
var src= /^https?:\/\//.test(page) ? page : getWikiPath(page,{'ctype':'text/javascript'});
var scriptElem = createElement( 'script',null,{'src':src,'type':'text/javascript'} );
document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );
}
function importStylesheet( page ) {
var sheet= /^https?:\/\//.test(page) ? page : getWikiPath(page,{'ctype':'text/css'});
var styleElem = createElement( 'style', ['@import "'+sheet+'";'], {'type':'text/css'} );
document.getElementsByTagName( 'head' )[0].appendChild( styleElem );
}
/* 測試元素中是否含有指定的樣式 **************************************
* Description: 使用正則式與緩存來提高性能
* Maintainers: User:fdcn @zh.wikipedia
* [[en:User:Mike Dillon]], [[en:User:R. Koot]], [[en:User:SG]] @en.wikipedia
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
//設置中文語言頁
var htmlE=document.documentElement;
htmlE.setAttribute("lang",wgUserLanguage);
htmlE.setAttribute("xml:lang",wgUserLanguage);
//返回繁簡字串
function wgULS(cn,tw,hk,sg,zh){
return {//保證每一語言有值
'zh-cn':cn||sg,
'zh-sg':sg||cn,
'zh-tw':tw||hk,
'zh-hk':hk||tw,
'zh':zh||cn||tw||hk||sg
}[wgUserLanguage];
}
/*** 調整編輯工具欄
mwEditButtons , mwCustomEditButtons 爲預設按鈕集合
***/
//override original function
var mwEdittoolButtons=[];
function mwInsertEditButton(parent,item) {
var doClick = typeof item.doClick=='function' ? item.doClick : insertTags;
var image = createElement("IMG",null,
{
'width':item.width||23,
'height':22,
'class':"mw-toolbar-editbutton",
'src':item.imageFile,
'border':0,
'alt':item.speedTip,
'title':item.speedTip,
'styles':{'cursor':"pointer"},
'events':{'click':function(){
doClick(item.tagOpen, item.tagClose, item.sampleText);
return false;
}}
}
);
if (item.imageId) {
image.id = item.imageId;
mwEdittoolButtons[image.id]=Image;
}
mwEdittoolButtons.push(image);
parent.appendChild(image);
return true;
}
/**
* 插入游標所在的分段前後
* sectReg 分段的正則運算式
* author & maintainer : fdcn@zhwiki
*/
function insertSect(sectReg,pre,post){
var txtarea = document.editform.wpTextbox1;
insertTags('<sectins>','</sectins>','');
var reg=/<sectins><\/sectins>/g;
var scrollTop = txtarea.scrollTop;
var text=txtarea.value;
var index=-1;
text=text.replace(reg,function(m,i){index=i;return '';});
if(index>-1){
sectReg.lastIndex=0;
var currentIndex=0,startIndex=0,endIndex=0;
while(true){
var item= sectReg.exec(text);
if(!item){
endIndex=text.length;
break;
}
currentIndex=item.index;
if(currentIndex<index){
startIndex=sectReg.lastIndex;
continue;
}else{
endIndex=currentIndex;
break;
}
}
txtarea.value=text.substring(0, startIndex)+pre+text.substring(startIndex,endIndex)+post+text.substr(endIndex);
}else{
txtarea.value=text.replace(/<sectins>/g,pre).replace(/<\/sectins>/g,post);
}
txtarea.scrollTop = scrollTop;
}
/**
* 插入游標所在的行前後
* isMultiLine 是否應用于每一行前後
* author & maintainer : fdcn@zhwiki
*/
function insertLine(pre,sampletext,post,isMultiLine){
var txtarea = document.editform.wpTextbox1;
var scrollTop = txtarea.scrollTop;
insertTags('<sectins>','</sectins>','');
var text=txtarea.value
.replace(/\r/g,"")
.replace(/^(.*)<sectins>/m,'<sectins>$1')
.replace(/<\/sectins>(.*)$/m,'$1<\/sectins>')
.replace(/<sectins> *<\/sectins>/,'<sectins>'+sampletext+'<\/sectins>');
if(/<sectins>((?:a|[^a])*)<\/sectins>/.exec(text)){
var leftContext=RegExp.leftContext;
var rightContext =RegExp.rightContext ;
var matchContext= isMultiLine
? RegExp.$1.replace(/$/mg,'<endline\/>').replace(/^/mg,pre).replace(/<endline\/>/g,post)
: pre+RegExp.$1+post;
}
txtarea.value=leftContext+matchContext+rightContext;
//IE
if (document.selection && !is_gecko) {
var range=txtarea.createTextRange();
var searchText=matchContext.replace(/\n.*/g,'');
range.findText(searchText);
range.select();
// Mozilla
}else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
txtarea.selectionStart = leftContext.length;
txtarea.selectionEnd = txtarea.selectionStart +matchContext.length;
txtarea.scrollTop = scrollTop;
}
// reposition cursor if possible
if (txtarea.createTextRange) {
txtarea.caretPos = document.selection.createRange().duplicate();
}
}
if (mwCustomEditButtons){
var doML=function(pre,post,sampletext){insertLine(pre,sampletext,post,true);}
//prepare buttons
function addEditButton(imageFile, tagOpen, sampleText, tagClose, speedTip, imageId){
var item={
"imageId": imageId,
"imageFile": "http://studwww.nou.edu.tw/~e-live/image/" + imageFile,
"tagOpen": tagOpen,
"sampleText": sampleText,
"tagClose": tagClose,
"speedTip": speedTip
};
mwCustomEditButtons.push(item);
return item;
}
//define buttons
var __temp,item;
addEditButton('wiki_buttons/Internal_link_icon.png','[[','鏈結標題',']]','內部鏈結','btnInterLink');
addEditButton("wiki_buttons/Button_sub_link.png","[[條目#","章節|文本","]]","內部段落鏈結",'btnInterHashLink' );
addEditButton("wiki_buttons/Button_category02.png","[[:Category:","分類名","]]","分類鏈結",'btnCategoryLink');
addEditButton('wiki_buttons/Media_icon.png','[[Media:','Example.ogg',']]','媒體文件鏈結','btnMediaLink');
addEditButton('wiki_buttons/External_link_icon.png','[','http://www.example.com 鏈結標題',']','外部鏈結(加字首 http://)','btnExtraLink');
addEditButton("wiki_buttons/Template_button.png","{{","樣板名","}}","應用樣板",'btnTemplateLink');
addEditButton("wiki_buttons/Button_category03.png","[[Category:","分類名","]]","分類",'btnCategory');
addEditButton("wiki_buttons/Button_redir.png","#REDIRECT [[","目標條目名","]]","重定向",'btnRedirect');
addEditButton('wiki_buttons/Image_icon.png','[[Image:','Example.jpg',']]','嵌入圖像','btnImage');
addEditButton("wiki_buttons/Button_advanced_image.png",
"<imagemap>\n",
"Image:圖像名 | 100px | 描述\nrect 0 0 50 50 [[鏈接]]\ncircle 50 50 20 [[鏈接B]]\ndesc bottom-left\n",
"</imagemap>",
wgULS("高級畫像","高級畫像"),
'btnAdvImage'
);
__temp="\nImage:PictureFileName.jpg|"+wgULS("圖片題注","圖片題注");
addEditButton("wiki_buttons/Btn_toolbar_gallery.png","<gallery>",__temp+__temp,"\n</gallery>",wgULS("畫廊","畫廊"),'btnGallery' );
addEditButton('wiki_buttons/Math_icon.png','\<math\>','插入數學公式','\</math\>','插入數學公式(LaTeX)','btnMath');
addEditButton('wiki_buttons/Nowiki_icon.png','\<nowiki\>','插入非格式文本','\</nowiki\>','插入非格式文本','btnNowiki');
item=addEditButton('wiki_buttons/Button_sig.png','[[User:Michael|Michael]]','','','簽名(無日期)','btnSigOnly')
.width = 11;
addEditButton('wiki_buttons/Signature_icon.png','—[[User:Michael|Michael]] 2008年1月12日 (六) 15:26 (UTC)','','','簽名','btnSignature');
addEditButton('wiki_buttons/Button_headline2.png','== ','標題文字','==','2級標題文字','btnHeadline2')
.doClick=doML;
addEditButton("wiki_buttons/Button_headline3.png","=== ","標題文本","===","三級子標題",'btnHeadline3' )
.doClick=doML;
addEditButton('wiki_buttons/H-line_icon.png','\n----\n','','',wgULS('水平線','水平線'),'btnHr' );
addEditButton("wiki_buttons/Button_enter.png","<br />","","", wgULS("換行","換行"),'btnBr' );
addEditButton('wiki_buttons/Bold_icon.png','\'\'\'','粗體','\'\'\'','粗體','btnBold');
addEditButton('wiki_buttons/Italic_icon.png','\'\'','斜體','\'\'','斜體','btnItalic');
__temp=wgULS("下劃線","下劃線");
addEditButton('wiki_buttons/Button_underline.png','<span style="text-decoration: underline;">',__temp,'</span>',__temp,'btnUnderline');
__temp=wgULS("刪除線","刪除線");
addEditButton("wiki_buttons/Button_strike.png","<del>",__temp,"</del>",__temp,'btnStrike');
__temp=wgULS("左對齊","左對齊");
addEditButton("wiki_buttons/Button_align_left.png",'<div style="text-align: left;">\n',__temp,"\n</div>",__temp,'btnAlignLeft')
.doClick=doML;
addEditButton("wiki_buttons/Button_center.png",'<div style="text-align: center;">\n',"居中","\n</div>","居中",'btnAlignCenter')
.doClick=doML;
__temp=wgULS("右對齊","右對齊");
addEditButton("wiki_buttons/Button_align_right.png",'<div style="text-align: right;">\n',__temp,"\n</div>",__temp,'btnAlignRight')
.doClick=doML;
__temp=wgULS("上標","上標");
addEditButton("wiki_buttons/Button_sup_letter.png","<sup>",__temp,"</sup>", __temp,'btnSup');
__temp=wgULS("下標","下標");
addEditButton("wiki_buttons/Button_sub_letter.png","<sub>",__temp,"</sub>",__temp,'btnSub');
addEditButton("wiki_buttons/Button_big.png",'<span style="font-size:larger;">',"放大","</span>","放大",'btnBig');
__temp=wgULS("縮小","縮小");
addEditButton("wiki_buttons/Button_small.png",'<span style="font-size:smaller;">',__temp,"</span>",__temp,'btnSmall');
addEditButton("wiki_buttons/Button_shifting.png",":","","","縮進",'btnShift' )
.doClick=doML;
addEditButton("wiki_buttons/Btn_toolbar_enum.png","#","","","數字列表",'btnEnum' )
.doClick=doML;
addEditButton("wiki_buttons/Btn_toolbar_liste.png","*","","","符號列表",'btnList' )
.doClick=doML;
addEditButton("wiki_buttons/Button_definition_list.png","; ","釋義",": ","定義文本",'btnDefine' )
.doClick=doML;
addEditButton("wiki_buttons/Button_font_color.png",'<span style="color: ColorName;">',"彩色文本","</span>","彩色文本",'btnColor');
addEditButton("wiki_buttons/Button_blockquote.png",'{\{quote|\n',"引文","\n}\}","塊引用",'btnQuote' );
addEditButton("wiki_buttons/Button_code.png","<code>","代碼","</code>","代碼文本",'btnCode' );
addEditButton('wiki_buttons/Tt_icon.png','<tt>','tt文字註記','</tt>','tt文字註記','btnTt');
addEditButton('wiki_buttons/Button_pre.png','<pre>','pre_text文字標籤','</pre>','pre_text文字標籤','btnPretext');
addEditButton('wiki_buttons/Button_source.png','<syntaxhighlight lang="php">','[http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi 前往查看]','
','高亮度語法標示','btnSource');
addEditButton("wiki_buttons/Button_hide_comment.png","","注釋或隱藏文字",'btnComment' ); addEditButton("wiki_buttons/Button_array.png",'\n{| border="1" \n|- \n| 第一部分 || 第二部分 \n|- \n| 第三部分 || 第四部分',"","\n|}\n","插入表格",'btnTable'); addEditButton('wiki_buttons/Button_array_excel.png','<tab width=100% class="wikitable sortable">','\n姓名 分數\n張三 65\n李四 75\n','</tab>','MS Excel相容表格','btnArrayExcel'); __temp=wgULS("參考","參考"); addEditButton("wiki_buttons/Button_ref.png","[1]", __temp,'btnRef' ); __temp=wgULS("同項參考","同項參考"); addEditButton("wiki_buttons/Button_ref_adv.png",'[2]', __temp,'btnRef2' ) .width = 12;
addEditButton("wiki_buttons/Button_refs.png",'\n==參考文獻==\n
',,, wgULS("參考文獻區","參考文獻區"),'btnReferences' );
delete __temp; addOnloadHook(function(){ mwEditButtons=[]; }); }
// 調整工具 hookEvent("load",function(){ var wpEditToolbar=document.getElementById("toolbar"); if(wpEditToolbar){ //移動下拉選單 var dropdownListEditTools=document.getElementById("dropdownListEditTools"); if(wpEditToolbar&&dropdownListEditTools){ wpEditToolbar.appendChild(dropdownListEditTools); } //dropdownListEditTools.style.display="inline"; //移動符號表 var editspecialchars=document.getElementById("editpage-specialchars"); elementMoveto(editspecialchars , wpEditToolbar , 'after' ); } }); /**** 增加特殊符號的下拉選單 ****/ /** * add menu for selecting subsets of secial characters * must match MediaWiki:Edittools * Maintainers: User:fdcn @zh.wikipedia */ addOnloadHook(function(){ var edittools = document.getElementById('editpage-specialchars'); if (edittools) { // select subsection of special characters var lines = edittools.getElementsByTagName('p'); function chooseCharSubset() { var s=menu.selectedIndex; for (var i = 0,p; p=lines[i] ; i++) { p.style.display = i == s ? 'inline' : 'none'; } } var menu=createElement("select",null,{ 'styles':{'display':"inline"}, 'events':{'change':chooseCharSubset} }); for (var i = 0,p; p=lines[i] ; i++) { menu.options[i]=new Option(p.title?p.title:p.id); } edittools.insertBefore(menu,edittools.firstChild); chooseCharSubset(); } }); /**** 尋找及取代工具 ****/ var sr$t; var sr$f; var sr$s; var sr$r; var sr$w; var sr$i; var sr$re; var sr$mc; function $e(id) {return document.getElementById(id)} function srBack() { if (sr$s.value=='') {sr$t.focus(); return } if (sr$re.checked) { var searchString = sr$s.value; } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); } searchString="("+searchString+")(?![\\s\\S]*"+searchString+")"; if (sr$mc.checked) var re=new RegExp(searchString); else var re=new RegExp(searchString,"i"); var res = re.exec (sr$t.value.substring(0,sr$t.selectionStart)); if (!res) { var res = re.exec (sr$t.value) } if (res) { sr$t.selectionStart=res.index; sr$t.selectionEnd=res.index+res[1].length; } else sr$t.selectionStart=sr$t.selectionEnd; srSync(); } function srNext() { if (sr$s.value=='') {sr$t.focus(); return } if (sr$re.checked) { var searchString = sr$s.value; } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); } if (sr$mc.checked) var re=new RegExp(searchString,"g"); else var re=new RegExp(searchString,"gi"); re.lastIndex=sr$t.selectionEnd; var res = re.exec (sr$t.value) if (!res) { re.lastIndex=0; var res = re.exec (sr$t.value) } if (res) { sr$t.selectionStart=res.index; sr$t.selectionEnd=res.index+res[0].length; } else sr$t.selectionStart=sr$t.selectionEnd; srSync(); } function srReplace() { var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele; if (sr$s.value=='' || sels==sele) {sr$t.focus(); return } if (sr$re.checked) { var searchString = sr$s.value; var replaceString = sr$r.value; } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); replaceString=sr$r.value.replace(/([\$\\])/g,'\\$1'); } if (sr$mc.checked) var re=new RegExp(searchString,"g"); else var re=new RegExp(searchString,"gi"); re.lastIndex=sels; var res = re.exec (sr$t.value); var $$=0; if (res && res.index==sels && res[0].length==sele-sels) { if (sr$re.checked) { replaceString=replaceString.replace(/\\\\/g,'&backslash;').replace(/\\\$/g,'$') var replaceBits=(" "+replaceString).split(/(?=\$\d)/); replaceString=replaceBits[0].substring(1); for (var i=1; i<replaceBits.length; i++) { $$=replaceBits[i][1]-'0'; if ($$<res.length) replaceString += res[$$] + replaceBits[i].substring(2) else replaceString += replaceBits[i]; } replaceString=replaceString.replace (/\\n/,"\n").replace (/&backslash;/g,"\\").replace (/$/g,"\$") } sr$t.value= sr$t.value.substring(0,sels) + replaceString + sr$t.value.substring(sele); } sr$t.selectionStart=sels; sr$t.selectionEnd=sr$t.value.length-selr; srSync(); } function srReplaceall() { if (!sr$s.value) {sr$t.focus(); return } var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele; var reps; if (sr$re.checked) { var searchString = sr$s.value; var replaceString = sr$r.value.replace(/\\\\/,'&backslash;').replace(/\\n/,'\n').replace(/&backslash;/,"\\"); } else { searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); replaceString=sr$r.value.replace(/([\$\\])/g,'\\$1'); } if (sele>sels) reps=sr$t.value.substring(sels,sele); else reps=sr$t.value; if (sr$mc.checked) var re=new RegExp(searchString,"g"); else var re=new RegExp(searchString,"gi"); var replaceCounter=0; var replaceFunc=function(){replaceCounter++;return replaceString}; reps=reps.replace(re,replaceFunc); if (sele>sels) sr$t.value = sr$t.value.substring(0,sels) + reps + sr$t.value.substring(sele); else sr$t.value = reps; sr$t.selectionStart=sels; sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; window.status = replaceCounter+" ocurrences of " + searchString + " replaced."; srSync(); } function srToggleCase() { var sels=sr$t.selectionStart; var sele=sr$t.selectionEnd; var selr=sr$t.value.length-sele; var selt=sr$t.value.substring(sels,sele); if (sele>sels) { if (selt==selt.toUpperCase()) selt=selt.toLowerCase() else if (selt==selt.toLowerCase() && sele-sels>1) selt=selt.substring(0,1).toUpperCase()+selt.substring(1).toLowerCase() else selt=selt.toUpperCase(); sr$t.value = sr$t.value.substring(0,sels) + selt + sr$t.value.substring(sele); sr$t.selectionStart=sels; sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; } srSync(); } function srSync() { var i; var allLines=0; var lineNo=0; var w=sr$t.cols-5; var dummy=sr$t.value.split("\n"); for (i=0;i<dummy.length;i++){allLines+=Math.ceil(dummy[i].length/w)} var dummy=sr$t.value.substring(0,sr$t.selectionStart).split("\n"); for (i=0;i<dummy.length;i++){lineNo+=Math.ceil(dummy[i].length/w)} // alert (w+" "+lineNo+"/"+allLines); sr$t.scrollTop=sr$t.scrollHeight*(lineNo-10)/allLines; sr$t.focus(); } function srInit() { if($e('wpTextbox1')) { var srBoxCode ='<div id="srForm"><table id="srBox" cellpadding="0" cellspacing="2">' +'<tr><td valign="bottom"><small><span style="color:#000000;">search for:</span></small><br/>' +'<input type="text" id="srSearch" accesskey="F" tabindex="8"' +'onkeypress="event.which == 13 && srNext()"; value=""/></td>' +'<td valign="bottom"><small><span style="color:#000000;">replace with:</span></small><br/><input type="text" id="srReplace" accesskey="G" tabindex="9"' +'onkeypress="event.which == 13 && srNext()"; value=""/></td>' +'<td valign="top">' +'<input type="checkbox" id="srCase" onclick="sr$t.focus()" tabindex="10"/><small><span style="color:#000000;">match case</span></small>' +'<input type="checkbox" id="srRegexp" onclick="sr$t.focus()" tabindex="11"/><small><span style="color:#000000;">use regexp</span></small><br/> ' +'<a href="javascript:srBack()" onmouseover="sr$t.focus()" title="find previous match [alt-2]" accesskey="2"><</a> ' +'<a href="javascript:srNext()" onmouseover="sr$t.focus()" title="find next match [alt-3]" accesskey="3">find ></a> ' +'<a href="javascript:srReplace();srBack()" onmouseover="sr$t.focus()" title="replace and find previous match [alt-4]" accesskey="4"><</a> ' +'<a href="javascript:srReplace()" onmouseover="sr$t.focus()" title="replace this match">replace</a> ' +'<a href="javascript:srReplace();srNext()" onmouseover="sr$t.focus()" title="replace and find next match [alt-5]" accesskey="5">></a> ' +'<a href="javascript:srReplaceall()" onmouseover="sr$t.focus()" title="replace all matches [alt-7]" accesskey="7">replace all</a> ' +'</td></tr></table></div>' var ep=$e('searchInput'); if (ep) ep.accessKey='none'; sr$t=document.editform.wpTextbox1; sr$w=sr$t.style.width; var sr=document.createElement('div'); sr.innerHTML=srBoxCode; var im=document.createElement('span'); im.innerHTML='<a id="SearchIcon" href="javascript:srShowHide()"><img style="cursor: pointer;" title="Search/Replace" alt="Search/Replace" src="http://upload.wikimedia.org/wikipedia/en/1/12/Button_find.png" border="0" height="22" width="23"></a><a href="javascript:srToggleCase()"><img style="cursor: pointer;" title="Toggle case" alt="Toggle case" src="http://upload.wikimedia.org/wikipedia/en/1/12/Button_case.png" border="0" height="22" width="23"></a>'; var ep=$e('toolbar'); if (ep) { ep.appendChild(im) } else { var ep=$e('editform'); ep.parentNode.insertBefore(im,ep); } sr$i=$e('SearchIcon'); sr$i.accessKey="F"; sr.firstChild.style.display='none'; var ep=$e('editform'); ep.parentNode.insertBefore(sr,ep); sr$f=$e('srForm'); sr$s=$e('srSearch'); sr$r=$e('srReplace'); sr$re=$e('srRegexp'); sr$mc=$e('srCase'); } } function srShowHide() { if (sr$f.style.display=='none') { sr$f.style.display='block'; sr$i.accessKey="none"; sr$t.style.width='auto'; sr$s.focus(); } else { sr$f.style.display='none'; sr$t.style.width=sr$w; sr$i.accessKey="F"; } } document.write('<link rel="stylesheet" type="text/css" href="' + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.css' + '&action=raw&ctype=text/css&dontcountme=s">'); addOnloadHook(srInit); /***以新視窗開啟外部連結*****/ externalLinks = function() { if (!document.getElementsByTagName) { return; } var anchors = document.getElementsByTagName("a"); for (var i = 0; i < anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") != null && (anchor.getAttribute("rel").indexOf("external") >= 0 || anchor.getAttribute("rel").indexOf("nofollow") >= 0) ) { anchor.target = "_blank"; } } } if (window.addEventListener) { window.addEventListener("load", externalLinks, false); } else if (window.attachEvent) { window.attachEvent("onload", externalLinks); } /*** Collapsible tables ***/ /** Collapsible tables ********************************************************* * * Description: Allows tables to be collapsed, showing only the header. See * [[Wikipedia:NavFrame]]. * Maintainers: [[User:R. Koot]] */ var autoCollapse = 2; var collapseCaption = "隱藏"; var expandCaption = "顯示"; function collapseTable( tableIndex ) { var Button = document.getElementById( "collapseButton" + tableIndex ); var Table = document.getElementById( "collapsibleTable" + tableIndex ); if ( !Table || !Button ) { return false; } var Rows = Table.rows; if ( Button.firstChild.data == collapseCaption ) { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = "none"; } Button.firstChild.data = expandCaption; } else { for ( var i = 1; i < Rows.length; i++ ) { Rows[i].style.display = Rows[0].style.display; } Button.firstChild.data = collapseCaption; } } function createCollapseButtons() { var tableIndex = 0; var NavigationBoxes = new Object(); var Tables = document.getElementsByTagName( "table" ); for ( var i = 0; i < Tables.length; i++ ) { if ( hasClass( Tables[i], "collapsible" ) ) { /* only add button and increment count if there is a header row to work with */ var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0]; if (!HeaderRow) continue; var Header = HeaderRow.getElementsByTagName( "th" )[0]; if (!Header) continue; NavigationBoxes[ tableIndex ] = Tables[i]; Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex ); var Button = document.createElement( "span" ); var ButtonLink = document.createElement( "a" ); var ButtonText = document.createTextNode( collapseCaption ); Button.style.styleFloat = "right"; Button.style.cssFloat = "right"; Button.style.fontWeight = "normal"; Button.style.textAlign = "right"; Button.style.width = "6em"; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( "id", "collapseButton" + tableIndex ); ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNode( "[" ) ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( "]" ) ); Header.insertBefore( Button, Header.childNodes[0] ); tableIndex++; } } for ( var i = 0; i < tableIndex; i++ ) { if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) { collapseTable( i ); } } } addOnloadHook( createCollapseButtons ); /** Dynamic Navigation Bars (experimental) ************************************* * * Description: See [[Wikipedia:NavFrame]]. * Maintainers: UNMAINTAINED */ // set up the words in your language var NavigationBarHide = '[' + collapseCaption + ']'; var NavigationBarShow = '[' + expandCaption + ']'; // shows and hides content and picture (if available) of navigation bars // Parameters: // indexNavigationBar: the index of navigation bar to be toggled function toggleNavigationBar(indexNavigationBar) { var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) { return false; } // if shown now if (NavToggle.firstChild.data == NavigationBarHide) { for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if ( hasClass( NavChild, 'NavPic' ) ) { NavChild.style.display = 'none'; } if ( hasClass( NavChild, 'NavContent') ) { NavChild.style.display = 'none'; } } NavToggle.firstChild.data = NavigationBarShow; // if hidden now } else if (NavToggle.firstChild.data == NavigationBarShow) { for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if (hasClass(NavChild, 'NavPic')) { NavChild.style.display = 'block'; } if (hasClass(NavChild, 'NavContent')) { NavChild.style.display = 'block'; } } NavToggle.firstChild.data = NavigationBarHide; } } // adds show/hide-button to navigation bars function createNavigationBarToggleButton() { var indexNavigationBar = 0; // iterate over all < div >-elements var divs = document.getElementsByTagName("div"); for( var i=0; NavFrame = divs[i]; i++ ) { // if found a navigation bar if (hasClass(NavFrame, "NavFrame")) { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); var NavToggleText = document.createTextNode(NavigationBarHide); for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) { if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) { if (NavChild.style.display == 'none') { NavToggleText = document.createTextNode(NavigationBarShow); break; } } } NavToggle.appendChild(NavToggleText); // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) for( var j=0; j < NavFrame.childNodes.length; j++ ) { if (hasClass(NavFrame.childNodes[j], "NavHead")) { NavFrame.childNodes[j].appendChild(NavToggle); } } NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); } } } addOnloadHook( createNavigationBarToggleButton ); /**------------------**/