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 Forums

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

22. October 2011, 20:43:02

Wookman17

Posts: 14

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. smile

22. October 2011, 21:03:19 (edited)

Pesala

Reclining Buddha

Posts: 27343

Feature requests belong in the Wish-list, but this is already possible.

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')}"
Skins Tips Buttons Backup Security User Scripts Language Forums
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 idea
Rules of Conduct and Posting RulesPlease Don't ShoutEditing PostsOpera Config Links

22. October 2011, 23:18:54 (edited)

Wookman17

Posts: 14

Can't really do as you instructed. The first option does not work for me. And the other one I don't get, because I have no idea how JS works. On the other hand, the possibility seems very silly, as refreshing tabs occurs each time you restart your browser, so saving work is obviously not an option. Thanks for the answer anyways, you were surprisingly prompt, I did not expect an answer for a day at the very least.

[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. smile

23. October 2011, 03:39:59 (edited)

Pesala

Reclining Buddha

Posts: 27343

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.
Skins Tips Buttons Backup Security User Scripts Language Forums
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 idea
Rules of Conduct and Posting RulesPlease Don't ShoutEditing PostsOpera Config Links

23. October 2011, 08:37:01

Wookman17

Posts: 14

Hm... This might sound like I'm asking too much, but as far as I can see, if I hover over the name of the tab - I get the full name in the bubble that appears. Why not keep that bubble as is, and allow people to rename tabs? To be more precise, renaming does not edit the title of the tab, just the header display on the tab button. That is what I wanted all along - a shorter, faster way to find what I need, then go into detail.
_____________________________________________________________________________________________________________________________
Life is waaaay too brutal...though it can get much easier when you know the right people. smile

23. October 2011, 22:11:25

Wookman17

Posts: 14

That still does not really solve the problem. It IS getting there, but just not it... See, this is when I got to this idea - I am writing about the prices of gold on commodity and ForEx markets around the world. This is all nice, but there are so many indexes to remember. It would be a lot easier to, for instance, rename a tab into "London, UK commodity" for the London Metal Exchange, and the other one to "Mumbai, India commodity" instead of reading "Multi Commodity Exchange", or reading the titles of both tabs saying "Gold prices". See what I'm getting at? This REALLY needs to be customized the way I explained earlier.

[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. smile

26. October 2011, 16:05:14

Moderator

sgunhouse

Volunteer

Posts: 66788

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'));

26. October 2011, 16:52:19

Pesala

Reclining Buddha

Posts: 27343

Or, rather:
go to page, "javascript:void( document.title=prompt('Rename tab'));"
Skins Tips Buttons Backup Security User Scripts Language Forums
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 idea
Rules of Conduct and Posting RulesPlease Don't ShoutEditing PostsOpera Config Links

26. October 2011, 18:04:10

Pesala

Reclining Buddha

Posts: 27343

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.
Skins Tips Buttons Backup Security User Scripts Language Forums
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 idea
Rules of Conduct and Posting RulesPlease Don't ShoutEditing PostsOpera Config Links

27. October 2011, 08:44:12 (edited)

Frenzie

Posts: 15571

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 anyeverything that matched e.g. "Wikipedia" to be changed.
The DnD Sanctuary — a safety net for My Opera's demise.

27. October 2011, 09:14:34

Frenzie

Posts: 15571

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.
The DnD Sanctuary — a safety net for My Opera's demise.

27. October 2011, 09:22:56

Wookman17

Posts: 14

Uhm, Frenzie, bon appetite, and can you give us more how-to on using the code? :O
_____________________________________________________________________________________________________________________________
Life is waaaay too brutal...though it can get much easier when you know the right people. smile

27. October 2011, 10:40:54 (edited)

Frenzie

Posts: 15571

Duplicate (or change) the example line and adjust the relevant variables to your liking. Like this:

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.
The DnD Sanctuary — a safety net for My Opera's demise.

27. October 2011, 14:21:43

Sorry I didn't read the whole topic.

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.

27. October 2011, 15:00:21

Wookman17

Posts: 14

This is actually getting there! bigsmile 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. smile
_____________________________________________________________________________________________________________________________
Life is waaaay too brutal...though it can get much easier when you know the right people. smile

28. October 2011, 19:23:07

Wookman17

Posts: 14

@gdveggie - it works, but you need to restart your browser after each alteration (that's just my experience, perhaps I am wrong). Most of the work was really done by Frenzie, and I feel like I'm spamming his mailbox, but the script's great. This should really be additionally improved and included in some future versions of Opera. Now, I am running Opera 11.52 and using UJS Manager, but it takes to go to Preferences and setup the JavaScript folder; also, the script did not work with the Cyrillic, but if saved as a UTF-8, it works. wink 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. smile

28. October 2011, 22:11:47

Frenzie

Posts: 15571

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.
The DnD Sanctuary — a safety net for My Opera's demise.

29. October 2011, 13:57:17

Frenzie

Posts: 15571

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.
The DnD Sanctuary — a safety net for My Opera's demise.

29. October 2011, 14:48:31

Wookman17

Posts: 14

This is basically what I have asked Frenzie via private message, but I feel like I'm asking too much from him as is (there is no bowing smiley to show how much I'm enjoying what he has made so far, but I wanted it here bigsmile ), 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. smile

29. October 2011, 22:28:39

Wookman17

Posts: 14

Uhm..we have excluded some things that are a not an option at the moment - like expedia/indian stock exchange(mcx) - sites that have a name given already with JavaScript - this won't work for instance because it would need to refresh the page every 2 seconds, so it would eat up your speed.
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. smile

29. October 2011, 22:53:38

Frenzie

Posts: 15571

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. p

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. wink

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.
The DnD Sanctuary — a safety net for My Opera's demise.

30. October 2011, 09:19:57

Frenzie

Posts: 15571

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. p 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. smile
The DnD Sanctuary — a safety net for My Opera's demise.

30. October 2011, 12:34:42

Zotlan

ExtendOpera admin

Posts: 2819

I don't have access to fix my own mistakes in that particular area.


But you do smile 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.
Visit ExtendOpera.org for finding and sharing UserJS, user CSS and other customisation files.

30. October 2011, 12:56:19

Frenzie

Posts: 15571

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. wink
The DnD Sanctuary — a safety net for My Opera's demise.

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

Seems like there was some UserJS I ran across long ago when I first started using Opera that a user could tweak so it would automatically edit out a user selected portion of a repetitive site name when saving webpages. I've always wanted to find it again and set it up to modify page titles for certain sites I frequently save webpages from. For example, I would like to always automatically delete the end of all saved Wikipedia page titles as follows:

Anytopic - Wikipedia, the free encyclopedia
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.)

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

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.

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

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. p

...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)

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

Thanks, Pesala! smile 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).

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

Originally posted by Frenzie:

Quite easily. The basic structure would be like this, in pseudo-code


up Thanks! I may want to get back to you on that, but gonna have to put it on the back burner for now.

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

Just dropped by to check in on the progress, because it seemed like maybe this was going in the right direction. And it looks like it's really coming together! yes

I'll still have to wait a while before I'll have time to play with this, but thanks, Frenzie! cheers ...and Saskatchewan! cheers I really appreciate it! cheers

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. smile

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

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! up ...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!

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

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. smile)

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

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. up

27. January 2012, 08:34:48

gdveggie

(Arcimboldo's "The Gardener" - ca 1590)

Posts: 1710

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! smile

Forums » Opera for Windows/Mac/Linux » Desktop wish-list