Updating ( refresh ) embedly plugin on page display
-
I'ven sent a PR to @a_5mith 's plugin. You can apply that to the plugin if you don't want to wait for it to be merged https://github.com/a5mith/nodebb-plugin-embedly/pull/4/files
It works fine for me with that change.
The post content was
Testing embedly [NodeBB](http://nodebb.org)
-
Thank you. I have applied the change in the plugin file. Restarted the website. I am not sure if it is 'the fix'. I have noticed a performance difference when rendering the embedly ( taking more time ).... but it is still fickle of when it decides to render. A page refresh will still not fire a call for rendering. What is strange is that if one is not rendering... then 'all' the embedly's don't render. Ex... on the front page... none render, I click on the 'read more' of a non-rendering page. The article comes up... the embedly renders, then all the embedly's render everywhere ( including the front page ones.
I am running nodebb 0.7.0
FireoxThank you for your time...
-
A little more insight into this issue......
A post on the thread was this
http://www.zerohedge.com/news/2015-03-20/one-last-look-real-economy-it-implodes-part-3
the parser turned it into this on the display
!function(a){var b="embedly-platform",c="script";if(!a.getElementById(b)){var d=a.createElement(c);d.id=b,d.src=("https:"===document.location.protocol?"https":"http")+"://cdn.embedly.com/widgets/platform.js";var e=document.getElementsByTagName(c)[0];e.parentNode.insertBefore(d,e)}}(document); .......
Which is fine. It would be nice for pasted links by users to be converted into embedly..... but it needs to fire on display.
-
Hello, instead of using the plugin, you can put this on the head (Admin Control Panel -> Appearance -> Custom Header, then check the box "Enable custom Header") to display embed.ly only inside topics. This works on lavender:
<script> (function(w, d){ var id='embedly-platform', n = 'script'; if (!d.getElementById(id)){ w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);}; var e = d.createElement(n); e.id = id; e.async=1; e.src = ('https:' === document.location.protocol ? 'https' : 'http') + '://cdn.embedly.com/widgets/platform.js'; var s = d.getElementsByTagName(n)[0]; s.parentNode.insertBefore(e, s); } })(window, document); embedly('card', {selector: 'div.topic-text a'}); </script>
See also http://embed.ly/docs/products/cards
But this will transform all links in embed.ly, I would like to embed just some thinks like wikipedia excerpts and these kind of stuff...
-
@Codejet said:
Never liked embed.ly, I wonder how much javascript it would take to make your own embed.ly type embed of url's
Don't care much for it either.... but there is nothing yet that I have found that embeds a linked page like facebook does as well as the embedly. I would like to find something better myself.
Rich
-
Hello, I was sucessfull using this https://github.com/nfl/jquery-oembed-all
Just add to
Admin CP -> Appearance - > Custom HTML & CSS
then add toCustom Header
and enable it.<script src="https://rawgit.com/nfl/jquery-oembed-all/master/jquery.oembed.js"></script> <link rel="stylesheet" href="https://rawgit.com/nfl/jquery-oembed-all/master/jquery.oembed.css" /> <script> $(function(){ $("div.topic-text a").oembed(); }); </script>
It doesn't embed all links, but if you use https you can have error by loading via http, i'm still seeing it. : )
edit. using this:
<script src="https://rawgit.com/kassius/jquery-oembed-all/master/jquery.oembed.js"></script> <link rel="stylesheet" href="https://rawgit.com/kassius/jquery-oembed-all/master/jquery.oembed.css" /> <script> $(document).ajaxComplete(function() { $("div.topic-text a").oembed(); }); </script>
With this code I was able to embed wikipedia articles through https and also pdf through scribd. Very cool!!
sources:
http://www.oembed.com/
http://ogp.me/
https://stackoverflow.com/questions/17341122/link-and-execute-external-javascript-file-hosted-on-github -
Until the fix is merged, have you tried playing with the order of plugins? The embedly plugin should be loaded after Markdown
@julian I did try the change as suggested
{
"id": "nodebb-plugin-embedly",
"name": "NodeBB Embed.ly Plugin",
"description": "NodeBB Plugin that allows users to embed Embed.Ly cards inline in their posts.",
"url": "https://github.com/a5mith/nodebb-plugin-embedly",
"library": "./library.js",
"hooks": [
{ "hook": "filter:parse.post", "method": "parse", "priority": 6 }
],
"staticDirs": {
"css": "./static"
}
}But is still a random fix.
Thanks @Codejet for the Favorite.
-
@RichG Embedly has a pretty decent API which you can potentially call from the NodeBB server instance - it will give you a fair bit of data from the page that you're trying to embed, in JSON format. Up to you how to use that data.
Once I have a stable and scalable "vanilla" NodeBB, want to look at using their API on NodeBB.