Sign up | Lost password? | Help

[ advanced search ]

[UserJS] MyOpera Community Forums Enhancements - Version 1.11

Forums » Opera Community » General Opera topics » Customizing Opera


Go to last post

Monday, 27. February 2006, 01:59:20

[UserJS] MyOpera Community Forums Enhancements - Version 1.11

A script by xErath and BtEO

A short history:
This script resulted from a post xErath made in the UserJS forum. While he had been coding this, I had also been working on my own set of toys to improve life here. My own standards precluded my releasing the messy code I had, but in this post I saw an opportunity to gain motivation.
We began to collaborate and agree on a feature set for version 1.00, which was released in that thread, and submitted to userjs.org. I had originally planned to wait until the script got accepted at userjs.org before placing an announcement here; but at the moment they have more important things to do, and I could wait no longer given the progress to version 1.10 and beyond.

The script is a suite of toys that improve various tasks at these forums, the basic functions break down as follows. Each part can be enabled independently of it's fellows, and there are many more configuration options within the script. Always check later posts, and the file itself, for the most up-to-date information about the tools available.

Search Results Cleaner:
cleanresults.png
This tool looks through the results pages of any search (also including pre-baked searches such as the unread posts, my active topics, etc...) and highlights (with a user-definable colour) on those listings any post from a forum you have chosen to highlight in search results.

Forum List Cleaner:
cleanforum.png
This tool processes the main forum listing (and the listing of any group you might subscribe to.) You can hide any forum you wish from the listings (I hide all those operating system specific ones that do not apply to me) or, much as with search results, highlight a forum on the listings. Highlighting is configured independently of those highlighted on the search results (although they share a colour configuration.) Should you hide all of the forums from a particular grouping, that group will also be hidden.

Smiley Extras:
smileyextra.png
This tool has two distinct areas of operation. The first is on the smiley panel; when making or editing a post anywhere except the quick reply field, It will add code so that the smileys are preloaded with the page (a cosmetic thing to be sure, but it is jarring to open the panel and see numerous placeholders temporarily.) It will also add a number of hidden smileys to that panel.
The second place it operates is when you hover a smiley, it will add a title so that you can see the text string corresponding to that image.

Inline Attachments:
showattachment.png
This tool will take image or text attachments (as you desire,) and display them inline underneath the attachment link. The inlined attachments can be hidden by default. You can also control the height of the inlined content, with anything larger gaining a scrollbar.

Classic Forum View:
classicforum.png
The default forum view at http://my.opera.com/community/forums/ is nice looking, but some people may prefer a more classing styling with information such as thread counts, and who posted last. Fortunately, one already exists here at http://my.opera.com/community/forums/home.dml. This tool will ensure that the classic view is the one you use. This is the only one of the six tools off by default

Page Numbers:
pagenumbers.png
Some forum systems include page numbers underneath threads large enough to have more that one page. Before the site redesign there was a userscript that added that here; so we resurrected that functionality[1]. The script grabs your currently defined posts-per-page value automatically and stores it in a cookie. It will in theory keep track should you change that value, and in the event of losing sync, the cookie is only given three day's life whereupon the figure will be updated once more. If you have cookies disabled, you can hard-code the value in the script, much as with it's predecessor.


One final feature is support for an external preferences file[2] (credit goes to Hesido's MultiPopup for the idea.) Many scripts have configuration, but any changes you make have to be redone with each new version. Given the number of options here this is clearly unacceptable. Full instructions on how to create such a file are included in comments at the top of the script, but I include a sample version below.
Note that unlike MultiPopup's external settings, this one only overrides defaults. This means that if a future version of the script adds a new setting you do not need to add it to your settings unless the default is undesirable.

With all that said, the script (as an attachment, so you can even see it in action by reloading the page):
myopera-community-enhancements.js
And an external preferences file.
myopera-community-enhancements-prefs.js

All future versions of the script will be announced in a new post in this thread, but the attachment in this post will always be the most current version.

[1] Note: The code used here is written from scratch. I could not even tell you who wrote the original, nor tell you where to find that code. But thanks for the idea, whoever gave it to us. P:
[2] The external preferences file may need to be loaded before the main script in order to work properly. Opera reads and loads the files in the order reported by the operating system. On Windows 2000/XP systems this will always be alphabetical order. On Windows 9x/ME it will be the order that the files were created.

Tuesday, 28. February 2006, 05:10:03

yadavankur

-title goes here-

avatar

Posts: 285

Wow, neat script. I love the "Page Numbers" feature the best :-)
Thanks

Tuesday, 28. February 2006, 20:47:48

I'm loving this. Everything is nice, especially the inline attachments.

If I may suggest a few additional things:

1) A forum quickjump dropdown menu.

2) A thread review for normal replys


Both these things have been absent from the new community boards and I severely miss them.

Wednesday, 1. March 2006, 03:02:16

filbo

propellerhead @VMware

avatar

Posts: 660

USA

Maybe add a comment documenting the fields of forumRules[] in myopera-community-enhancements-prefs.js? (Actually, most of the settings could use explanatory comments there, but forumRules[] was the least understandable from local context.)

>Bela<

Wednesday, 1. March 2006, 03:14:15

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by Sgt_Hobo:

2) A thread review for normal replys

hum ? I didn't get this one.

We're glad you're liking ! :cheers:

Wednesday, 1. March 2006, 10:20:03

scipio

Undutchable

avatar

Posts: 29747

Netherlands

This script slows down my Opera. The mouse pointer is an hourglass for several seconds after the page has finished loading.

Wednesday, 1. March 2006, 12:16:15

Originally posted by BtEO:

[2] The external preferences file may need to be loaded before the main script in order to work properly. Opera reads and loads the files in the order reported by the operating system. On Windows 2000/XP systems this will always be alphabetical order. On Windows 9x/ME it will be the order that the files were created.

I'm informed that Linux will be alphabetical too; Mac OSX and probably every *nix style OS will concur.
The edit time limit has however passed on my original post now :/

Originally posted by filbo:

Maybe add a comment documenting the fields of forumRules[] in myopera-community-enhancements-prefs.js? (Actually, most of the settings could use explanatory comments there, but forumRules[] was the least understandable from local context.)

The preferences file is only my example, full instructions are in the main file, and that one does include comments. Given that you don't need an external file, or an external file that defines every setting, it was a slight attempt to make sure those instructions were read.

Originally posted by scipio:

This script slows down my Opera. The mouse pointer is an hourglass for several seconds after the page has finished loading.

We've tried our best to make the script as efficient as possible, but some lag is to be expected, especially on slower systems.

Thursday, 2. March 2006, 01:41:17

dserl

avatar

Posts: 1191

China

Great,now we can see attachment picture in our forum.

Thursday, 2. March 2006, 01:51:49

yadavankur

-title goes here-

avatar

Posts: 285

May I suggest something, is it possible to add some code so that a person who is logged in can jump directly to first unread post in a thread.

Why I like the "page number" addition is that without this script sometimes when a discussion in which I am involved has grown to 2 pages, I always have to click on thread name and then the link to second page to go to see new discussions. It would really improve things if we went directly to the first unread page/post.

Just a suggestion.

Again, like it has been said earlier - loving it.

Thursday, 2. March 2006, 11:56:05

lakeview

avatar

Posts: 1202

like it, thks!

but how to make forum list cleaner work?

Thursday, 2. March 2006, 18:48:55

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by yadavankur:

Why I like the "page number" addition is that without this script sometimes when a discussion in which I am involved has grown to 2 pages, I always have to click on thread name and then the link to second page to go to see new discussions. It would really improve things if we went directly to the first unread page/post.

You can click the link on the far right below the last poster's name, to go to the last post.

Thursday, 2. March 2006, 20:29:27

hum ? I didn't get this one.



Nevermind. Apparently there is some kind of thread history after you clikc post reply. That's what I get for not using it in a while. :smile:

Friday, 3. March 2006, 20:18:32

yadavankur

-title goes here-

avatar

Posts: 285

Originally posted by xErath:

You can click the link on the far right below the last poster's name, to go to the last post.



Neat, thanks :smile:

Friday, 3. March 2006, 20:23:56

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by Sgt_Hobo:

1) A forum quickjump dropdown menu.

and there's a forum quickjump menu too ! :yes:

Saturday, 4. March 2006, 18:30:24

Oh, I noticed. :D

But I mentioned something else in the My Opera Community wishlist thread on the Feedback forum that has to do with the forum quickjump menu:

Just thought of something that would make the forum quickjump better: highlight the background of the forums in the menu that have new posts (kind of like having the new posts icon on the main page). That would make it easy to see which boards have new posts instead of playing trial and error with them all.



That would be fairly easy to do with UserJS, right?

Sunday, 5. March 2006, 23:08:55

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by Sgt_Hobo:

That would be fairly easy to do with UserJS, right?

hum.. probably but extremely laborous for such a small gain

Sunday, 5. March 2006, 23:16:22

I'd do it myself but I'm afraid I don't speak Javascript. :wink: Though I am taking a Dreamweaver class and I've found that I can really be into web design if I want to so I wouldn't rule out my learning Javascript in the future.

Sunday, 5. March 2006, 23:20:36

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by Sgt_Hobo:

I'd do it myself but I'm afraid I don't speak Javascript.

that's would require access other pages with xmlhttprequest and determine if there are unread posts, which therefore would drag Opera a bit, and have a significant delay.

Sunday, 5. March 2006, 23:33:55

OK, I understood that a little bit. But surely it couldn't be that much of a lag, right?

Sunday, 5. March 2006, 23:44:04

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by Sgt_Hobo:

OK, I understood that a little bit. But surely it couldn't be that much of a lag, right?

I can't tell. I'd have to debug the forum pages and try to find out the best way to get that info. Doing that server side when the pages are being built it's almost instant. Using a script to get forums main pages and see if there are unread posts is slow.

Sunday, 5. March 2006, 23:53:49

I was thinking that implementing this server-side would be way better but I think they've got other things to do right now. And seeing as how they fulfilled both my major wishes for the boards (thread history in when you click on post reply and the forum quickjump), I'm willing to give them time.

So, feel free to go ahead and try it if you want or if you do and it doesn't seem to work well, don't worry about it. I'll just go bug whoever I have to at a later time. :D

Friday, 17. March 2006, 13:08:17

Indyan

avatar

Posts: 455

India

Thanks a lot.That page no. feature is very usefull.Spotlighted

Wednesday, 22. March 2006, 04:55:39 (edited)

I wondered if this feature could fit in with the Opera Community Forums Enhancements:

Would rather not have "My friends' latest posts" on Opera Forums page

:confused:

Wednesday, 22. March 2006, 09:49:54

Nxqd3051990

GTD

avatar

Posts: 177

Viet Nam

how can i use all of them in Opera 9 :|

Wednesday, 22. March 2006, 19:14:26

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by Nxqd3051990:

how can i use all of them in Opera 9 :|

hum?


Originally posted by aimzz:

I wondered if this feature could fit in with the Opera Community Forums Enhancements:

ok. for a later release.

Thursday, 23. March 2006, 03:12:48

sgunhouse

Volunteer

avatar

Posts: 52783

Flag City, USA

Originally posted by yadavankur:

May I suggest something, is it possible to add some code so that a person who is logged in can jump directly to first unread post in a thread.


I always find it amazing how many people don't know that the "New messages" icon in the thread list is a link ... You can already go directly to the first unread post in a thread that way. :rolleyes:

Thursday, 23. March 2006, 18:06:26

filbo

propellerhead @VMware

avatar

Posts: 660

USA

Originally posted by sgunhouse:

I always find it amazing how many people don't know that the "New messages" icon in the thread list is a link ... You can already go directly to the first unread post in a thread that way.

Unless the thread has been locked since you read half of it ... then the lock icon isn't a link.

>Bela<

Friday, 24. March 2006, 17:56:38

mav1976

Spirit of Depeche Mode

avatar

Posts: 1160

Germany

Hi,

can someone help me to customizing the scripts for showing the german forums too? What must I do that opera shows me these forums. :frown:

Thanks in advance.

Friday, 2. June 2006, 16:03:18

Saddle Magic

Psycho Chicken What_The_Cluck!

avatar

Posts: 19081

About the page numbers.

I have optioned to show 100 posts per page, but the community enhancement numbers reflect a 20 post per page view. I changed the setting in the file, from 50 to 100, and still it reflects 20 per page.

Is there something I'm missing or is this an issue to be worked out in a future release?

Friday, 2. June 2006, 22:12:50

A recent forum upgrade screwed that feature.
Because I'm working off an internal version I can't guarantee that this fix will work for the last release, but I'm pretty sure no crucial changes have happened to this area.

Find the getPostsPerPage() function and replace with this updated version.

var getPostsPerPage = function () {
var expires, defaultPostsPerPage = 20;
var scriptCookieName = 'UJSMOCFE'; // UserJavaScriptMyOperaCommunityForumEnhancements
var pageCookies = new CookieBag();

// Cookies are disabled?
if (cookiesDisabled) return fixedPostsPerPage;

// Check if the user is logged in.
//if (!pageCookies['usernm'])
var loginBox = document.getElementById('loginbox');
if (loginBox.class == 'loginnow')
return defaultPostsPerPage;

// Get current username.
var userNameP, userName;
if (userNameP = loginBox.getElementsByTagName('p')[2])
userName = userNameP.firstChild.data.match(/Currently\slogged\sin\sas\s(.+)\s\(/)[1];

// On settings page - update the value.
if( location.href.indexOf("/account/forumsettings.dml") != -1 ){
var value = parseInt(document.getElementById('forumpage').value);
expires = new Date(new Date().getTime() + 3 * 24 * 60 * 60 * 1000); // Expire in three days.
pageCookies.addCookie(scriptCookieName, value + '_' + userName, expires, '/');
return value;
}
// Not on the settings page - check for valid cookie value.
if (!pageCookies[scriptCookieName] || !pageCookies[scriptCookieName].match(/^(\d+)_(.*)$/) || RegExp.$2 != userName) {
// Cookie non existant
// OR Cookie format -> number_username (must respect format), to track different sessions
// OR Username of cookie must be the same of the current user

// Retreive settings page, and read the value
var req = new XMLHttpRequest();
req.open('GET', 'http://my.opera.com/' + userName + '/account/forumsettings.dml', false); // Sync!
req.send('');

try { // Some error might cause the page to be returned not to be valid, including HTTP errors
var value = parseInt(req.responseXML.getElementById('forumpage').value);
}
catch (ex) {
return defaultPostsPerPage;
}
expires = new Date(new Date().getTime() + 3 * 24 * 60 * 60 * 1000); // Expire in three days.
pageCookies.addCookie(scriptCookieName, value + '_' + userName, expires, '/');
return value;
}
// Cookie and user okay!
return parseInt(RegExp.$1);
}

Friday, 2. June 2006, 22:23:58

Saddle Magic

Psycho Chicken What_The_Cluck!

avatar

Posts: 19081

Beauty :up: worked like a charm :smile:

I had been noticing that problem with version 1.10, so I updated to 1.11 and it continued.

Keep up the great work, I really like the community enhancement script.

Monday, 3. July 2006, 11:56:33

Saddle Magic

Psycho Chicken What_The_Cluck!

avatar

Posts: 19081

Show images and texts in previews.

I have optioned this on, at least I tried, but it doesn't work. Any insights as to the setting or is this still on the todo list?

Monday, 24. July 2006, 05:53:03

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software
New feature ! p:
Just look at the links below the post that say "Quote, Edit, Quick Quote, ..."
This one was inspired by some vBulletin boards.
It a simple Quick Edit feature, which prevents you from going to the regular edit post page.
Get it here
Note: this file DOES NOT replace the original script !
This file only contains the quick edit feature.

myopera-community-quickedit.js

This will be merged with the main script in future, if BtEO agrees. :smile:

Also, this needs a bit of eye candy. Currently it's working, but nothing pretty to see, only to use.

Monday, 24. July 2006, 08:14:53 (edited)

An updated version would indeed be pleasent to have. Mine stopped working long ago. :smile:

Edit:
Whoa! The new feature is AWESOME! :D :D :D :D

Bug:
- Smilies are lost when I write their text version in the quick edit box (see above...).

Feature:
- A Preview link that will show the regular preview page with the regular edit options?

Monday, 24. July 2006, 12:35:00

Originally posted by YtseJam:

Mine stopped working long ago


Not confirmed here-- have used it from Opera 8.2 through 9.01, build 8542. Updates always appreciated, though
:smile:

cow

Monday, 24. July 2006, 15:03:00

Saddle Magic

Psycho Chicken What_The_Cluck!

avatar

Posts: 19081

This script is still working for me, got a couple little glitches, nothing worth writing home about.

I might try that quick-edit script later today.

Monday, 24. July 2006, 16:11:07 (edited)

xErath

javascript guru

avatar

Posts: 6413

Norway

Opera Software

Originally posted by YtseJam:

- Smilies are lost when I write their text version in the quick edit box (see above...).


:faint: Odd !!!!! All data is submited like when writing in the regular online form...

testing: :hat: :bomb: :confused: :smile: p: :D Homer: Doh! banana

broken link

Edit: yeap ! what I though. The edit page has the Disable smilies checkbox, which has a value of 'yes' in the html, but oddly smilies are disabled.

Ah ! I didn't mention.
Bug reports are wellcome, and needed :smile: Feedback as well.

Wednesday, 26. July 2006, 09:00:26

d.i.z.

bug hunter

avatar

Posts: 2942

Poland

QuickEdit is very usefull. Thanks.

I do have one small problem though. After submiting changes it returns this:
"Error loading contents: no body of message found"
but message is edited fine.

Maybe it's because of some of my other userjs, gotta look at this later today.

One thing in Opera Community that is killing me - clicking link in watched items does not take me to the right page. Probably you know that well.

One hacky solution would be to go through next pages with xmlhttprequest and look for anchor (ie. "#commment239834") that does not exist in current page.
I will try to do it if I find some time.

Wednesday, 26. July 2006, 09:08:11

That one should be reported to olak and not fixed via this script.
We should not give them slack for such errors! P:

Wednesday, 26. July 2006, 09:22:36

d.i.z.

bug hunter

avatar

Posts: 2942

Poland

Originally posted by YtseJam:

That one should be reported to olak and not fixed via this script. We should not give them slack for such errors!


I reported this few months ago. That's why I'm loosing patience and want to fix it by myself.

Wednesday, 26. July 2006, 09:27:53

Bump the thread and PM olak. :smile:

Wednesday, 26. July 2006, 13:26:21

d.i.z.

bug hunter

avatar

Posts: 2942

Poland

Originally posted by YtseJam:

Bump the thread and PM olak. :smile:


Maybe this will eventually help (even though I have already bumped it once).

Till then: opera_community_watches_fix.js

Wednesday, 26. July 2006, 13:30:56

"Failed! 301"?
Anyway, I have bumped the thread and olak fixed it but it won't be live for some weeks until Fred returns.

Wednesday, 26. July 2006, 13:41:02

d.i.z.

bug hunter

avatar

Posts: 2942

Poland

Originally posted by YtseJam:

"Failed! 301"?


???

Originally posted by YtseJam:

Anyway, I have bumped the thread and olak fixed it but it won't be live for some weeks until Fred returns.


Few more weeks could kill me, so I'm happy to have temporary solution :smile:

Wednesday, 26. July 2006, 21:21:46 (edited)

d.i.z.

bug hunter

avatar

Posts: 2942

Poland

BTW. I can see now what you meaned then with this "Failed! 301". It's this myopera-community script that stopped showing attachments, somehow.

I was at work then, so I didn't know what you were talking about as I had no script there.

Wednesday, 26. July 2006, 21:11:20

Darken

Dragonfly rulez!

avatar

Posts: 356

Canada

Nice! :up:

Wednesday, 26. July 2006, 21:19:21

When do we get a new version? :smile:

Saturday, 12. August 2006, 07:33:42

this could also be added as another community enhancment featuer for this script.

Saturday, 12. August 2006, 12:14:05

sgunhouse

Volunteer

avatar

Posts: 52783

Flag City, USA

Originally posted by d.i.z.:

One thing in Opera Community that is killing me - clicking link in watched items does not take me to the right page. Probably you know that well.
One hacky solution would be to go through next pages with xmlhttprequest and look for anchor (ie. "#commment239834") that does not exist in current page.
I will try to do it if I find some time.



Why in the world would you do it that way?

If it's a forum post, then use the findpost link (see any "PermaLink"). Not certain if there's something similar for blog posts though.

Forums » Opera Community » General Opera topics » Customizing Opera