Monday, 27. February 2006, 01:59:20
[UserJS] MyOpera Community Forums Enhancements - Version 1.11
A script by xErath and BtEOA 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.
[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
Thanks
Tuesday, 28. February 2006, 20:47:48
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, 10:20:03
Wednesday, 1. March 2006, 12:16:15
Originally posted by BtEO:
I'm informed that Linux will be alphabetical too; Mac OSX and probably every *nix style OS will concur.[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.
The edit time limit has however passed on my original post now :/
Originally posted by filbo:
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.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.)
Originally posted by scipio:
We've tried our best to make the script as efficient as possible, but some lag is to be expected, especially on slower systems.This script slows down my Opera. The mouse pointer is an hourglass for several seconds after the page has finished loading.
Thursday, 2. March 2006, 01:51:49
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, 18:48:55
Originally posted by yadavankur:
You can click the link on the far right below the last poster's name, to go to the last post.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.
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.
Friday, 3. March 2006, 20:18:32
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
Saturday, 4. March 2006, 18:30:24
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:16:22
Sunday, 5. March 2006, 23:20:36
Originally posted by Sgt_Hobo:
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.I'd do it myself but I'm afraid I don't speak Javascript.
Sunday, 5. March 2006, 23:33:55
Sunday, 5. March 2006, 23:44:04
Originally posted by Sgt_Hobo:
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.OK, I understood that a little bit. But surely it couldn't be that much of a lag, right?
Sunday, 5. March 2006, 23:53:49
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.
Wednesday, 22. March 2006, 04:55:39 (edited)
Would rather not have "My friends' latest posts" on Opera Forums page
Thursday, 23. March 2006, 03:12:48
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.
Thursday, 23. March 2006, 18:06:26
Originally posted by sgunhouse:
Unless the thread has been locked since you read half of it ... then the lock icon isn't a link.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.
>Bela<
Friday, 2. June 2006, 16:03:18
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
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
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
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
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.
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)
Edit:
Whoa! The new feature is AWESOME!
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
Monday, 24. July 2006, 15:03:00
I might try that quick-edit script later today.
Monday, 24. July 2006, 16:11:07 (edited)
Originally posted by YtseJam:
- Smilies are lost when I write their text version in the quick edit box (see above...).
testing:
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
Wednesday, 26. July 2006, 09:00:26
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, 13:26:21
Originally posted by YtseJam:
Bump the thread and PM olak.
Maybe this will eventually help (even though I have already bumped it once).
Till then: opera_community_watches_fix.js
Wednesday, 26. July 2006, 21:21:46 (edited)
Saturday, 12. August 2006, 07:33:42
Saturday, 12. August 2006, 12:14:05
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.
Showing topic replies 1 - 50 of 77.
Forums » Opera Community » General Opera topics » Customizing Opera
