Forums

RS-Linkify Thread is sticky

Quick find code: 261-262-33-65181208

AoDude

AoDude

Posts: 1,694 Mithril Posts by user Forum Profile RuneMetrics Profile
Making a test post to test a theory:

https://www.reddit.com/r/AoDude/comments/4biv2k/redditlinkify_testing/d19hou9

Also, when first loading the page you can see "
Comment
from Discussion .", might be better to modify the internal to a link to the direct post with the text of that link should the secondary embed script fail. (instead of the default comment text reddit was using)

In effect:
retObjLnk = '<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="true"><a href="' + urlRed + '">' + urlRed + '</a></div>';


Edit: Well that wasn't quite what I was expecting, lol. I assume you only have the embedding enabled for /r/runescape then? If that is the case, potentially might want to add support for at least /r/2007scape and /r/RSChronicle...

Edit2: Test 2

https://www.reddit.com/r/runescape/comments/3pgcas/if_theres_any_max_capecomp_capers_out_there_that/cw8hj43

Edit3: That answers my question. I wondered if Linkify would have turned the reddit embedded puush links into images. More curiosity than anything really...

Edit4: Updated specific code line, and now I see your regex expression confirming it only embedding /r/runescape
AO
Deputy-Owner :
The Nexus CC

22-Mar-2016 19:12:55 - Last edited on 22-Mar-2016 23:09:57 by AoDude

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Hiya AoDude, I hadn't thought of other runescape reddits, like old school and 2007. I will add them though.

Linkify cant interact with the reddit posts and linkify links. That's actually the whole idea of iframes sandboxing external content. I can elevate Linkify's permissions to embed images in iframes, but it's an untrusted source and potential XSS nightmare waiting to happen.

I think the "
Comment
" you're seeing when the reddit post first loads is during the rendering of the iframe. Notice my returnValue contains no such textNode. That means (for the same reasons above) I can't interact with it as the iframe source is cross domain.

I will look over all you have mentioned but things within the iframe probably wont change.

Edit: There is one thing I may be able to do, and that is use JSONP to get the comments. That way I can build my own elements and perhaps be able to linkify the content.

The reason I didn't go that way was because linkify would have to wait for reddit's reply, build the elements, then look for and embed images. That would really slow things down and nothing would happen to these forums pages until the reddit stuff was done.

Linkify would either have to wait for reddit then work on the page as whole, or make two passes with embedding, once before reddit and once once after. Neither is something I'm keen on, or intend on doing.

23-Mar-2016 01:33:58 - Last edited on 23-Mar-2016 01:56:21 by Indecent Act

AoDude

AoDude

Posts: 1,694 Mithril Posts by user Forum Profile RuneMetrics Profile
About linkifying push/ect links embedded in reddit: No, wasn't asking if you could make that a feature. Was just curious to test it out.

And the "
comment
" part, let me quote the lines:

Your version:
retObjLnk = '<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="true"><a href="' + urlRed + '">Comment</a> from discussion <a></a>.</div>';


My version:
retObjLnk = '<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="true"><a href="' + urlRed + '">' + urlRed + '</a></div>';


Should reddit's scripting server go down at address: https://www.redditstatic.com/comment-embed.js, this would act as a clean default link since the embed would fail.
AO
Deputy-Owner :
The Nexus CC

23-Mar-2016 02:24:39 - Last edited on 23-Mar-2016 02:27:55 by AoDude

AoDude

AoDude

Posts: 1,694 Mithril Posts by user Forum Profile RuneMetrics Profile
Why thank you :)

As far as reloading or jquery/fetching yourself... Lot of trouble for nothing imo. Think it will be just fine with that tweak.

­coffee

Speaking of, how is it the astrix_word pictures work? They don't function if posted from a cell phone without linkify. So I assume you need linkify at the moment you post for them to actually work?

Curiosity again ;)
AO
Deputy-Owner :
The Nexus CC

23-Mar-2016 02:45:22

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
AoDude said :
Speaking of, how is it the astrix_word pictures work? They don't function if posted from a cell phone without linkify. So I assume you need linkify at the moment you post for them to actually work?

When submitting a post, that for example contains: * support

RS Linkify swaps the "*" for a soft-hyphen (many unicode control characters also work). So the asterisk is never submitted.

This means the text looks normal to non linkify users (no leading asterisk) But it also means Linkify can see all cases of soft-hyphens. If the soft-hyphen is followed by a list of know words linkify swaps the text for an image element and uses the text for it's className.

So you need linkify to make the post.

The best way to see this is preview a post and watch both the textarea and the preview. The reverse also happens when you edit a post with soft-hyphens they are decoded as "*" and the text are adjusted accordingly.

Here's a neat test using alt codes. Try previewing the following...
Alt + 0173 <-- immediately followed by <3

Hit preview and you'll see what I mean :)

23-Mar-2016 03:02:40 - Last edited on 23-Mar-2016 03:03:32 by Indecent Act

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Okay AoDude, now it's my turn to toss a question back at you :)

ht tps://www.reddit.com/r/runescape/comments/
3pgcas
/Blah_blah_blah/
df5hp


The bit's marked in gold I've seen between 5 and 6 characters long, do know what the min and max character length is?

Also are they always word characters (a-z, A-Z, 0-9, and _ underscore) or can they contain things like minus signs?

I just ask so I can fine tune my regex, currently I'm going with 5-7 character length and word characters only. I expect if something doesn't embed it's going to be because of those conditions weren't met.

23-Mar-2016 03:50:41 - Last edited on 23-Mar-2016 03:51:18 by Indecent Act

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