MediaWiki:Common.js

From open-support.info

(Difference between revisions)
Jump to: navigation, search
m (ページの作成:「- ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます: function createBookNavLink() {...」)
m
Line 2: Line 2:
function createBookNavLink() {
function createBookNavLink() {
 +
if (
 +
document.getElementById('bodyContent') &&
 +
document.getElementById('bookFooterMargin')
 +
) {
 +
var bct = document.getElementById('bodyContent');
 +
var bfm = document.getElementById('bookFooterMargin');
 +
if ( bct.clientHeight < 350 ) {
 +
bfm.style.height = ( 350 + bfm.clientHeight - bct.clientHeight ) + "px";
 +
}
 +
}
 +
if (
if (
document.getElementById('bookHeaderNavSrc').innerHTML &&
document.getElementById('bookHeaderNavSrc').innerHTML &&
Line 13: Line 24:
curNode.innerHTML = newNode.innerHTML + curNode.innerHTML;
curNode.innerHTML = newNode.innerHTML + curNode.innerHTML;
}
}
 +
if (
if (
document.getElementById('bookFooterNavSrc').innerHTML &&
document.getElementById('bookFooterNavSrc').innerHTML &&

Revision as of 11:48, 15 April 2011

/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */

function createBookNavLink() {
	if (
		document.getElementById('bodyContent') &&
		document.getElementById('bookFooterMargin')
	) {
		var bct = document.getElementById('bodyContent');
		var bfm = document.getElementById('bookFooterMargin');
		if ( bct.clientHeight < 350 ) {
			bfm.style.height = ( 350 + bfm.clientHeight - bct.clientHeight ) + "px";
		}
 	}

	if (
		document.getElementById('bookHeaderNavSrc').innerHTML &&
		document.getElementById('contentSub')
	) {
		var curNode = document.getElementById('contentSub');
		var newNode = document.getElementById('bookHeaderNavSrc');
		if( ! curNode.innerHTML ) {
			curNode.innerHTML = '&nbsp;';
		}
		curNode.innerHTML = newNode.innerHTML + curNode.innerHTML;
	}

	if (
		document.getElementById('bookFooterNavSrc').innerHTML &&
		document.getElementById('catlinks').innerHTML &&
		document.createElement &&
		document.insertBefore
	) {
		var curNode = document.getElementById('catlinks');
		var newNode = document.createElement('div');
		newNode.id = 'bookFooter';
		newNode.innerHTML = document.getElementById('bookFooterNavSrc').innerHTML;
		newNode.style.margin        = '0px';
		newNode.style.padding       = '0px';
		newNode.style.verticalAlign = 'bottom';
		curNode.parentNode.insertBefore(newNode,curNode);
	}

}
addOnloadHook( createBookNavLink );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox