News: TinyPortal Release Schedule. Please read this update for More Info.

Login  |  Register
HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

October 14, 2019, 09:48:53 AM

Login with username, password and session length

Recent

Members
  • Total Members: 3756
  • Latest: Ocean
Stats
  • Total Posts: 189080
  • Total Topics: 20763
  • Online Today: 70
  • Online Ever: 629
  • (November 08, 2018, 01:36:54 PM)
Users Online
Users: 2
Guests: 50
Total: 52

Author Topic: A+ | A - | RESET  (Read 9469 times)

0 Members and 1 Guest are viewing this topic.

Offline bloc

  • Founder
  • *
  • Posts: 5217
    • Bloc
Re: A+ | A - | RESET
« Reply #10 on: March 23, 2006, 04:11:39 PM »
ok, here goes. Beware its a chunk to insert.

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

and insert this:
Code: [Select]
// 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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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

  • Guest
Re: A+ | A - | RESET
« Reply #11 on: March 23, 2006, 04:19:48 PM »
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

  • Guest
Re: A+ | A - | RESET
« Reply #12 on: March 23, 2006, 04:21:45 PM »
Visually impaired folks probably already have discovered their browser font settings.   ;)

PZsHosting

  • Guest
Re: A+ | A - | RESET
« Reply #13 on: March 23, 2006, 04:29:49 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

  • Guest
Re: A+ | A - | RESET
« Reply #14 on: March 23, 2006, 04:39:47 PM »
Makes you wish you could sit on their lap and slap them around from time to time, doesn't it?   ;)

PZsHosting

  • Guest
Re: A+ | A - | RESET
« Reply #15 on: March 23, 2006, 05:51:41 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

  • Guest
Re: A+ | A - | RESET
« Reply #16 on: March 23, 2006, 06:07:45 PM »
WOW.. thanks i got it installed and working just great

Offline G6Cad

  • Friends
  • *
  • Posts: 12643
    • FamiljeGodis
Re: A+ | A - | RESET
« Reply #17 on: March 24, 2006, 01:25:42 AM »
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:

Offline bloc

  • Founder
  • *
  • Posts: 5217
    • Bloc
Re: A+ | A - | RESET
« Reply #18 on: March 24, 2006, 06:28:00 AM »
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?

Offline G6Cad

  • Friends
  • *
  • Posts: 12643
    • FamiljeGodis
Re: A+ | A - | RESET
« Reply #19 on: March 24, 2006, 06:45:34 AM »
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