Request - member highlight in nested quotes
Request - member highlight in nested quotes
Author
Discussion

Xenocide

Original Poster:

4,286 posts

237 months

Thursday 6th November 2008
quotequote all
Morning mods,

My latest request. I'd like my posts to be highlighted when quoted in threads.

I guess it'd only work if you didn't change your name for historic posts (if posted name == logged in name, as you can't identify by posterID for quotes as they're not associated).

Thoughts?

RacingPete

9,197 posts

233 months

Thursday 6th November 2008
quotequote all
It would be a useful tool but the problem is that we look at the ID of the poster to do the highlighting and for a quoted post we do not have the quoted person's ID and thus cant match it up.

There is a possibility we could do this with a bit of clever looking at the text in the posts but we would have to evaluate how that effects the speed of the forums. Though as I write I wonder if I could do it on your browser side (thus not effecting the speed) and have a button to click (or once page is loaded) to highlight your name through the page.

I will add it on to the list but probably not something that will be done (if we can work it out) till next year.

Taita

7,995 posts

232 months

Thursday 6th November 2008
quotequote all
Could a greasemonkey script do this? Just input your username, then it would parse the text on the page, and highlight anything it found with both your name in, and surrounded by [ quote] tags?

Or even JScript?

RacingPete

9,197 posts

233 months

Thursday 6th November 2008
quotequote all
Taita said:
Could a greasemonkey script do this? Just input your username, then it would parse the text on the page, and highlight anything it found with both your name in, and surrounded by [ quote] tags?

Or even JScript?
Wasn't that this bit - "I could do it on your browser side (thus not effecting the speed) and have a button to click (or once page is loaded) to highlight your name through the page." wink

Taita

7,995 posts

232 months

Thursday 6th November 2008
quotequote all
RacingPete said:
Taita said:
Could a greasemonkey script do this? Just input your username, then it would parse the text on the page, and highlight anything it found with both your name in, and surrounded by [ quote] tags?

Or even JScript?
Wasn't that this bit - "I could do it on your browser side (thus not effecting the speed) and have a button to click (or once page is loaded) to highlight your name through the page." wink
Yup, just in the meantime as I know you guys are busy implementing my 'link to individual posts' idea wink

Xenocide

Original Poster:

4,286 posts

237 months

Thursday 6th November 2008
quotequote all
If I write the script (js) will you put it sitewide? wink

RacingPete

9,197 posts

233 months

Thursday 6th November 2008
quotequote all
Xenocide said:
If I write the script (js) will you put it sitewide? wink
Sure, go for it smile

Xenocide

Original Poster:

4,286 posts

237 months

Thursday 6th November 2008
quotequote all
RacingPete said:
Xenocide said:
If I write the script (js) will you put it sitewide? wink
Sure, go for it smile
Can you have a div somewhere with a unique(obviously) id with just the username in it, hidden somewhere?

RacingPete

9,197 posts

233 months

Thursday 6th November 2008
quotequote all
Not in the middle of a post, but can outside of the posts. Not sure how this helps though?

Xenocide

Original Poster:

4,286 posts

237 months

Thursday 6th November 2008
quotequote all
No, as in the user's username. It's easier getting the innerHTML of a div rather than trying to scrape the bit at the top "Welcome back, RacingPete. Your last visit was etc".

You could have "Welcome back <div id='userName'>Xenocide</div>".

smile

RacingPete

9,197 posts

233 months

Thursday 6th November 2008
quotequote all
Sorry, now I get it smile

Yes this could be done, probably put it around the logged in bit and make it a span instead smile

I will call it <span id="membername">RacingPete</span>

Does that help?

Xenocide

Original Poster:

4,286 posts

237 months

Friday 7th November 2008
quotequote all
Ok. Done it smile.

First, add this to the stylesheet:

code said:
.quoteHighlight{ background-color: #E0E8F9;
margin: 1px 2em 1.5em 1em;
padding: 0.5em; border: 1px solid gray;
font-size: small;
}
Add this JS:

code said:
function HighlightQuotes()
{

// username = document.getElementById("membername").innerHTML;
username = "Xenocide";
quotes = document.getElementsByTagName("div");
output = "";
for (i = 0; i < quotes.length; i = i + 1)
{

if( quotes[i].className == "forumQuoter")
{
tquser = quotes[i].innerHTML.match("^([a-zA-Z ]+) said:");
if(tquser != null)
{
if(tquser[1] == username)
{
quotes[i].nextSibling.nextSibling.className = "quoteHighlight";
}
}

}

}

}
Obviously delete out the second username declaration when you've implemented the usernameid do-dah.

Tested in just firefox but don't see why it shouldn't work in other browsers.

smile

[Edit: Oh, and call HightlightQuotes() when the page has loaded. Add a small image at the bottom of the page and have an onload event?]

Edited by Xenocide on Friday 7th November 12:51


Edited by Xenocide on Friday 7th November 12:51


Edited by Xenocide on Friday 7th November 12:53


Edited by Xenocide on Friday 7th November 12:54

RacingPete

9,197 posts

233 months

Friday 7th November 2008
quotequote all
Cheers thumbup

Will have a play with it on our test server smile

Taita

7,995 posts

232 months

Friday 7th November 2008
quotequote all
Nice!

RacingPete

9,197 posts

233 months

Friday 7th November 2008
quotequote all
It works smile

I will make it so in the next update thumbup

Xenocide

Original Poster:

4,286 posts

237 months

Friday 7th November 2008
quotequote all
You're a stella geeza, Pete. Did it work on in IE? It'll give annoying errors if it's not happy.

RacingPete

9,197 posts

233 months

Monday 10th November 2008
quotequote all
Just put on staging environment and it isn't working for the Classic PH skin, but is for the Big Blue... so need a little bit more playing before go live with this.

Xenocide

Original Poster:

4,286 posts

237 months

Monday 10th November 2008
quotequote all
Did you add the new css thing to the other stylesheet?

[edit: to be more helpful. I made it for the classic skin. does it give js errors or does it just not change your quotes?! Is it public access? Call me if its any use. *removed*, edit the number out when you've got it wink]

Edited by Xenocide on Monday 10th November 13:11


Edited by RacingPete on Monday 10th November 14:03

RacingPete

9,197 posts

233 months

Monday 10th November 2008
quotequote all
The code is fine, it just needs a quick tweak to work cross all the skins which I will do in a bit as have some commercial stuff to sort out first... it pays the bills smile

Xenocide

Original Poster:

4,286 posts

237 months

Monday 10th November 2008
quotequote all
Ahh ok fair enough smile.

Good luck !