NodeBB-Community / nodebb-plugin-iframely

Iframely Embeds for NodeBB
MIT License
17 stars 13 forks source link

Option to embed urls with a special class or a attribute? #15

Closed qgp9 closed 8 years ago

qgp9 commented 8 years ago

Hi,

I really love a iframely with nodeBB. I have to say "thank you" first. But the only problem is that it embed every naked URLs and sometimes it's so messy.

Is it possible I can get a option to specify a class or attribute of link (<a> tag) to embed? I know in nodeBB, naked URLs doesn't have chance to have a special class or a attribute. However plugins can do that and my nodebb-plugin-magicblock is one of it.

Actually I'm using my nodeBB with a bittly modified nodebb-plugin-iframely ( just 2 lines so not universal ) but I wish that offical plugin support this.

-QGP9

qgp9 commented 8 years ago

Also, if user enables the option, the plugin doesn't need to check if a link is naked or not by https://github.com/NodeBB/nodebb-plugin-iframely/blob/master/library.js#L108-L110

qgp9 commented 8 years ago

Hi, I implemented this by myself and check that it's working well. Here is a comparison of code; https://github.com/NodeBB/nodebb-plugin-iframely/compare/master...qgp9:master Any comments or arguments?

julianlam commented 8 years ago

Hey @qgp9 -- the problem with adding in the option to only allow embeds for links of a certain class, is that it doesn't have any functionality unless it is paired with another plugin...

qgp9 commented 8 years ago

@julianlam Yes you are right, but in different of view, it means that iframely can cooperate with other plugin easily in this way :) . ( for example my nodebb-plugin-magicblock or nodebb-plugin-sanitizehtml ) Currently there is no way to control iframely if somebody doesn't want that whole naked links are embeded except a domain filtering. Specially if somebody who leads a large forum like nodeBB, I can bet that he/she doesn't want to install iframely which will convert every links from old pages, do you? :)

qgp9 commented 8 years ago

Hi @julianlam , do we still have a room to discuss or did you make any decision already? I wish to see this option in an official version and cooperations between plugins, but I also respect any strategy of a development team. If you think that this option is probably conflicted with any of your strategy/policy/plan/rule then, It's OK, I think I have still other ways to control the iframely independently, even though they are somewhat(quite) tricky :(

qgp9 commented 8 years ago

Hi @julianlam, I found and implemented a some hack way to control iframely with current iframely without modifications. It's some tricky, in short description,

  1. MagicBlock adds <<hackIframely>> at the end of contents of any <a> tag before the iframely plugin.
  2. Then selectively removes this for iframely ( still before iframely )
  3. After iframely plugin, MagicBlock removes all <<hackIframely>>

A Kind of Trick!! :) But this will work securely before you don't change a priority iframely or a selection algorithms.

So now I close this issues. ( even though I wish to see that option yet :) )

Thanks!