Forums

RS-Linkify Thread is sticky

Quick find code: 261-262-33-65181208

Blasty
Feb Member 2017

Blasty

Posts: 9,319 Rune Posts by user Forum Profile RuneMetrics Profile
Yay :D

Actually could ht tps://hlf-polls.appspot.com/#/polls/
3
?height=
646
be embedded into:

< iframe src="ht tps://
embed-dot-
hlf-polls.appspot.com/#/polls/
3
"
style="margin:auto; display: block;"
height="
646
"
width="450"
></iframe>

My reasoning is that non-linkify users should see a link to the non-embedded link, so the non-embedded link should embed the embedded iframe for linkify users. The reason for the "embed-dot-" and not "embed." subdomain is that appspot doesn't support subdomains but lets users use "-dot-" instead. It's a little strange but it's only the embedded url and the way it's being used should mean it won't get seen.

Tyvmmm :)
Blasty
// @BlastytheBlue // Blasty#5167
| Co-owner of Mine Nation

20-Jun-2015 05:50:41 - Last edited on 20-Jun-2015 05:51:34 by Blasty

Ryan M
May Member 2008

Ryan M

Posts: 3,095 Adamant Posts by user Forum Profile RuneMetrics Profile
Indecent Act said :
@lbody,

I have tried doing that and my main problem is linkify doesn't know when a thread no longer exists, so you end up lots of data stored that has no use. The more data the slower linkify becomes and there is a limit on how much I can store.

Basically I have a number of obstacles to overcome and I'm not sure I can do it well from within the scope of the browser. It is something I'm still looking into tho


Well since :visited doesn't allow background images as per Mozilla, how about something like this? https://developer.mozilla.org/en-US/docs/Web/CSS/:visited
a:visited.thread-plate__main-link--forumview .thread-plate__title { color: orange; }


Tried looking into some JS that would then read CSS values but overall it seems more of a hassle than it is worth. It would be nice if images would work with :visited pseudo classes, but they just won't. :(

20-Jun-2015 06:22:18

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Thanks Blasty, I totally missed that with the url.

I have made the changes you suggested. There is still one issue and that's the size difference between the vote page and the results page.

The best way I can describe it is create a poll, you'll see it embeds nicely. But once you vote the size changes and requires scrolling (depending on the poll). I only mention this because it's the results that will get the most views rather than the vote page.

Chances are I'm missing something else, so I appreciate your patience. Just want to get it 100% right before I go any further :)

Version 3.1.8.45 is live and has the changes.

here's some example polls, watch what happens after voting...

https://hlf-polls.appspot.com/#/polls/4?height=335

https://hlf-polls.appspot.com/#/polls/3?height=646

Ryan M said :
Tried looking into some JS that would then read CSS values but overall it seems more of a hassle than it is worth. It would be nice if images would work with :visited pseudo classes, but they just won't. :(

The visited thing isn't something I have looked into, there is some nice potential there. I'll definitely look into the info you have given :)

20-Jun-2015 08:30:27

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Blasty said :
postMessage()


Never used it but I'm keen to give postMessage a try.

I'm very familiar with message parsing among srcipts (same origin) so I expect it should be pretty straight forward. The only thing I need to check up on is permissions from within an extension.

Edit: If using postMessage there will be some things to consider, such as if there are multiple polls on the page. I guess the poll id and height can be sent to solve that.

It looks very simple for the iframe to send a message to the parent, pretty sure I can inject a listener and then take action from there.

20-Jun-2015 08:51:53 - Last edited on 20-Jun-2015 09:14:32 by Indecent Act

Blasty
Feb Member 2017

Blasty

Posts: 9,319 Rune Posts by user Forum Profile RuneMetrics Profile
After adding some postMessage senders, this works for me from the console, I think it'll work for an extension too:

ht tps://hlf-polls.appspot.com/#/polls/
3
becomes:

<iframe id="hlfpolls-frame
{{id}}
" src="
ht tps://embed-dot-hlf-polls.appspot.com/#/polls/
3
"
style="margin:auto; display: block;"
height="600"
width="450"
>


window.addEventListener("message",function(e){receiveMessage(e)},false)

var receiveMessage=function(e){
var message;
try{
message=JSON.parse(e.data)
}catch(err){return false};
$('#hlfpolls-frame'+message.id).height(message.height)}
Blasty
// @BlastytheBlue // Blasty#5167
| Co-owner of Mine Nation

20-Jun-2015 10:08:40 - Last edited on 20-Jun-2015 10:09:27 by Blasty

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
Okay I have tried it, seems good so far.

Can you assign the the poll number to the id in message? By poll number I mean the number marked in green...
/#/polls/
4

so that way it would look something like this on the receiving end...

Object {height: 413, id: 4}


Thanks again for all you are doing, going to be awesome :)

20-Jun-2015 11:13:57 - Last edited on 20-Jun-2015 11:56:13 by Indecent Act

Blasty
Feb Member 2017

Blasty

Posts: 9,319 Rune Posts by user Forum Profile RuneMetrics Profile
Hmm, actually could a unique identifier be passed through the url instead, since it'll mean it'll be more able to support the create page better and and also it'll support multiple of the same poll (although neither are necessary). Otherwise, I could set the id to -1 or "create" for creation maybe.

With the id being passed through the url, It would be something like this:

ht tps://hlf-polls.appspot.com/#/create

ht tps://hlf-polls.appspot.com/#/polls/1

embeds as:

ht tps://embed-dot-hlf-polls.appspot.com/#/create
?id=1


ht tps://embed-dot-hlf-polls.appspot.com/#/polls/1
?id=2
Blasty
// @BlastytheBlue // Blasty#5167
| Co-owner of Mine Nation

20-Jun-2015 11:57:48 - Last edited on 20-Jun-2015 12:14:38 by Blasty

Indecent Act

Indecent Act

Posts: 7,456 Rune Posts by user Forum Profile RuneMetrics Profile
This might explain what I'm doing...

$("iframe[src='htt ps://embed-dot-hlf-polls.appspot.com/#/polls/" +
message.id
+ "']&quot ;) .attr('height',
message.heigh
t);

That locates the iframe by src and applies the new height and ensures the hight is assigned to correct iframe.

I assume the /#/polls/
4
<--- the number is unique to that poll.

I figure since it's already in the url there is no need to create more parameters because every poll has it's own unique url.

As for your question about id parameters, yes but for me to use it must identify the url. But remember we can get other stuff via post message to keep the url small and clean. Also we may be able to eliminate the height parameter altogether since I can get it via message. But I think first of all we should get the basics sorted and get the height and target iframe wrapped up.

Then we can refine a few things and build on it :)

20-Jun-2015 12:21:50 - Last edited on 20-Jun-2015 12:59:09 by Indecent Act

Blasty
Feb Member 2017

Blasty

Posts: 9,319 Rune Posts by user Forum Profile RuneMetrics Profile
Passing an id to the poll through postMessage instead of url would make it neater for sure :) , but to use postMessage to do it I think I have to send you a postMessage first to say the iframe is ready to receive an id. (no onload for iframes)

If that's the case, perhaps it could go something like this:

Linkify listens for:
postMessage("ready", ...);

Hlfpolls listens for:
postMessage({id: 99}, ...); // (JSON)

Linkify listens for:
postMessage({height: 600, id: 99}, ...); // (JSON)

Either way works :D Are those messages fine?
Blasty
// @BlastytheBlue // Blasty#5167
| Co-owner of Mine Nation

20-Jun-2015 13:01:54 - Last edited on 20-Jun-2015 13:10:55 by Blasty

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