67 replies [Last post]
jojedo
Offline
Regular
Last seen: 7 years 33 weeks ago
Timezone: GMT+2
Joined: 2006-06-05
Posts: 30
Points: 0

Dynamic User Preference Script

Hi Tony,

Found the other cookie as well. I was going through the JS from my tracker (awstats) instead of doing what you did - check the browser Shock That had been so much easier! Laughing out loud

For the time being I keep the userpref running to get some feedback of some of the users, personally I really like it.

Thanks for your help

Jojedo

Dale limosna, mujer
que no hay en la vida nada
como la pena de ser
ciego en Granada.

(Francisco Alarcón de Icaza)

matcom
Offline
newbie
Last seen: 6 years 47 weeks ago
Timezone: GMT-11
Joined: 2006-08-12
Posts: 4
Points: 0

Dynamic User Preference Script

Hi Tony,

I have tried your script on a test site and everything works great EXCEPT the fontsize won't change. I can change the colors and the font-family just fine but NOT font-size (this is really the only control i'm looking for).

I haven't altered the script in any way and am very confused. I made sure that I wasn't setting the size with font tags and all text is within the body tag (obviously, since the rest of the controls work)

Any ideas?

Thank you

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 hours 43 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5054
Points: 2632

link

Hi matcom,
Can you provide a link so we can see what is going on.
The script changes font size from the body tag.
If you are specifying font size for other tags then you will need to change the tag you are targeting or change how you apply font size.
For example if you have paragraphs set at 12px then changing the body font size wont have any effect on paragraphs.
If you set paragraphs to a percentage or em value then it will take the value given to the body and work out the size to render the font from that.

matcom
Offline
newbie
Last seen: 6 years 47 weeks ago
Timezone: GMT-11
Joined: 2006-08-12
Posts: 4
Points: 0

Thank you Tony

Here is the URL (Obviously everything is a placeholder right now): http://www.tves.org/new/indexfontchange.html

Like I said. Everything else works just fine.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 hours 43 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5054
Points: 2632

firefox

Hi Matcom,
Font size is working in firefox but you have some other issues with JavaScript comments. Have a look in firefox and you will see what I mean.

You have specified font size in pixels inline so changing the body font size will have no affect.

Try using percentages or ems then you will be able to see the font size change in IE.

matcom
Offline
newbie
Last seen: 6 years 47 weeks ago
Timezone: GMT-11
Joined: 2006-08-12
Posts: 4
Points: 0

can you help explain?

I have been playing around with other scripts that are currently commented out but not sure what you meant by "inline" or where i'm I have specified the font size in pixels

:shrug:

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 hours 43 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5054
Points: 2632

script

Hi matcom,
One of your scripts is writing

Quote:
.AWMSTTD1 {border-style:none;border-width:0px;text-align:center; font:14px sans-serif; color:#000000;background-color:transparent;}

along with other rules.

Using firefox and the 'web developers toolbar' go to edit css and it will show the embedded styles.

I don't have the time to dig through your scripts for you.

matcom
Offline
newbie
Last seen: 6 years 47 weeks ago
Timezone: GMT-11
Joined: 2006-08-12
Posts: 4
Points: 0

thanks Tony - what about the form border?

got everything working the way I need it but an asthetics question: Is it possible to get rid of the blue border around the control form?

Did a search but can't readily find the answer.

Thanks again.

myob9a
Offline
newbie
Australia
Last seen: 6 years 24 weeks ago
Australia
Timezone: GMT+10
Joined: 2007-05-03
Posts: 1
Points: 0

USE OF SCRIPT WITH FORMS IN EXPLORER

I have found your script extremely useful, but I have an annoying problem with Internet Explorer. If I position the script before a form code the form fails in Explorer; Firefox is fine.
What appears to be happening is the url picks up the settings for the text size and includes this as part of the input data (eg www.xxx.com?fontsize=font-size%3Aclear&name=Name&email=email&subject=subject&message=message&submit=Send

I can overcome the issue by placing the dynamic script at the foot of the page, but on some pages this could be out of sight without scrolling - therefore out of mind and not helpful to the visitor.

Is there a more elegant solution?

dbaker
Offline
newbie
Last seen: 6 years 15 weeks ago
Joined: 2008-01-04
Posts: 4
Points: 0

Link using an image map.

Hello Tony,
Thanks so much for this script, it is exactly what I am looking for. I like the fact that it just changes single properties rather than the entire style sheet. Much more efficient for what I am after.

I would like to use it to change a background image on a site I am working on: http://www.popmag.com.au/cactus/. I want the links to be on an image map. The site is built using wordpress, so I have stripped out the PHP stuff for you here, but I think the problem is that I can't understand the javascript links you have used as an example. You have said "If you are unfamilier with JavaScript, take note of how the quotes are escaped." butI'm not really sure what you meant by that.

Anyway, have a look what I have done below and I'm sure it will make sense to you. Thanks for the help.

Test

Home Button




My style sheet has this for BODY:

body {padding: 0;width: 995px; margin: 0 auto; background:#000; background-image: url(images/surfbackdrop1.jpg); background-position: center center; background-repeat: no-repeat; height:100%; text-decoration: none;}

dbaker
Offline
newbie
Last seen: 6 years 15 weeks ago
Joined: 2008-01-04
Posts: 4
Points: 0

Bad link preferences.js

Ah ha! I think I figured it out! I just "right-clicked, save as" on your link to preferences.js but it seems that the file has moved and I have been trying to use a 404 page as my preferences.js!

Could you please update the link over at http://csscreator.com/?q=generator/userpref.php so that I can get this working. Thanks!

dbaker
Offline
newbie
Last seen: 6 years 15 weeks ago
Joined: 2008-01-04
Posts: 4
Points: 0

Found it!

Forget about the last post, I found it by going to http://csscreator.com/generator/userpref.php. It's weird that your permalinks change depending on how you came to the page (in my case from both your search engine and google). I'll let you know if it works now that I have the right script.

dbaker
Offline
newbie
Last seen: 6 years 15 weeks ago
Joined: 2008-01-04
Posts: 4
Points: 0

Got it!

That was the missing link (pun intended). Works like a charm on the two browsers I tested (FF 2.0.0.11 and IE6 on Windows XP).

gianni
Offline
newbie
Last seen: 6 years 5 weeks ago
Joined: 2008-03-16
Posts: 1
Points: 0

Dynamic User Script

I am new to all of this but I have a friend that is interested in allowing the user to be able to scale the font on a page for readablility. I have tried to find where I actually download your script to try but can't seem to find it.

Thanks

john

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 7 hours 15 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9054
Points: 3023

In the global menu at the

In the global menu at the top of this page, click "tools".

cheers,

gary

Unplanned code results in a tangled wad of brain-cramping confusion.

There are enough html & css demos and tutorials to be interesting. Please visit.

sooners123
Offline
newbie
Last seen: 5 years 4 weeks ago
Joined: 2009-03-19
Posts: 1
Points: 0

Errors in code

First of all, thank you very much for sharing this code. It is exactly what I need! I ran into a couple of problems in your code, and if feel that it is necessary, you can change update it on your page. I won't get too specific, as it occurs in multiple locations.

1) .indexOf
This will return -1 ONLY if the search pattern is not found. In some locations, you do (string.indexOf > 0 to see if the pattern exists, which is incorrect)

2) cookieCutter()
If only one style has been added to the cookie, then the cookieCutter will return false, since there is no trailing separator (|). This will prevent the page from displaying the custom CSS. Here is my fix (there may be a better way)

/* break up the cookies */
function cookieCutter(cookie, seperator){
	cookie = (cookie.length > 1 && cookie.indexOf(seperator) < <img src="http://csscreator.com/sites/all/modules/smileys/packs/Roving/innocent.png" title="Innocent" alt="Innocent" class="smiley-content" /> ? cookie+'|' : cookie;
	return (testVar(cookie) && cookie.length >1 && cookie.indexOf(seperator) >=0)? cookie.split(seperator): false;
}

Thanks again for this code! I am new to javascript and it would have taken me a very long time to develop this code.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 hours 43 min ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5054
Points: 2632

Thanks for the feedback

Thanks for the feedback sooners123.
I'm sure there's other bits that can be improved and much easier ways to do this now days.
It has been 4 years since I looked at this so I'm not in a great hurry to change it.