renaming tab

Subscribe to renaming tab 5 posts, 2 voices

 
Metal Miketh User

i want to rename a tab

eg.

from Userscripts.org

to

Userscripts or bacon

as an example.

 
znerp Scriptwright

Have you tried looking at current scripts to see how they do it? I'd recommend you look at eg. Henrik's script here, and maybe look up regular expressions to help you understand it better.

 
Metal Miketh User

ok...

i've changed :

document.title = document.title.replace(/^Facebook \| /, '')

to

document.title = document.title.replace(/^Tribal \Wars \Map /,'en17')

where am i going wrong?

 
znerp Scriptwright

As I said, look up regular expressions...

In the example that I linked, /^Facebook \| / is a regular expression. ^ denotes the beginning of the string, and \| is because the pipe is a special character so the slash escapes it so that the pipe is not evaluated. The 'W' and 'M' in your code aren't special characters, so you don't need to escape them.

Assuming that the title of the page you're trying to change starts with "Tribal Wars Map " then you want to use /^Tribal Wars Map /.

 
Metal Miketh User

many thanks