Not logged in. · Lost password · Register
Forum: Customising UNB Modifications and plug-ins Plug-in gallery RSS
Additional scripts
Add additional Javascripts to the head
Morty #1
Member since Sep 2005 · 52 posts
Group memberships: Members
Show profile · Link to this post
Subject: Additional scripts
This is a Plugin to add Javascripts to the head. This comes handy if you want to add ASCIIMathML or my iframe-script (somewhere in the forum) or whatever script you like.

2006-02-17: This is more or less the initial Version.
2006-02-17: Forgot to delete some debug-stuff.
Unser forum: http://www.fsi-mechatronik.de/forum/
The author has attached one file to this post:
additional_scripts.zip 1.8 kBytes
You have no permission to open this file.
This post was edited on 2006-02-17, 20:25 by Morty.
Avatar
Keith #2
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
I added this but I get a Wrong Version status for it.

Version compatibility:      unb.stable.1.6 - unb.stable.1.6.99

Can I not use this with the latest development version?

If I can, what steps do I need to take to use it?

Thanks.
Keith
Morty #3
Member since Sep 2005 · 52 posts
Group memberships: Members
Show profile · Link to this post
There are meta-informations at the beginning of the main file. One is called version. Just edit it. Should work in case Yves didn't chage too much.
Unser forum: http://www.fsi-mechatronik.de/forum/
Avatar
Keith #4
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
OK, I just added this line after the original one:

UnbPluginMeta('unb.devel.20070225', 'version');

The status message is gone, so now I will try adding a script (if I can figure out how to write one correctly  :-) )
Morty #5
Member since Sep 2005 · 52 posts
Group memberships: Members
Show profile · Link to this post
The iframe-script might give you a good start: http://newsboard.unclassified.de/forum/thread/959
Unser forum: http://www.fsi-mechatronik.de/forum/
Avatar
Keith #6
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Wow, what does the iframe-script do? I can't read German.

Anyway, your plug-in works just fine. I wasn't sure where to put my js file at first.
I put it in the home directory.

My script redirects if the location is www.
So the user gets the same page without the www's.

I got it working. Thanks.
Avatar
Yves (Administrator) #7
User title: UNB developer & webmaster
Member since Jan 2004 · 3813 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Off Topic:
Keith, your script redirects from http://www.domain.com/... to http://domain.com/...? I have a .htaccess Rewrite snippet that may be interesting for you. Doesn't require JavaScript. Also works for separate domains or the other way round.
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Keith #8
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Yes, that's what it does. So, if somebody types in http://www.domain.com/forum/2 then it would redirect to http://domain.com/forum/2

I didn't mention before, but it has has a second check.
If the page is trapped in a frame, it redirects.

if (parent.frames.length)
  top.location.href = document.location;

I didn't have to write that javascript. I had found it before.

Maybe my Javascript is not efficient. I don't know how cookies work exactly, but I would want the browser redirected before any cookies would be set.

What do you mean by Also works for separate domains or the other way round? Does that mean it is useful for when you need to redirect a visitor to your new site?
Avatar
Yves (Administrator) #9
User title: UNB developer & webmaster
Member since Jan 2004 · 3813 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by Keith:
Maybe my Javascript is not efficient. I don't know how cookies work exactly, but I would want the browser redirected before any cookies would be set.

Doesn't work by design. The first HTTP client request to a domain already contains all cookies.

What do you mean by Also works for separate domains or the other way round? Does that mean it is useful for when you need to redirect a visitor to your new site?

See here: http://newsboard.unclassified.de/forum/thread/1398
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Keith #10
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: Separate by space does not work
Morty,

The plug-in settings page says you can separate scripts by space, comma, or |. I tried using a space found that didn't work. It put both scripts in the same src tag.  So then I used the third option and that works fine.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20110527-dev, © 2003-2011 by Yves Goergen
Page created in 193.1 ms (114.4 ms) · 99 database queries in 123.1 ms
Current time: 2012-02-04, 02:52:51 (UTC +01:00)