Hi, I am a newbee and i have a problem in the fontsize module which i downloaded from drupal.org
I have customised the fontsize module to work in drupal 6. It is working fine in IE6 but is not working in Firefox 2.0.0.1. There are no error messages. But the fontsize is just not changing.
Please tell me whether i need to do changes in the .module file, the javascript or in the css. And what changes can help me to run this module perfectly on firefox.
The code of the .module file, the javascript and the css are given below:
The customised drupal code of the fontsize.module file is:
// $Id: fontsize.module,v 1.6.2.3 2005/06/30 22:02:03 drumm Exp $
/**
* Implementation of hook_help()
*/
function fontsize_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Creates a block allowing visitors to change the site\'s font size.');
case 'admin/help#fontsize':
return t('
The font size module allows users to change the font size of the site they are viewing. This is useful for creating 508 accessible websites.
The font size module adds a block which has two buttons, one for a larger text size and one for a smaller or normal text size. Javascript is used to load generic stylesheets that work with most themes and templates.
You can
For more information, read the configuration and customization handbook Fontsize page
',
array('%block-admin' => url('admin/block')));
}
}
/**
* Implementation of hook_block()
*/
function fontsize_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = 'Change text size';
return $blocks;
}
elseif ($op == 'view') {
switch($delta) {
case 0:
drupal_set_html_head(''."\n".
''."\n".
''."\n".
' ');
$block['content'] = 'A'.'A'. 'A';
return $block;
}
}
}
*******************************************************************
The code of the javascript file styleswitcher.js is:
function fontsizeup() {
active = getActiveStyleSheet();
switch (active) {
case 'A--' :
setActiveStyleSheet('A-');
break;
case 'A-' :
setActiveStyleSheet('A');
break;
case 'A' :
setActiveStyleSheet('A+');
break;
case 'A+' :
setActiveStyleSheet('A++');
break;
case 'A++' :
break;
default :
setActiveStyleSheet('A');
break;
}
}
function fontsizedown() {
active = getActiveStyleSheet();
switch (active) {
case 'A++' :
setActiveStyleSheet('A+');
break;
case 'A+' :
setActiveStyleSheet('A');
break;
case 'A' :
setActiveStyleSheet('A-');
break;
case 'A-' :
setActiveStyleSheet('A--');
break;
case 'A--' :
break;
default :
setActiveStyleSheet('A--');
break;
}
}
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alternate") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alternate") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
return ('A-');
}
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 null;
}
window.onload = function(e) {
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
}
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
title = getPreferredStyleSheet();
}
setActiveStyleSheet(title);
**********************************************************************
The code of the CSS are similar. code of largest.css is:
html
{
font-size: 150%;
}
code of larger.css is:
html
{
font-size: 125%;
}
code of normal.css is:
html
{
font-size: 100%;
}
Comments
Hi request someone to help
Hi request someone to help me with the fontsize module.
Thank you,
Hi request someone to help
Sorry - I don't have the detailed knowledge to help.
However I note that the Four Seasons theme has a font changer
Text Size
The Fonsize module was for Drupal 4 and has moved [1] to the Text Size module http://drupal.org/project/textsize.
[1] http://drupal.org/node/132886
Text Resize Module
There's a module that I built for this a few months ago, called Text Resize.
http://drupal.org/project/text_resize
Let me know how it goes!
Mark W. Jarrell
Manager of Web Services
Jones Knowledge Integration Group, Inc.
http://www.jones.com
http://www.jonesknowledge.com
http://www.jonesdifference.com
http://www.jiu.edu
Twitter: attheshow
Mark W. Jarrell
Web Services Specialist
Austin Peay State University
http://www.apsu.edu
http://fleetthought.com
Twitter: attheshow