[Greasemonkey] Changing HMTLTitleElement

jason brackins j-san at j-san.net
Mon Apr 25 16:51:56 EDT 2005


Michael,
thanks. I will install your script for myself!
Jason Brackins
<http://www.j-san.net/>



[Michael Bierman] said on [04/25/2005 3:25 PM]

>Jason,
> 
>Perhaps you will find this helpful.
> 
>http://www.thebiermans.net/GreaseMonkey/Title%20Scrubber.user.js
> 
>Michael
>
>  _____  
>
>From: jason brackins
>
>
>
>Hi all,
>
>I am trying to change the title of the page my script is running in. The
>page in question is a wiki and it puts the least specific info first in the
>title element. So you might have "Wiki Site Name - Current Page name" as the
>title. Since I tend to have 10-15 tabs opened when I'm using this particular
>wiki it would be really nice to swap the two parts.
>
>It's easy to do if you just want the change reflected in the DOM (as viewed
>with the DOM inspector). But the change never makes it to the title bar of
>the window (and therefor not the tab label). 
>
>I'm not sure if what I'm trying to do is even possible. After all, the label
>on the window picks up the Title element and sets itself long before the
>page finishes loading. Since the window label is outside of the DOM the
>javascript can't get to it directly. I was hoping Firefox would notice the
>change in the DOM and react accordingly, but no joy. Anybody have any ideas?
>
>thanks.
>---
>btw, using FF 1.0.3, Greasemonkey 0.2.6, windows 98
>
>my code looks like this:
>
>function changeTitle() {
>var ptitle = document.getElementsByTagName("title")[0];
>    var titleComponents = ptitle.innerHTML.split(' - ');
>    ptitle.textContent = titleComponents[1]+' - '+titleComponents[0];    
>}
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Greasemonkey mailing list
>Greasemonkey at mozdev.org
>http://mozdev.org/mailman/listinfo/greasemonkey
>  
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.308 / Virus Database: 266.10.2 - Release Date: 04/21/2005
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050425/98b200ac/attachment-0001.htm


More information about the Greasemonkey mailing list