The problem with this module is that if in the CSS file there is font-size set up for HTML elements, they are not resized. I have rewritten the javascript implementation of this module. Now it works that way:
1) Saves in the cookie how many times the larger/smaller button is clicked;
2) Resizes the text in the scope (can be multiple scopes seperated by comma)
3) Resizing is done recursively for each of the subelements of the scope
4) Resizing is done proportionally (e.g. 10% added for each of the element font size) for each of the elements;
Attachment contains the javascript file and the module. In the module file the scope field is changed to textarea and added small comment for the scope.
Hope to see the changes in the next version of the module!
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | text_resize-6.x-1.x-dev.patch | 17.32 KB | nor4a |
| #14 | text_resize-6.x-1.6.patch | 32.6 KB | nor4a |
| #4 | text_resize_js.patch | 12.07 KB | arski |
| text_resize.zip | 4.33 KB | nor4a |
Comments
Comment #1
milchbar commentedThanks a lot! This seems to work and solves the problem for me.
Great work!
Comment #2
Matt-H commentedDoes this rewrite include code for the reset button? I'm not seeing anything for 'text_resize_reset'.
Comment #3
attheshow commentedPlease submit patches instead of module zip files. Here are the instructions on how to create patches: http://drupal.org/patch/create
Comment #4
arski commentedk, tried to make a patch out of that.. there were some weird changes, like t() wrappers being removed around text.. I assumed that they were due to an older version of -dev being taken and removed them.. so take a look.
Comment #5
arski commentedquite some issues with this:
1. on load, the font size of the elements selected in the config of the module are set to the maximum size..
2. the proportional increase is slightly buggy, say im increasing two elements, one of which starts at 15 and one at 10, and say the maximum is 18. Now when the first reaches 18, the second will still be at around 14 or something. However, you can still increase it to 18 by clicking on (note that now the first element just stays at 18) so eventually the proportions are lost..
thanks
Comment #6
arski commentederm, you should have also mentioned that your code doesn't work with spaces between the class/id/tag names.. so if in the config it says "field-a, field-b" it will look for ". field-b" and "# field-b" - fail :(
Comment #7
arski commentedAs for the weird on-load bug, is this code really necessary when a document is loaded??:
Comment #8
arski commentedHey, added a check that checks if all elements are resizable before actually doing it, it's called just before the resize loop around line 30:
The checks can be then removed from the resizeTextElement function..
I'll leave it to you to put this all together and look through it.. ;)
Comment #9
j.slemmer commentedsub
Comment #10
nor4a commentedAbout the text restet to normal size - it happens if the reset button is pressed.
It resets the resize cookie value to 0 - e.g. no resize.
Line: 37. of the code I've submitted.
Comment #11
nor4a commentedReply to #5.
1) We have site running with this module - www.een.lv. Nobady has complained about such a bug so far. Can you tell how to reproduce it?
2) The proportional increase is not buggy, but made exactly the way we wanted to make it. The main purpose of the text increasing feature is accessibility. So - if somebody cannot read the text in the small font - he can use this feature to enlarge the font for reading. If the font is big enough - it is not necessary to enlarge it more, because it is already readable... So we set the "maximum" font size - which we think everybody can read...
Comment #12
arski commentedHey,
I'm not sure how to reproduce it.. sometimes it happens and sometimes not.. not having the code that I mentioned in #7 fixes the issue, and considering that there seems to be no point in that anyway..
As for the proportional resize, your reply does not say anything about the issue. Yes, the idea of this module/plugin is to increase text size. And yes, if it is not big enough it is not necessary to enlarge more. But what I was trying to point out is that it's possible that texts will be selected with different initial sizes, like the usual p tags, together with some headings or whatever.. And in that case, things need to stay proportional.
Cheers
Comment #13
arski commentedOK, checked your site, and both issues appear on it:
1. If you go to the page, increase the font size, then reload the page, the sizes will increase automatically without any click. Are you storing this in some cookie or something? Anyway, it's very confusing and annoying.
2. On the home page, the news items in the middle start out with 12px for the text and 13px for the titles. And the maximum you have seems to be 16px. The first 2 times you click to increase the font size, both the title and the text increase simultaneously. However, if you click a 3rd time, the titles will not increase because they're already at the maximum limit, but the text still will increase once, actually becoming slightly bigger than the titles.. either way this breaks the proportions, as mentiong.
Hope this helps.
Cheers
Comment #14
nor4a commentedYes, I agree... If you start playing with texts more than they are starting to look bad.
So I rewrited the code. Now the text resize limitation is not in pixels, but in "resize times" - e.g. how many times user can click the A button to enlarge the text. Also a new setting now available - "resize step" in %. So by how many % you want to enlarge the text by clicking on the button 1 time.
I'm submitting a patch... for 6.x-1.6 version. The javascript code is completely rewritten. The module code just adds the resize_step setting, makes the scope field as textarea and hides the line_height limitations as I think they are not necessary. Do not know why, but the latest 64bit tortoise SVN created the .module patch as it is is rewritten completely.
Comment #15
arski commentedI'm not a maintainer here, but all patches should be made against the latest -dev, and if you submit one, then set the status to "needs review" so that people can see that there is something to check here ;)
Comment #16
nor4a commentedPatch against the latest dev release attached.
It seams that majority of the font resizing problems fixed.
Small configuration changes implemented to avoid unexpected font sizes in IE which can occure with CSS features such as providing font sizes in %.
Comment #17
mgiffordComment #18
mgiffordUnless this should be bumped to D7 or D8...