The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features
See the new ForumsYou need to be logged in to post in the forums. If you do not have an account, please sign up first.
Renaming tabs
This is an idea for those who are in working in the development of Opera, and I also want to hear opinions about this from other users.I usually have a bunch of tabs open, and the view of this has been greatly improved with the introduction of tab stacking. Now, the proposition I want to make here is to allow the users to edit the text which is located in the tab, and is the same as the title of the page.
With this, I can shorten my time of finding the tab I need inside the stack. For instance - if I am checking on the weather on the accuweather website as such:
http://www.accuweather.com/us/mt/belgrade/59714/city-weather-forecast.asp?unit=c
http://www.accuweather.com/us/ne/belgrade/68623/city-weather-forecast.asp?unit=c
I will find myself in a confusing situation, for I will not know which of these two cities I am looking up data for at the time, so I have to re-check every time. Because when I am in the third tab, on the both of them, I find the same header to be displayed: "Belgrade weather - Ac...". Now, this can lead to losing time and stress, especially at work.
Another example would be this - http://www.expedia.com/Flights-Search?c=be077e49-aa56-4a6f-b501-162c63a8f7b1&
Whatever data I put in, I see the header that says - "Build your own trip - Y...". If I could change these contents, it would have saved time, and made it much easier to go through tabs without losing focus on the subject and time on finding the right tab.
p.s. Comments like "Use ctrl+tab" are pretty much useless to me, because I know how to use it, but still there are websites that give you the same header no matter what part of the website you have entered.
Life is waaaay too brutal...though it can get much easier when you know the right people.
22. October 2011, 21:03:19 (edited)
Rename — Drag the link to the address bar or to one of the page bar toolbars (head, floating, or tail). Click the button the rename any tab. Note that refreshing a tab will reload the "Title" from the web page.
This code should work as a shortcut, but it doesn't work for me. Maybe one of the Javascript gurus can tell us why not.
Go to page, "javascript:function(){document.title=prompt('Rename tab')}"
Browser JS Changelogs Opera Next Dragonfly Bugs FTP
My Website Opera Review My Fonts IrfanView Search Downloads
Opera 11.64 on Windows 7 64-bit • AMD A10-6800K, 8 Gbyte RAM specs
Rules of Conduct and Posting Rules • Please Don't Shout • Editing Posts • Opera Config Links
22. October 2011, 23:18:54 (edited)
[EDIT] Correction - I managed to make the first option work, after some trial and error, but I still can not believe it does not save the name...that's just silly.
Life is waaaay too brutal...though it can get much easier when you know the right people.
23. October 2011, 03:39:59 (edited)
Originally posted by Wookman17:
that's just silly.
Reading the title tag is how Opera gets the names of the tabs, so there's nothing silly about it. If you don't want to lose the edited title you will have to look for ways not to refresh the page. Preferences, History, check documents, never, or save a local copy for reading later perhaps?
I don't think it would be very practical to store user-defined names for web pages, but it might be reasonable to store names for tab groups. This request is already in the wish-list.
Browser JS Changelogs Opera Next Dragonfly Bugs FTP
My Website Opera Review My Fonts IrfanView Search Downloads
Opera 11.64 on Windows 7 64-bit • AMD A10-6800K, 8 Gbyte RAM specs
Rules of Conduct and Posting Rules • Please Don't Shout • Editing Posts • Opera Config Links
Life is waaaay too brutal...though it can get much easier when you know the right people.
[EDIT] @Pesala Are you a forum moderator or something? Do you have any idea who I could ask to move this entire topic to the Wish-list forum?
Life is waaaay too brutal...though it can get much easier when you know the right people.
go to page, "javascript:void( document.title=prompt('Rename tab'));"
Browser JS Changelogs Opera Next Dragonfly Bugs FTP
My Website Opera Review My Fonts IrfanView Search Downloads
Opera 11.64 on Windows 7 64-bit • AMD A10-6800K, 8 Gbyte RAM specs
Rules of Conduct and Posting Rules • Please Don't Shout • Editing Posts • Opera Config Links
Originally posted by gdveggie:
Procedurally, how is that code implemented
Assign it to a shortcut, mouse gesture, or menu item. The button code is in this post.
Browser JS Changelogs Opera Next Dragonfly Bugs FTP
My Website Opera Review My Fonts IrfanView Search Downloads
Opera 11.64 on Windows 7 64-bit • AMD A10-6800K, 8 Gbyte RAM specs
Rules of Conduct and Posting Rules • Please Don't Shout • Editing Posts • Opera Config Links
27. October 2011, 08:44:12 (edited)
Originally posted by gdveggie:
(3) Theoretically, could this kind of code be written in a site specific way and added to a cumulative list of similar site specific codes in a UserJS file so the Tabs for those sites would automatically be renamed whenever the site is loaded or refreshed? (probably gets back to something like the UserJS I mentioned above having run across long ago and have never re-found)
Quite easily. The basic structure would be like this, in pseudo-code
array of conditions and title changes
for (i=0; i<array.length; i++) {
if (window.location.match(url of site where you want the title changed) && document.title.match(title you want changed)) {
document.title.replace(arguments);
}
}
I used URL as well as title in there because you presumably wouldn't want
Originally posted by gdveggie:
I may want to get back to you on that, but gonna have to put it on the back burner for now.
No need. I decided to write the script while eating breakfast as a way to start a couple of free days.
http://extendopera.org/userjs/content/title-changer
If you're interested in more complicated regexp you should probably read up on the replace function and modify accordingly, but I figured this should suffice for the vast majority of use cases.
Life is waaaay too brutal...though it can get much easier when you know the right people.
27. October 2011, 10:40:54 (edited)
UJS_title_changes[UJS_title_changes.length] = ['en.wikipedia.org', 'Wikipedia, the free encyclopedia', 'Wikipedia']; UJS_title_changes[UJS_title_changes.length] = ['my.opera.com/community/forums', 'Opera Community', 'MyOpera']; UJS_title_changes[UJS_title_changes.length] = ['', 'Word I don't like', 'Word I like']; // applies everywhere
Edit: hm, perhaps I should adjust the code slightly so it compares with the entire location instead of just the hostname. I'll upload an updated version.
Edit 2: OK, done.
Originally posted by Pesala:
go to page, "javascript:void( document.title=prompt('Rename tab'));"It could even be:go to page, "javascript:void(document.title=prompt('Rename tab',document.title) || document.title);"This way title isn't removed when you press Cancel and current title is the default in the prompt window.
Thanks, Frenzie. I will try tweaking it some more, and ask for more help when and should I need it, but this is really working for me. 
Life is waaaay too brutal...though it can get much easier when you know the right people.
We got to this when I tried out the script with some Russian sites.Life is waaaay too brutal...though it can get much easier when you know the right people.
Originally posted by Wookman17:
@gdveggie - it works, but you need to restart your browser after each alteration (that's just my experience, perhaps I am wrong).
Refreshing the page* should suffice.
* Or actually no more than refresh display; I recommend binding the action to a keyboard shortcut.
Originally posted by gdveggie:
I think I understand what you mean conceptually, but I don't have a clue how to do that. Would you please explain? Thanks!
In Preferences > Advanced > Shortcuts you can bind refresh display to e.g. ctrl+r, but that's really unrelated to the rest here. Simply refreshing the page (F5) will work fine to test changes.
), so if there's anyone else who's feeling up to the challenge:The creation of a button that would, when clicked, open a mini screen in which a user could setup stuff without any knowledge of writing codes.
It would be like a dialog box with two tabs, and in the first a user would see:
1)first field is the website address that you can edit, but when started, it takes the address from the address bar of the tab from which it was opened (to ease that as well);
2)second would be like a radiobox - apply to only this page/all subpages/pages in same domain, like we did with the london metal exchange (you can check it in the basic code that is uploaded here http://extendopera.org/userjs/content/title-changer ;
3)third would be a field where one can add text of choice to be erased, and would take the title from the tab to make it easier to insert UTF-8 symbols without changing keyboard settings, or going to view>source, cause most people don't really know how to use that;
4)fourth, of course, replacement text (if left blank, just erases).
Then it uses the given data to change the basic code of the script, and adds it to a list of rules which are listed in the rules (second) tab that checks the script and reads the type of rule and all its characteristics, so one can edit it when necessary. This would literally make this script as easy to use as creating the search engine shortcuts in Opera. It would likely become a new thing to be added to the basic code.
Life is waaaay too brutal...though it can get much easier when you know the right people.
And also, sites with "https" instead of "http" are not included because, as Frenzie explained, and I quote:
"Anyway, for HTTPS you'd need to enable opera:config#UserPrefs|UserJavaScriptonHTTPS but that results in a dialog every time you restart Opera. I think extensions may not have that issue, but I can't recall atm. You'd probably have to add a window in front of location.toString() on line 32 but otherwise it's probably ready to go as an extension. I'm personally not fond of extensions insofar as they limit compatibility with GreaseMonkey for no good reason (like they would for this script), but feel free to make it into one."
So, the idea is great, but the fruition is still far from it, and I hope to see it some day, because I am sure that many people would like the option even for silly stuff - like when my friend asked me if he could rename his gfs facebook page into "my love"...I mean, it's a silly example, but it is something I am sure many users would welcome.
Life is waaaay too brutal...though it can get much easier when you know the right people.
Originally posted by gdveggie:
(BTW, Frenzie, assuming you have editorial access, the version 0.1 description at http://extendopera.org/userjs/content/title-changer should read "0.1 Oct 27, 2011 Proof of concept", but currently has the version 0.2 description. )
I don't have access to fix my own mistakes in that particular area. There never was an explicit 0.1 description as it's the changelog for what has changed since the last version.

Originally posted by Wookman17:
this won't work for instance because it would need to refresh the page every 2 seconds, so it would eat up your speed.
The specific impact would depend on a variety of factors such as speed of your computer, number of tabs and title polling interval, but yeah, that basically seems like a waste of CPU cycles to me. A possible way around that problem would be to only do title polling if explicitly told to do so on a particular URL. The impact is likely to be small either way, but if you've got a bunch of scripts/extensions that "only have a small impact" it'd start to be apparent.

What's needed for a less hackish approach is DOMSubtreeModified.
Note of course that it'd be easy to make a little UserJS file that only works on Facebook by making a file that says something like
// ==UserScript==
// @name Facebook My Love
// @include http://facebook.com/mylove/*
// ==/UserScript==
(function () {
function changeTitle () {document.title = document.title.replace('Love's Name', 'My Love');}
var interval = setInterval(changeTitle, 1000);
})();
You could somewhat alleviate the redundancy of making multiple files like that by having a library file that has changeTitle as a function with arguments or some such.
Originally posted by gdveggie:
But the simple Facebook example above looks is already almost transparent to me, and looks like something I could easily duplicate and adapt on a per site basis for the 3-4 sites I'm concerned about, and might be all I need.
Thanks!
I haven't tested whether it actually works.
On any site that doesn't set the title through Javascript you'd simply want to run the function once on DOMContentLoaded or load, not run it every second in case the site's own Javascript changes it. Which is what the Title Changer UserJS does. 
I don't have access to fix my own mistakes in that particular area.
But you do
Just click on the title of the changelog entry (the date in this case) and you'll get taken to a page where you can edit or delete the entry.Originally posted by Zotlan:
Just click on the title of the changelog entry (the date in this case) and you'll get taken to a page where you can edit or delete the entry.
How about that. Thanks.

Anytopic - Wikipedia
Anytopic - Wikipedia
My recollection is that it could be set up to work the same way on repeating patterns at the beginning of webpage titles, e.g., with your links above as follows:
Belgrade Weather - AccuWeather Forecast for NE 68623
Belgrade Weather - AccuWeather Forecast for MT 59714
...could be shortened to:
Forecast for NE 68623
Forecast for MT 59714
...or even:
NE 68623
MT 59714
Since I never saw how it worked, I don't know if it modified the title display in Opera's Title Bar and Tabs, but I've always assumed it did. If it does work that way, maybe it would be a persistent fix for the sites you use enough to make it worthwhile to customize the UserJS for.
...IF we could only find it...
(I'm pretty sure it was posted by a user here in the forum, so it's probably still here somewhere.)
Originally posted by Wookman17:
Do you have any idea who I could ask to move this entire topic to the Wish-list forum?
One way to attempt that is to "Report" your own post with link at the lower right of your post and check the "Wrong forum" and maybe briefly explain that you now think that's a better fit. Then a moderator can assess it and make a determination.
Originally posted by sgunhouse:
Just to post it here ... I'm not a javascript guru, but this works (until you refresh the page of course):
javascript:void( document.title=prompt('Rename tab'));
Originally posted by Pesala:
Or, rather:
go to page, "javascript:void( document.title=prompt('Rename tab'));"
I'm not only not a JavaScript guru, I'm sub-n))b, pre-newb, or whatever the classification is before n00b.
...So 3 questions (first two maybe a little OT, but third gets back to this thread):
(1) Procedurally, how is that code implemented (e.g., type it in the Address Bar? ...make it into a button? ...?)
(2) Do you know a good place to get a a try-on-the-fly intro to JavaScript via simple, one line commands like this? (even better if Opera related, but doesn't need to be)
(3) Theoretically, could this kind of code be written in a site specific way and added to a cumulative list of similar site specific codes in a UserJS file so the Tabs for those sites would automatically be renamed whenever the site is loaded or refreshed? (probably gets back to something like the UserJS I mentioned above having run across long ago and have never re-found)
Does sgunhouse's code provide any clue as to why your button code doesn't work as a shortcut? (as you mentioned in your first post above)Still interested in anyone's response to questions (2) & (3).
I'll still have to wait a while before I'll have time to play with this, but thanks, Frenzie!
...and Saskatchewan!
I really appreciate it!
I've wanted to ask about this for a couple years, more for saving pages than for the Tab title, but the Tab title will be really nice, too! But I just hadn't gotten to it and Wookman17's question gave me a chance to pursue it.
So if it works for you, Wookman17, terrific!
And I'll post back and let you all know if it's working (or if I need more help with it) as soon as I get a chance.
Originally posted by Wookman17:
@gdveggie - it works
Great! Glad to hear it. Like, I said, I've wanted to find a way to implement this for a long time, so I'm looking forward t trying it out.
Originally posted by Wookman17:
Most of the work was really done by Frenzie
...Yep!
...Again, thanks, Frenzie!Originally posted by Frenzie:
Or actually no more than refresh display; I recommend binding the action to a keyboard shortcut.
I think I understand what you mean conceptually, but I don't have a clue how to do that. Would you please explain? Thanks!
Originally posted by Wookman17:
The creation of a button that would, when clicked, open a mini screen in which a user could setup stuff without any knowledge of writing codes.
Seems like a nifty idea, and I can tell you've put some thought into some of the requirements; e.g.:
• automatic URL selection
• text to be deleted (with built-in method to preserve proper encoding)
• replacement text (by replacement, I assume you mean it would be inserted in the string at the same spot where the deleted text had been; but what if you wanted it inserted elsewhere in the string, or wanted to both replace text somewhere in the string and add text somewhere else in the string?)
• applicability to page only/all subpages/domain, etc.).
...Wish I had the requisite coding skills because it seems like a nice project, and certainly one for which I have an affinity.
Sounds like you're thinking of a simple GUI that would exist on your local machine (e.g., an additional UserJS module?), but I suppose it could also be a webpage application like some of the button configurators that already exist. Not sure what the pros & cons of each would be.
Although I still haven't had a chance to start playing with this, I think I will be able to manually adapt the UserJS to other sites. However, if it is feasible (e.g., the relevant title and URL variables are limited and predictable enough to code for most/all possible combinations), a simple desktop or web GUI to automatically make the necessary coding changes would be fantastic! ...And I think there may be many users who will appreciate the renaming capability, but I imagine a simple GUI might be the only way a lot of users would be able to take advantage of it.
(BTW, Frenzie, assuming you have editorial access, the version 0.1 description at http://extendopera.org/userjs/content/title-changer should read "0.1 Oct 27, 2011 Proof of concept", but currently has the version 0.2 description.
)Originally posted by Wookman17:
Uhm..we have excluded some things that are a not an option at the moment - like... ... ...
I assume you mean you and Frenzie in some PMs, so I appreciate you summarizing some of that. Helps me better understand the programming task and provides a glimpse of some of the potential challenges/complexities/impossibilities.
Originally posted by Wookman17:
I am sure that many people would like the option even for silly stuff - like when my friend asked me if he could rename his gfs facebook page into "my love"...I mean, it's a silly example, but it is something I am sure many users would welcome.
Yeah, once something is available for use, there's no telling what creative (practical, "silly", humorous, trivial, or even nefarious) applications people will come up with.
Originally posted by Frenzie:
Note of course that it'd be easy to make a little UserJS file that only works on Facebook by making a file that says something like
All of this is a (welcome) stretch for me, with only some "basic" BASIC programming 30+ years ago that I barely remember and some Fortran 40+ years ago that I've completely forgotten. My goal is to study and understand what is happening in, and how to use, the Title Changer UserJS. But the simple Facebook example above looks is already almost transparent to me, and looks like something I could easily duplicate and adapt on a per site basis for the 3-4 sites I'm concerned about, and might be all I need.
Thanks!