Blame Artworks/Webenv/PhpBB/3.0.4/Modern/template/styleswitcher.js

Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function fontsizeup()
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var active = getActiveStyleSheet();
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	switch (active)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		case 'A--':
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A-');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A-':
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A':
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A+');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A+':
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A++');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A++':
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		default:
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function fontsizedown()
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	active = getActiveStyleSheet();
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	switch (active)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		case 'A++' : 
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A+');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A+' : 
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A' : 
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A-');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A-' : 
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A--');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		case 'A--' : 
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		default :
Alain Reguera Delgado 46de3c
			setActiveStyleSheet('A--');
Alain Reguera Delgado 46de3c
		break;
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function setActiveStyleSheet(title)
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var i, a, main;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title'))
Alain Reguera Delgado 46de3c
		{
Alain Reguera Delgado 46de3c
			a.disabled = true;
Alain Reguera Delgado 46de3c
			if (a.getAttribute('title') == title)
Alain Reguera Delgado 46de3c
			{
Alain Reguera Delgado 46de3c
				a.disabled = false;
Alain Reguera Delgado 46de3c
			}
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function getActiveStyleSheet()
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var i, a;
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	for (i = 0; (a = document.getElementsByTagName('link')[i]); i++)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		if (a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled)
Alain Reguera Delgado 46de3c
		{
Alain Reguera Delgado 46de3c
			return a.getAttribute('title');
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	return null;
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function getPreferredStyleSheet()
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	return ('A-');
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function createCookie(name, value, days)
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	if (days)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		var date = new Date();
Alain Reguera Delgado 46de3c
		date.setTime(date.getTime() + (days*24*60*60*1000));
Alain Reguera Delgado 46de3c
		var expires = '; expires=' + date.toGMTString();
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
	else
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		expires = '';
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	document.cookie = name + '=' + value + expires + style_cookie_settings;
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function readCookie(name)
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var nameEQ = name + '=';
Alain Reguera Delgado 46de3c
	var ca = document.cookie.split(';');
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	for (var i = 0; i < ca.length; i++)
Alain Reguera Delgado 46de3c
	{
Alain Reguera Delgado 46de3c
		var c = ca[i];
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		while (c.charAt(0) == ' ')
Alain Reguera Delgado 46de3c
		{
Alain Reguera Delgado 46de3c
			c = c.substring(1, c.length);
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
		if (c.indexOf(nameEQ) == 0)
Alain Reguera Delgado 46de3c
		{
Alain Reguera Delgado 46de3c
			return c.substring(nameEQ.length, c.length);
Alain Reguera Delgado 46de3c
		}
Alain Reguera Delgado 46de3c
	}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	return null;
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function load_cookie()
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var cookie = readCookie('style_cookie');
Alain Reguera Delgado 46de3c
	var title = cookie ? cookie : getPreferredStyleSheet();
Alain Reguera Delgado 46de3c
	setActiveStyleSheet(title);
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
function unload_cookie()
Alain Reguera Delgado 46de3c
{
Alain Reguera Delgado 46de3c
	var title = getActiveStyleSheet();
Alain Reguera Delgado 46de3c
	createCookie('style_cookie', title, 365);
Alain Reguera Delgado 46de3c
}
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
onload_functions.push('load_cookie()');
Alain Reguera Delgado 46de3c
onunload_functions.push('unload_cookie()');
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
/*
Alain Reguera Delgado 46de3c
var cookie = readCookie("style");
Alain Reguera Delgado 46de3c
var title = cookie ? cookie : getPreferredStyleSheet();
Alain Reguera Delgado 46de3c
setActiveStyleSheet(title);
Alain Reguera Delgado 46de3c
*/