Change Font Size Block

Change Font Size Block

Julian Ridden發表於
Number of replies: 18

I have just completed my first block for Moodle and hope it may also be helpful to others.

this block allows users to adjust the font size of a page by using either a button or the + and - keys on the keyboard.

The block only magnifies text of pages it is on and data is stored in a cookie on the users system. This means that a: The users settings are saved so they dont have to reset the size on every page and b: pages you do not wish to have changed can stay that way.

Customizable variables allow you to set minimum and maximum font sizes as well as the increment at wich the zoom steps change the fonts.

Should you wish for areas to not be resized then set these "noResize" areas by using <div class="noresize">ex....</div> or <font class="noresize">ex....</font> or <p class="noresize">ex....</p>

It is my first block and thus is open to suggestions and changes to help it best suit those who wish to use it.

The block is written for 1.5 Instalation files are included in the file

評比平均分數: -
In reply to Julian Ridden

Ynt: Change Font Size Block

Serkan Ozel發表於
Hi,

I installed the magnifier block into my moodle. I can add the magnifier block into the screen but the block contains nothing; the images to increase and decrease the font do not show up under the block.

Do you know what may be the problem?

Thanks in advance,
Serkan
In reply to Serkan Ozel

Re: Ynt: Change Font Size Block

Rico Dredd發表於

Looks like some PHP code was wrong in reference to 'fontresize' instead of 'magnifier' have tweaked code and attached edited version which works for me.

Rico

In reply to Rico Dredd

Ynt: Re: Ynt: Change Font Size Block

Serkan Ozel發表於
Thanks now it works, but still reset doesn't work. It acts like decrease font size? Do you have such problem?
In reply to Serkan Ozel

Re: Ynt: Re: Ynt: Change Font Size Block

Rico Dredd發表於

The reset as far as I can tell does not work in my test site only removing the 'cookie' manually then refreshing puts it back to normal. May need a button to do this if Julian the block creator has time to create one I guess.

Demo site

http://mambo.highlands.ac.uk/moodle15/

Just an example of the block in action

Rico

In reply to Rico Dredd

Re: Ynt: Re: Ynt: Change Font Size Block

W Page發表於
Hi Rico & Julian!

Thank you for the link, however, there is no guest access to the site.

I installed the block and it went smoothly.

PROBLEM
When I checked the homepage after installation, I noticed that all the text on the page became extremely small.  Please see image below.  Is there anyway I could correct this. [BTW, the Kubrik theme was not being used at the time.  It was the "Standard Blue" theme with different graphics but not any change in coding.]

BASIC QUESTION
Is it possible to install the script into the header instead of a block? 

NOSEY QUESTION
Rico!  Looks like you are working on a marquee or rolling text block.  Is that so??

Thanks in advance for your response.

WP1

附件 post_magnifier_02.gif
In reply to W Page

Re: Ynt: Re: Ynt: Change Font Size Block

Rhonda Goetz發表於

Oh thank God!  I thought it was my style sheet!  I've spent an inordinate amount of time going through the style sheet to find where I had a small font listed.  Then of course through the standard one as well.

I am going to uninstall it until it is fixed.  Otherwise my customers will have to squint!

In reply to Rico Dredd

Re: Ynt: Re: Ynt: Change Font Size Block

Tareque Chowdhury發表於

Hi

How you are using scrolling text on your moodle site? Could you please let me know how can I put scrolling text on my moodle site?

Thanks

Tareque

In reply to Rico Dredd

Re: Change Font Size Block

W Page發表於

Hi Julian & Rico!

Do you have the block installed some where it can be seen in action?  I would like to check it out before installing. 微笑

WP1

In reply to W Page

Re: Change Font Size Block

Rico Dredd發表於

Have put it on the front page of my test site so you can use it from there. No courses on the site but you should see it effects without having to login.

The marque stuff is just the HTML code which can be run in a label or HTML block.

http://mambo.highlands.ac.uk/moodle15/

It will be up for a while till someone can get the reset code working before using in a production site.

In reply to Rico Dredd

Re: Change Font Size Block

Timothy Takemoto發表於

Dear Rico
Very cool! A real usability bonus. I have had some students complain about font sizes in tests (especially since I am using vocabulary tests with 1 minute time limits). When I upgrade to 1.5, soon, I will install your block. Thank you. 
Timothy

In reply to Julian Ridden

Re: Change Font Size Block

Dan Clarke發表於

You may have a problem if you add the block to a course. If this is the case, open block_magnifier.php and replace lines 18 - 22 with the following code:

  $jscript = '<script src="'.$CFG->wwwroot.'/blocks/magnifier/js/zoom.js" type="text/javascript"></script>';
  $bodyload = "<BODY onLoad=\"changeFontSize(0, 0, true);\"> ";
  $increase = '<center><A HREF="#" onClick="javascript:increaseFontSize();"><img src="'.$CFG->wwwroot.'/blocks/magnifier/images/plus.gif" alt="" border="0"></a>';
  $decrease = '&nbsp;<A HREF="#" onClick="javascript:decreaseFontSize();"><img src="'.$CFG->wwwroot.'/blocks/magnifier/images/minus.gif" alt="" border="0"></a>';
  $reset = '&nbsp<A HREF="#" onClick="javascript:deleteCookie(\'incrSize\');deleteCookie(\'incrStyleSize\');changeFontSize(0, 0, true)"><img src="blocks/magnifier/images/plus.gif" alt="" border="0"></a>';

In reply to Dan Clarke

Re: Change Font Size Block

Rico Dredd發表於

Have cleaned up some of the code so the reset button is now displayed and works. When you click on the R button you need to refresh your browser so F5 in IE or equivalent in Firefox.

Dan maybe you can add your tweaks to this version if not working for others.

Rico

In reply to Rico Dredd

Re: Change Font Size Block

Julian Ridden發表於
Hey Rico,

Thanks for tidying up my block. Only just rediscovered this thread and saw the problems/your fixes.

This is what the community is really about.

It was my very first block and a rather shakey effort at best.
In reply to Julian Ridden

Re: Change Font Size Block

Rico Dredd發表於

All credit to you for making the block in the first place Julian I think, do not know how to javascript just tied back links etc to correct areas, more a tester.

How difficult is it to code a button to set standard sizes like 12 point or 10 point? A drop down list of font sizes even different fonts for the more ambitious coders out there. I know you can change themes etc but being able to do it on the fly could be useful for some people.

Rico

In reply to Rico Dredd

Re: Change Font Size Block

W Page發表於

Hi Julian & Rico!

I wrote this a while back so I will ask again today.

Is it possible to place the script in the header and then get the font sizer to change the font size of an entire page?

Thanks

WP