Updating ( refresh ) embedly plugin on page display


  • I am using the embedly plugin to display a partial web page into a post.... kind of like facebook does when you paste a link. This is the only plugin that I could find here that allows embedding like that. If there is better way I would be happy to use it. I am a noob here, but what I have seen of this framwork is just fantastic! Just excellent stuff!

    I have searched the forum here and I 'think' that I have seen this solution in another thread.... but because of my lack of understand, the solution escapes me as it pertains to the problem I am having with Embedly.

    The main issue is that the code embeded in the post and other areas on the forum does not fire to pull in the content. In most cases it looks like this below. Even a page refresh does not do the trick of pulling content. As a matter of fact even going to the post itself still will not fire it. However, if I edit the post and save then 'ALL' embedly embeded content gets pulled. If one gets pulled then they 'all' get pulled an display correctly.

    What is looks like in 'most' cases.

    2015-03-25 22_02_38-Symbols of an Alien Sky (Full Documentary) _ American Bulletin.png

    what is should look like:

    2015-03-25 21_57_28-Truth Behind the Photos_ What the Hubble Space Telescope Really Sees _ American .png

    I really would like to get this fixed or find a better alternative. This ability is a favorite of mine and is easy for the users.

    Thanks in advance.


  • @RichG as an after thought here is the website to see for yourself....

    http://theamericanbulletin.com:8080

  • Admin NodeBB

    This might be because of the order the plugins are executing if markdown plugin parses the post after the embedly plugin it will escape the html.

    Not sure if the hook priority is still supported @julian ?

    If it is the embedly plugin should use a higher priority. @a_5mith


  • I guess I need to bump this. Is it that hard of a question?

    RIch

  • Admin NodeBB

    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.

    upload-86fa1d0e-0525-4fea-87d7-c678b8eabf55

    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
    Fireox

    Thank you for your time...


  • A little more insight into this issue......

    A post on the thread was this

    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.


  • Merged but can't publish until later. 👍


  • 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...

  • GNU/Linux

    Never liked embed.ly, I wonder how much javascript it would take to make your own embed.ly type embed of url's


  • @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

  • GNU/Linux Admin

    Until the fix is merged, have you tried playing with the order of plugins? The embedly plugin should be loaded after Markdown


  • Hello, I was sucessfull using this https://github.com/nfl/jquery-oembed-all

    Just add to Admin CP -> Appearance - > Custom HTML & CSS then add to Custom 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:


  • 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.

Suggested Topics

  • 3
  • 4
  • 1
  • 12
  • 5
| |