Zum Inhalt springen

fontresize

Erstellt am 23. August 2007 · 3 Antworten · letzte Antwort am 19. September 2008

Tags: Frage

jagang ·

Hallo!

Hab da ein Problem mit dem js von der extension fontresizer.

Folgender Code wird eingebunden:

// Initialize the arrays containing our size info.

var pixelArray = new Array('10','11', '15'); // Possible font px sizes
var countOfPixels = pixelArray.length;
var initSize = 1; // Array position of inital px size

function fontSizer(inc) {
	/*if (!document.getElementById) return;*/
	
	var size = readCookie('size');
	size = parseInt(inc)+parseInt(size);
	if (size < 0 ) { size = 0; }	
	if (size > countOfPixels ) { size = countOfPixels; }
	
	doFontSizing(size);	
	
	createCookie("size", size, 365);
}

function fontSizerOnLoad(preferredSize) {	
	/*if (!document.getElementById) return;*/
	
	var size = readCookie('size');	
	if (size < 0 ) { size = 0; }
	if (size > countOfPixels ) { size = countOfPixels; }
	
	/*switchPic();*/
	doFontSizing(size);
}

function doFontSizing(theFontSize) {			
	// Bugfix: Elements inside table would not resize with only the code below, so we do them seperatly.
	// NOTE: This only resizes the font, nothing else.
	// Resize by ID does not work with this.
	//aTables = document.getElementsByTagName('table');
	//for(i = 0; i < aTables.length; i++){
	//		aTables[i].style.fontSize = pixelArray[theFontSize];
	//}
	
	// if you rather want to size an individual element by ID, use this:
	// resizeContainer = document.getElementById('nameOfConainingElement');	
	// and uncomment the if statements at the start of each function
	resizeContainer = document.getElementsByTagName('body')[0];		
	resizeContainer.style.fontSize = pixelArray[theFontSize];	
	
}

function normalSize() {
	/*if (!document.getElementById) return;*/
	
	var size = 1;
	
	doFontSizing(size);	
	createCookie("size", size, 365);
}

function normalSizePrint() {
	/*if (!document.getElementById) return;*/
	
	var size = 1;
	
	doFontSizing(size);	
}

/*function switchPic(size){	
	theImage = document.getElementById('dIndexBanner').firstChild;		
	imagePath = theImage.src;
	
}*/

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "expires="+date.toGMTString();
	}
	else {
		expires = "";
	}
	document.cookie = name+'='+value+'; '+expires+'; path=/';
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' '){ 
			c = c.substring(1,c.length);
		}
		if (c.indexOf(nameEQ) == 0) {
			return c.substring(nameEQ.length,c.length);
		}
	}
	return initSize;
}

window.onload = function(e) {
	fontSizerOnLoad(readCookie("size"));
}

IM FF funkts tadellos aber im IE6 und IE7 speichert er mir die cookies einfach nicht! Wenn ich also auf einen anderen Menüpunkt klicke wird der Text wieder in der Ausgansgröße dargestellt. Hat jemand ne Ahnung an was das liegn könnte? Brauch ich da vielleicht nen anderen js code extra für den IE?
Ich danke im Voraus für jede Hilfe!

mfg

dnalor ·

Hast Du inzwischen eine ANtwort auf deinen Beitrag. Ich kämpfe mit dem gleichen Problem?

Gruß

ROland

consiliasozial ·

hallo,
hat zwar nichts direkt mit dem skript zu tun dafür aber mit der extension. und zwar wenn ich die extension auf einen marker anzeigen möchte was muss ich da im ts definieren?
danke
lg
sebastian

smart ·

Hallo consiliasozial,

Im Setup des Haupttemplates folgendes:

workOnMarks = DOCUMENT_BODY
marks.RESIZE = CONTENT
marks.RESIZE < plugin.tx_fontresize_pi1

Martin