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]"
) {
//$('.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
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
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
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