TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,996
  • Total Topics: 21,327
  • Online today: 386
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 203
  • Total: 203

A+ | A - | RESET

Started by os1, March 22, 2006, 02:10:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bloc

ok, here goes. Beware its a chunk to insert.

First off, open index.template and find this code:
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/fonts-compat.css" />';


and insert this:
// set the body font-size here, so it can be changed
echo '<style type="text/css"><!--
body
{
font-size: ' , !empty($options['mysize']) ? $options['mysize'] : 'small' , ';
}
--></style>';


...then find this:
echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}


and insert this right after:
var mysize = "', !empty($options['mysize']) ? $options['mysize'] : 'small', '";

function setmysize(size)
{';

if ($context['user']['is_guest'])
echo '
document.cookie = "size=" + size;';
else
echo '
smf_setThemeOption("mysize", size , null, "', $context['session_id'], '");';

echo '
}

/*------------------------------------------------------------
Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
Web Site: http://txkang.com
Script featured on Dynamic Drive (http://www.dynamicdrive.com)

Please retain this copyright notice in the script.
License is granted to user to reuse this code on
their own website if, and only if,
this entire copyright notice is included.
--------------------------------------------------------------*/

//Specify affected tags. Add or remove from list:
var tgs = new Array( \'div\',\'td\',\'tr\');

//Specify spectrum of different font sizes:
var szs = new Array( \'xx-small\',\'x-small\',\'small\',\'medium\',\'large\',\'x-large\' );
';

// setup the array to start with
$fsize=array('xx-small' => 0 , 'x-small' => 1, 'small' => 2, 'medium' => 3, 'large' => 4, 'x-large' => 5);
if(!empty($options['mysize']))
$what=$fsize[$options['mysize']];
else
$what=2;

echo '
var startSz = '.$what.';

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 5 ) sz = 5;
startSz = sz;


if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
    setmysize(szs[ sz ]);
}

function tsreset( trgt ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz = 2;
startSz = sz;


if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
    setmysize(szs[ sz ]);
}


And finally , find the spot where you want the links, and use this code:
echo '<a href="javascript:ts(\'body\',1)">A+</a> | <a href="javascript:ts(\'body\',-1)">A -</a> | <a href="javascript:tsreset(\'body\')">RESET</a>';

Make sure all sizes are percentages, apart from the fontsize for body. That should be set as "small".

PZsHosting

Thank You! :)
This should make things much nicer for my visually impaired members And my eyes, when I've been staring at code too long ;)

TwinsX2Dad

Visually impaired folks probably already have discovered their browser font settings.   ;)

PZsHosting

Quote from: TwÃÆ'Ã,­nsX2DÃÆ'Ã,Â¥Ã,,‘ÂÃ,³ on March 23, 2006, 11:21:45 PM
Visually impaired folks probably already have discovered their browser font settings.   ;)

It snuck up on some of them, some of them only use the web to visit the board, some are not all the computer savy and I'll still have to point this out to some of them, because they won't see it unless I do.  :o

TwinsX2Dad

Makes you wish you could sit on their lap and slap them around from time to time, doesn't it?   ;)

PZsHosting

Quote from: TwÃÆ'Ã,­nsX2DÃÆ'Ã,Â¥Ã,,‘ÂÃ,³ on March 23, 2006, 11:39:47 PM
Makes you wish you could sit on their lap and slap them around from time to time, doesn't it?   ;)

If they weren't such nice old folks, perhaps ;)
But now that I'm starting to realize the early stages of aging, I better be nice :o

os1

WOW.. thanks i got it installed and working just great

G6Cad

WOHOOOOO, sometimes am really happy that I atleast can make backups properly    :uglystupid2:

This totally messed up and i didnt even manage to remove the code i pasted in to get it to work.
Backups is really a lovley thing to have sometimes  :2funny:

This one have to wait until i can get it allready built in a theme  :2funny:

bloc

yes..its importnant to set it up so it works php-wise. One wrong palcement and you get errors. And since index.template is called everytime, everything stops with an error screen.

But I can help if you need it..is it the default theme?

G6Cad

No, i try out things at my testforum, so no need to help :)
Im just testing out things on that forum to learn more about how things work. :)
Thanks for the offer though :D

This website is proudly hosted on Crocweb Cloud Website Hosting.