The Grey Labyrinth is a collection of puzzles, riddles, mind games, paradoxes and other intellectually challenging diversions. Related topics: puzzle games, logic puzzles, lateral thinking puzzles, philosophy, mind benders, brain teasers, word problems, conundrums, 3d puzzles, spatial reasoning, intelligence tests, mathematical diversions, paradoxes, physics problems, reasoning, math, science.

   
The Grey Labyrinth Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    RegisterRegister  
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

For Firefox users - a useful script

 
Reply to topic    The Grey Labyrinth Forum Index -> Feature Requests / Site Problems
View previous topic :: View next topic  
Author Message
Nsof
Daedalian Member



PostPosted: Sat Nov 18, 2006 12:18 am    Post subject: 1 Reply with quote

I have created a GreaseMonkey script that adds a link for each post (under the author’s name) which when clicked reveals spoilers. Another click will re-spoiler the post.

After installing, posts look like this


When you click the “show spoiler” link the invisible text is seen.


You can reveal several spoilers at the same time and you can still mark text as usual


Behavior / Advantages
• Script does not let you know if a post contains a spoiler – all posts contain the 'show spoiler' link.
• You can still mark text the normal way
• Spoiler revealed in a single click
• A revealed spoiler stays revealed no matter what you do with the mouse (e.g. clicking anywhere in the browser will not re-hide a marked text.)
• You can view spoilers from several posts without marking half the page

System Requirements
FireFox with GreaseMonkey installed.
The script (which will only work after you install GreaseMonkey.

Works with
OS: WinXP Pro and Mac OS X (thanks Jack_Ian)
FF: versions 2.0 and 1.5

Why
Having to mark the text in order to see spoilers annoys me. I have tried suggesting a new feature that will basically accomplish what this script does, but majority of users felt this was not a good suggestion. Not recently I have learned about GreaseMonkey and immediately knew I found my answer.

Some notes about the script and how it works.
GreaseMonkey is an extension to FF that lets you write or install a java script which changes the behavior of a specific site/s. There are lots of useful scripts out there http://userscripts.org/ (such as a script that adds a link next to videos on YouTube which allows you to download them).

• It took me a day to create it and in the process learn how to use GreaseMonkey, JavaScript, FF DOM and some XPATH (although I have some background)
• The script is ugly
• The script can definitely be made more efficient

If you
• have any questions/suggestions
• encounter a problem
• tried the script with other settings (OS or FF version)
please post to this thread so I can update the script.

Disclaimer
I won’t put a software disclaimer here, instead;
Because spoiler revealing is easy, it does not mean you should reveal spoilers sooner than you would have otherwise.

Credits
Thanks to fadeblue and Griffin for participating.


Last edited by Nsof on Sat Nov 18, 2006 2:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
Lepton*
Guest



PostPosted: Sat Nov 18, 2006 1:33 am    Post subject: 2 Reply with quote

Looks good, Nsof. Pretty slick upfront.

(I got a cameo!)
Back to top
Samadhi
+1



PostPosted: Sat Nov 18, 2006 4:10 am    Post subject: 3 Reply with quote

Nice.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Jack_Ian
Big Endian



PostPosted: Sat Nov 18, 2006 6:32 am    Post subject: 4 Reply with quote

Works on OSX too.
Thank you.
This makes life much easier for me.
Highlighting didn't work for me and I needed to copy and paste to a text editor to see invizzed text.
Back to top
View user's profile Send private message
Nsof
Daedalian Member



PostPosted: Sat Nov 18, 2006 2:23 pm    Post subject: 5 Reply with quote

Thanks for the replies.

I have edited the post to include OSX (thanks Jack_Ian).

Lepton wrote:
Looks good,... (I got a cameo!)

Thanks for response but what's "Cameo"? Embarassed
Back to top
View user's profile Send private message
Courk
Daedalian Member



PostPosted: Sun Nov 19, 2006 1:30 am    Post subject: 6 Reply with quote

A cameo is like when a famous person has a small part in a movie. For example: Peter Jackson appears as a person eating a carrot in FOTR.

In the posts you used as an example, Griffin mentions Lepton.
Back to top
View user's profile Send private message Send e-mail AIM Address
mudbuck
Dirty Dollar



PostPosted: Sun Nov 19, 2006 1:57 am    Post subject: 7 Reply with quote

One problem:

In short posts around 1 or 2 lines, the [show spoiler] tag creates extra lines that make it seem like there are actually spoilers in the post.
_________________
1000oclock.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
worm
unregistered



PostPosted: Sun Nov 19, 2006 3:28 am    Post subject: 8 Reply with quote

is that really a problem?




Back to top
View user's profile Send private message AIM Address
Nsof
Daedalian Member



PostPosted: Sun Nov 19, 2006 7:24 am    Post subject: 9 Reply with quote

Courk wrote:
A cameo is... ...FOTR.
Thanks for the explanation Courk

mudbuck wrote:
One problem:

In short posts around 1 or 2 lines, the [show spoiler] tag creates extra lines that make it seem like there are actually spoilers in the post.
I'll see what i can do.
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Nsof
Daedalian Member



PostPosted: Mon Nov 20, 2006 10:13 pm    Post subject: 10 Reply with quote

OK,
Made the following changes to the script:
  • made the link appear closer to the author name (which will not create extra lines in short posts). thanks mudbuck for the suggestion.
  • improved efficiency
  • added comments
  • made some refactoring for readability
To install/update click here

Comments/Suggestions/Ideas will be welcome,
Nsof
Back to top
View user's profile Send private message
Courk
Daedalian Member



PostPosted: Fri Dec 08, 2006 5:15 pm    Post subject: 11 Reply with quote

Amb's post ina nother thread made me realize that some posters would prefer to show spoilers for every post with one click. Would it be possible to add something like that?
Back to top
View user's profile Send private message Send e-mail AIM Address
Nsof
Daedalian Member



PostPosted: Sat Dec 09, 2006 12:52 am    Post subject: 12 Reply with quote

Courk,
I'd be happy to add any feature that i can, but can you try to be more specific about what exactly it is that you think the users would want?

I have also found out that there is an IE plugin that offers the same functionality like GreaseMonkey, which means that I can try to make the 'show spoiler' feature available to IE users.
This should not be too difficult but before i try this I'd like to know if there are interested users. So, IE users, please post here if you would like this kind of feature.
Back to top
View user's profile Send private message
Courk
Daedalian Member



PostPosted: Sat Dec 09, 2006 1:21 am    Post subject: 13 Reply with quote

Sometimes a person could want to show the spoiler text for all posts on a page. My understanding of how this tool works would mean that that person is required to click all 40 posts on a page. If you could add a link at the top of pages that would show all the spoilers for a page once clicked, it could save some people time.
Back to top
View user's profile Send private message Send e-mail AIM Address
Nsof
Daedalian Member



PostPosted: Sat Dec 09, 2006 10:25 pm    Post subject: 14 Reply with quote

Added a link at top of messages table that shows/hides all spoilers on page.



Clicking once shows all spoilers on page. Clicking a second time re-hides them.

To install/update click here

As always, feel free to comment.
Back to top
View user's profile Send private message
Jack_Ian
Big Endian



PostPosted: Fri Apr 27, 2007 5:40 pm    Post subject: 15 Reply with quote

Hi Nsof,
I really like this feature. Thanks for writing it.

Bug report:
Users with images for titles prevent spoiler links being added to posts.

Description:
Users, such as wordcross, RSA and Coyote, have images instead of text for their respective titles. When they post, they have no spoiler link and the same goes for all subsequent posts on that page.
For example:
Spoiler links are not added for all posts on Page 57 of "A complete waste of time is found within this thread"
Post 2260 by jesternl is the last post with the spoiler link.
The next post is by wordcross.

The same is true for posts by Coyote and presumably RSA (can't search for users with 3-char usernames or less, so I haven't been able to confirm this).

Not sure where change should be made. It might be easier to form these posts in a way to match your script rather than the other way around.
Removal of the "<memstat><br />" would solve the problem. (Not sure why this is included).

Thanks again for this feature.
Back to top
View user's profile Send private message
Nsof
Daedalian Member



PostPosted: Sat Apr 28, 2007 8:02 pm    Post subject: 16 Reply with quote

Thnaks Jack_Ian for all the detailed info. I saw that in some pages the script didn't work correctly but was too lazy to fix.

New script can be found here.

Release info
fixed a bug in which all posts following and including users which have an image for title did not have the 'show/hide' links.

Technical info
Symptoms: all posts following and including users which have an image for title do not have the 'show/hide' links.
Pathology:
  • to allow for mudbuck's request, the script removed extra line breaks from the span element.
  • this was done by removing the child <br>'s from the <span> element.
  • these users have an extra <memstat> element inside the <span> element which contains the author's title.
  • for these users it failed because the <br>'s are children of the <memstat> element rather than that of the <span>.
  • the failure caused an exception in the script which immediately stopped its execution thus preventing it from adding the 'show/hide' links to the following posts.
Treatment: fixed script so that <br>’s are removed from their directly from their parents.
Treatment's side effects: caused image titles to display too close to name.
Treatment for side effects: fixed script to leave one <br> in case these users have posted.

Note: lab studies could not explain
  • What is the purpose of this extra, undefined in html, unclosed <memstat> element
  • Why programmer didn’t remove <br>s directly from parent in first place Revenge most foul!


As always, feel free to comment/report a bug/suggest a feature.
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Antrax
ESL Student



PostPosted: Sat Apr 28, 2007 8:55 pm    Post subject: 17 Reply with quote

I can fill in the first question: <memstat> is a leftover from the period the grey labyrinth ran on UBB. It's sorta like an appendix in that regard, it used to be necessary for the special titles we had back then, but after the migration I became useless but harmless.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Courk
Daedalian Member



PostPosted: Sat Apr 28, 2007 11:21 pm    Post subject: 18 Reply with quote

Antrax wrote:
after the migration I became useless but harmless.

Ecstatic Happiness
Back to top
View user's profile Send private message Send e-mail AIM Address
Lepton
1:41+ Arse Scratcher



PostPosted: Sun Apr 29, 2007 12:40 am    Post subject: 19 Reply with quote

Considering that Antrax does all the work around here, that's just screaming "title"...
Back to top
View user's profile Send private message Send e-mail AIM Address
Nsof
Daedalian Member



PostPosted: Thu Sep 27, 2007 7:32 am    Post subject: 20 Reply with quote

Since i'm currently on a vacation (Koh-Phi-Phi Thailand) i have no idea if the script is broken or not as a result of the phpbb version update.
I'll be back in two weeks to fix it if it is broken.
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Jack_Ian
Big Endian



PostPosted: Wed Nov 28, 2007 1:37 am    Post subject: 21 Reply with quote

Not sure if this is a FireFox bug or a problem with your GreaseMonkey script.
Each successive click on the "show spoiler" makes some of the text appear darker.
I assume it is just drawing the text in an incorrect position and OR'ing the bits without clearing them first.

Anyway it's a minor problem, but I thought you should know about it.

The image below shows what happens after two successive clicks on "show spoiler".
The actual post used for this may be found here.

BTW
If I can provide any assistance to you, should you decide to fix this, please let me know.
I really like this script and would be very willing to help if I could.

Version stuff:
Quote:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10
Quote:
GreaseMonkey version 0.7.20070607.0


Back to top
View user's profile Send private message
Nsof
Daedalian Member



PostPosted: Thu Nov 29, 2007 7:22 pm    Post subject: 22 Reply with quote

I distinctly remember thinking after reading this post that if i ever had the chance to hire you - i would. Welcome aboard (our very small ship).

Anyway, I cant reproduce the problem. I have the same FF and GM versions as you do and clicked the link about 40 times without any visible effect (other than having the spoiler de-spoilered and re-spoilered 20 times).

I use Firebug add-on for debugging. Post or PM me if there is something i might help with. Happy hunting!

Myself - I'll give it a look over the weekend.
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Jack_Ian
Big Endian



PostPosted: Fri Nov 30, 2007 2:51 am    Post subject: 23 Reply with quote

Nsof wrote:
I distinctly remember thinking after reading this post that if i ever had the chance to hire you - i would. Welcome aboard (our very small ship).
Glad to be aboard cap'n. Revenge most foul!

Anyway, I did some further testing and toyed around with your script (when I finally figured out how to enable the "Edit" button).
It seems that your script is not to blame and that it is a Greasemonkey/quartz problem and a fault in the way anti-aliased text is handled.

I expect Greasemonkey is trying to be as economical as possible with invalidating areas of the window and is re-drawing the effected area without invalidating it. This is understandable since it did not expect that the intervening text would be rendered differently. The result being that it drew the text directly on top, naively expecting it to match pixel for pixel. This created a gradual buildup of pixels around the characters making them appear darker.

So, no need to spend any more time on this.
Have a nice week-end. Revenge most foul!
Back to top
View user's profile Send private message
Nsof
Daedalian Member



PostPosted: Sat Dec 01, 2007 5:26 pm    Post subject: 24 Reply with quote

If this was really important i would try to force the renderer to invalidate the area somehow. (overlaying a frame on top, hiding and showing the span, etc').

Instead I took your advice and had a great weekend Wink.
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Amb
Amb the Hitched.



PostPosted: Sat Dec 01, 2007 8:16 pm    Post subject: 25 Reply with quote

You absolute genius. Downloading as soon as I get home!

I so wanted to campaign against spoilers altogether
Back to top
View user's profile Send private message AIM Address MSN Messenger
Nsof
Daedalian Member



PostPosted: Sat Jul 05, 2008 1:52 pm    Post subject: 26 Reply with quote

Wanted to share several nice scripts for phpbb i found:

Unpaginate phpbbV2 threads
This script causes the next page to load automatically when you reach the end of the page.

To use it you'll need to
1) install Unpaginate pagination microformated web pages script first (click black button at top right part of page)
2) install Unpaginate phpbbV2 threads script
3a) Go to Tools->GreaseMonkey->Manage user scripts.
3b) Select "Unpaginate phpbbV2 threads" script
3c) Select the default link (http://www.ibdof.com/viewtopic.php*)
3d) Click Edit and replace with "http://*greylabyrinth.com/discussion/viewtopic.php*" (w/o quotes)
3e) Close


phpBB Expand Posting Form
This script allows you to change the size of the subject, message fields, and font on a phpBB posting form

To use
1) Install the script
2) Type "about:config" (w/o quotes) in the browser address bar and press enter
3) Type "greasemonkey.scriptvals.http://glenncarr.com/greasemonkey/phpbb/phpBB Expand Posting Form." (w/o quotes) in the Filter bar
4) Dbl click and edit your prefered width, height and font size.


phpBB Advanced Quick Reply Quote Edit
Very useful if you are a quick poster and you dont need to preview your message.
It adds
a) A text area at bottom of page from which you can quickly post a reply.
b) A "QQ" - Quick Quote link next to the quote image/link. Clicking this will add the post as quoted text in the bottom text area.
c) A "QE" - Quick Edit link next to the edit image/link of your own posts. Clicking this will allow you to edit your post inplace.

To use
1) Install the script
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Display posts from previous: by   
Reply to topic    The Grey Labyrinth Forum Index -> Feature Requests / Site Problems All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Site Design by Wx3