Forums

RS-Linkify Thread is sticky

Quick find code: 261-262-33-65181208

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Ryan M said :
I'm not very good with .each() yet and wonder if there is a nicer way of implementing Post Numbers than what I'm doing. http://pastebin.com/qFewbnDE

I would like to make it run through all possible 100 or more on
window.location.href.match(/showuser/)
, but at the moment it's okay with just the first 10. Just would like to know a nicer method. :)

HTTP://i.imgur.com/rmqRqbA.png


Is this what you mean?

$('.msgplace').each(function (index, ele) {
console.log(index);
console.log(ele.name);
if ($(this).is("[name]&quot ;) ) {
//$('.someElement').eq(index).text(ele.name);
//or
//append / prepend some element.
}
});

Not sure how hidden posts are handled (they used appear in showuser). Anyway index can be used for error correction, or more specifically to circumvent the need for error handling. This way you're elements and numbers will always match up.

Bit of mix of js and jquery, the 'if' condition is what keeps your index in check for hidden posts, the 'is' works like hasAttribute.

Edit: if I missed the point, please let me know :)

20-Mar-2015 08:54:24 - Last edited on 20-Mar-2015 09:21:41 by Indecent Act

Fairytales
Nov Member 2019

Fairytales

Posts: 7,345 Rune Posts by user Forum Profile RuneMetrics Profile
A world without Indy is a worse world to be.

Thanks for getting it updated so quickly :) . Hope getting everything else sorted isn't too stressful!

Watching the solar eclipse while finding out that linkify works again is a brilliant combination!

20-Mar-2015 08:57:17 - Last edited on 20-Mar-2015 09:00:57 by Fairytales

Sotox
Dec Member 2022

Sotox

Posts: 3,038 Adamant Posts by user Forum Profile RuneMetrics Profile
Thanks for the update, it's really helpful

Also, could you change thread titles colour to yellow like this?

http://puu.sh/gHTvM.jpg

I think it would be much more readable than the light blue colour.
There's a thread in rsd about this but I doubt Jagex willl change it anytime soon.

20-Mar-2015 09:15:00

Ryan M
May Member 2008

Ryan M

Posts: 3,095 Adamant Posts by user Forum Profile RuneMetrics Profile
You got it. I'm just not used to doing that since none of my scripts have done that yet.

$('.msgplace').each(function (index, ele) {
$('.forum-post__time-below').eq(index).prepend("<a href='#" + ele.name + "'>#" + ele.name + "</a> ");
});


I can get post numbers for hidden posts, just the anchor isn't clickable because the minimum height of .forum-post__body is 122px, but .forum-post--hide-shunt is a height of 70px. So that's why nothing will click (if you wondered).

It's helped a lot. Thanks. :)

Edit: Why is that clickable in the code?
Edit2: Linkify is making anchors come to life.

20-Mar-2015 09:21:38 - Last edited on 20-Mar-2015 09:25:27 by Ryan M

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Ryan M
I always just skipped them in showuser.

In threads I just used the index with page number to handle hidden posts.

for example if all 10 posts were hidden, you could get the (page number * 10 ) - 10 = first post.

page number: obtained from element. Maybe from url too, but different maths needed.

pageNumber = (page number * 10 ) - 10;

assume inside each loop here (index, ele)
postNumber = pageNumber.slice(0, -1) + index;

Edit:

Oh that's cool you can see the anchors in hidden posts, disregard the above.

and is linkify messing with them?

20-Mar-2015 09:31:53 - Last edited on 20-Mar-2015 09:35:48 by Indecent Act

Ryan M
May Member 2008

Ryan M

Posts: 3,095 Adamant Posts by user Forum Profile RuneMetrics Profile
Testing:
Noparse:
$('.forum-post__time-below').eq(index).prepend("<a href='#" + ele.name + "'>#" + ele.name + "</a> ");

Parse:
$('.forum-post__time-below').eq(index).prepend("<a href='#" + ele.name + "'>#" + ele.name + "</a> &quot ;) ;

What it's doing:
http://i.imgur.com/YsrONDj.png

What it should be doing:
http://i.imgur.com/Zyn2lI7.png

What the RSOF is doing:
http://i.imgur.com/WsMhl3I.png

There is something incredibly annoying in the forums... Not only does chrome hate me (the Aww message), but Preview and Submit sometimes forget the changes I made (yet save a new timestamp). This is unrelated to both Tampermonkey and Linkify.

20-Mar-2015 09:38:03 - Last edited on 20-Mar-2015 09:47:47 by Ryan M

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
That's annoying but they have to encode entities now more than ever with link BB tag. That's giving some defence againt XSS. Though they are not handling single ' quotes'.

The aww snap is pain too, I notice having console open makes it happen more frequently. Also performance drops in a big way. I see it with animations, they (not always) often become jerky.

It's like garbage collection is hampered when the console is open. I guess it probably is since there is a timeline, heap allocation monitoring and such. Closing the browser doesn't help either, unless you kill all the background services.

Assuming my code isn't too problematic a re-boot does wonders for the aww snap.

Edit: I'll make linkify decode them in the textarea soon :)

20-Mar-2015 09:59:42 - Last edited on 20-Mar-2015 10:08:00 by Indecent Act

Quick find code: 261-262-33-65181208 Back to Top